diff options
Diffstat (limited to 'sh.c')
-rw-r--r-- | sh.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child) | |||
321 | struct job *job=NULL; | 321 | struct job *job=NULL; |
322 | 322 | ||
323 | if (!child->argv[1] || child->argv[2]) { | 323 | if (!child->argv[1] || child->argv[2]) { |
324 | error_msg("%s: exactly one argument is expected\n", | 324 | error_msg("%s: exactly one argument is expected", |
325 | child->argv[0]); | 325 | child->argv[0]); |
326 | return EXIT_FAILURE; | 326 | return EXIT_FAILURE; |
327 | } | 327 | } |
328 | 328 | ||
329 | if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) { | 329 | if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) { |
330 | error_msg("%s: bad argument '%s'\n", | 330 | error_msg("%s: bad argument '%s'", |
331 | child->argv[0], child->argv[1]); | 331 | child->argv[0], child->argv[1]); |
332 | return EXIT_FAILURE; | 332 | return EXIT_FAILURE; |
333 | } | 333 | } |
@@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | if (!job) { | 341 | if (!job) { |
342 | error_msg("%s: unknown job %d\n", | 342 | error_msg("%s: unknown job %d", |
343 | child->argv[0], jobNum); | 343 | child->argv[0], jobNum); |
344 | return EXIT_FAILURE; | 344 | return EXIT_FAILURE; |
345 | } | 345 | } |
@@ -492,7 +492,7 @@ static int builtin_then(struct child_prog *child) | |||
492 | debug_printf( "job=%p entering builtin_then ('%s')-- context=%d\n", cmd, charptr1, cmd->job_context); | 492 | debug_printf( "job=%p entering builtin_then ('%s')-- context=%d\n", cmd, charptr1, cmd->job_context); |
493 | if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 493 | if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
494 | shell_context = 0; /* Reset the shell's context on an error */ | 494 | shell_context = 0; /* Reset the shell's context on an error */ |
495 | error_msg("%s `then'\n", syntax_err); | 495 | error_msg("%s `then'", syntax_err); |
496 | return EXIT_FAILURE; | 496 | return EXIT_FAILURE; |
497 | } | 497 | } |
498 | 498 | ||
@@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child) | |||
520 | 520 | ||
521 | if (! (cmd->job_context & THEN_EXP_CONTEXT)) { | 521 | if (! (cmd->job_context & THEN_EXP_CONTEXT)) { |
522 | shell_context = 0; /* Reset the shell's context on an error */ | 522 | shell_context = 0; /* Reset the shell's context on an error */ |
523 | error_msg("%s `else'\n", syntax_err); | 523 | error_msg("%s `else'", syntax_err); |
524 | return EXIT_FAILURE; | 524 | return EXIT_FAILURE; |
525 | } | 525 | } |
526 | /* If the if result was TRUE, skip the 'else' stuff */ | 526 | /* If the if result was TRUE, skip the 'else' stuff */ |
@@ -543,7 +543,7 @@ static int builtin_fi(struct child_prog *child) | |||
543 | debug_printf( "job=%p entering builtin_fi ('%s')-- context=%d\n", cmd, "", cmd->job_context); | 543 | debug_printf( "job=%p entering builtin_fi ('%s')-- context=%d\n", cmd, "", cmd->job_context); |
544 | if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 544 | if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
545 | shell_context = 0; /* Reset the shell's context on an error */ | 545 | shell_context = 0; /* Reset the shell's context on an error */ |
546 | error_msg("%s `fi'\n", syntax_err); | 546 | error_msg("%s `fi'", syntax_err); |
547 | return EXIT_FAILURE; | 547 | return EXIT_FAILURE; |
548 | } | 548 | } |
549 | /* Clear out the if and then context bits */ | 549 | /* Clear out the if and then context bits */ |
@@ -748,7 +748,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) | |||
748 | if (openfd < 0) { | 748 | if (openfd < 0) { |
749 | /* this could get lost if stderr has been redirected, but | 749 | /* this could get lost if stderr has been redirected, but |
750 | bash and ash both lose it as well (though zsh doesn't!) */ | 750 | bash and ash both lose it as well (though zsh doesn't!) */ |
751 | error_msg("error opening %s: %s\n", redir->filename, | 751 | error_msg("error opening %s: %s", redir->filename, |
752 | strerror(errno)); | 752 | strerror(errno)); |
753 | return 1; | 753 | return 1; |
754 | } | 754 | } |
@@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr, | |||
960 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ | 960 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ |
961 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result); | 961 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result); |
962 | if (rc == GLOB_NOSPACE) { | 962 | if (rc == GLOB_NOSPACE) { |
963 | error_msg("out of space during glob operation\n"); | 963 | error_msg("out of space during glob operation"); |
964 | return; | 964 | return; |
965 | } else if (rc == GLOB_NOMATCH || | 965 | } else if (rc == GLOB_NOMATCH || |
966 | (!rc && (prog->glob_result.gl_pathc - i) == 1 && | 966 | (!rc && (prog->glob_result.gl_pathc - i) == 1 && |
@@ -1068,7 +1068,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1068 | if (*src == '\\') { | 1068 | if (*src == '\\') { |
1069 | src++; | 1069 | src++; |
1070 | if (!*src) { | 1070 | if (!*src) { |
1071 | error_msg("character expected after \\\n"); | 1071 | error_msg("character expected after \\"); |
1072 | free_job(job); | 1072 | free_job(job); |
1073 | return 1; | 1073 | return 1; |
1074 | } | 1074 | } |
@@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1152 | chptr++; | 1152 | chptr++; |
1153 | 1153 | ||
1154 | if (!*chptr) { | 1154 | if (!*chptr) { |
1155 | error_msg("file name expected after %c\n", *src); | 1155 | error_msg("file name expected after %c", *src); |
1156 | free_job(job); | 1156 | free_job(job); |
1157 | job->num_progs=0; | 1157 | job->num_progs=0; |
1158 | return 1; | 1158 | return 1; |
@@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1171 | if (*prog->argv[argc_l]) | 1171 | if (*prog->argv[argc_l]) |
1172 | argc_l++; | 1172 | argc_l++; |
1173 | if (!argc_l) { | 1173 | if (!argc_l) { |
1174 | error_msg("empty command in pipe\n"); | 1174 | error_msg("empty command in pipe"); |
1175 | free_job(job); | 1175 | free_job(job); |
1176 | job->num_progs=0; | 1176 | job->num_progs=0; |
1177 | return 1; | 1177 | return 1; |
@@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1199 | src++; | 1199 | src++; |
1200 | 1200 | ||
1201 | if (!*src) { | 1201 | if (!*src) { |
1202 | error_msg("empty command in pipe\n"); | 1202 | error_msg("empty command in pipe"); |
1203 | free_job(job); | 1203 | free_job(job); |
1204 | job->num_progs=0; | 1204 | job->num_progs=0; |
1205 | return 1; | 1205 | return 1; |
@@ -1307,7 +1307,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1307 | printf("erik: found a continue char at EOL...\n"); | 1307 | printf("erik: found a continue char at EOL...\n"); |
1308 | command = (char *) xcalloc(BUFSIZ, sizeof(char)); | 1308 | command = (char *) xcalloc(BUFSIZ, sizeof(char)); |
1309 | if (get_command(input, command)) { | 1309 | if (get_command(input, command)) { |
1310 | error_msg("character expected after \\\n"); | 1310 | error_msg("character expected after \\"); |
1311 | free(command); | 1311 | free(command); |
1312 | free_job(job); | 1312 | free_job(job); |
1313 | return 1; | 1313 | return 1; |
@@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1323 | free(command); | 1323 | free(command); |
1324 | break; | 1324 | break; |
1325 | #else | 1325 | #else |
1326 | error_msg("character expected after \\\n"); | 1326 | error_msg("character expected after \\"); |
1327 | free(command); | 1327 | free(command); |
1328 | free_job(job); | 1328 | free_job(job); |
1329 | return 1; | 1329 | return 1; |
@@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l) | |||
1738 | case 'c': | 1738 | case 'c': |
1739 | input = NULL; | 1739 | input = NULL; |
1740 | if (local_pending_command != 0) | 1740 | if (local_pending_command != 0) |
1741 | error_msg_and_die("multiple -c arguments\n"); | 1741 | error_msg_and_die("multiple -c arguments"); |
1742 | local_pending_command = xstrdup(argv[optind]); | 1742 | local_pending_command = xstrdup(argv[optind]); |
1743 | optind++; | 1743 | optind++; |
1744 | argv = argv+optind; | 1744 | argv = argv+optind; |