projects
/
kopensolaris-gnu
/
glibc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Formerly ../time/sys/time.h.~16~
[kopensolaris-gnu/glibc.git]
/
time
/
zic.c
diff --git
a/time/zic.c
b/time/zic.c
index
eb19a5c
..
ce384f9
100644
(file)
--- a/
time/zic.c
+++ b/
time/zic.c
@@
-1,6
+1,6
@@
#ifndef lint
#ifndef NOID
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)zic.c 7.
19
";
+static char elsieid[] = "@(#)zic.c 7.
21
";
#endif /* !defined NOID */
#endif /* !defined lint */
#endif /* !defined NOID */
#endif /* !defined lint */
@@
-120,8
+120,10
@@
static int errors;
static const char * filename;
static int leapcnt;
static int linenum;
static const char * filename;
static int leapcnt;
static int linenum;
+static int max_int;
static time_t max_time;
static int max_year;
static time_t max_time;
static int max_year;
+static int min_int;
static time_t min_time;
static int min_year;
static int noise;
static time_t min_time;
static int min_year;
static int noise;
@@
-502,7
+504,7
@@
char * argv[];
** Find the next non-continuation zone entry.
*/
for (j = i + 1; j < nzones && zones[j].z_name == NULL; ++j)
** Find the next non-continuation zone entry.
*/
for (j = i + 1; j < nzones && zones[j].z_name == NULL; ++j)
- ;
+
continue
;
outzone(&zones[i], j - i);
}
/*
outzone(&zones[i], j - i);
}
/*
@@
-565,9
+567,10
@@
static void
setboundaries()
{
register time_t bit;
setboundaries()
{
register time_t bit;
+ register int bii;
for (bit = 1; bit > 0; bit <<= 1)
for (bit = 1; bit > 0; bit <<= 1)
- ;
+
continue
;
if (bit == 0) { /* time_t is an unsigned type */
tt_signed = FALSE;
min_time = 0;
if (bit == 0) { /* time_t is an unsigned type */
tt_signed = FALSE;
min_time = 0;
@@
-585,6
+588,11
@@
setboundaries()
}
min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
}
min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
+
+ for (bii = 1; bii > 0; bii <<= 1)
+ continue;
+ min_int = bii;
+ max_int = -1 - bii;
}
static int
}
static int
@@
-1129,10
+1137,10
@@
char * const timep;
cp = loyearp;
if ((lp = byword(cp, begin_years)) != NULL) switch ((int) lp->l_value) {
case YR_MINIMUM:
cp = loyearp;
if ((lp = byword(cp, begin_years)) != NULL) switch ((int) lp->l_value) {
case YR_MINIMUM:
- rp->r_loyear = min_
year
;
+ rp->r_loyear = min_
int
;
break;
case YR_MAXIMUM:
break;
case YR_MAXIMUM:
- rp->r_loyear = max_
year
;
+ rp->r_loyear = max_
int
;
break;
default: /* "cannot happen" */
(void) fprintf(stderr,
break;
default: /* "cannot happen" */
(void) fprintf(stderr,
@@
-1146,10
+1154,10
@@
char * const timep;
cp = hiyearp;
if ((lp = byword(cp, end_years)) != NULL) switch ((int) lp->l_value) {
case YR_MINIMUM:
cp = hiyearp;
if ((lp = byword(cp, end_years)) != NULL) switch ((int) lp->l_value) {
case YR_MINIMUM:
- rp->r_hiyear = min_
year
;
+ rp->r_hiyear = min_
int
;
break;
case YR_MAXIMUM:
break;
case YR_MAXIMUM:
- rp->r_hiyear = max_
year
;
+ rp->r_hiyear = max_
int
;
break;
case YR_ONLY:
rp->r_hiyear = rp->r_loyear;
break;
case YR_ONLY:
rp->r_hiyear = rp->r_loyear;
@@
-1778,6
+1786,10
@@
register const int wantedy;
register long dayoff; /* with a nod to Margaret O. */
register time_t t;
register long dayoff; /* with a nod to Margaret O. */
register time_t t;
+ if (wantedy == min_int)
+ return min_time;
+ if (wantedy == max_int)
+ return max_time;
dayoff = 0;
m = TM_JANUARY;
y = EPOCH_YEAR;
dayoff = 0;
m = TM_JANUARY;
y = EPOCH_YEAR;
@@
-1865,14
+1877,20
@@
const char * const string;
charcnt += eitol(i);
}
charcnt += eitol(i);
}
+
static int
static int
-mkdirs(name)
-char * const name;
+mkdirs(
arg
name)
+char * const
arg
name;
{
register char * cp;
{
register char * cp;
+ /* We must make a copy in case the
+ passed pointer is a read-only string. */
+ char *name = ecpyalloc (argname);
- if ((cp = name) == NULL || *cp == '\0')
- return 0;
+ if (*cp == '\0') {
+ ifree (name);
+ return 0;
+ }
while ((cp = strchr(cp + 1, '/')) != 0) {
*cp = '\0';
#ifndef unix
while ((cp = strchr(cp + 1, '/')) != 0) {
*cp = '\0';
#ifndef unix
@@
-1894,11
+1912,13
@@
char * const name;
"%s: Can't create directory ",
progname);
(void) perror(name);
"%s: Can't create directory ",
progname);
(void) perror(name);
+ free (name);
return -1;
}
}
*cp = '/';
}
return -1;
}
}
*cp = '/';
}
+ free (name);
return 0;
}
return 0;
}