__AUDIT__ cleanup.

This commit is contained in:
mycroft 1998-07-27 16:43:25 +00:00
parent 0bbc075c20
commit dbfa4f81b0
7 changed files with 76 additions and 60 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: date.c,v 1.22 1998/04/01 13:54:44 kleink Exp $ */
/* $NetBSD: date.c,v 1.23 1998/07/27 16:43:25 mycroft Exp $ */
/*
* Copyright (c) 1985, 1987, 1988, 1993
@ -44,7 +44,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: date.c,v 1.22 1998/04/01 13:54:44 kleink Exp $");
__RCSID("$NetBSD: date.c,v 1.23 1998/07/27 16:43:25 mycroft Exp $");
#endif
#endif /* not lint */
@ -70,7 +70,7 @@ time_t tval;
int retval, nflag;
int main __P((int, char *[]));
static void setthetime __P((char *));
static void setthetime __P((const char *));
static void badformat __P((void));
static void usage __P((void));
@ -134,12 +134,12 @@ main(argc, argv)
void
setthetime(p)
char *p;
const char *p;
{
struct tm *lt;
struct timeval tv;
char *dot, *t;
int yearset;
const char *dot, *t;
int yearset, len;
for (t = p, dot = NULL; *t; ++t) {
if (isdigit(*t))
@ -154,15 +154,18 @@ setthetime(p)
lt = localtime(&tval);
if (dot != NULL) { /* .ss */
*dot++ = '\0';
if (strlen(dot) != 2)
len = strlen(dot);
if (len != 3)
badformat();
++dot;
lt->tm_sec = ATOI2(dot);
} else
} else {
len = 0;
lt->tm_sec = 0;
}
yearset = 0;
switch (strlen(p)) {
switch (strlen(p) - len) {
case 12: /* cc */
lt->tm_year = ATOI2(p) * 100 - TM_YEAR_BASE;
yearset = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ar_io.c,v 1.8 1998/03/06 09:13:01 mrg Exp $ */
/* $NetBSD: ar_io.c,v 1.9 1998/07/27 16:43:25 mycroft Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
__RCSID("$NetBSD: ar_io.c,v 1.8 1998/03/06 09:13:01 mrg Exp $");
__RCSID("$NetBSD: ar_io.c,v 1.9 1998/07/27 16:43:25 mycroft Exp $");
#endif
#endif /* not lint */
@ -85,8 +85,8 @@ static struct stat arsb; /* stat of archive device at open */
static int invld_rec; /* tape has out of spec record size */
static int wr_trail = 1; /* trailer was rewritten in append */
static int can_unlnk = 0; /* do we unlink null archives? */
char *arcname; /* printable name of archive */
char *gzip_program; /* name of gzip program */
const char *arcname; /* printable name of archive */
const char *gzip_program; /* name of gzip program */
static int get_phys __P((void));
extern sigset_t s_mask;
@ -103,11 +103,11 @@ static void ar_start_gzip __P((int));
#if __STDC__
int
ar_open(char *name)
ar_open(const char *name)
#else
int
ar_open(name)
char *name;
const char *name;
#endif
{
struct mtget mb;
@ -1321,7 +1321,7 @@ ar_next()
*/
if (ar_open(buf) >= 0) {
if (freeit) {
(void)free(arcname);
(void)free((char *)arcname);
freeit = 0;
}
if ((arcname = strdup(buf)) == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: cache.c,v 1.7 1998/07/26 19:43:14 mycroft Exp $ */
/* $NetBSD: cache.c,v 1.8 1998/07/27 16:43:25 mycroft Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: cache.c,v 1.7 1998/07/26 19:43:14 mycroft Exp $");
__RCSID("$NetBSD: cache.c,v 1.8 1998/07/27 16:43:25 mycroft Exp $");
#endif
#endif /* not lint */
@ -250,12 +250,13 @@ name_uid(uid, frc)
if (ptr == NULL)
return("");
ptr->uid = uid;
ptr->valid = INVALID;
# ifdef NET2_STAT
(void)sprintf(ptr->name, "%u", uid);
(void)snprintf(ptr->name, UNMLEN, "%u", uid);
# else
(void)sprintf(ptr->name, "%lu", (long) uid);
(void)snprintf(ptr->name, UNMLEN, "%lu", (long) uid);
# endif
ptr->name[UNMLEN-1] = '\0';
ptr->valid = INVALID;
if (frc == 0)
return("");
} else {
@ -327,12 +328,13 @@ name_gid(gid, frc)
if (ptr == NULL)
return("");
ptr->gid = gid;
ptr->valid = INVALID;
# ifdef NET2_STAT
(void)sprintf(ptr->name, "%u", gid);
(void)snprintf(ptr->name, GNMLEN, "%u", gid);
# else
(void)sprintf(ptr->name, "%lu", (long) gid);
(void)snprintf(ptr->name, GNMLEN, "%lu", (long) gid);
# endif
ptr->name[GNMLEN-1] = '\0';
ptr->valid = INVALID;
if (frc == 0)
return("");
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.10 1998/07/26 19:43:14 mycroft Exp $ */
/* $NetBSD: extern.h,v 1.11 1998/07/27 16:43:25 mycroft Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -48,9 +48,9 @@
/*
* ar_io.c
*/
extern char *arcname;
extern char *gzip_program;
int ar_open __P((char *));
extern const char *arcname;
extern const char *gzip_program;
int ar_open __P((const char *));
void ar_close __P((void));
void ar_drain __P((void));
int ar_set_wr __P((void));
@ -234,7 +234,7 @@ extern int pids;
extern int exit_val;
extern int docrc;
extern char *dirptr;
extern char *ltmfrmt;
extern const char *ltmfrmt;
extern char *argv0;
int main __P((int, char **));
void sig_cleanup __P((int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: gen_subs.c,v 1.11 1998/07/26 19:43:14 mycroft Exp $ */
/* $NetBSD: gen_subs.c,v 1.12 1998/07/27 16:43:25 mycroft Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: gen_subs.c,v 1.11 1998/07/26 19:43:14 mycroft Exp $");
__RCSID("$NetBSD: gen_subs.c,v 1.12 1998/07/27 16:43:25 mycroft Exp $");
#endif
#endif /* not lint */
@ -96,7 +96,7 @@ ls_list(arcn, now)
struct stat *sbp;
char f_mode[MODELEN];
char f_date[DATELEN];
char *timefrmt;
const char *timefrmt;
/*
* if not verbose, just print the file name
@ -183,7 +183,7 @@ ls_tty(arcn)
{
char f_date[DATELEN];
char f_mode[MODELEN];
char *timefrmt;
const char *timefrmt;
if (ltmfrmt == NULL) {
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pax.c,v 1.6 1997/07/20 20:32:40 christos Exp $ */
/* $NetBSD: pax.c,v 1.7 1998/07/27 16:43:26 mycroft Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
#else
__RCSID("$NetBSD: pax.c,v 1.6 1997/07/20 20:32:40 christos Exp $");
__RCSID("$NetBSD: pax.c,v 1.7 1998/07/27 16:43:26 mycroft Exp $");
#endif
#endif /* not lint */
@ -98,7 +98,7 @@ int pids; /* preserve file uid/gid */
int exit_val; /* exit value */
int docrc; /* check/create file crc */
char *dirptr; /* destination dir in a copy */
char *ltmfrmt; /* -v locale time format (if any) */
const char *ltmfrmt; /* -v locale time format (if any) */
char *argv0; /* root of argv[0] */
sigset_t s_mask; /* signal mask for cleanup critical sect */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sel_subs.c,v 1.9 1998/04/01 14:14:43 kleink Exp $ */
/* $NetBSD: sel_subs.c,v 1.10 1998/07/27 16:43:26 mycroft Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)sel_subs.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: sel_subs.c,v 1.9 1998/04/01 14:14:43 kleink Exp $");
__RCSID("$NetBSD: sel_subs.c,v 1.10 1998/07/27 16:43:26 mycroft Exp $");
#endif
#endif /* not lint */
@ -66,7 +66,7 @@ __RCSID("$NetBSD: sel_subs.c,v 1.9 1998/04/01 14:14:43 kleink Exp $");
#include "sel_subs.h"
#include "extern.h"
static int str_sec __P((char *, time_t *));
static int str_sec __P((const char *, time_t *));
static int usr_match __P((ARCHD *));
static int grp_match __P((ARCHD *));
static int trng_match __P((ARCHD *));
@ -595,41 +595,52 @@ trng_match(arcn)
#if __STDC__
static int
str_sec(char *str, time_t *tval)
str_sec(const char *p, time_t *tval)
#else
static int
str_sec(str, tval)
char *str;
str_sec(p, tval)
const char *p;
time_t *tval;
#endif
{
struct tm *lt;
char *dot = NULL;
int yearset;
const char *dot, *t;
int yearset, len;
for (t = p, dot = NULL; *t; ++t) {
if (isdigit(*t))
continue;
if (*t == '.' && dot == NULL) {
dot = t;
continue;
}
return(-1);
}
lt = localtime(tval);
if ((dot = strchr(str, '.')) != NULL) {
/*
* seconds (.ss)
*/
*dot++ = '\0';
if (strlen(dot) != 2)
if (dot != NULL) {
len = strlen(dot);
if (len != 3)
return(-1);
++dot;
lt->tm_sec = ATOI2(dot);
} else
} else {
len = 0;
lt->tm_sec = 0;
}
yearset = 0;
switch (strlen(str)) {
switch (strlen(p) - len) {
case 12:
lt->tm_year = ATOI2(str) * 100 - TM_YEAR_BASE;
lt->tm_year = ATOI2(p) * 100 - TM_YEAR_BASE;
yearset = 1;
/* FALLTHROUGH */
case 10:
if (yearset) {
lt->tm_year += ATOI2(str);
lt->tm_year += ATOI2(p);
} else {
yearset = ATOI2(str);
yearset = ATOI2(p);
if (yearset < 69)
lt->tm_year = yearset + 2000 - TM_YEAR_BASE;
else
@ -637,17 +648,17 @@ str_sec(str, tval)
}
/* FALLTHROUGH */
case 8:
lt->tm_mon = ATOI2(str);
lt->tm_mon = ATOI2(p);
--lt->tm_mon;
/* FALLTHROUGH */
case 6:
lt->tm_mday = ATOI2(str);
lt->tm_mday = ATOI2(p);
/* FALLTHROUGH */
case 4:
lt->tm_hour = ATOI2(str);
lt->tm_hour = ATOI2(p);
/* FALLTHROUGH */
case 2:
lt->tm_min = ATOI2(str);
lt->tm_min = ATOI2(p);
break;
default:
return(-1);