diff options
| author | Paul Eggert | 2011-07-08 03:00:52 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-08 03:00:52 -0700 |
| commit | 4a621aae149e694c8a53bebcc593d51811f69444 (patch) | |
| tree | 98f8469d3d5a2daff773ca7431f93c59061dc440 /lib | |
| parent | 354cf0ba0b20108c9776be1d868458893bc2cd54 (diff) | |
| download | emacs-4a621aae149e694c8a53bebcc593d51811f69444.tar.gz emacs-4a621aae149e694c8a53bebcc593d51811f69444.zip | |
* lib/getopt.c, lib/unistd.in.h, m4/getopt.m4: Merge from gnulib.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/getopt.c | 11 | ||||
| -rw-r--r-- | lib/unistd.in.h | 141 |
2 files changed, 78 insertions, 74 deletions
diff --git a/lib/getopt.c b/lib/getopt.c index 2af8352ee9c..7c9f7040612 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
| @@ -829,7 +829,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 829 | return '?'; | 829 | return '?'; |
| 830 | } | 830 | } |
| 831 | /* Convenience. Treat POSIX -W foo same as long option --foo */ | 831 | /* Convenience. Treat POSIX -W foo same as long option --foo */ |
| 832 | if (temp[0] == 'W' && temp[1] == ';' && longopts) | 832 | if (temp[0] == 'W' && temp[1] == ';') |
| 833 | { | 833 | { |
| 834 | char *nameend; | 834 | char *nameend; |
| 835 | const struct option *p; | 835 | const struct option *p; |
| @@ -839,6 +839,9 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 839 | int indfound = 0; | 839 | int indfound = 0; |
| 840 | int option_index; | 840 | int option_index; |
| 841 | 841 | ||
| 842 | if (longopts == NULL) | ||
| 843 | goto no_longs; | ||
| 844 | |||
| 842 | /* This is an option that requires an argument. */ | 845 | /* This is an option that requires an argument. */ |
| 843 | if (*d->__nextchar != '\0') | 846 | if (*d->__nextchar != '\0') |
| 844 | { | 847 | { |
| @@ -1046,8 +1049,10 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 1046 | } | 1049 | } |
| 1047 | return pfound->val; | 1050 | return pfound->val; |
| 1048 | } | 1051 | } |
| 1049 | d->__nextchar = NULL; | 1052 | |
| 1050 | return 'W'; /* Let the application handle it. */ | 1053 | no_longs: |
| 1054 | d->__nextchar = NULL; | ||
| 1055 | return 'W'; /* Let the application handle it. */ | ||
| 1051 | } | 1056 | } |
| 1052 | if (temp[1] == ':') | 1057 | if (temp[1] == ':') |
| 1053 | { | 1058 | { |
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index fdf0fca54e9..769ecf0d43f 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -117,78 +117,77 @@ | |||
| 117 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 117 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | #if @GNULIB_GETHOSTNAME@ | 120 | /* Hide some function declarations from <winsock2.h>. */ |
| 121 | /* Get all possible declarations of gethostname(). */ | 121 | |
| 122 | # if @UNISTD_H_HAVE_WINSOCK2_H@ | 122 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ |
| 123 | # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H | 123 | # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H |
| 124 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 124 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 125 | # undef socket | 125 | # undef socket |
| 126 | # define socket socket_used_without_including_sys_socket_h | 126 | # define socket socket_used_without_including_sys_socket_h |
| 127 | # undef connect | 127 | # undef connect |
| 128 | # define connect connect_used_without_including_sys_socket_h | 128 | # define connect connect_used_without_including_sys_socket_h |
| 129 | # undef accept | 129 | # undef accept |
| 130 | # define accept accept_used_without_including_sys_socket_h | 130 | # define accept accept_used_without_including_sys_socket_h |
| 131 | # undef bind | 131 | # undef bind |
| 132 | # define bind bind_used_without_including_sys_socket_h | 132 | # define bind bind_used_without_including_sys_socket_h |
| 133 | # undef getpeername | 133 | # undef getpeername |
| 134 | # define getpeername getpeername_used_without_including_sys_socket_h | 134 | # define getpeername getpeername_used_without_including_sys_socket_h |
| 135 | # undef getsockname | 135 | # undef getsockname |
| 136 | # define getsockname getsockname_used_without_including_sys_socket_h | 136 | # define getsockname getsockname_used_without_including_sys_socket_h |
| 137 | # undef getsockopt | 137 | # undef getsockopt |
| 138 | # define getsockopt getsockopt_used_without_including_sys_socket_h | 138 | # define getsockopt getsockopt_used_without_including_sys_socket_h |
| 139 | # undef listen | 139 | # undef listen |
| 140 | # define listen listen_used_without_including_sys_socket_h | 140 | # define listen listen_used_without_including_sys_socket_h |
| 141 | # undef recv | 141 | # undef recv |
| 142 | # define recv recv_used_without_including_sys_socket_h | 142 | # define recv recv_used_without_including_sys_socket_h |
| 143 | # undef send | 143 | # undef send |
| 144 | # define send send_used_without_including_sys_socket_h | 144 | # define send send_used_without_including_sys_socket_h |
| 145 | # undef recvfrom | 145 | # undef recvfrom |
| 146 | # define recvfrom recvfrom_used_without_including_sys_socket_h | 146 | # define recvfrom recvfrom_used_without_including_sys_socket_h |
| 147 | # undef sendto | 147 | # undef sendto |
| 148 | # define sendto sendto_used_without_including_sys_socket_h | 148 | # define sendto sendto_used_without_including_sys_socket_h |
| 149 | # undef setsockopt | 149 | # undef setsockopt |
| 150 | # define setsockopt setsockopt_used_without_including_sys_socket_h | 150 | # define setsockopt setsockopt_used_without_including_sys_socket_h |
| 151 | # undef shutdown | 151 | # undef shutdown |
| 152 | # define shutdown shutdown_used_without_including_sys_socket_h | 152 | # define shutdown shutdown_used_without_including_sys_socket_h |
| 153 | # else | 153 | # else |
| 154 | _GL_WARN_ON_USE (socket, | 154 | _GL_WARN_ON_USE (socket, |
| 155 | "socket() used without including <sys/socket.h>"); | 155 | "socket() used without including <sys/socket.h>"); |
| 156 | _GL_WARN_ON_USE (connect, | 156 | _GL_WARN_ON_USE (connect, |
| 157 | "connect() used without including <sys/socket.h>"); | 157 | "connect() used without including <sys/socket.h>"); |
| 158 | _GL_WARN_ON_USE (accept, | 158 | _GL_WARN_ON_USE (accept, |
| 159 | "accept() used without including <sys/socket.h>"); | 159 | "accept() used without including <sys/socket.h>"); |
| 160 | _GL_WARN_ON_USE (bind, | 160 | _GL_WARN_ON_USE (bind, |
| 161 | "bind() used without including <sys/socket.h>"); | 161 | "bind() used without including <sys/socket.h>"); |
| 162 | _GL_WARN_ON_USE (getpeername, | 162 | _GL_WARN_ON_USE (getpeername, |
| 163 | "getpeername() used without including <sys/socket.h>"); | 163 | "getpeername() used without including <sys/socket.h>"); |
| 164 | _GL_WARN_ON_USE (getsockname, | 164 | _GL_WARN_ON_USE (getsockname, |
| 165 | "getsockname() used without including <sys/socket.h>"); | 165 | "getsockname() used without including <sys/socket.h>"); |
| 166 | _GL_WARN_ON_USE (getsockopt, | 166 | _GL_WARN_ON_USE (getsockopt, |
| 167 | "getsockopt() used without including <sys/socket.h>"); | 167 | "getsockopt() used without including <sys/socket.h>"); |
| 168 | _GL_WARN_ON_USE (listen, | 168 | _GL_WARN_ON_USE (listen, |
| 169 | "listen() used without including <sys/socket.h>"); | 169 | "listen() used without including <sys/socket.h>"); |
| 170 | _GL_WARN_ON_USE (recv, | 170 | _GL_WARN_ON_USE (recv, |
| 171 | "recv() used without including <sys/socket.h>"); | 171 | "recv() used without including <sys/socket.h>"); |
| 172 | _GL_WARN_ON_USE (send, | 172 | _GL_WARN_ON_USE (send, |
| 173 | "send() used without including <sys/socket.h>"); | 173 | "send() used without including <sys/socket.h>"); |
| 174 | _GL_WARN_ON_USE (recvfrom, | 174 | _GL_WARN_ON_USE (recvfrom, |
| 175 | "recvfrom() used without including <sys/socket.h>"); | 175 | "recvfrom() used without including <sys/socket.h>"); |
| 176 | _GL_WARN_ON_USE (sendto, | 176 | _GL_WARN_ON_USE (sendto, |
| 177 | "sendto() used without including <sys/socket.h>"); | 177 | "sendto() used without including <sys/socket.h>"); |
| 178 | _GL_WARN_ON_USE (setsockopt, | 178 | _GL_WARN_ON_USE (setsockopt, |
| 179 | "setsockopt() used without including <sys/socket.h>"); | 179 | "setsockopt() used without including <sys/socket.h>"); |
| 180 | _GL_WARN_ON_USE (shutdown, | 180 | _GL_WARN_ON_USE (shutdown, |
| 181 | "shutdown() used without including <sys/socket.h>"); | 181 | "shutdown() used without including <sys/socket.h>"); |
| 182 | # endif | ||
| 183 | # endif | 182 | # endif |
| 184 | # if !defined _@GUARD_PREFIX@_SYS_SELECT_H | 183 | # endif |
| 185 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 184 | # if !defined _@GUARD_PREFIX@_SYS_SELECT_H |
| 186 | # undef select | 185 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 187 | # define select select_used_without_including_sys_select_h | 186 | # undef select |
| 188 | # else | 187 | # define select select_used_without_including_sys_select_h |
| 189 | _GL_WARN_ON_USE (select, | 188 | # else |
| 190 | "select() used without including <sys/select.h>"); | 189 | _GL_WARN_ON_USE (select, |
| 191 | # endif | 190 | "select() used without including <sys/select.h>"); |
| 192 | # endif | 191 | # endif |
| 193 | # endif | 192 | # endif |
| 194 | #endif | 193 | #endif |