diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2003-11-28 11:24:04 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2003-11-28 11:24:04 +0000 |
commit | 79c3e70e4c5e5c98e64375ecc1cd071414c15e81 (patch) | |
tree | e931926676630fafe98c0b11f1e7707cdd229030 | |
parent | 99dfb315e097b21571a655461d8cd7adfb77352f (diff) | |
download | cpio-79c3e70e4c5e5c98e64375ecc1cd071414c15e81.tar.gz cpio-79c3e70e4c5e5c98e64375ecc1cd071414c15e81.tar.bz2 |
Updated
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | error.c | 33 | ||||
-rw-r--r-- | system.h | 92 |
3 files changed, 62 insertions, 71 deletions
@@ -8,6 +8,14 @@ * userspec.c: Changed the way of handling declared vs. undeclared system calls. * strerror.c: New file. Borrowed from GNU Radius. + + * copyin.c: Removed kludgy declaration of delayed_seek_count. + * copypass.c: Likewise + * extern.h: Declare delayed_seek_count. + * mkdir.c: Fixed handling of undeclared errno + * mt.c: Likewise + * util.c: Likewise + * rtapelib.c: Likewise 2003-11-28 Sergey Poznyakoff <gray@Mirddin.farlep.net> @@ -22,6 +22,11 @@ #endif #include <stdio.h> +#include "system.h" + +#if !HAVE_DECL_STRERROR +extern const char *strerror (int en); +#endif #if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC # if __STDC__ @@ -36,13 +41,6 @@ # define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; #endif -#if STDC_HEADERS || _LIBC -# include <stdlib.h> -# include <string.h> -#else -void exit (); -#endif - /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; @@ -52,32 +50,13 @@ unsigned int error_message_count; void (*error_print_progname) () = NULL; #ifdef _LIBC -#define program_name program_invocation_name +# define program_name program_invocation_name #endif /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; -#if HAVE_STRERROR || _LIBC -# ifndef strerror /* On some systems, strerror is a macro */ -char *strerror (); -# endif -#else -static char * -private_strerror (errnum) - int errnum; -{ - extern char *sys_errlist[]; - extern int sys_nerr; - - if (errnum > 0 && errnum <= sys_nerr) - return sys_errlist[errnum]; - return "Unknown system error"; -} -#define strerror private_strerror -#endif - /* Print the program name and error message MESSAGE, which is a printf-style format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. @@ -15,76 +15,85 @@ with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) -#include <string.h> +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#if defined(HAVE_STRING_H) +# include <string.h> +#else +# include <strings.h> +#endif + #ifndef index -#define index strchr +# define index strchr #endif #ifndef rindex -#define rindex strrchr +# define rindex strrchr #endif #ifndef bcmp -#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) +# define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) #endif #ifndef bzero -#define bzero(s, n) memset ((s), 0, (n)) -#endif -#else -#include <strings.h> +# define bzero(s, n) memset ((s), 0, (n)) #endif -#include <time.h> - -#ifdef STDC_HEADERS -#include <stdlib.h> +#if !HAVE_DECL_STRDUP +# ifdef __STDC__ +char *strdup (const char *s); +# else /* !__STDC__ */ +char *strdup (); +# endif /* __STDC__ */ #endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif +#include <time.h> #ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 #endif #ifndef _POSIX_VERSION -#if defined(__MSDOS__) && !defined(__GNUC__) +# if defined(__MSDOS__) && !defined(__GNUC__) typedef long off_t; -#endif +# endif off_t lseek (); #endif /* Since major is a function on SVR4, we can't use `ifndef major'. */ #ifdef MAJOR_IN_MKDEV -#include <sys/mkdev.h> -#define HAVE_MAJOR +# include <sys/mkdev.h> +# define HAVE_MAJOR #endif #ifdef MAJOR_IN_SYSMACROS -#include <sys/sysmacros.h> -#define HAVE_MAJOR +# include <sys/sysmacros.h> +# define HAVE_MAJOR #endif #ifdef major /* Might be defined in sys/types.h. */ -#define HAVE_MAJOR +# define HAVE_MAJOR #endif #ifndef HAVE_MAJOR -#define major(dev) (((dev) >> 8) & 0xff) -#define minor(dev) ((dev) & 0xff) -#define makedev(ma, mi) (((ma) << 8) | (mi)) +# define major(dev) (((dev) >> 8) & 0xff) +# define minor(dev) ((dev) & 0xff) +# defin makedev(ma, mi) (((ma) << 8) | (mi)) #endif #undef HAVE_MAJOR #if defined(__MSDOS__) || defined(_POSIX_VERSION) || defined(HAVE_FCNTL_H) -#include <fcntl.h> +# include <fcntl.h> #else -#include <sys/file.h> +# include <sys/file.h> #endif #ifndef O_BINARY -#define O_BINARY 0 +# define O_BINARY 0 #endif #include <errno.h> @@ -92,12 +101,12 @@ off_t lseek (); extern int errno; #endif #ifdef __EMX__ /* gcc on OS/2. */ -#define EPERM EACCES -#define ENXIO EIO +# define EPERM EACCES +# define ENXIO EIO #endif #ifdef HAVE_UTIME_H -#include <utime.h> +# include <utime.h> #else struct utimbuf { @@ -107,11 +116,11 @@ struct utimbuf #endif #ifdef TRUE -#undef TRUE +# undef TRUE #endif #define TRUE 1 #ifdef FALSE -#undef FALSE +# undef FALSE #endif #define FALSE 0 @@ -121,11 +130,6 @@ struct utimbuf #define CONSOLE "con" #endif -#if defined(__MSDOS__) && !defined(__GNUC__) -typedef int uid_t; -typedef int gid_t; -#endif - /* On most systems symlink() always creates links with rwxrwxrwx protection modes, but on some (HP/UX 8.07; I think maybe DEC's OSF on MIPS too) symlink() uses the value of umask, so links' protection modes @@ -135,8 +139,8 @@ typedef int gid_t; symlink(). */ #ifndef SYMLINK_USES_UMASK -#define UMASKED_SYMLINK(name1,name2,mode) symlink(name1,name2) +# define UMASKED_SYMLINK(name1,name2,mode) symlink(name1,name2) #else -#define UMASKED_SYMLINK(name1,name2,mode) umasked_symlink(name1,name2,mode) +# define UMASKED_SYMLINK(name1,name2,mode) umasked_symlink(name1,name2,mode) #endif /* SYMLINK_USES_UMASK */ |