1.1 --- a/fsaccess/fsaccess.c Tue Mar 05 00:15:15 2024 +0100
1.2 +++ b/fsaccess/fsaccess.c Tue Mar 05 00:16:01 2024 +0100
1.3 @@ -27,14 +27,20 @@
1.4
1.5
1.6
1.7 -/* Help message. */
1.8 +/* Help messages. */
1.9
1.10 -char help_text[] = "\
1.11 +char command_help_text[] = "\
1.12 Usage: %s [ <options> ] <operation> <filename>...\n\
1.13 +";
1.14 +
1.15 +char options_help_text[] = "\
1.16 \n\
1.17 File permission options:\n\
1.18 \n\
1.19 -m MASK Set mode/permissions mask for new directories\n\
1.20 +";
1.21 +
1.22 +char operations_help_text[] = "\
1.23 \n\
1.24 Transfer operations:\n\
1.25 \n\
1.26 @@ -51,6 +57,7 @@
1.27 Script operations:\n\
1.28 \n\
1.29 script Read operations from a script file (or stdin)\n\
1.30 +\n\
1.31 Execution operations:\n\
1.32 \n\
1.33 file Send a file to a program\n\
1.34 @@ -61,11 +68,26 @@
1.35 wait Wait for a spawned program to finish\n\
1.36 ";
1.37
1.38 +
1.39 +
1.40 +/* Show a help message appropriate to interactive use. */
1.41 +
1.42 +static int show_help(int argc, char *argv[])
1.43 +{
1.44 + (void) argc; (void) argv;
1.45 +
1.46 + fprintf(stderr, operations_help_text);
1.47 + return 0;
1.48 +}
1.49 +
1.50 +
1.51 +
1.52 /* Operations exposed by the program. */
1.53
1.54 struct operation operations[] = {
1.55 {"copy-in", copy_in},
1.56 {"file", file_to_program},
1.57 + {"help", show_help},
1.58 {"jobs", show_programs},
1.59 {"ls", list_objects},
1.60 {"mkdir", make_dirs},
1.61 @@ -101,7 +123,9 @@
1.62
1.63 if (num_args < 2)
1.64 {
1.65 - fprintf(stderr, help_text, argv[0]);
1.66 + fprintf(stderr, command_help_text, argv[0]);
1.67 + fprintf(stderr, options_help_text);
1.68 + fprintf(stderr, operations_help_text);
1.69 return 1;
1.70 }
1.71