aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib-src/getopt.c36
-rw-r--r--lib-src/getopt.h36
-rw-r--r--lib-src/getopt1.c36
-rw-r--r--src/strftime.c25
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.
11NOTE: The canonical source of this file is maintained with the GNU C Library. 11
12Bugs 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
14This program is free software; you can redistribute it and/or modify it 14 Free Software Foundation; either version 2, or (at your option) any
15under the terms of the GNU General Public License as published by the 15 later version.
16Free Software Foundation; either version 2, or (at your option) any 16
17later 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
19This program is distributed in the hope that it will be useful, 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20but WITHOUT ANY WARRANTY; without even the implied warranty of 20 GNU General Public License for more details.
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21
22GNU 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
24You should have received a copy of the GNU General Public License 24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25along with this program; if not, write to the Free Software 25 USA. */
26Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27USA. */
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.
6NOTE: The canonical source of this file is maintained with the GNU C Library. 6
7Bugs 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
9This program is free software; you can redistribute it and/or modify it 9 Free Software Foundation; either version 2, or (at your option) any
10under the terms of the GNU General Public License as published by the 10 later version.
11Free Software Foundation; either version 2, or (at your option) any 11
12later 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
14This program is distributed in the hope that it will be useful, 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15but WITHOUT ANY WARRANTY; without even the implied warranty of 15 GNU General Public License for more details.
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16
17GNU 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
19You should have received a copy of the GNU General Public License 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20along with this program; if not, write to the Free Software 20 USA. */
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22USA. */
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.
6NOTE: The canonical source of this file is maintained with the GNU C Library. 6
7Bugs 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
9This program is free software; you can redistribute it and/or modify it 9 Free Software Foundation; either version 2, or (at your option) any
10under the terms of the GNU General Public License as published by the 10 later version.
11Free Software Foundation; either version 2, or (at your option) any 11
12later 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
14This program is distributed in the hope that it will be useful, 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15but WITHOUT ANY WARRANTY; without even the implied warranty of 15 GNU General Public License for more details.
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16
17GNU 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
19You should have received a copy of the GNU General Public License 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20along with this program; if not, write to the Free Software 20 USA. */
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22USA. */
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. */
179static const char spaces[16] = " "; 179static const char spaces[16] = " ";
180static 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 } \