Skip to content

Commit

Permalink
o __P has been reoved
Browse files Browse the repository at this point in the history
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
  • Loading branch information
bsdimp committed Feb 2, 2002
1 parent 3fc8df5 commit 50014e3
Show file tree
Hide file tree
Showing 42 changed files with 447 additions and 1,809 deletions.
9 changes: 3 additions & 6 deletions bin/hostname/hostname.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,10 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>

int main __P((int, char *[]));
void usage __P((void));
void usage(void);

int
main(argc,argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch, sflag;
char *p, hostname[MAXHOSTNAMELEN];
Expand Down Expand Up @@ -94,7 +91,7 @@ main(argc,argv)
}

void
usage()
usage(void)
{

(void)fprintf(stderr, "usage: hostname [-s] [name-of-host]\n");
Expand Down
24 changes: 9 additions & 15 deletions bin/kill/kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ static const char rcsid[] =
#include <stdlib.h>
#include <string.h>

int main __P((int, char *[]));
void nosig __P((char *));
void printsignals __P((FILE *));
int signame_to_signum __P((char *));
void usage __P((void));
void nosig(char *);
void printsignals(FILE *);
int signame_to_signum(char *);
void usage(void);

int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int errors, numsig, pid;
char *ep;
Expand Down Expand Up @@ -140,8 +137,7 @@ main(argc, argv)
}

int
signame_to_signum(sig)
char *sig;
signame_to_signum(char *sig)
{
int n;

Expand All @@ -155,8 +151,7 @@ signame_to_signum(sig)
}

void
nosig(name)
char *name;
nosig(char *name)
{

warnx("unknown signal %s; valid signals:", name);
Expand All @@ -165,8 +160,7 @@ nosig(name)
}

void
printsignals(fp)
FILE *fp;
printsignals(FILE *fp)
{
int n;

Expand All @@ -180,7 +174,7 @@ printsignals(fp)
}

void
usage()
usage(void)
{

(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
Expand Down
17 changes: 6 additions & 11 deletions bin/ln/ln.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,14 @@ int iflag; /* Interactive mode. */
int sflag; /* Symbolic, not hard, link. */
int vflag; /* Verbose output. */
/* System link call. */
int (*linkf) __P((const char *, const char *));
int (*linkf)(const char *, const char *);
char linkch;

int linkit __P((const char *, const char *, int));
int main __P((int, char *[]));
void usage __P((void));
int linkit(const char *, const char *, int);
void usage(void);

int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
struct stat sb;
char *p, *sourcedir;
Expand Down Expand Up @@ -155,9 +152,7 @@ main(argc, argv)
}

int
linkit(target, source, isdir)
const char *target, *source;
int isdir;
linkit(const char *target, const char *source, int isdir)
{
struct stat sb;
const char *p;
Expand Down Expand Up @@ -232,7 +227,7 @@ linkit(target, source, isdir)
}

void
usage()
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: ln [-fhinsv] file1 file2",
Expand Down
24 changes: 8 additions & 16 deletions bin/ls/cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,57 +53,49 @@ static const char rcsid[] =
#include "extern.h"

int
namecmp(a, b)
const FTSENT *a, *b;
namecmp(const FTSENT *a, const FTSENT *b)
{
return (strcoll(a->fts_name, b->fts_name));
}

int
revnamecmp(a, b)
const FTSENT *a, *b;
revnamecmp(const FTSENT *a, const FTSENT *b)
{
return (strcoll(b->fts_name, a->fts_name));
}

int
modcmp(a, b)
const FTSENT *a, *b;
modcmp(const FTSENT *a, const FTSENT *b)
{
return (b->fts_statp->st_mtime - a->fts_statp->st_mtime);
}

int
revmodcmp(a, b)
const FTSENT *a, *b;
revmodcmp(const FTSENT *a, const FTSENT *b)
{
return (a->fts_statp->st_mtime - b->fts_statp->st_mtime);
}

int
acccmp(a, b)
const FTSENT *a, *b;
acccmp(const FTSENT *a, const FTSENT *b)
{
return (b->fts_statp->st_atime - a->fts_statp->st_atime);
}

int
revacccmp(a, b)
const FTSENT *a, *b;
revacccmp(const FTSENT *a, const FTSENT *b)
{
return (a->fts_statp->st_atime - b->fts_statp->st_atime);
}

int
statcmp(a, b)
const FTSENT *a, *b;
statcmp(const FTSENT *a, const FTSENT *b)
{
return (b->fts_statp->st_ctime - a->fts_statp->st_ctime);
}

int
revstatcmp(a, b)
const FTSENT *a, *b;
revstatcmp(const FTSENT *a, const FTSENT *b)
{
return (a->fts_statp->st_ctime - b->fts_statp->st_ctime);
}
34 changes: 17 additions & 17 deletions bin/ls/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@
* $FreeBSD$
*/

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 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 *);

void printcol __P((DISPLAY *));
void printlong __P((DISPLAY *));
void printscol __P((DISPLAY *));
void usage __P((void));
int len_octal __P((const char *, int));
int prn_octal __P((const char *));
int prn_printable __P((const char *));
void printcol(DISPLAY *);
void printlong(DISPLAY *);
void printscol(DISPLAY *);
void usage(void);
int len_octal(const char *, int);
int prn_octal(const char *);
int prn_printable(const char *);
#ifdef COLORLS
void parsecolors __P((const char *cs));
void colorquit __P((int));
void parsecolors(const char *cs);
void colorquit(int);

extern char *ansi_fgcol;
extern char *ansi_bgcol;
Expand Down
11 changes: 6 additions & 5 deletions bin/ls/lomac.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct lomac_fioctl2 ioctl_args;
*/

void
lomac_start(void) {

lomac_start(void)
{
if ((devlomac = open(LOMAC_DEVICE, O_RDWR)) == -1)
err(1, "cannot open %s", LOMAC_DEVICE);
}
Expand All @@ -84,8 +84,8 @@ lomac_start(void) {
*/

void
lomac_stop(void) {

lomac_stop(void)
{
if (close(devlomac) == -1)
err(1, "cannot close %s", LOMAC_DEVICE);
}
Expand All @@ -104,7 +104,8 @@ lomac_stop(void) {
*/

char *
get_lattr(FTSENT *ent) {
get_lattr(FTSENT *ent)
{
char *lattr;

#ifdef NOT_NOW
Expand Down
29 changes: 11 additions & 18 deletions bin/ls/ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ static const char rcsid[] =
*/
#define STRBUF_SIZEOF(t) (1 + CHAR_BIT * sizeof(t) / 3 + 1)

static void display __P((FTSENT *, FTSENT *));
static u_quad_t makenines __P((u_long));
static int mastercmp __P((const FTSENT **, const FTSENT **));
static void traverse __P((int, char **, int));
static void display(FTSENT *, FTSENT *);
static u_quad_t makenines(u_long);
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 *);

long blocksize; /* block size units */
int termwidth = 80; /* default terminal width */
Expand Down Expand Up @@ -129,9 +129,7 @@ char *enter_bold; /* ANSI sequence to set color to bold mode */
int rval;

int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
static char dot[] = ".", *dotav[] = {dot, NULL};
struct winsize win;
Expand Down Expand Up @@ -409,9 +407,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;
Expand Down Expand Up @@ -474,8 +470,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;
Expand Down Expand Up @@ -721,8 +716,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;

Expand Down Expand Up @@ -751,8 +745,7 @@ mastercmp(a, b)
* into a number that wide in decimal.
*/
static u_quad_t
makenines(n)
u_long n;
makenines(u_long n)
{
u_long i;
u_quad_t reg;
Expand Down
Loading

0 comments on commit 50014e3

Please sign in to comment.