diff options
Diffstat (limited to 'src/commands/dd.c')
-rw-r--r-- | src/commands/dd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/commands/dd.c b/src/commands/dd.c index 2b6955f..6b973e2 100644 --- a/src/commands/dd.c +++ b/src/commands/dd.c @@ -1,13 +1,12 @@ #include "../command.h" -static void help() { +static void help(void) { printf("Usage: dd [if=FILE] [of=FILE] [bs=N] [count=N]\n\n"); printf("Copy a file with converting and formatting\n\n"); printf("\tif=FILE\t\tRead from FILE instead of stdin\n"); printf("\tof=FILE\t\tWrite to FILE instead of stdout\n"); printf("\tbs=N\t\tRead and write N bytes at a time\n"); printf("\tcount=N\t\tCopy only N input blocks\n"); - exit(EXIT_SUCCESS); } COMMAND(dd) { @@ -17,6 +16,8 @@ COMMAND(dd) { int bs = 1024; int count = -1; + parse_help(argc, argv, help); + for (int i = 0; i < argc; i++) { if (prefix("if=", argv[i])) { char* path = argv[i] + 3; @@ -36,8 +37,6 @@ COMMAND(dd) { if (count < 1) { error("error: count must be greather than 0"); } - } else if (streql("--help", argv[i])) { - help(); } else { error("error: unkown option %s", argv[i]); } |