diff options
-rw-r--r-- | pw.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -250,7 +250,10 @@ static void execute(char *cmd) switch (cmd[1]) { case 'w': case 'a': - { + if (arg[0] == 0) { + sprintf(cmd, "file name required!"); + break; + } else { FILE *f = fopen(arg, cmd[1] == 'w' ? "w" : "a"); int ok = 1; @@ -272,7 +275,10 @@ static void execute(char *cmd) } break; case '!': - { + if (arg[0] == 0) { + sprintf(cmd, "command required!"); + break; + } else { FILE *p = popen(arg, "w"); int ok = 1; |