- Timestamp:
- Sep 9, 2012 3:22:30 AM (12 years ago)
- Location:
- trunk/src/kash
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/bltin/printf.c
r1233 r2648 55 55 #include <string.h> 56 56 #include <unistd.h> 57 #include "shinstance.h" 57 58 58 59 #ifdef __GNUC__ … … 647 648 rval = 1; 648 649 } else if (errno == ERANGE) { 649 warnx("%s: %s", s, s trerror(ERANGE));650 warnx("%s: %s", s, sh_strerror(psh, ERANGE)); 650 651 rval = 1; 651 652 } -
trunk/src/kash/cd.c
r2290 r2648 392 392 continue; 393 393 if (!noerror) 394 error(psh, "getcwd() failed: %s", s trerror(errno));394 error(psh, "getcwd() failed: %s", sh_strerror(psh, errno)); 395 395 return; 396 396 } -
trunk/src/kash/error.c
r2298 r2648 138 138 } 139 139 if (sv_errno >= 0) 140 outfmt(&psh->errout, "%s", s trerror(sv_errno));140 outfmt(&psh->errout, "%s", sh_strerror(psh, sv_errno)); 141 141 out2c(psh, '\n'); 142 142 flushout(&psh->errout); … … 156 156 #ifdef DEBUG 157 157 if (msg) { 158 va_list va2; 158 159 TRACE((psh, "exverror(%d, \"", cond)); 159 TRACEV((psh, msg, ap)); 160 va_copy(va2, ap); 161 TRACEV((psh, msg, va2)); 162 va_end(va2); 160 163 TRACE((psh, "\") pid=%d\n", sh_getpid(psh))); 161 164 } else -
trunk/src/kash/exec.c
r2642 r2648 1138 1138 if (!v_flag) 1139 1139 out1fmt(psh, ": %s\n", 1140 s trerror(errno));1140 sh_strerror(psh, errno)); 1141 1141 else 1142 1142 err = 126; -
trunk/src/kash/jobs.c
r2290 r2648 150 150 if (sh_getpgid(psh, 0) != psh->rootpid && sh_setpgid(psh, 0, psh->rootpid) == -1) 151 151 error(psh, "Cannot set process group (%s) at %d", 152 s trerror(errno), __LINE__);152 sh_strerror(psh, errno), __LINE__); 153 153 if (sh_tcsetpgrp(psh, psh->ttyfd, psh->rootpid) == -1) 154 154 error(psh, "Cannot set tty process group (%s) at %d", 155 s trerror(errno), __LINE__);155 sh_strerror(psh, errno), __LINE__); 156 156 } else { /* turning job control off */ 157 157 if (sh_getpgid(psh, 0) != psh->initialpgrp && sh_setpgid(psh, 0, psh->initialpgrp) == -1) 158 158 error(psh, "Cannot set process group (%s) at %d", 159 s trerror(errno), __LINE__);159 sh_strerror(psh, errno), __LINE__); 160 160 if (sh_tcsetpgrp(psh, psh->ttyfd, psh->initialpgrp) == -1) 161 161 error(psh, "Cannot set tty process group (%s) at %d", 162 s trerror(errno), __LINE__);162 sh_strerror(psh, errno), __LINE__); 163 163 shfile_close(&psh->fdtab, psh->ttyfd); 164 164 psh->ttyfd = -1; … … 209 209 if (i >= jp->nprocs) { 210 210 error(psh, "Cannot set tty process group (%s) at %d", 211 s trerror(errno), __LINE__);211 sh_strerror(psh, errno), __LINE__); 212 212 } 213 213 restartjob(psh, jp); … … 301 301 break; 302 302 if (i >= jp->nprocs) 303 error(psh, "Cannot continue job (%s)", s trerror(errno));303 error(psh, "Cannot continue job (%s)", sh_strerror(psh, errno)); 304 304 for (ps = jp->ps, i = jp->nprocs ; --i >= 0 ; ps++) { 305 305 if (WIFSTOPPED(ps->status)) { … … 485 485 if (sh_tcsetpgrp(psh, psh->ttyfd, sh_getpid(psh)) == -1) 486 486 error(psh, "Cannot set tty process group (%s) at %d", 487 s trerror(errno), __LINE__);487 sh_strerror(psh, errno), __LINE__); 488 488 TRACE((psh, "repaired tty process group\n")); 489 489 silent = 1; … … 854 854 if (sh_tcsetpgrp(psh, psh->ttyfd, pgrp) == -1) 855 855 error(psh, "Cannot set tty process group (%s) at %d", 856 s trerror(errno), __LINE__);856 sh_strerror(psh, errno), __LINE__); 857 857 } 858 858 setsignal(psh, SIGTSTP, vforked); … … 927 927 if (sh_tcsetpgrp(psh, psh->ttyfd, mypgrp) == -1) 928 928 error(psh, "Cannot set tty process group (%s) at %d", 929 s trerror(errno), __LINE__);929 sh_strerror(psh, errno), __LINE__); 930 930 } 931 931 if (jp->state == JOBSTOPPED && psh->curjob != jp - psh->jobtab) -
trunk/src/kash/miscbltin.c
r2498 r2648 424 424 limit.rlim_cur = val; 425 425 if (sh_setrlimit(psh, l->cmd, &limit) < 0) 426 error(psh, "error setting limit (%s)", s trerror(errno));426 error(psh, "error setting limit (%s)", sh_strerror(psh, errno)); 427 427 } else { 428 428 if (how & SOFT) -
trunk/src/kash/redir.c
r2424 r2648 144 144 default: 145 145 INTON; 146 error(psh, "%d: %s", fd, s trerror(errno));146 error(psh, "%d: %s", fd, sh_strerror(psh, errno)); 147 147 /* NOTREACHED */ 148 148 } … … 377 377 if (errno == EMFILE) 378 378 return EMPTY; 379 error(psh, "%d: %s", from, s trerror(errno));379 error(psh, "%d: %s", from, sh_strerror(psh, errno)); 380 380 } 381 381 return newfd; … … 398 398 if (errno == EMFILE) 399 399 return EMPTY; 400 error(psh, "%d: %s", from, s trerror(errno));400 error(psh, "%d: %s", from, sh_strerror(psh, errno)); 401 401 } 402 402 return newfd; … … 419 419 if (errno == EMFILE) 420 420 return EMPTY; 421 error(psh, "%d: %s", from, s trerror(errno));421 error(psh, "%d: %s", from, sh_strerror(psh, errno)); 422 422 } 423 423 return newfd; -
trunk/src/kash/shinstance.c
r2593 r2648 1417 1417 } 1418 1418 1419 1420 /* Wrapper for strerror that makes sure it doesn't return NULL and causes the 1421 caller or fprintf routines to crash. */ 1422 const char *sh_strerror(shinstance *psh, int error) 1423 { 1424 char *err = strerror(error); 1425 if (!err) 1426 return "strerror return NULL!"; 1427 (void)psh; 1428 return err; 1429 } 1430 -
trunk/src/kash/shinstance.h
r2639 r2648 494 494 int sh_setrlimit(shinstance *, int, const shrlimit *); 495 495 496 /* string.h */ 497 const char *sh_strerror(shinstance *, int); 496 498 497 499 #ifdef DEBUG … … 499 501 # define TRACE2V(param) tracev param 500 502 #else 501 # define TRACE2(param) 502 # define TRACE2V(param) 503 #endif 504 505 #endif 503 # define TRACE2(param) do { } while (0) 504 # define TRACE2V(param) do { } while (0) 505 #endif 506 507 #endif
Note:
See TracChangeset
for help on using the changeset viewer.