1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-12-08 13:32:06 +00:00

minor mods

SCCS-file: zic.c
SCCS-SID: 1.15
This commit is contained in:
Arthur David Olson
1986-03-05 18:56:24 -05:00
committed by Paul Eggert
parent 73aa537c31
commit e3bb78bbd1

23
zic.c
View File

@ -14,7 +14,7 @@ static char sccsid[] = "%W%";
#endif #endif
#ifndef MAL #ifndef MAL
#define MAL 0 #define MAL NULL
#endif #endif
#ifndef BUFSIZ #ifndef BUFSIZ
@ -27,7 +27,6 @@ static char sccsid[] = "%W%";
#endif #endif
extern char * calloc(); extern char * calloc();
extern char * strchr();
extern char * malloc(); extern char * malloc();
extern char * optarg; extern char * optarg;
extern int optind; extern int optind;
@ -36,13 +35,14 @@ extern char * realloc();
extern char * scheck(); extern char * scheck();
extern char * sprintf(); extern char * sprintf();
extern char * strcat(); extern char * strcat();
extern char * strchr();
extern char * strcpy(); extern char * strcpy();
static int errors; static int errors;
static char * progname;
static char * filename; static char * filename;
static char ** getfields(); static char ** getfields();
static int linenum; static int linenum;
static char * progname;
static long rpytime(); static long rpytime();
static long tadd(); static long tadd();
@ -383,7 +383,7 @@ char * argv[];
if (link(links[i].l_from, links[i].l_to) != 0) if (link(links[i].l_from, links[i].l_to) != 0)
wild2exit("result creating", links[i].l_to); wild2exit("result creating", links[i].l_to);
} }
if (localtime) { if (localtime != NULL) {
(void) unlink(TZDEFAULT); (void) unlink(TZDEFAULT);
if (link(localtime, TZDEFAULT) != 0) if (link(localtime, TZDEFAULT) != 0)
wild2exit("result creating", TZDEFAULT); wild2exit("result creating", TZDEFAULT);
@ -410,13 +410,22 @@ char * cp2;
{ {
register struct rule * rp1; register struct rule * rp1;
register struct rule * rp2; register struct rule * rp2;
register long l1, l2;
register int diff; register int diff;
rp1 = (struct rule *) cp1; rp1 = (struct rule *) cp1;
rp2 = (struct rule *) cp2; rp2 = (struct rule *) cp2;
if ((diff = strcmp(rp1->r_name, rp2->r_name)) != 0) if ((diff = strcmp(rp1->r_name, rp2->r_name)) != 0)
return diff; return diff;
return abs(rp1->r_stdoff) - abs(rp2->r_stdoff); if ((l1 = rp1->r_stdoff) < 0)
l1 = -l1;
if ((l2 = rp2->r_stdoff) < 0)
l2 = -l2;
if (l1 > l2)
return 1;
else if (l1 < l2)
return -1;
else return 0;
} }
static static
@ -630,7 +639,7 @@ char ** fields;
} }
/* /*
** Day work. ** Day work.
** Accept things like: ** Accept things such as:
** 1 ** 1
** last-Sunday ** last-Sunday
** Sun<=20 ** Sun<=20
@ -758,7 +767,7 @@ char * name;
register int i; register int i;
char fullname[BUFSIZ]; char fullname[BUFSIZ];
if (strlen(directory) + 1 + strlen(name) + 1 > BUFSIZ) if (strlen(directory) + 1 + strlen(name) >= BUFSIZ)
wild2exit("long directory/file", filename); wild2exit("long directory/file", filename);
(void) sprintf(fullname, "%s/%s", directory, name); (void) sprintf(fullname, "%s/%s", directory, name);
if ((fp = fopen(fullname, "w")) == NULL) { if ((fp = fopen(fullname, "w")) == NULL) {