diff options
author | tjr <tjr@FreeBSD.org> | 2002-09-29 11:37:39 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-09-29 11:37:39 +0000 |
commit | 6307190b53a87478b299a91b61de89cb11d9be6e (patch) | |
tree | b98ee1bc6b1544336b5f69e753b430c3bbbb9f63 /bin/sh/redir.c | |
parent | 89c5289c522dcbfe7a37ea4c076f10888e6ed771 (diff) | |
download | FreeBSD-src-6307190b53a87478b299a91b61de89cb11d9be6e.zip FreeBSD-src-6307190b53a87478b299a91b61de89cb11d9be6e.tar.gz |
Convert the remaining callers of errmsg() to use strerror(), and remove
errmsg() and its table of error messages.
Diffstat (limited to 'bin/sh/redir.c')
-rw-r--r-- | bin/sh/redir.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bin/sh/redir.c b/bin/sh/redir.c index ed48f9f..9f809d8 100644 --- a/bin/sh/redir.c +++ b/bin/sh/redir.c @@ -179,7 +179,7 @@ openredirect(union node *redir, char memory[10]) case NFROM: fname = redir->nfile.expfname; if ((f = open(fname, O_RDONLY)) < 0) - error("cannot open %s: %s", fname, errmsg(errno, E_OPEN)); + error("cannot open %s: %s", fname, strerror(errno)); movefd: if (f != fd) { close(fd); @@ -191,17 +191,17 @@ movefd: fname = redir->nfile.expfname; #ifdef O_CREAT if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); #else if ((f = open(fname, O_RDWR, 0666)) < 0) { if (errno != ENOENT) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); else if ((f = creat(fname, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); else { close(f); if ((f = open(fname, O_RDWR)) < 0) { - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); remove(fname); } } @@ -212,29 +212,29 @@ movefd: fname = redir->nfile.expfname; if (Cflag && stat(fname, &sb) != -1 && S_ISREG(sb.st_mode)) error("cannot create %s: %s", fname, - errmsg(EEXIST, E_CREAT)); + strerror(EEXIST)); #ifdef O_CREAT if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); #else if ((f = creat(fname, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); #endif goto movefd; case NCLOBBER: fname = redir->nfile.expfname; if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); goto movefd; case NAPPEND: fname = redir->nfile.expfname; #ifdef O_APPEND if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); #else if ((f = open(fname, O_WRONLY)) < 0 && (f = creat(fname, 0666)) < 0) - error("cannot create %s: %s", fname, errmsg(errno, E_CREAT)); + error("cannot create %s: %s", fname, strerror(errno)); lseek(f, (off_t)0, 2); #endif goto movefd; |