Support arg parsing for shell

This commit is contained in:
K. Lange 2018-02-25 23:05:23 +09:00 committed by Kevin Lange
parent 8c0bd33e0b
commit 89f2a45ad9

14
sh.c
View File

@ -836,6 +836,20 @@ int main(int argc, char ** argv) {
//add_path_contents("/usr/bin");
sort_commands();
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "-c")) {
return shell_exec(argv[i+1], strlen(argv[i+1]));
}
if (!strcmp(argv[i], "-v")) {
show_version();
return 0;
}
if (!strcmp(argv[i], "-?")) {
show_usage(argc, argv);
return 0;
}
}
#if 0
if (argc > 1) {
int index, c;