cake
/
p7utils
Archived
1
0
Fork 0

Bikeshedding myself

This commit is contained in:
Thomas Touhey 2017-02-09 16:47:28 +01:00
parent 9470df3386
commit 36accb7eb8
3 changed files with 18 additions and 18 deletions

View File

@ -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 <source directory]\n"
"Usage: " QUOTE(BIN) " copy [-d <source directory]\n"
" [-t <destination directory>] <source file> <dest file>\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 <on-calc directory] <on-calc filename>\n"
"Usage: " QUOTE(BIN) " delete [-d <on-calc directory] <on-calc filename>\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]);

View File

@ -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:

View File

@ -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 */