FreeCalypso > hg > freecalypso-hwlab
changeset 22:e9df47110181
lcdtest: added ability to specify chdir on the command line
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 14 Apr 2018 06:15:24 +0000 |
parents | 1d8c499711f1 |
children | 2127e6fdeab2 |
files | lcdtest/main.c |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lcdtest/main.c Wed Apr 11 00:09:50 2018 +0000 +++ b/lcdtest/main.c Sat Apr 14 06:15:24 2018 +0000 @@ -23,6 +23,19 @@ exit(1); } } + switch (argc - optind) { + case 0: + break; + case 1: + if (chdir(argv[optind]) < 0) { + perror(argv[optind]); + exit(1); + } + break; + default: + fprintf(stderr, "usage: %s [options] [chdir]\n", argv[0]); + exit(1); + } } main(argc, argv)