summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-02-27 00:55:03 +0000
committerRoland McGrath <roland@gnu.org>1996-02-27 00:55:03 +0000
commit92777700d297c23825e785e6f6a0161bd398705d (patch)
tree18a993370c7cac36c18f22726cab004f54899122 /time/zic.c
parentWed Feb 21 02:25:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> (diff)
downloadglibc-92777700d297c23825e785e6f6a0161bd398705d.tar.gz
glibc-92777700d297c23825e785e6f6a0161bd398705d.tar.bz2
glibc-92777700d297c23825e785e6f6a0161bd398705d.zip
Mon Feb 26 10:22:30 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>cvs/libc-960227
* sysdeps/unix/dirstream.h: Rewritten. * sysdeps/unix/readdir.c: Rewritten. * sysdeps/unix/telldir.c: Rewritten. * sysdeps/unix/closedir.c: Use <...> instead of "..." for dirstream.h. Remove __ from DIR struct member names. * sysdeps/unix/dirfd.c: Likewise. * sysdeps/unix/seekdir.c: Likewise. * sysdeps/unix/rewinddir.c: Likewise. * sysdeps/unix/opendir.c: Likewise. Don't allocate extra space after DIR structure. * sysdeps/stub/direct.h: File removed. * sysdeps/unix/bsd/bsd4.4/direct.h: File removed. * sysdeps/unix/bsd/direct.h: File removed. * sysdeps/unix/common/direct.h: File removed. * sysdeps/unix/sysv/irix4/direct.h: File removed. * sysdeps/unix/sysv/isc3/direct.h: File removed. * sysdeps/unix/sysv/sco3.2.4/direct.h: File removed. * sysdeps/unix/sysv/sysv4/solaris2/direct.h: File removed. * sysdeps/unix/common/direntry.h: New file. * sysdeps/unix/bsd/direntry.h: New file. * sysdeps/unix/bsd/bsd4.4/direntry.h: New file. * sysdeps/unix/sysv/direntry.h: New file. * sysdeps/stub/direntry.h: New file. * dirent/dirent.h (struct dirent): Type removed. Include <direntry.h> to define it. (_D_EXACT_NAMLEN, _D_ALLOC_NAMLEN): New macros. * dirent/Makefile (headers): Add direntry.h. (distribute): Remove direct.h. * sysdeps/posix/getcwd.c: Use new macros instead of d_namlen. * dirent/scandir.c: Likewise. * io/fts.c (fts_build): Likewise. * io/ftw.c (ftw_dir): Likewise. * sysdeps/posix/ttyname.c: Likewise. * sysdeps/unix/sysv/sysv4/solaris2/syscalls.list: New file. * sysdeps/mach/hurd/profil.c (MAX_PC_SAMPLES): New macro. (collector_timeout): New static variable. (update_waiter): Actually call __task_enable_pc_sampling. Set collector_timeout based on the `tick' count returned. (profile_waiter): Use MAX_PC_SAMPLES. Set nsamples before RPC. Use collector_timeout in __mach_msg call. * gmon/Makefile (noprof): New variable containing mcount. Append profil unless it is in $(unix-syscalls). (mcount.po): Use $(noprof) for list of targets in this rule. * libc-symbols.h: Define _LIBC before #include <config.h>. Sun Feb 25 12:29:23 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> * config.h.in [_LIBC] (HAVE_STRERROR): Define it. Protect 2nd page of #undef's for generator programs with #ifndef _LIBC. * time/zic.c, time/zdump.c, time/private.h: Updated from ADO's latest. Fri Feb 9 12:40:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com> * libio/cleanup.c (_IO_cleanup_registration_needed) [!_G_HAVE_ATEXIT]: Init to NULL. * libio/filedoalloc.c (_IO_cleanup_registration_needed): Remove decl. Thu Feb 8 08:12:50 1996 Brendan Kehoe <brendan@cygnus.com> * libio/filedoalloc.c (_IO_cleanup_registration_needed): Revert previous change, since cleanup.c only defines it if _G_HAVE_ATEXIT. Wed Feb 7 15:10:17 1996 Brendan Kehoe <brendan@lisa.cygnus.com> * libio/filedoalloc.c (_IO_cleanup_registration_needed): Declare as extern. Sat Feb 24 11:34:13 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> * sysdeps/i386/memcmp.S: Fix argument %esp offsets. * time/sys/time.h (timeradd, timersub): New macros; BSD has these.
Diffstat (limited to 'time/zic.c')
-rw-r--r--time/zic.c78
1 files changed, 55 insertions, 23 deletions
diff --git a/time/zic.c b/time/zic.c
index c0ce5be138..756b7eb84a 100644
--- a/time/zic.c
+++ b/time/zic.c
@@ -1,10 +1,11 @@
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)zic.c 7.60";
+static char elsieid[] = "@(#)zic.c 7.62";
#endif /* !defined NOID */
#endif /* !defined lint */
#include "private.h"
+#include "locale.h"
#include "tzfile.h"
#ifdef unix
#include "sys/stat.h" /* for umask manifest constants */
@@ -135,6 +136,10 @@ static void usage P((void));
static void writezone P((const char * name));
static int yearistype P((int year, const char * type));
+#if !HAVE_STRERROR
+static char * strerror P((int));
+#endif /* !HAVE_STRERROR */
+
static int charcnt;
static int errors;
static const char * filename;
@@ -351,7 +356,9 @@ memcheck(ptr)
char * const ptr;
{
if (ptr == NULL) {
- (void) perror(progname);
+ const char *e = strerror(errno);
+ (void) fprintf(stderr, _("%s: Memory exhausted: %s\n"),
+ progname, e);
(void) exit(EXIT_FAILURE);
}
return ptr;
@@ -366,6 +373,20 @@ char * const ptr;
** Error handling.
*/
+#if ! HAVE_STRERROR
+static char *
+strerror(errnum)
+int errnum;
+{
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+
+ if (errnum > 0 && errnum <= sys_nerr)
+ return sys_errlist[errnum];
+ return "Unknown system error";
+}
+#endif /* ! HAVE_STRERROR */
+
static void
eats(name, num, rname, rnum)
const char * const name;
@@ -434,6 +455,13 @@ char * argv[];
#ifdef unix
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
#endif /* defined unix */
+#if HAVE_GETTEXT - 0
+ (void) setlocale(LC_MESSAGES, "");
+#ifdef TZ_DOMAINDIR
+ (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
+#endif /* defined TEXTDOMAINDIR */
+ (void) textdomain(TZ_DOMAIN);
+#endif /* HAVE_GETTEXT - 0 */
progname = argv[0];
while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF)
switch (c) {
@@ -567,9 +595,10 @@ const char * const tofile;
if (mkdirs(toname) != 0)
(void) exit(EXIT_FAILURE);
if (link(fromname, toname) != 0) {
- (void) fprintf(stderr, _("%s: Can't link from %s to "),
- progname, fromname);
- (void) perror(toname);
+ const char *e = strerror(errno);
+ (void) fprintf(stderr,
+ _("%s: Can't link from %s to %s: %s\n"),
+ progname, fromname, toname, e);
(void) exit(EXIT_FAILURE);
}
}
@@ -682,7 +711,8 @@ associate P((void))
** Maybe we have a local standard time offset.
*/
eat(zp->z_filename, zp->z_linenum);
- zp->z_stdoff = gethms(zp->z_rule, "unruly zone", TRUE);
+ zp->z_stdoff = gethms(zp->z_rule, _("unruly zone"),
+ TRUE);
/*
** Note, though, that if there's no rule,
** a '%s' in the format is a bad thing.
@@ -712,8 +742,9 @@ const char * name;
name = _("standard input");
fp = stdin;
} else if ((fp = fopen(name, "r")) == NULL) {
- (void) fprintf(stderr, _("%s: Can't open "), progname);
- (void) perror(name);
+ const char *e = strerror(errno);
+ (void) fprintf(stderr, _("%s: Can't open %s: %s\n"),
+ progname, name, e);
(void) exit(EXIT_FAILURE);
}
wantcont = FALSE;
@@ -774,13 +805,14 @@ _("%s: panic: Invalid l_value %d\n"),
ifree((char *) fields);
}
if (ferror(fp)) {
- (void) fprintf(stderr, _("%s: Error reading "), progname);
- (void) perror(filename);
+ (void) fprintf(stderr, _("%s: Error reading %s\n"),
+ progname, filename);
(void) exit(EXIT_FAILURE);
}
if (fp != stdin && fclose(fp)) {
- (void) fprintf(stderr, _("%s: Error closing "), progname);
- (void) perror(filename);
+ const char *e = strerror(errno);
+ (void) fprintf(stderr, _("%s: Error closing %s: %s\n"),
+ progname, filename, e);
(void) exit(EXIT_FAILURE);
}
if (wantcont)
@@ -1048,7 +1080,7 @@ const int nfields;
}
dayoff = oadd(dayoff, eitol(day - 1));
if (dayoff < 0 && !TYPE_SIGNED(time_t)) {
- error("time before zero");
+ error(_("time before zero"));
return;
}
t = (time_t) dayoff * SECSPERDAY;
@@ -1059,7 +1091,7 @@ const int nfields;
error(_("time overflow"));
return;
}
- tod = gethms(fields[LP_TIME], "invalid time of day", FALSE);
+ tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
cp = fields[LP_CORR];
{
register int positive;
@@ -1161,7 +1193,7 @@ const char * const timep;
break;
}
}
- rp->r_tod = gethms(dp, "invalid time of day", FALSE);
+ rp->r_tod = gethms(dp, _("invalid time of day"), FALSE);
ifree(dp);
/*
** Year work.
@@ -1303,9 +1335,9 @@ const char * const name;
if (mkdirs(fullname) != 0)
(void) exit(EXIT_FAILURE);
if ((fp = fopen(fullname, "wb")) == NULL) {
- (void) fprintf(stderr, _("%s: Can't create "),
- progname);
- (void) perror(fullname);
+ const char *e = strerror(errno);
+ (void) fprintf(stderr, _("%s: Can't create %s: %s\n"),
+ progname, fullname, e);
(void) exit(EXIT_FAILURE);
}
}
@@ -1369,8 +1401,8 @@ const char * const name;
for (i = 0; i < typecnt; ++i)
(void) putc(ttisgmts[i], fp);
if (ferror(fp) || fclose(fp)) {
- (void) fprintf(stderr, _("%s: Write error on "), progname);
- (void) perror(fullname);
+ (void) fprintf(stderr, _("%s: Error writing %s\n"),
+ progname, fullname);
(void) exit(EXIT_FAILURE);
}
}
@@ -1977,10 +2009,10 @@ char * const argname;
** It doesn't seem to exist, so we try to create it.
*/
if (mkdir(name, 0755) != 0) {
+ const char *e = strerror(errno);
(void) fprintf(stderr,
- _("%s: Can't create directory "),
- progname);
- (void) perror(name);
+ _("%s: Can't create directory %s: %s\n"),
+ progname, name, e);
ifree(name);
return -1;
}