rc fix
This commit is contained in:
parent
a42f6545e8
commit
491e883b5c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue