{
WCHAR szComputerName[MAX_STRING_SIZE];
DWORD comp_size = MAX_STRING_SIZE;
- BOOL interpreter_running = TRUE;
LPCWSTR file_name = NULL;
int i;
int timeout = 0;
timeout = _wtoi(argv[i]);
}
}
+ else if (wcscmp(&argv[i][1], L"?") == 0)
+ {
+ PrintResourceString(IDS_APP_USAGE);
+ return EXIT_SUCCESS;
+ }
}
}
}
else
{
- while (interpreter_running)
- interpreter_running = interpret_main();
+ interpret_main();
}
/* Let the user know the program is exiting */
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/diskpart.c
* PURPOSE: Manages all the partitions of the OS in
- * an interactive way
+ * an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#ifndef DISKPART_H
/* interpreter.c */
BOOL interpret_script(WCHAR *line);
-BOOL interpret_main(VOID);
BOOL interpret_cmd(INT argc, WCHAR **argv);
+VOID interpret_main(VOID);
/* list.c */
BOOL list_main(INT argc, WCHAR **argv);
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/interpreter.c
* PURPOSE: Reads the user input and then envokes the selected
- * command by the user.
+ * command by the user.
* PROGRAMMERS: Lee Schroeder
*/
{L"setid", setid_main, help_setid},
{L"shrink", shrink_main, help_shrink},
{L"uniqueid", uniqueid_main, help_uniqueid},
- {NULL, NULL, NULL}
+ {NULL, NULL, NULL}
};
* it sends the string to interpret_line, where it determines what
* command to use.
*/
-BOOL
+VOID
interpret_main(VOID)
{
WCHAR input_line[MAX_STRING_SIZE];
WCHAR *args_vector[MAX_ARGS_COUNT];
INT args_count = 0;
BOOL bWhiteSpace = TRUE;
+ BOOL bRun = TRUE;
WCHAR *ptr;
- memset(args_vector, 0, sizeof(args_vector));
+ while (bRun == TRUE)
+ {
+ memset(args_vector, 0, sizeof(args_vector));
- /* shown just before the input where the user places commands */
- PrintResourceString(IDS_APP_PROMPT);
+ /* shown just before the input where the user places commands */
+ PrintResourceString(IDS_APP_PROMPT);
- /* gets input from the user. */
- fgetws(input_line, MAX_STRING_SIZE, stdin);
+ /* gets input from the user. */
+ fgetws(input_line, MAX_STRING_SIZE, stdin);
- ptr = input_line;
- while (*ptr != 0)
- {
- if (iswspace(*ptr) || *ptr == L'\n')
- {
- *ptr = 0;
- bWhiteSpace = TRUE;
- }
- else
+ ptr = input_line;
+ while (*ptr != 0)
{
- if ((bWhiteSpace == TRUE) && (args_count < MAX_ARGS_COUNT))
+ if (iswspace(*ptr) || *ptr == L'\n')
{
- args_vector[args_count] = ptr;
- args_count++;
+ *ptr = 0;
+ bWhiteSpace = TRUE;
}
+ else
+ {
+ if ((bWhiteSpace == TRUE) && (args_count < MAX_ARGS_COUNT))
+ {
+ args_vector[args_count] = ptr;
+ args_count++;
+ }
- bWhiteSpace = FALSE;
+ bWhiteSpace = FALSE;
+ }
+
+ ptr++;
}
- ptr++;
+ /* sends the string to find the command */
+ bRun = interpret_cmd(args_count, args_vector);
}
-
- /* sends the string to find the command */
- return interpret_cmd(args_count, args_vector);
}
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_HEADER, "\nReactOS DiskPart version %s\n"
+ IDS_APP_USAGE, "Diskpart command line syntax:\ndiskpart [/s <script file>] [/t <timeout value>] [/?]\n\
+/s <script file> - Runs the given script file.\n\
+/t <timeout value> - Waits for the given time (in seconds) after running a\n\
+ script file.\n\
+/? - Shows this help text."
IDS_APP_LICENSE, "Licensed under the GNU GPLv2\n"
IDS_APP_CURR_COMPUTER, "On computer: %s\n\n"
IDS_APP_LEAVING, "\nLeaving DiskPart...\n"