Changeset 42521 in vbox
- Timestamp:
- Aug 1, 2012 8:13:21 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
r42515 r42521 107 107 108 108 /** 109 * Displays a common header for all help text to stdout. 110 */ 111 static void VBoxServiceToolboxShowUsageHeader(void) 112 { 113 RTPrintf(VBOX_PRODUCT " Guest Toolbox Version " 114 VBOX_VERSION_STRING "\n" 115 "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n" 116 "All rights reserved.\n" 117 "\n"); 118 RTPrintf("Usage:\n\n"); 119 } 120 121 122 /** 109 123 * Displays a help text to stdout. 110 124 */ 111 125 static void VBoxServiceToolboxShowUsage(void) 112 126 { 113 RTPrintf("Toolbox Usage:\n" 114 "cat [FILE] - Concatenate FILE(s), or standard input, to standard output.\n" 127 VBoxServiceToolboxShowUsageHeader(); 128 RTPrintf(" VBoxService [--use-toolbox] vbox_<command> <general options> <parameters>\n\n" 129 "General options:\n\n" 130 " --machinereadable produce all output in machine-readable form\n" 131 " -V print version number and exit\n" 115 132 "\n" 116 /** @todo Document options! */ 117 "ls [OPTION]... FILE... - List information about the FILEs (the current directory by default).\n" 118 "\n" 119 /** @todo Document options! */ 120 "rm [OPTION]... FILE... - delete FILEs (the current directory by default).\n" 121 "\n" 122 /** @todo Document options! */ 123 "mkdir [OPTION]... DIRECTORY... - Create the DIRECTORY(ies), if they do not already exist.\n" 124 "\n" 125 /** @todo Document options! */ 126 "stat [OPTION]... FILE... - Display file or file system status.\n" 127 "\n" 128 /** @todo Document options! */ 133 "Commands:\n\n" 134 " cat <general options> <file>...\n" 135 " ls <general options> [--dereference|-L] [-l] [-R]\n" 136 " [--verbose|-v] [<file>...]\n" 137 " rm <general options> [-r|-R] <file>...\n" 138 " mkdir <general options> [--mode|-m] [--parents|-p]\n" 139 " [--verbose|-v] <directory>...\n" 140 " stat <general options> [--file-system|-f]\n" 141 " [--dereference|-L] [--terse|-t]\n" 142 " [--verbose|-v] <file>...\n" 129 143 "\n"); 130 144 } … … 291 305 292 306 307 /** @todo Document options! */ 308 static char g_paszCatHelp[] = 309 " VBoxService [--use-toolbox] vbox_cat <general options> <file>...\n\n" 310 "Concatenate files, or standard input, to standard output.\n" 311 "\n"; 312 313 293 314 /** 294 315 * Main function for tool "vbox_cat". … … 360 381 361 382 case 'h': 362 VBoxServiceToolboxShowUsage(); 383 VBoxServiceToolboxShowUsageHeader(); 384 RTPrintf("%s", g_paszCatHelp); 363 385 return RTEXITCODE_SUCCESS; 364 386 … … 744 766 745 767 768 /** @todo Document options! */ 769 static char g_paszLsHelp[] = 770 " VBoxService [--use-toolbox] vbox_ls <general options> [option]...\n" 771 " [<file>...]\n\n" 772 "List information about files (the current directory by default).\n\n" 773 "Options:\n\n" 774 " [--dereference|-L]\n" 775 " [-l][-R]\n" 776 " [--verbose|-v]\n" 777 " [<file>...]\n" 778 "\n"; 779 780 746 781 /** 747 782 * Main function for tool "vbox_ls". … … 785 820 { 786 821 case 'h': 787 VBoxServiceToolboxShowUsage(); 822 VBoxServiceToolboxShowUsageHeader(); 823 RTPrintf("%s", g_paszLsHelp); 788 824 return RTEXITCODE_SUCCESS; 789 825 … … 903 939 904 940 941 static char g_paszRmHelp[] = 942 " VBoxService [--use-toolbox] vbox_rm <general options> <file>...\n\n" 943 "Delete files and optionally directories if the '-R' or '-r' option is specified.\n" 944 "If a file or directory cannot be deleted, an error message is printed if the\n" 945 "'--machine-readable' option is not specified and the next file will be\n" 946 "processed. The root directory is always ignored.\n\n" 947 "Options:\n\n" 948 " [-R|-r] Recursively delete directories too.\n" 949 "\n"; 950 951 905 952 /** 906 953 * Main function for tool "vbox_rm". … … 947 994 { 948 995 case 'h': 949 VBoxServiceToolboxShowUsage(); 996 VBoxServiceToolboxShowUsageHeader(); 997 RTPrintf("%s", g_paszRmHelp); 950 998 return RTEXITCODE_SUCCESS; 951 999 … … 1042 1090 1043 1091 1092 /** @todo Document options! */ 1093 static char g_paszMkDirHelp[] = 1094 " VBoxService [--use-toolbox] vbox_mkdir <general options> [options]\n" 1095 " <directory>...\n\n" 1096 "Options:\n\n" 1097 " [--mode=<mode>|-m <mode>] The file mode to set (chmod) on the created\n" 1098 " directories. Default: a=rwx & umask.\n" 1099 " [--parents|-p] Create parent directories as needed, no\n" 1100 " error if the directory already exists.\n" 1101 " [--verbose|-v] Display a message for each created directory.\n" 1102 "\n"; 1103 1104 1044 1105 /** 1045 1106 * Main function for tool "vbox_mkdir". … … 1099 1160 1100 1161 case 'h': 1101 RTPrintf("Usage: %s [options] dir1 [dir2...]\n" 1102 "\n" 1103 "Options:\n" 1104 " -m,--mode=<mode> The file mode to set (chmod) on the created\n" 1105 " directories. Default: a=rwx & umask.\n" 1106 " -p,--parents Create parent directories as needed, no\n" 1107 " error if the directory already exists.\n" 1108 " -v,--verbose Display a message for each created directory.\n" 1109 " -V,--version Display the version and exit\n" 1110 " -h,--help Display this help text and exit.\n" 1111 , argv[0]); 1162 VBoxServiceToolboxShowUsageHeader(); 1163 RTPrintf("%s", g_paszMkDirHelp); 1112 1164 return RTEXITCODE_SUCCESS; 1113 1165 … … 1147 1199 1148 1200 1201 /** @todo Document options! */ 1202 static char g_paszStatHelp[] = 1203 " VBoxService [--use-toolbox] vbox_stat <general options> [options] <file>...\n\n" 1204 "Display file or file system status.\n\n" 1205 "Options:\n\n" 1206 " [--file-system|-f]\n" 1207 " [--dereference|-L]\n" 1208 " [--terse|-t]\n" 1209 " [--verbose|-v]\n" 1210 "\n"; 1211 1212 1149 1213 /** 1150 1214 * Main function for tool "vbox_stat". … … 1201 1265 1202 1266 case 'h': 1203 VBoxServiceToolboxShowUsage(); 1267 VBoxServiceToolboxShowUsageHeader(); 1268 RTPrintf("%s", g_paszStatHelp); 1204 1269 return RTEXITCODE_SUCCESS; 1205 1270 … … 1349 1414 if (!pfnHandler) 1350 1415 { 1351 *prcExit = RTMsgErrorExit(RTEXITCODE_SYNTAX, "Toolbox program '%s' does not exist", pszTool); 1416 *prcExit = RTEXITCODE_SUCCESS; 1417 if (!strcmp(pszTool, "-V")) 1418 { 1419 VBoxServiceToolboxShowVersion(); 1420 return true; 1421 } 1422 if ( (strcmp(pszTool, "help")) && (strcmp(pszTool, "--help")) 1423 && (strcmp(pszTool, "-h"))) 1424 *prcExit = RTEXITCODE_SYNTAX; 1425 VBoxServiceToolboxShowUsage(); 1352 1426 return true; 1353 1427 }
Note:
See TracChangeset
for help on using the changeset viewer.

