diff options
author | Roland McGrath <roland@gnu.org> | 1995-02-18 03:51:45 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-02-18 03:51:45 +0000 |
commit | 0ad46177053e2c91b967d7193eeaf43e82f279ea (patch) | |
tree | 35804bc94c9d7f43cd78398a061052e38f4e9141 | |
parent | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (diff) | |
download | glibc-0ad46177053e2c91b967d7193eeaf43e82f279ea.tar glibc-0ad46177053e2c91b967d7193eeaf43e82f279ea.tar.gz glibc-0ad46177053e2c91b967d7193eeaf43e82f279ea.tar.bz2 glibc-0ad46177053e2c91b967d7193eeaf43e82f279ea.zip |
Updated from ../gpl2lgpl.sed /home/gd/gnu/lib/getopt.c
-rw-r--r-- | mach/mach_init.c | 2 | ||||
-rw-r--r-- | posix/getopt.c | 64 | ||||
-rw-r--r-- | posix/getopt.h | 12 | ||||
-rw-r--r-- | posix/getopt1.c | 11 | ||||
-rw-r--r-- | sysdeps/mach/hurd/errlist.c | 77 | ||||
-rw-r--r-- | sysdeps/mach/hurd/errnos.h | 110 |
6 files changed, 163 insertions, 113 deletions
diff --git a/mach/mach_init.c b/mach/mach_init.c index 42379feb85..43646a761e 100644 --- a/mach/mach_init.c +++ b/mach/mach_init.c @@ -20,7 +20,7 @@ Cambridge, MA 02139, USA. */ #include <mach/mach_interface.h> mach_port_t __mach_task_self_; -vm_size_t __vm_page_size; +vm_size_t __vm_page_size = 0; /* Must be data not bss for weak alias. */ weak_alias (__vm_page_size, vm_page_size) void diff --git a/posix/getopt.c b/posix/getopt.c index 7e7fdc7c3b..7fef53a0b3 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -31,17 +31,10 @@ Cambridge, MA 02139, USA. */ #endif #ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ #include <config.h> -#else -#include "config.h" -#endif #endif -#ifndef __STDC__ +#if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const @@ -70,6 +63,14 @@ Cambridge, MA 02139, USA. */ #include <stdlib.h> #endif /* GNU C library. */ +/* This is for other GNU distributions with internationalized messages. + The GNU C Library itself does not yet support such messages. */ +#if HAVE_LIBINTL_H +# include <libintl.h> +#else +# define gettext(msgid) (msgid) +#endif + /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. @@ -199,7 +200,7 @@ my_index (str, chr) #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ -#ifndef __STDC__ +#if !defined (__STDC__) || !__STDC__ /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); @@ -516,7 +517,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (ambig && !exact) { if (opterr) - fprintf (stderr, "%s: option `%s' is ambiguous\n", + fprintf (stderr, gettext ("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; @@ -536,18 +537,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) else { if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - "%s: option `--%s' doesn't allow an argument\n", - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - "%s: option `%c%s' doesn't allow an argument\n", - argv[0], argv[optind - 1][0], pfound->name); - } + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + gettext ("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + gettext ("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + nextchar += strlen (nextchar); return '?'; } @@ -559,8 +559,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) else { if (opterr) - fprintf (stderr, "%s: option `%s' requires an argument\n", - argv[0], argv[optind - 1]); + fprintf (stderr, + gettext ("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } @@ -587,11 +588,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { if (argv[optind][1] == '-') /* --option */ - fprintf (stderr, "%s: unrecognized option `--%s'\n", + fprintf (stderr, gettext ("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ - fprintf (stderr, "%s: unrecognized option `%c%s'\n", + fprintf (stderr, gettext ("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; @@ -616,9 +617,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); + fprintf (stderr, gettext ("%s: illegal option -- %c\n"), + argv[0], c); else - fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c); + fprintf (stderr, gettext ("%s: invalid option -- %c\n"), + argv[0], c); } optopt = c; return '?'; @@ -652,8 +655,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (opterr) { /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: option requires an argument -- %c\n", - argv[0], c); + fprintf (stderr, + gettext ("%s: option requires an argument -- %c\n"), + argv[0], c); } optopt = c; if (optstring[0] == ':') diff --git a/posix/getopt.h b/posix/getopt.h index ab50378d09..f3696d955d 100644 --- a/posix/getopt.h +++ b/posix/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -80,7 +80,7 @@ extern int optopt; struct option { -#if __STDC__ +#if defined (__STDC__) && __STDC__ const char *name; #else char *name; @@ -98,15 +98,15 @@ struct option #define required_argument 1 #define optional_argument 2 -#if __STDC__ -#if defined(__GNU_LIBRARY__) +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ extern int getopt (); -#endif /* not __GNU_LIBRARY__ */ +#endif /* __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, @@ -124,7 +124,7 @@ extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); -#endif /* not __STDC__ */ +#endif /* __STDC__ */ #ifdef __cplusplus } diff --git a/posix/getopt1.c b/posix/getopt1.c index 644894f7bc..de8e2ad567 100644 --- a/posix/getopt1.c +++ b/posix/getopt1.c @@ -1,5 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 + Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of @@ -21,19 +21,12 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ #include <config.h> -#else -#include "config.h" -#endif #endif #include "getopt.h" -#ifndef __STDC__ +#if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const diff --git a/sysdeps/mach/hurd/errlist.c b/sysdeps/mach/hurd/errlist.c index b72cd7379a..5f40e04209 100644 --- a/sysdeps/mach/hurd/errlist.c +++ b/sysdeps/mach/hurd/errlist.c @@ -30,8 +30,8 @@ const char *_sys_errlist[] = "Not a directory", /* 20 = ENOTDIR */ "Is a directory", /* 21 = EISDIR */ "Invalid argument", /* 22 = EINVAL */ - "Too many open files", /* 23 = EMFILE */ - "Too many open files in system", /* 24 = ENFILE */ + "Too many open files in system", /* 23 = ENFILE */ + "Too many open files", /* 24 = EMFILE */ "Inappropriate ioctl for device", /* 25 = ENOTTY */ "Text file busy", /* 26 = ETXTBSY */ "File too large", /* 27 = EFBIG */ @@ -42,7 +42,7 @@ const char *_sys_errlist[] = "Broken pipe", /* 32 = EPIPE */ "Numerical argument out of domain", /* 33 = EDOM */ "Numerical result out of range", /* 34 = ERANGE */ - "Operation would block", /* 35 = EWOULDBLOCK */ + "Resource temporarily unavailable", /* 35 = EAGAIN */ "Operation now in progress", /* 36 = EINPROGRESS */ "Operation already in progress", /* 37 = EALREADY */ "Socket operation on non-socket", /* 38 = ENOTSOCK */ @@ -66,28 +66,59 @@ const char *_sys_errlist[] = "Socket is already connected", /* 56 = EISCONN */ "Socket is not connected", /* 57 = ENOTCONN */ "Can't send after socket shutdown", /* 58 = ESHUTDOWN */ - "Connection timed out", /* 59 = ETIMEDOUT */ - "Connection refused", /* 60 = ECONNREFUSED */ - "Too many levels of symbolic links",/* 61 = ELOOP */ - "File name too long", /* 62 = ENAMETOOLONG */ - "Host is down", /* 63 = EHOSTDOWN */ - "No route to host", /* 64 = EHOSTUNREACH */ - "Directory not empty", /* 65 = ENOTEMPTY */ - "Too many users", /* 66 = EUSERS */ - "Disc quota exceeded", /* 67 = EDQUOT */ - "Stale NFS file handle", /* 68 = ESTALE */ - "Too many levels of remote in path",/* 69 = EREMOTE */ - "No locks available", /* 70 = ENOLCK */ - "Function not implemented", /* 71 = ENOSYS */ - "Inappropriate operation for background process",/* 72 = EBACKGROUND */ - "?", /* 73 = ED */ - "You really blew it this time", /* 74 = EGREGIOUS */ - "Computer bought the farm", /* 75 = EIEIO */ - "Gratuitous error", /* 76 = EGRATUITOUS */ + "Too many references: can't splice",/* 59 = ETOOMANYREFS */ + "Connection timed out", /* 60 = ETIMEDOUT */ + "Connection refused", /* 61 = ECONNREFUSED */ + "Too many levels of symbolic links",/* 62 = ELOOP */ + "File name too long", /* 63 = ENAMETOOLONG */ + "Host is down", /* 64 = EHOSTDOWN */ + "No route to host", /* 65 = EHOSTUNREACH */ + "Directory not empty", /* 66 = ENOTEMPTY */ + "Too many processes", /* 67 = EPROCLIM */ + "Too many users", /* 68 = EUSERS */ + "Disc quota exceeded", /* 69 = EDQUOT */ + "Stale NFS file handle", /* 70 = ESTALE */ + "Too many levels of remote in path",/* 71 = EREMOTE */ + "RPC struct is bad", /* 72 = EBADRPC */ + "RPC version wrong", /* 73 = ERPCMISMATCH */ + "RPC program not available", /* 74 = EPROGUNAVAIL */ + "RPC program version wrong", /* 75 = EPROGMISMATCH */ + "RPC bad procedure for program", /* 76 = EPROCUNAVAIL */ + "No locks available", /* 77 = ENOLCK */ + "Function not implemented", /* 78 = ENOSYS */ + "Inappropriate file type or format",/* 79 = EFTYPE */ + "Authentication error", /* 80 = EAUTH */ + "Need authenticator", /* 81 = ENEEDAUTH */ + "Reserved error 82", + "Reserved error 83", + "Reserved error 84", + "Reserved error 85", + "Reserved error 86", + "Reserved error 87", + "Reserved error 88", + "Reserved error 89", + "Reserved error 90", + "Reserved error 91", + "Reserved error 92", + "Reserved error 93", + "Reserved error 94", + "Reserved error 95", + "Reserved error 96", + "Reserved error 97", + "Reserved error 98", + "Reserved error 99", + "Inappropriate operation for background process",/* 100 = EBACKGROUND */ + "Translator died", /* 101 = EDIED */ + "?", /* 102 = ED */ + "You really blew it this time", /* 103 = EGREGIOUS */ + "Computer bought the farm", /* 104 = EIEIO */ + "Gratuitous error", /* 105 = EGRATUITOUS */ }; #include <errno.h> -#if _HURD_ERRNOS != 77 +#if _HURD_ERRNOS != 106 #error errlist/errnos generation bug #endif -const int _sys_nerr = 77; +const int _sys_nerr = 106; +weak_alias (_sys_errlist, sys_errlist) +weak_alias (_sys_nerr, sys_nerr) diff --git a/sysdeps/mach/hurd/errnos.h b/sysdeps/mach/hurd/errnos.h index 911af3c5c8..cd8e51e438 100644 --- a/sysdeps/mach/hurd/errnos.h +++ b/sysdeps/mach/hurd/errnos.h @@ -1,4 +1,4 @@ -/* This file generated by gawk manual/errno.texi ../mach/mach/message.h ../mach/mach/kern_return.h ../mach/mach/mig_errors.h ../mach/device/device_types.h. */ +/* This file generated by gawk ../manual/errno.texi ../../mach/mach/message.h ../../mach/mach/kern_return.h ../../mach/mach/mig_errors.h ../../mach/device/device_types.h. */ /* The Hurd uses Mach error system 0x10, currently only subsystem 0. */ #ifndef _HURD_ERRNO @@ -55,10 +55,10 @@ enum __error_t_codes #define EISDIR _HURD_ERRNO (21)/* Is a directory */ EINVAL = _HURD_ERRNO (22), #define EINVAL _HURD_ERRNO (22)/* Invalid argument */ - EMFILE = _HURD_ERRNO (23), -#define EMFILE _HURD_ERRNO (23)/* Too many open files */ - ENFILE = _HURD_ERRNO (24), -#define ENFILE _HURD_ERRNO (24)/* Too many open files in system */ + EMFILE = _HURD_ERRNO (24), +#define EMFILE _HURD_ERRNO (24)/* Too many open files */ + ENFILE = _HURD_ERRNO (23), +#define ENFILE _HURD_ERRNO (23)/* Too many open files in system */ ENOTTY = _HURD_ERRNO (25), #define ENOTTY _HURD_ERRNO (25)/* Inappropriate ioctl for device */ ETXTBSY = _HURD_ERRNO (26), @@ -88,8 +88,6 @@ enum __error_t_codes #define EALREADY _HURD_ERRNO (37)/* Operation already in progress */ ENOTSOCK = _HURD_ERRNO (38), #define ENOTSOCK _HURD_ERRNO (38)/* Socket operation on non-socket */ - EDESTADDRREQ = _HURD_ERRNO (39), -#define EDESTADDRREQ _HURD_ERRNO (39)/* Destination address required */ EMSGSIZE = _HURD_ERRNO (40), #define EMSGSIZE _HURD_ERRNO (40)/* Message too long */ EPROTOTYPE = _HURD_ERRNO (41), @@ -126,44 +124,68 @@ enum __error_t_codes #define EISCONN _HURD_ERRNO (56)/* Socket is already connected */ ENOTCONN = _HURD_ERRNO (57), #define ENOTCONN _HURD_ERRNO (57)/* Socket is not connected */ + EDESTADDRREQ = _HURD_ERRNO (39), +#define EDESTADDRREQ _HURD_ERRNO (39)/* Destination address required */ ESHUTDOWN = _HURD_ERRNO (58), #define ESHUTDOWN _HURD_ERRNO (58)/* Can't send after socket shutdown */ - ETIMEDOUT = _HURD_ERRNO (59), -#define ETIMEDOUT _HURD_ERRNO (59)/* Connection timed out */ - ECONNREFUSED = _HURD_ERRNO (60), -#define ECONNREFUSED _HURD_ERRNO (60)/* Connection refused */ - ELOOP = _HURD_ERRNO (61), -#define ELOOP _HURD_ERRNO (61)/* Too many levels of symbolic links */ - ENAMETOOLONG = _HURD_ERRNO (62), -#define ENAMETOOLONG _HURD_ERRNO (62)/* File name too long */ - EHOSTDOWN = _HURD_ERRNO (63), -#define EHOSTDOWN _HURD_ERRNO (63)/* Host is down */ - EHOSTUNREACH = _HURD_ERRNO (64), -#define EHOSTUNREACH _HURD_ERRNO (64)/* No route to host */ - ENOTEMPTY = _HURD_ERRNO (65), -#define ENOTEMPTY _HURD_ERRNO (65)/* Directory not empty */ - EUSERS = _HURD_ERRNO (66), -#define EUSERS _HURD_ERRNO (66)/* Too many users */ - EDQUOT = _HURD_ERRNO (67), -#define EDQUOT _HURD_ERRNO (67)/* Disc quota exceeded */ - ESTALE = _HURD_ERRNO (68), -#define ESTALE _HURD_ERRNO (68)/* Stale NFS file handle */ - EREMOTE = _HURD_ERRNO (69), -#define EREMOTE _HURD_ERRNO (69)/* Too many levels of remote in path */ - ENOLCK = _HURD_ERRNO (70), -#define ENOLCK _HURD_ERRNO (70)/* No locks available */ - ENOSYS = _HURD_ERRNO (71), -#define ENOSYS _HURD_ERRNO (71)/* Function not implemented */ - EBACKGROUND = _HURD_ERRNO (72), -#define EBACKGROUND _HURD_ERRNO (72)/* Inappropriate operation for background process */ - ED = _HURD_ERRNO (73), -#define ED _HURD_ERRNO (73)/* ? */ - EGREGIOUS = _HURD_ERRNO (74), -#define EGREGIOUS _HURD_ERRNO (74)/* You really blew it this time */ - EIEIO = _HURD_ERRNO (75), -#define EIEIO _HURD_ERRNO (75)/* Computer bought the farm */ - EGRATUITOUS = _HURD_ERRNO (76), -#define EGRATUITOUS _HURD_ERRNO (76)/* Gratuitous error */ + ETOOMANYREFS = _HURD_ERRNO (59), +#define ETOOMANYREFS _HURD_ERRNO (59)/* Too many references: can't splice */ + ETIMEDOUT = _HURD_ERRNO (60), +#define ETIMEDOUT _HURD_ERRNO (60)/* Connection timed out */ + ECONNREFUSED = _HURD_ERRNO (61), +#define ECONNREFUSED _HURD_ERRNO (61)/* Connection refused */ + ELOOP = _HURD_ERRNO (62), +#define ELOOP _HURD_ERRNO (62)/* Too many levels of symbolic links */ + ENAMETOOLONG = _HURD_ERRNO (63), +#define ENAMETOOLONG _HURD_ERRNO (63)/* File name too long */ + EHOSTDOWN = _HURD_ERRNO (64), +#define EHOSTDOWN _HURD_ERRNO (64)/* Host is down */ + EHOSTUNREACH = _HURD_ERRNO (65), +#define EHOSTUNREACH _HURD_ERRNO (65)/* No route to host */ + ENOTEMPTY = _HURD_ERRNO (66), +#define ENOTEMPTY _HURD_ERRNO (66)/* Directory not empty */ + EPROCLIM = _HURD_ERRNO (67), +#define EPROCLIM _HURD_ERRNO (67)/* Too many processes */ + EUSERS = _HURD_ERRNO (68), +#define EUSERS _HURD_ERRNO (68)/* Too many users */ + EDQUOT = _HURD_ERRNO (69), +#define EDQUOT _HURD_ERRNO (69)/* Disc quota exceeded */ + ESTALE = _HURD_ERRNO (70), +#define ESTALE _HURD_ERRNO (70)/* Stale NFS file handle */ + EREMOTE = _HURD_ERRNO (71), +#define EREMOTE _HURD_ERRNO (71)/* Too many levels of remote in path */ + EBADRPC = _HURD_ERRNO (72), +#define EBADRPC _HURD_ERRNO (72)/* RPC struct is bad */ + ERPCMISMATCH = _HURD_ERRNO (73), +#define ERPCMISMATCH _HURD_ERRNO (73)/* RPC version wrong */ + EPROGUNAVAIL = _HURD_ERRNO (74), +#define EPROGUNAVAIL _HURD_ERRNO (74)/* RPC program not available */ + EPROGMISMATCH = _HURD_ERRNO (75), +#define EPROGMISMATCH _HURD_ERRNO (75)/* RPC program version wrong */ + EPROCUNAVAIL = _HURD_ERRNO (76), +#define EPROCUNAVAIL _HURD_ERRNO (76)/* RPC bad procedure for program */ + ENOLCK = _HURD_ERRNO (77), +#define ENOLCK _HURD_ERRNO (77)/* No locks available */ + EFTYPE = _HURD_ERRNO (79), +#define EFTYPE _HURD_ERRNO (79)/* Inappropriate file type or format */ + EAUTH = _HURD_ERRNO (80), +#define EAUTH _HURD_ERRNO (80)/* Authentication error */ + ENEEDAUTH = _HURD_ERRNO (81), +#define ENEEDAUTH _HURD_ERRNO (81)/* Need authenticator */ + ENOSYS = _HURD_ERRNO (78), +#define ENOSYS _HURD_ERRNO (78)/* Function not implemented */ + EBACKGROUND = _HURD_ERRNO (100), +#define EBACKGROUND _HURD_ERRNO (100)/* Inappropriate operation for background process */ + EDIED = _HURD_ERRNO (101), +#define EDIED _HURD_ERRNO (101)/* Translator died */ + ED = _HURD_ERRNO (102), +#define ED _HURD_ERRNO (102)/* ? */ + EGREGIOUS = _HURD_ERRNO (103), +#define EGREGIOUS _HURD_ERRNO (103)/* You really blew it this time */ + EIEIO = _HURD_ERRNO (104), +#define EIEIO _HURD_ERRNO (104)/* Computer bought the farm */ + EGRATUITOUS = _HURD_ERRNO (105), +#define EGRATUITOUS _HURD_ERRNO (105)/* Gratuitous error */ /* Errors from <mach/message.h>. */ EMACH_SEND_IN_PROGRESS = 0x10000001, @@ -245,7 +267,7 @@ enum __error_t_codes }; -#define _HURD_ERRNOS 77 +#define _HURD_ERRNOS 106 /* User-visible type of error codes. It is ok to use `int' or `kern_return_t' for these, but with `error_t' the debugger prints |