=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/os.c,v retrieving revision 1.1.1.3 retrieving revision 1.1.1.4 diff -u -r1.1.1.3 -r1.1.1.4 --- src/usr.bin/less/os.c 2011/09/16 17:47:07 1.1.1.3 +++ src/usr.bin/less/os.c 2014/04/25 13:33:49 1.1.1.4 @@ -1,11 +1,10 @@ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -23,7 +22,6 @@ #include "less.h" #include -#include #if HAVE_TIME_H #include #endif @@ -40,31 +38,10 @@ #define time_type long #endif -/* - * BSD setjmp() saves (and longjmp() restores) the signal mask. - * This costs a system call or two per setjmp(), so if possible we clear the - * signal mask with sigsetmask(), and use _setjmp()/_longjmp() instead. - * On other systems, setjmp() doesn't affect the signal mask and so - * _setjmp() does not exist; we just use setjmp(). - */ -#if HAVE__SETJMP && HAVE_SIGSETMASK -#define SET_JUMP _setjmp -#define LONG_JUMP _longjmp -#else -#define SET_JUMP setjmp -#define LONG_JUMP longjmp -#endif +extern volatile sig_atomic_t sigs; -public int reading; - -static jmp_buf read_label; - -extern int sigs; - /* * Like read() system call, but is deliberately interruptible. - * A call to intread() from a signal handler will interrupt - * any pending iread(). */ public int iread(fd, buf, len) @@ -91,32 +68,8 @@ } #endif #endif - if (SET_JUMP(read_label)) - { - /* - * We jumped here from intread. - */ - reading = 0; -#if HAVE_SIGPROCMASK - { - sigset_t mask; - sigemptyset(&mask); - sigprocmask(SIG_SETMASK, &mask, NULL); - } -#else -#if HAVE_SIGSETMASK - sigsetmask(0); -#else -#ifdef _OSK - sigmask(~0); -#endif -#endif -#endif - return (READ_INTR); - } flush(); - reading = 1; #if MSDOS_COMPILER==DJGPPC if (isatty(fd)) { @@ -155,7 +108,6 @@ } } #endif - reading = 0; if (n < 0) { #if HAVE_ERRNO @@ -167,7 +119,7 @@ #endif #ifdef EINTR if (errno == EINTR) - goto start; + return (READ_INTR); #endif #ifdef EAGAIN if (errno == EAGAIN) @@ -180,15 +132,6 @@ } /* - * Interrupt a pending iread(). - */ - public void -intread() -{ - LONG_JUMP(read_label, 1); -} - -/* * Return the current time. */ #if HAVE_TIME @@ -218,7 +161,7 @@ if (err < sys_nerr) return sys_errlist[err]; - sprintf(buf, "Error %d", err); + snprintf(buf, sizeof(buf), "Error %d", err); return buf; #else return ("cannot open"); @@ -235,7 +178,7 @@ { register char *p; register char *m; - int len; + size_t len; #if HAVE_ERRNO #if MUST_DEFINE_ERRNO extern int errno;