convert to new KNF
This commit is contained in:
parent
2da9fd746e
commit
ba2e04dc88
44
bin/ls/cmp.c
44
bin/ls/cmp.c
@ -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
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93";
|
||||
#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 /* not lint */
|
||||
|
||||
@ -69,23 +69,23 @@ __RCSID("$NetBSD: cmp.c,v 1.15 2000/07/23 20:50:44 mycroft Exp $");
|
||||
#endif
|
||||
|
||||
int
|
||||
namecmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
namecmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
return (strcmp(a->fts_name, b->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
revnamecmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revnamecmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
return (strcmp(b->fts_name, a->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
modcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
modcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_mtime > a->fts_statp->st_mtime)
|
||||
return (1);
|
||||
else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime)
|
||||
@ -99,9 +99,9 @@ modcmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
revmodcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revmodcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_mtime > a->fts_statp->st_mtime)
|
||||
return (-1);
|
||||
else if (b->fts_statp->st_mtime < a->fts_statp->st_mtime)
|
||||
@ -115,9 +115,9 @@ revmodcmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
acccmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
acccmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_atime > a->fts_statp->st_atime)
|
||||
return (1);
|
||||
else if (b->fts_statp->st_atime < a->fts_statp->st_atime)
|
||||
@ -131,9 +131,9 @@ acccmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
revacccmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revacccmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_atime > a->fts_statp->st_atime)
|
||||
return (-1);
|
||||
else if (b->fts_statp->st_atime < a->fts_statp->st_atime)
|
||||
@ -147,9 +147,9 @@ revacccmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
statcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
statcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_ctime > a->fts_statp->st_ctime)
|
||||
return (1);
|
||||
else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime)
|
||||
@ -163,9 +163,9 @@ statcmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
revstatcmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revstatcmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_ctime > a->fts_statp->st_ctime)
|
||||
return (-1);
|
||||
else if (b->fts_statp->st_ctime < a->fts_statp->st_ctime)
|
||||
@ -179,9 +179,9 @@ revstatcmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
sizecmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
sizecmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_size > a->fts_statp->st_size)
|
||||
return (1);
|
||||
if (b->fts_statp->st_size < a->fts_statp->st_size)
|
||||
@ -191,9 +191,9 @@ sizecmp(a, b)
|
||||
}
|
||||
|
||||
int
|
||||
revsizecmp(a, b)
|
||||
const FTSENT *a, *b;
|
||||
revsizecmp(const FTSENT *a, const FTSENT *b)
|
||||
{
|
||||
|
||||
if (b->fts_statp->st_size > a->fts_statp->st_size)
|
||||
return (-1);
|
||||
if (b->fts_statp->st_size < a->fts_statp->st_size)
|
||||
|
@ -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
|
||||
@ -35,25 +35,25 @@
|
||||
* @(#)extern.h 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
|
||||
int acccmp __P((const FTSENT *, const FTSENT *));
|
||||
int revacccmp __P((const FTSENT *, const FTSENT *));
|
||||
int modcmp __P((const FTSENT *, const FTSENT *));
|
||||
int revmodcmp __P((const FTSENT *, const FTSENT *));
|
||||
int namecmp __P((const FTSENT *, const FTSENT *));
|
||||
int revnamecmp __P((const FTSENT *, const FTSENT *));
|
||||
int statcmp __P((const FTSENT *, const FTSENT *));
|
||||
int revstatcmp __P((const FTSENT *, const FTSENT *));
|
||||
int sizecmp __P((const FTSENT *, const FTSENT *));
|
||||
int revsizecmp __P((const FTSENT *, const FTSENT *));
|
||||
int acccmp(const FTSENT *, const FTSENT *);
|
||||
int revacccmp(const FTSENT *, const FTSENT *);
|
||||
int modcmp(const FTSENT *, const FTSENT *);
|
||||
int revmodcmp(const FTSENT *, const FTSENT *);
|
||||
int namecmp(const FTSENT *, const FTSENT *);
|
||||
int revnamecmp(const FTSENT *, const FTSENT *);
|
||||
int statcmp(const FTSENT *, const FTSENT *);
|
||||
int revstatcmp(const FTSENT *, const FTSENT *);
|
||||
int sizecmp(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 *));
|
||||
void printacol __P((DISPLAY *));
|
||||
void printcol __P((DISPLAY *));
|
||||
void printlong __P((DISPLAY *));
|
||||
void printscol __P((DISPLAY *));
|
||||
void printstream __P((DISPLAY *));
|
||||
void usage __P((void));
|
||||
int printescaped(const char *);
|
||||
void printacol(DISPLAY *);
|
||||
void printcol(DISPLAY *);
|
||||
void printlong(DISPLAY *);
|
||||
void printscol(DISPLAY *);
|
||||
void printstream(DISPLAY *);
|
||||
void usage(void);
|
||||
|
||||
#include "stat_flags.h"
|
||||
|
28
bin/ls/ls.c
28
bin/ls/ls.c
@ -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
|
||||
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
|
||||
#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 /* 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 "extern.h"
|
||||
|
||||
static void display __P((FTSENT *, FTSENT *));
|
||||
static int mastercmp __P((const FTSENT **, const FTSENT **));
|
||||
static void traverse __P((int, char **, int));
|
||||
static void display(FTSENT *, FTSENT *);
|
||||
static int mastercmp(const FTSENT **, const FTSENT **);
|
||||
static void traverse(int, char **, int);
|
||||
|
||||
static void (*printfcn) __P((DISPLAY *));
|
||||
static int (*sortfcn) __P((const FTSENT *, const FTSENT *));
|
||||
static void (*printfcn)(DISPLAY *);
|
||||
static int (*sortfcn)(const FTSENT *, const FTSENT *);
|
||||
|
||||
#define BY_NAME 0
|
||||
#define BY_SIZE 1
|
||||
@ -110,9 +110,7 @@ int f_typedir; /* add type character for directories */
|
||||
int f_whiteout; /* show whiteout entries */
|
||||
|
||||
int
|
||||
ls_main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
ls_main(int argc, char *argv[])
|
||||
{
|
||||
static char dot[] = ".", *dotav[] = { dot, NULL };
|
||||
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.
|
||||
*/
|
||||
static void
|
||||
traverse(argc, argv, options)
|
||||
int argc, options;
|
||||
char *argv[];
|
||||
traverse(int argc, char *argv[], int options)
|
||||
{
|
||||
FTS *ftsp;
|
||||
FTSENT *p, *chp;
|
||||
@ -408,8 +404,7 @@ traverse(argc, argv, options)
|
||||
* points to the parent directory of the display list.
|
||||
*/
|
||||
static void
|
||||
display(p, list)
|
||||
FTSENT *p, *list;
|
||||
display(FTSENT *p, FTSENT *list)
|
||||
{
|
||||
struct stat *sp;
|
||||
DISPLAY d;
|
||||
@ -588,8 +583,7 @@ display(p, list)
|
||||
* All other levels use the sort function. Error entries remain unsorted.
|
||||
*/
|
||||
static int
|
||||
mastercmp(a, b)
|
||||
const FTSENT **a, **b;
|
||||
mastercmp(const FTSENT **a, const FTSENT **b)
|
||||
{
|
||||
int a_info, b_info;
|
||||
|
||||
|
@ -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.
|
||||
@ -39,7 +39,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#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 */
|
||||
|
||||
#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 "extern.h"
|
||||
|
||||
int main __P((int, char *[]));
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
return (ls_main(argc, argv));
|
||||
|
@ -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
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
|
||||
#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 /* 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 "extern.h"
|
||||
|
||||
static int printaname __P((FTSENT *, int, int));
|
||||
static void printlink __P((FTSENT *));
|
||||
static void printtime __P((time_t));
|
||||
static int printtype __P((u_int));
|
||||
static int printaname(FTSENT *, int, int);
|
||||
static void printlink(FTSENT *);
|
||||
static void printtime(time_t);
|
||||
static int printtype(u_int);
|
||||
|
||||
static time_t now;
|
||||
|
||||
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
|
||||
|
||||
void
|
||||
printscol(dp)
|
||||
DISPLAY *dp;
|
||||
printscol(DISPLAY *dp)
|
||||
{
|
||||
FTSENT *p;
|
||||
|
||||
@ -88,8 +87,7 @@ printscol(dp)
|
||||
}
|
||||
|
||||
void
|
||||
printlong(dp)
|
||||
DISPLAY *dp;
|
||||
printlong(DISPLAY *dp)
|
||||
{
|
||||
struct stat *sp;
|
||||
FTSENT *p;
|
||||
@ -146,8 +144,7 @@ printlong(dp)
|
||||
}
|
||||
|
||||
void
|
||||
printcol(dp)
|
||||
DISPLAY *dp;
|
||||
printcol(DISPLAY *dp)
|
||||
{
|
||||
extern int termwidth;
|
||||
static FTSENT **array;
|
||||
@ -210,8 +207,7 @@ printcol(dp)
|
||||
}
|
||||
|
||||
void
|
||||
printacol(dp)
|
||||
DISPLAY *dp;
|
||||
printacol(DISPLAY *dp)
|
||||
{
|
||||
extern int termwidth;
|
||||
FTSENT *p;
|
||||
@ -256,8 +252,7 @@ printacol(dp)
|
||||
}
|
||||
|
||||
void
|
||||
printstream(dp)
|
||||
DISPLAY *dp;
|
||||
printstream(DISPLAY *dp)
|
||||
{
|
||||
extern int termwidth;
|
||||
FTSENT *p;
|
||||
@ -292,9 +287,7 @@ printstream(dp)
|
||||
* return # of characters printed, no trailing characters.
|
||||
*/
|
||||
static int
|
||||
printaname(p, inodefield, sizefield)
|
||||
FTSENT *p;
|
||||
int sizefield, inodefield;
|
||||
printaname(FTSENT *p, int inodefield, int sizefield)
|
||||
{
|
||||
struct stat *sp;
|
||||
int chcnt;
|
||||
@ -316,8 +309,7 @@ printaname(p, inodefield, sizefield)
|
||||
}
|
||||
|
||||
static void
|
||||
printtime(ftime)
|
||||
time_t ftime;
|
||||
printtime(time_t ftime)
|
||||
{
|
||||
int i;
|
||||
char *longstring;
|
||||
@ -342,8 +334,7 @@ printtime(ftime)
|
||||
}
|
||||
|
||||
static int
|
||||
printtype(mode)
|
||||
u_int mode;
|
||||
printtype(u_int mode)
|
||||
{
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
@ -370,8 +361,7 @@ printtype(mode)
|
||||
}
|
||||
|
||||
static void
|
||||
printlink(p)
|
||||
FTSENT *p;
|
||||
printlink(FTSENT *p)
|
||||
{
|
||||
int lnklen;
|
||||
char name[MAXPATHLEN + 1], path[MAXPATHLEN + 1];
|
||||
|
@ -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
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94";
|
||||
#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 /* 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.
|
||||
*/
|
||||
char *
|
||||
flags_to_string(flags, def)
|
||||
u_long flags;
|
||||
char *def;
|
||||
flags_to_string(u_long flags, char *def)
|
||||
{
|
||||
static char string[128];
|
||||
char *prefix;
|
||||
@ -108,9 +106,7 @@ flags_to_string(flags, def)
|
||||
* to the offending token.
|
||||
*/
|
||||
int
|
||||
string_to_flags(stringp, setp, clrp)
|
||||
char **stringp;
|
||||
u_long *setp, *clrp;
|
||||
string_to_flags(char **stringp, u_long *setp, u_long *clrp)
|
||||
{
|
||||
int clear;
|
||||
char *string, *p;
|
||||
|
@ -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
|
||||
@ -35,5 +35,5 @@
|
||||
* @(#)extern.h 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
|
||||
char *flags_to_string __P((u_long, char *));
|
||||
int string_to_flags __P((char **, u_long *, u_long *));
|
||||
char *flags_to_string(u_long, char *);
|
||||
int string_to_flags(char **, u_long *, u_long *);
|
||||
|
@ -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
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)util.c 8.5 (Berkeley) 4/28/95";
|
||||
#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 /* not lint */
|
||||
|
||||
@ -58,8 +58,7 @@ __RCSID("$NetBSD: util.c,v 1.19 2000/06/22 23:42:22 assar Exp $");
|
||||
#include "extern.h"
|
||||
|
||||
int
|
||||
printescaped(src)
|
||||
const char *src;
|
||||
printescaped(const char *src)
|
||||
{
|
||||
unsigned char c;
|
||||
int n;
|
||||
@ -73,7 +72,7 @@ printescaped(src)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: ls [-1ACFLRSTWacdfgiklmnopqrstux] [file ...]\n");
|
||||
|
Loading…
Reference in New Issue
Block a user