diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2014-11-10 21:31:43 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2014-11-10 21:31:43 +0000 |
commit | 456458354e0f26749ebfde9f8ded879c5209458f (patch) | |
tree | 63b679b116bcd17307dae3856ce0a0295fda2bc1 | |
parent | 4c214b022e274a365f1b7dc397f26d7c55a07714 (diff) |
remove old, unnecessary compat code. from Martin Natano
-rw-r--r-- | usr.bin/vi/common/exf.c | 17 | ||||
-rw-r--r-- | usr.bin/vi/common/key.c | 12 | ||||
-rw-r--r-- | usr.bin/vi/common/recover.c | 11 | ||||
-rw-r--r-- | usr.bin/vi/ex/ex_shell.c | 171 |
4 files changed, 5 insertions, 206 deletions
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c index f8121ef1e07..d6ab1ca5249 100644 --- a/usr.bin/vi/common/exf.c +++ b/usr.bin/vi/common/exf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exf.c,v 1.28 2013/12/01 20:22:34 krw Exp $ */ +/* $OpenBSD: exf.c,v 1.29 2014/11/10 21:31:42 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -856,21 +856,6 @@ file_write(sp, fm, tm, name, flags) msgq_str(sp, M_ERR, name, "252|%s: write lock was unavailable"); -#if __linux__ - /* - * XXX - * In libc 4.5.x, fdopen(fd, "w") clears the O_APPEND flag (if set). - * This bug is fixed in libc 4.6.x. - * - * This code works around this problem for libc 4.5.x users. - * Note that this code is harmless if you're using libc 4.6.x. - */ - if (LF_ISSET(FS_APPEND) && lseek(fd, (off_t)0, SEEK_END) < 0) { - msgq(sp, M_SYSERR, "%s", name); - return (1); - } -#endif - /* * Use stdio for buffering. * diff --git a/usr.bin/vi/common/key.c b/usr.bin/vi/common/key.c index 43617a12d87..fbcc22a9190 100644 --- a/usr.bin/vi/common/key.c +++ b/usr.bin/vi/common/key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key.c,v 1.11 2013/11/28 22:12:40 krw Exp $ */ +/* $OpenBSD: key.c,v 1.12 2014/11/10 21:31:42 tedu Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -114,16 +114,6 @@ v_key_init(sp) * character set, as long as nul isn't a character. */ (void)setlocale(LC_ALL, ""); -#if __linux__ - /* - * In libc 4.5.26, setlocale(LC_ALL, ""), doesn't setup the table - * for ctype(3c) correctly. This bug is fixed in libc 4.6.x. - * - * This code works around this problem for libc 4.5.x users. - * Note that this code is harmless if you're using libc 4.6.x. - */ - (void)setlocale(LC_CTYPE, ""); -#endif v_key_ilookup(sp); v_keyval(sp, K_CNTRLD, KEY_VEOF); diff --git a/usr.bin/vi/common/recover.c b/usr.bin/vi/common/recover.c index 8adb35d384a..1b5b154b787 100644 --- a/usr.bin/vi/common/recover.c +++ b/usr.bin/vi/common/recover.c @@ -1,4 +1,4 @@ -/* $OpenBSD: recover.c,v 1.15 2009/10/27 23:59:47 deraadt Exp $ */ +/* $OpenBSD: recover.c,v 1.16 2014/11/10 21:31:42 tedu Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -339,15 +339,6 @@ rcv_mailfile(sp, issync, cp_path) int fd; char *dp, *p, *t, buf[4096], mpath[MAXPATHLEN]; char *t1, *t2, *t3; - - /* - * XXX - * MAXHOSTNAMELEN is in various places on various systems, including - * <netdb.h> and <sys/socket.h>. If not found, use a large default. - */ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 1024 -#endif char host[MAXHOSTNAMELEN]; gp = sp->gp; diff --git a/usr.bin/vi/ex/ex_shell.c b/usr.bin/vi/ex/ex_shell.c index d9f57da852d..ce7d1e0b623 100644 --- a/usr.bin/vi/ex/ex_shell.c +++ b/usr.bin/vi/ex/ex_shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ex_shell.c,v 1.11 2009/10/27 23:59:47 deraadt Exp $ */ +/* $OpenBSD: ex_shell.c,v 1.12 2014/11/10 21:31:42 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -26,8 +26,6 @@ #include "../common/common.h" -static const char *sigmsg(int); - /* * ex_shell -- :sh[ell] * Invoke the program named in the SHELL environment variable @@ -179,7 +177,7 @@ proc_wait(sp, pid, cmd, silent, okpipe) len = strlen(p); msgq(sp, M_ERR, "%.*s%s: received signal: %s%s", MIN(len, 20), p, len > 20 ? " ..." : "", - sigmsg(WTERMSIG(pstat)), + strsignal(WTERMSIG(pstat)), WCOREDUMP(pstat) ? "; core dumped" : ""); if (nf) FREE_SPACE(sp, p, 0); @@ -209,168 +207,3 @@ proc_wait(sp, pid, cmd, silent, okpipe) } return (0); } - -/* - * XXX - * The sys_siglist[] table in the C library has this information, but there's - * no portable way to get to it. (Believe me, I tried.) - */ -typedef struct _sigs { - int number; /* signal number */ - char *message; /* related message */ -} SIGS; - -SIGS const sigs[] = { -#ifdef SIGABRT - { SIGABRT, "Abort trap" }, -#endif -#ifdef SIGALRM - { SIGALRM, "Alarm clock" }, -#endif -#ifdef SIGBUS - { SIGBUS, "Bus error" }, -#endif -#ifdef SIGCLD - { SIGCLD, "Child exited or stopped" }, -#endif -#ifdef SIGCHLD - { SIGCHLD, "Child exited" }, -#endif -#ifdef SIGCONT - { SIGCONT, "Continued" }, -#endif -#ifdef SIGDANGER - { SIGDANGER, "System crash imminent" }, -#endif -#ifdef SIGEMT - { SIGEMT, "EMT trap" }, -#endif -#ifdef SIGFPE - { SIGFPE, "Floating point exception" }, -#endif -#ifdef SIGGRANT - { SIGGRANT, "HFT monitor mode granted" }, -#endif -#ifdef SIGHUP - { SIGHUP, "Hangup" }, -#endif -#ifdef SIGILL - { SIGILL, "Illegal instruction" }, -#endif -#ifdef SIGINFO - { SIGINFO, "Information request" }, -#endif -#ifdef SIGINT - { SIGINT, "Interrupt" }, -#endif -#ifdef SIGIO - { SIGIO, "I/O possible" }, -#endif -#ifdef SIGIOT - { SIGIOT, "IOT trap" }, -#endif -#ifdef SIGKILL - { SIGKILL, "Killed" }, -#endif -#ifdef SIGLOST - { SIGLOST, "Record lock" }, -#endif -#ifdef SIGMIGRATE - { SIGMIGRATE, "Migrate process to another CPU" }, -#endif -#ifdef SIGMSG - { SIGMSG, "HFT input data pending" }, -#endif -#ifdef SIGPIPE - { SIGPIPE, "Broken pipe" }, -#endif -#ifdef SIGPOLL - { SIGPOLL, "I/O possible" }, -#endif -#ifdef SIGPRE - { SIGPRE, "Programming error" }, -#endif -#ifdef SIGPROF - { SIGPROF, "Profiling timer expired" }, -#endif -#ifdef SIGPWR - { SIGPWR, "Power failure imminent" }, -#endif -#ifdef SIGRETRACT - { SIGRETRACT, "HFT monitor mode retracted" }, -#endif -#ifdef SIGQUIT - { SIGQUIT, "Quit" }, -#endif -#ifdef SIGSAK - { SIGSAK, "Secure Attention Key" }, -#endif -#ifdef SIGSEGV - { SIGSEGV, "Segmentation fault" }, -#endif -#ifdef SIGSOUND - { SIGSOUND, "HFT sound sequence completed" }, -#endif -#ifdef SIGSTOP - { SIGSTOP, "Suspended (signal)" }, -#endif -#ifdef SIGSYS - { SIGSYS, "Bad system call" }, -#endif -#ifdef SIGTERM - { SIGTERM, "Terminated" }, -#endif -#ifdef SIGTRAP - { SIGTRAP, "Trace/BPT trap" }, -#endif -#ifdef SIGTSTP - { SIGTSTP, "Suspended" }, -#endif -#ifdef SIGTTIN - { SIGTTIN, "Stopped (tty input)" }, -#endif -#ifdef SIGTTOU - { SIGTTOU, "Stopped (tty output)" }, -#endif -#ifdef SIGURG - { SIGURG, "Urgent I/O condition" }, -#endif -#ifdef SIGUSR1 - { SIGUSR1, "User defined signal 1" }, -#endif -#ifdef SIGUSR2 - { SIGUSR2, "User defined signal 2" }, -#endif -#ifdef SIGVTALRM - { SIGVTALRM, "Virtual timer expired" }, -#endif -#ifdef SIGWINCH - { SIGWINCH, "Window size changes" }, -#endif -#ifdef SIGXCPU - { SIGXCPU, "Cputime limit exceeded" }, -#endif -#ifdef SIGXFSZ - { SIGXFSZ, "Filesize limit exceeded" }, -#endif -}; - -/* - * sigmsg -- - * Return a pointer to a message describing a signal. - */ -static const char * -sigmsg(signo) - int signo; -{ - static char buf[40]; - const SIGS *sigp; - int n; - - for (n = 0, - sigp = &sigs[0]; n < sizeof(sigs) / sizeof(sigs[0]); ++n, ++sigp) - if (sigp->number == signo) - return (sigp->message); - (void)snprintf(buf, sizeof(buf), "Unknown signal: %d", signo); - return (buf); -} |