convert to new KNF

This commit is contained in:
lukem 2000-07-29 03:46:14 +00:00
parent 2da9fd746e
commit ba2e04dc88
8 changed files with 82 additions and 105 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmp.c,v 1.15 2000/07/23 20:50:44 mycroft Exp $ */ /* $NetBSD: cmp.c,v 1.16 2000/07/29 03:46:14 lukem Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: cmp.c,v 1.15 2000/07/23 20:50:44 mycroft Exp $"); __RCSID("$NetBSD: cmp.c,v 1.16 2000/07/29 03:46:14 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -69,23 +69,23 @@ __RCSID("$NetBSD: cmp.c,v 1.15 2000/07/23 20:50:44 mycroft Exp $");
#endif #endif
int int
namecmp(a, b) namecmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
return (strcmp(a->fts_name, b->fts_name)); return (strcmp(a->fts_name, b->fts_name));
} }
int int
revnamecmp(a, b) revnamecmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
return (strcmp(b->fts_name, a->fts_name)); return (strcmp(b->fts_name, a->fts_name));
} }
int int
modcmp(a, b) modcmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_mtime > a->fts_statp->st_mtime) if (b->fts_statp->st_mtime > a->fts_statp->st_mtime)
return (1); return (1);
else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime) else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime)
@ -99,9 +99,9 @@ modcmp(a, b)
} }
int int
revmodcmp(a, b) revmodcmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_mtime > a->fts_statp->st_mtime) if (b->fts_statp->st_mtime > a->fts_statp->st_mtime)
return (-1); return (-1);
else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime) else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime)
@ -115,9 +115,9 @@ revmodcmp(a, b)
} }
int int
acccmp(a, b) acccmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_atime > a->fts_statp->st_atime) if (b->fts_statp->st_atime > a->fts_statp->st_atime)
return (1); return (1);
else if (b->fts_statp->st_atime < a->fts_statp->st_atime) else if (b->fts_statp->st_atime < a->fts_statp->st_atime)
@ -131,9 +131,9 @@ acccmp(a, b)
} }
int int
revacccmp(a, b) revacccmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_atime > a->fts_statp->st_atime) if (b->fts_statp->st_atime > a->fts_statp->st_atime)
return (-1); return (-1);
else if (b->fts_statp->st_atime < a->fts_statp->st_atime) else if (b->fts_statp->st_atime < a->fts_statp->st_atime)
@ -147,9 +147,9 @@ revacccmp(a, b)
} }
int int
statcmp(a, b) statcmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_ctime > a->fts_statp->st_ctime) if (b->fts_statp->st_ctime > a->fts_statp->st_ctime)
return (1); return (1);
else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime) else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime)
@ -163,9 +163,9 @@ statcmp(a, b)
} }
int int
revstatcmp(a, b) revstatcmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_ctime > a->fts_statp->st_ctime) if (b->fts_statp->st_ctime > a->fts_statp->st_ctime)
return (-1); return (-1);
else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime) else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime)
@ -179,9 +179,9 @@ revstatcmp(a, b)
} }
int int
sizecmp(a, b) sizecmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_size > a->fts_statp->st_size) if (b->fts_statp->st_size > a->fts_statp->st_size)
return (1); return (1);
if (b->fts_statp->st_size < a->fts_statp->st_size) if (b->fts_statp->st_size < a->fts_statp->st_size)
@ -191,9 +191,9 @@ sizecmp(a, b)
} }
int int
revsizecmp(a, b) revsizecmp(const FTSENT *a, const FTSENT *b)
const FTSENT *a, *b;
{ {
if (b->fts_statp->st_size > a->fts_statp->st_size) if (b->fts_statp->st_size > a->fts_statp->st_size)
return (-1); return (-1);
if (b->fts_statp->st_size < a->fts_statp->st_size) if (b->fts_statp->st_size < a->fts_statp->st_size)

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.12 2000/06/22 23:42:22 assar Exp $ */ /* $NetBSD: extern.h,v 1.13 2000/07/29 03:46:15 lukem Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@ -35,25 +35,25 @@
* @(#)extern.h 8.1 (Berkeley) 5/31/93 * @(#)extern.h 8.1 (Berkeley) 5/31/93
*/ */
int acccmp __P((const FTSENT *, const FTSENT *)); int acccmp(const FTSENT *, const FTSENT *);
int revacccmp __P((const FTSENT *, const FTSENT *)); int revacccmp(const FTSENT *, const FTSENT *);
int modcmp __P((const FTSENT *, const FTSENT *)); int modcmp(const FTSENT *, const FTSENT *);
int revmodcmp __P((const FTSENT *, const FTSENT *)); int revmodcmp(const FTSENT *, const FTSENT *);
int namecmp __P((const FTSENT *, const FTSENT *)); int namecmp(const FTSENT *, const FTSENT *);
int revnamecmp __P((const FTSENT *, const FTSENT *)); int revnamecmp(const FTSENT *, const FTSENT *);
int statcmp __P((const FTSENT *, const FTSENT *)); int statcmp(const FTSENT *, const FTSENT *);
int revstatcmp __P((const FTSENT *, const FTSENT *)); int revstatcmp(const FTSENT *, const FTSENT *);
int sizecmp __P((const FTSENT *, const FTSENT *)); int sizecmp(const FTSENT *, const FTSENT *);
int revsizecmp __P((const FTSENT *, const FTSENT *)); int revsizecmp(const FTSENT *, const FTSENT *);
int ls_main __P((int, char *[])); int ls_main(int, char *[]);
int printescaped __P((const char *)); int printescaped(const char *);
void printacol __P((DISPLAY *)); void printacol(DISPLAY *);
void printcol __P((DISPLAY *)); void printcol(DISPLAY *);
void printlong __P((DISPLAY *)); void printlong(DISPLAY *);
void printscol __P((DISPLAY *)); void printscol(DISPLAY *);
void printstream __P((DISPLAY *)); void printstream(DISPLAY *);
void usage __P((void)); void usage(void);
#include "stat_flags.h" #include "stat_flags.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: ls.c,v 1.42 2000/06/17 16:11:25 assar Exp $ */ /* $NetBSD: ls.c,v 1.43 2000/07/29 03:46:15 lukem Exp $ */
/* /*
* Copyright (c) 1989, 1993, 1994 * Copyright (c) 1989, 1993, 1994
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else #else
__RCSID("$NetBSD: ls.c,v 1.42 2000/06/17 16:11:25 assar Exp $"); __RCSID("$NetBSD: ls.c,v 1.43 2000/07/29 03:46:15 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -70,12 +70,12 @@ __RCSID("$NetBSD: ls.c,v 1.42 2000/06/17 16:11:25 assar Exp $");
#include "ls.h" #include "ls.h"
#include "extern.h" #include "extern.h"
static void display __P((FTSENT *, FTSENT *)); static void display(FTSENT *, FTSENT *);
static int mastercmp __P((const FTSENT **, const FTSENT **)); static int mastercmp(const FTSENT **, const FTSENT **);
static void traverse __P((int, char **, int)); static void traverse(int, char **, int);
static void (*printfcn) __P((DISPLAY *)); static void (*printfcn)(DISPLAY *);
static int (*sortfcn) __P((const FTSENT *, const FTSENT *)); static int (*sortfcn)(const FTSENT *, const FTSENT *);
#define BY_NAME 0 #define BY_NAME 0
#define BY_SIZE 1 #define BY_SIZE 1
@ -110,9 +110,7 @@ int f_typedir; /* add type character for directories */
int f_whiteout; /* show whiteout entries */ int f_whiteout; /* show whiteout entries */
int int
ls_main(argc, argv) ls_main(int argc, char *argv[])
int argc;
char *argv[];
{ {
static char dot[] = ".", *dotav[] = { dot, NULL }; static char dot[] = ".", *dotav[] = { dot, NULL };
struct winsize win; struct winsize win;
@ -342,9 +340,7 @@ static int output; /* If anything output. */
* a superset (may be exact set) of the files to be displayed. * a superset (may be exact set) of the files to be displayed.
*/ */
static void static void
traverse(argc, argv, options) traverse(int argc, char *argv[], int options)
int argc, options;
char *argv[];
{ {
FTS *ftsp; FTS *ftsp;
FTSENT *p, *chp; FTSENT *p, *chp;
@ -408,8 +404,7 @@ traverse(argc, argv, options)
* points to the parent directory of the display list. * points to the parent directory of the display list.
*/ */
static void static void
display(p, list) display(FTSENT *p, FTSENT *list)
FTSENT *p, *list;
{ {
struct stat *sp; struct stat *sp;
DISPLAY d; DISPLAY d;
@ -588,8 +583,7 @@ display(p, list)
* All other levels use the sort function. Error entries remain unsorted. * All other levels use the sort function. Error entries remain unsorted.
*/ */
static int static int
mastercmp(a, b) mastercmp(const FTSENT **a, const FTSENT **b)
const FTSENT **a, **b;
{ {
int a_info, b_info; int a_info, b_info;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.1 1999/05/17 12:16:03 lukem Exp $ */ /* $NetBSD: main.c,v 1.2 2000/07/29 03:46:15 lukem Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: main.c,v 1.1 1999/05/17 12:16:03 lukem Exp $"); __RCSID("$NetBSD: main.c,v 1.2 2000/07/29 03:46:15 lukem Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/types.h> #include <sys/types.h>
@ -48,12 +48,10 @@ __RCSID("$NetBSD: main.c,v 1.1 1999/05/17 12:16:03 lukem Exp $");
#include "ls.h" #include "ls.h"
#include "extern.h" #include "extern.h"
int main __P((int, char *[])); int main(int, char *[]);
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
return (ls_main(argc, argv)); return (ls_main(argc, argv));

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.29 2000/06/22 23:42:22 assar Exp $ */ /* $NetBSD: print.c,v 1.30 2000/07/29 03:46:15 lukem Exp $ */
/* /*
* Copyright (c) 1989, 1993, 1994 * Copyright (c) 1989, 1993, 1994
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94"; static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
#else #else
__RCSID("$NetBSD: print.c,v 1.29 2000/06/22 23:42:22 assar Exp $"); __RCSID("$NetBSD: print.c,v 1.30 2000/07/29 03:46:15 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -64,18 +64,17 @@ __RCSID("$NetBSD: print.c,v 1.29 2000/06/22 23:42:22 assar Exp $");
#include "ls.h" #include "ls.h"
#include "extern.h" #include "extern.h"
static int printaname __P((FTSENT *, int, int)); static int printaname(FTSENT *, int, int);
static void printlink __P((FTSENT *)); static void printlink(FTSENT *);
static void printtime __P((time_t)); static void printtime(time_t);
static int printtype __P((u_int)); static int printtype(u_int);
static time_t now; static time_t now;
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT) #define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
void void
printscol(dp) printscol(DISPLAY *dp)
DISPLAY *dp;
{ {
FTSENT *p; FTSENT *p;
@ -88,8 +87,7 @@ printscol(dp)
} }
void void
printlong(dp) printlong(DISPLAY *dp)
DISPLAY *dp;
{ {
struct stat *sp; struct stat *sp;
FTSENT *p; FTSENT *p;
@ -146,8 +144,7 @@ printlong(dp)
} }
void void
printcol(dp) printcol(DISPLAY *dp)
DISPLAY *dp;
{ {
extern int termwidth; extern int termwidth;
static FTSENT **array; static FTSENT **array;
@ -210,8 +207,7 @@ printcol(dp)
} }
void void
printacol(dp) printacol(DISPLAY *dp)
DISPLAY *dp;
{ {
extern int termwidth; extern int termwidth;
FTSENT *p; FTSENT *p;
@ -256,8 +252,7 @@ printacol(dp)
} }
void void
printstream(dp) printstream(DISPLAY *dp)
DISPLAY *dp;
{ {
extern int termwidth; extern int termwidth;
FTSENT *p; FTSENT *p;
@ -292,9 +287,7 @@ printstream(dp)
* return # of characters printed, no trailing characters. * return # of characters printed, no trailing characters.
*/ */
static int static int
printaname(p, inodefield, sizefield) printaname(FTSENT *p, int inodefield, int sizefield)
FTSENT *p;
int sizefield, inodefield;
{ {
struct stat *sp; struct stat *sp;
int chcnt; int chcnt;
@ -316,8 +309,7 @@ printaname(p, inodefield, sizefield)
} }
static void static void
printtime(ftime) printtime(time_t ftime)
time_t ftime;
{ {
int i; int i;
char *longstring; char *longstring;
@ -342,8 +334,7 @@ printtime(ftime)
} }
static int static int
printtype(mode) printtype(u_int mode)
u_int mode;
{ {
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
case S_IFDIR: case S_IFDIR:
@ -370,8 +361,7 @@ printtype(mode)
} }
static void static void
printlink(p) printlink(FTSENT *p)
FTSENT *p;
{ {
int lnklen; int lnklen;
char name[MAXPATHLEN + 1], path[MAXPATHLEN + 1]; char name[MAXPATHLEN + 1], path[MAXPATHLEN + 1];

View File

@ -1,4 +1,4 @@
/* $NetBSD: stat_flags.c,v 1.7 1999/01/03 01:30:10 lukem Exp $ */ /* $NetBSD: stat_flags.c,v 1.8 2000/07/29 03:46:15 lukem Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@ -38,7 +38,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94"; static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94";
#else #else
__RCSID("$NetBSD: stat_flags.c,v 1.7 1999/01/03 01:30:10 lukem Exp $"); __RCSID("$NetBSD: stat_flags.c,v 1.8 2000/07/29 03:46:15 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -64,9 +64,7 @@ __RCSID("$NetBSD: stat_flags.c,v 1.7 1999/01/03 01:30:10 lukem Exp $");
* are set, return the default string. * are set, return the default string.
*/ */
char * char *
flags_to_string(flags, def) flags_to_string(u_long flags, char *def)
u_long flags;
char *def;
{ {
static char string[128]; static char string[128];
char *prefix; char *prefix;
@ -108,9 +106,7 @@ flags_to_string(flags, def)
* to the offending token. * to the offending token.
*/ */
int int
string_to_flags(stringp, setp, clrp) string_to_flags(char **stringp, u_long *setp, u_long *clrp)
char **stringp;
u_long *setp, *clrp;
{ {
int clear; int clear;
char *string, *p; char *string, *p;

View File

@ -1,4 +1,4 @@
/* $NetBSD: stat_flags.h,v 1.1 1998/10/10 07:38:22 mrg Exp $ */ /* $NetBSD: stat_flags.h,v 1.2 2000/07/29 03:46:15 lukem Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@ -35,5 +35,5 @@
* @(#)extern.h 8.1 (Berkeley) 5/31/93 * @(#)extern.h 8.1 (Berkeley) 5/31/93
*/ */
char *flags_to_string __P((u_long, char *)); char *flags_to_string(u_long, char *);
int string_to_flags __P((char **, u_long *, u_long *)); int string_to_flags(char **, u_long *, u_long *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.19 2000/06/22 23:42:22 assar Exp $ */ /* $NetBSD: util.c,v 1.20 2000/07/29 03:46:15 lukem Exp $ */
/* /*
* Copyright (c) 1989, 1993, 1994 * Copyright (c) 1989, 1993, 1994
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)util.c 8.5 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)util.c 8.5 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: util.c,v 1.19 2000/06/22 23:42:22 assar Exp $"); __RCSID("$NetBSD: util.c,v 1.20 2000/07/29 03:46:15 lukem Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -58,8 +58,7 @@ __RCSID("$NetBSD: util.c,v 1.19 2000/06/22 23:42:22 assar Exp $");
#include "extern.h" #include "extern.h"
int int
printescaped(src) printescaped(const char *src)
const char *src;
{ {
unsigned char c; unsigned char c;
int n; int n;
@ -73,7 +72,7 @@ printescaped(src)
} }
void void
usage() usage(void)
{ {
(void)fprintf(stderr, (void)fprintf(stderr,
"usage: ls [-1ACFLRSTWacdfgiklmnopqrstux] [file ...]\n"); "usage: ls [-1ACFLRSTWacdfgiklmnopqrstux] [file ...]\n");