diff options
| -rw-r--r-- | lib-src/getopt.c | 36 | ||||
| -rw-r--r-- | lib-src/getopt.h | 36 | ||||
| -rw-r--r-- | lib-src/getopt1.c | 36 | ||||
| -rw-r--r-- | src/strftime.c | 25 |
4 files changed, 74 insertions, 59 deletions
diff --git a/lib-src/getopt.c b/lib-src/getopt.c index 19f3f056592..f622fc375ee 100644 --- a/lib-src/getopt.c +++ b/lib-src/getopt.c | |||
| @@ -6,25 +6,23 @@ | |||
| 6 | Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 | 6 | Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 |
| 7 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
| 8 | 8 | ||
| 9 | the C library, however. The master source lives in /gd/gnu/lib. | 9 | NOTE: The canonical source of this file is maintained with the GNU C Library. |
| 10 | 10 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | |
| 11 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 11 | |
| 12 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | 12 | This program is free software; you can redistribute it and/or modify it |
| 13 | 13 | under the terms of the GNU General Public License as published by the | |
| 14 | This program is free software; you can redistribute it and/or modify it | 14 | Free Software Foundation; either version 2, or (at your option) any |
| 15 | under the terms of the GNU General Public License as published by the | 15 | later version. |
| 16 | Free Software Foundation; either version 2, or (at your option) any | 16 | |
| 17 | later version. | 17 | This program is distributed in the hope that it will be useful, |
| 18 | 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | This program is distributed in the hope that it will be useful, | 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 20 | GNU General Public License for more details. |
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 21 | |
| 22 | GNU General Public License for more details. | 22 | You should have received a copy of the GNU General Public License |
| 23 | 23 | along with this program; if not, write to the Free Software | |
| 24 | You should have received a copy of the GNU General Public License | 24 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 25 | along with this program; if not, write to the Free Software | 25 | USA. */ |
| 26 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
| 27 | USA. */ | ||
| 28 | 26 | ||
| 29 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. | 27 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. |
| 30 | Ditto for AIX 3.2 and <stdlib.h>. */ | 28 | Ditto for AIX 3.2 and <stdlib.h>. */ |
diff --git a/lib-src/getopt.h b/lib-src/getopt.h index c4549243230..062bb87cfe5 100644 --- a/lib-src/getopt.h +++ b/lib-src/getopt.h | |||
| @@ -1,25 +1,23 @@ | |||
| 1 | /* Declarations for getopt. | 1 | /* Declarations for getopt. |
| 2 | Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. | 2 | Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | the C library, however. The master source lives in /gd/gnu/lib. | 4 | NOTE: The canonical source of this file is maintained with the GNU C Library. |
| 5 | 5 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | |
| 6 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 6 | |
| 7 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | 7 | This program is free software; you can redistribute it and/or modify it |
| 8 | 8 | under the terms of the GNU General Public License as published by the | |
| 9 | This program is free software; you can redistribute it and/or modify it | 9 | Free Software Foundation; either version 2, or (at your option) any |
| 10 | under the terms of the GNU General Public License as published by the | 10 | later version. |
| 11 | Free Software Foundation; either version 2, or (at your option) any | 11 | |
| 12 | later version. | 12 | This program is distributed in the hope that it will be useful, |
| 13 | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | This program is distributed in the hope that it will be useful, | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | GNU General Public License for more details. |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | |
| 17 | GNU General Public License for more details. | 17 | You should have received a copy of the GNU General Public License |
| 18 | 18 | along with this program; if not, write to the Free Software | |
| 19 | You should have received a copy of the GNU General Public License | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 20 | along with this program; if not, write to the Free Software | 20 | USA. */ |
| 21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
| 22 | USA. */ | ||
| 23 | 21 | ||
| 24 | #ifndef _GETOPT_H | 22 | #ifndef _GETOPT_H |
| 25 | #define _GETOPT_H 1 | 23 | #define _GETOPT_H 1 |
diff --git a/lib-src/getopt1.c b/lib-src/getopt1.c index b51be7f1bc3..af8e6819657 100644 --- a/lib-src/getopt1.c +++ b/lib-src/getopt1.c | |||
| @@ -1,25 +1,23 @@ | |||
| 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. | 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. |
| 2 | Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. | 2 | Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | the C library, however. The master source lives in /gd/gnu/lib. | 4 | NOTE: The canonical source of this file is maintained with the GNU C Library. |
| 5 | 5 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | |
| 6 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 6 | |
| 7 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | 7 | This program is free software; you can redistribute it and/or modify it |
| 8 | 8 | under the terms of the GNU General Public License as published by the | |
| 9 | This program is free software; you can redistribute it and/or modify it | 9 | Free Software Foundation; either version 2, or (at your option) any |
| 10 | under the terms of the GNU General Public License as published by the | 10 | later version. |
| 11 | Free Software Foundation; either version 2, or (at your option) any | 11 | |
| 12 | later version. | 12 | This program is distributed in the hope that it will be useful, |
| 13 | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | This program is distributed in the hope that it will be useful, | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | GNU General Public License for more details. |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | |
| 17 | GNU General Public License for more details. | 17 | You should have received a copy of the GNU General Public License |
| 18 | 18 | along with this program; if not, write to the Free Software | |
| 19 | You should have received a copy of the GNU General Public License | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 20 | along with this program; if not, write to the Free Software | 20 | USA. */ |
| 21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
| 22 | USA. */ | ||
| 23 | 21 | ||
| 24 | #ifdef HAVE_CONFIG_H | 22 | #ifdef HAVE_CONFIG_H |
| 25 | #include <config.h> | 23 | #include <config.h> |
diff --git a/src/strftime.c b/src/strftime.c index c0cc077b072..abd039f5b24 100644 --- a/src/strftime.c +++ b/src/strftime.c | |||
| @@ -177,6 +177,7 @@ localtime_r (t, tp) | |||
| 177 | /* Some systems lack the `memset' function and we don't want to | 177 | /* Some systems lack the `memset' function and we don't want to |
| 178 | introduce additional dependencies. */ | 178 | introduce additional dependencies. */ |
| 179 | static const char spaces[16] = " "; | 179 | static const char spaces[16] = " "; |
| 180 | static const char zeroes[16] = "0000000000000000"; | ||
| 180 | 181 | ||
| 181 | # define memset_space(P, Len) \ | 182 | # define memset_space(P, Len) \ |
| 182 | do { \ | 183 | do { \ |
| @@ -191,11 +192,26 @@ static const char spaces[16] = " "; | |||
| 191 | } \ | 192 | } \ |
| 192 | while (_len > 0); \ | 193 | while (_len > 0); \ |
| 193 | } while (0) | 194 | } while (0) |
| 195 | |||
| 196 | # define memset_zero(P, Len) \ | ||
| 197 | do { \ | ||
| 198 | int _len = (Len); \ | ||
| 199 | \ | ||
| 200 | do \ | ||
| 201 | { \ | ||
| 202 | int _this = _len > 16 ? 16 : _len; \ | ||
| 203 | memcpy ((P), zeroes, _this); \ | ||
| 204 | (P) += _this; \ | ||
| 205 | _len -= _this; \ | ||
| 206 | } \ | ||
| 207 | while (_len > 0); \ | ||
| 208 | } while (0) | ||
| 194 | #else | 209 | #else |
| 195 | # define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len)) | 210 | # define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len)) |
| 211 | # define memset_zero(P, Len) (memset ((P), '0', (Len)), (P) += (Len)) | ||
| 196 | #endif | 212 | #endif |
| 197 | 213 | ||
| 198 | #define add(n, f) \ | 214 | #define add(n, f) \ |
| 199 | do \ | 215 | do \ |
| 200 | { \ | 216 | { \ |
| 201 | int _n = (n); \ | 217 | int _n = (n); \ |
| @@ -206,7 +222,12 @@ static const char spaces[16] = " "; | |||
| 206 | if (p) \ | 222 | if (p) \ |
| 207 | { \ | 223 | { \ |
| 208 | if (_delta > 0) \ | 224 | if (_delta > 0) \ |
| 209 | memset_space (p, _delta); \ | 225 | { \ |
| 226 | if (pad == '0') \ | ||
| 227 | memset_zero (p, _delta); \ | ||
| 228 | else \ | ||
| 229 | memset_space (p, _delta); \ | ||
| 230 | } \ | ||
| 210 | f; \ | 231 | f; \ |
| 211 | p += _n; \ | 232 | p += _n; \ |
| 212 | } \ | 233 | } \ |