diff --git a/src/shell/rc/rc.c b/src/shell/rc/rc.c index c1d1ab1..43d2307 100644 --- a/src/shell/rc/rc.c +++ b/src/shell/rc/rc.c @@ -183,10 +183,25 @@ int main(int argc, char **argv) { return 1; } + int opt; + while ((opt = getopt(argc, argv, "l")) != -1) { + switch (opt) { + case 'l': + break; + + default: + printf("rc [script]\n\t[-l UNUSED]\n"); + return 0; + } + } + + argv += optind; + argc -= optind; + unsigned int script_flag = 0; FILE *fp = stdin; - if (argc == 2) { + if (argc == 1) { fp = fopen(argv[1], "r"); if (fp == NULL) { fprintf(stderr, "rc: %s: %s\n", argv[1], strerror(errno)); @@ -197,6 +212,11 @@ int main(int argc, char **argv) { } while (!exit_flag) { + if (!script_flag) { + printf("> "); + fflush(stdin); + } + char *str = readline(fp); if (str == NULL) break;