From 36accb7eb80f1e44767a745eb9fcc22fedbf8340 Mon Sep 17 00:00:00 2001 From: "Thomas \"Cakeisalie5\" Touhey" Date: Thu, 9 Feb 2017 16:47:28 +0100 Subject: [PATCH] Bikeshedding myself --- src/p7/args.c | 30 +++++++++++++++--------------- src/p7/main.c | 2 +- src/p7/main.h | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/p7/args.c b/src/p7/args.c index ea470ad..f9fc181 100644 --- a/src/p7/args.c +++ b/src/p7/args.c @@ -37,10 +37,10 @@ static const char help_main[] = " send Send a file to the calculator.\n" " get Get a file from the calculator.\n" " copy Copy a file into another on the calculator.\n" -" del Delete a file on the calculator.\n" +" delete Delete a file on the calculator.\n" " reset Reset the flash memory.\n" " optimize Optimize the distant filesystem.\n" -" ls List files on the distant filesystem.\n" +" list List files on the distant filesystem.\n" " info Dump info about the calculator.\n" "\n" "General options:\n" @@ -93,7 +93,7 @@ FOOT; /* Copying help message */ static const char help_copy[] = -"Usage: p7 copy [-f] [-d ] \n" "Copies a file into the other on the calculator.\n" "\n" @@ -104,7 +104,7 @@ FOOT; /* Deleting help message */ static const char help_del[] = -"Usage: p7 del [-d \n" +"Usage: " QUOTE(BIN) " delete [-d \n" "Delete a file on the calculator.\n" "\n" "Options are:\n" @@ -113,26 +113,26 @@ static const char help_del[] = FOOT; /* Listing help message */ -static const char help_ls[] = -"Usage: p7 ls\n" +static const char help_list[] = +"Usage: " QUOTE(BIN) " list\n" "List files on the distant filesystem.\n" FOOT; /* Resetting help message */ static const char help_reset[] = -"Usage: p7 reset\n" +"Usage: " QUOTE(BIN) " reset\n" "Reset the distant filesystem.\n" FOOT; /* Optimizing help message */ static const char help_optimize[] = -"Usage: p7 optimize\n" +"Usage: " QUOTE(BIN) " optimize\n" "Optimize the distant filesystem.\n" FOOT; /* Dumping help message */ static const char help_info[] = -"Usage: p7 info\n" +"Usage: " QUOTE(BIN) " info\n" "Dump information about the calculator.\n" FOOT; @@ -257,8 +257,8 @@ int parse_args(int ac, char **av, args_t *args) return (0); } else if (!strcmp(aav[0], "info")) { sub_init(info, 0) - } else if (!strcmp(aav[0], "ls")) { - sub_init(ls, 0) + } else if (!strcmp(aav[0], "list") || !strcmp(aav[0], "ls")) { + sub_init(list, 0) } else if (!strcmp(aav[0], "reset")) { sub_init(reset, 0) } else if (!strcmp(aav[0], "optimize")) { @@ -281,22 +281,22 @@ int parse_args(int ac, char **av, args_t *args) /* put arguments to check */ fpmode[0] = 'w'; args->filename = aav[1]; - args->dirname = s_dir ? s_dir : NULL; + args->dirname = s_dir; args->localpath = s_out ? s_out : args->filename; } else if (!strcmp(aav[0], "copy")) { sub_init(copy, 2) /* get filename */ args->filename = aav[1]; - args->dirname = s_dir ? s_dir : NULL; + args->dirname = s_dir; args->newname = aav[2]; - args->newdir = s_todir ? s_todir : NULL; + args->newdir = s_todir; } else if (!strcmp(aav[0], "del") || !strcmp(aav[0], "delete")) { sub_init(del, 1) /* get filename */ args->filename = aav[1]; - args->dirname = s_dir ? s_dir : NULL; + args->dirname = s_dir; } else { /* unknown subcommand ! */ log("Unknown subcommand '%s'.\n", aav[0]); diff --git a/src/p7/main.c b/src/p7/main.c index 8b2d7fb..578b4c4 100644 --- a/src/p7/main.c +++ b/src/p7/main.c @@ -250,7 +250,7 @@ int main(int ac, char **av) err = p7_delete(handle, args.dirname, args.filename, args.storage); break; - case mn_ls: + case mn_list: err = p7_list(handle, args.storage, &print_file_info, NULL); break; case mn_reset: diff --git a/src/p7/main.h b/src/p7/main.h index db14863..6ad30c5 100644 --- a/src/p7/main.h +++ b/src/p7/main.h @@ -17,8 +17,8 @@ /* Menus */ typedef enum { - mn_send, mn_get, mn_copy, mn_del, mn_ls, mn_reset, mn_optimize, - mn_info + mn_send, mn_get, mn_copy, mn_del, mn_list, mn_reset, + mn_optimize, mn_info } menu_t; /* Arguments */