ANSIfy + static + __dead

This commit is contained in:
joerg 2011-09-04 20:29:12 +00:00
parent 924863260a
commit 4e46e5935f
5 changed files with 42 additions and 58 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: logname.c,v 1.9 2008/07/21 14:19:23 lukem Exp $ */
/* $NetBSD: logname.c,v 1.10 2011/09/04 20:29:12 joerg Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993, 1994\
#if 0
static char sccsid[] = "@(#)logname.c 8.2 (Berkeley) 4/3/94";
#endif
__RCSID("$NetBSD: logname.c,v 1.9 2008/07/21 14:19:23 lukem Exp $");
__RCSID("$NetBSD: logname.c,v 1.10 2011/09/04 20:29:12 joerg Exp $");
#endif /* not lint */
#include <stdio.h>
@ -48,13 +48,10 @@ __RCSID("$NetBSD: logname.c,v 1.9 2008/07/21 14:19:23 lukem Exp $");
#include <unistd.h>
#include <err.h>
int main __P((int, char **));
void usage __P((void));
__dead static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch;
char *p;
@ -80,8 +77,8 @@ main(argc, argv)
exit(0);
}
void
usage()
static void
usage(void)
{
(void)fprintf(stderr, "usage: logname\n");
exit(1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: look.c,v 1.14 2009/04/26 15:55:50 christos Exp $ */
/* $NetBSD: look.c,v 1.15 2011/09/04 20:29:32 joerg Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\
#if 0
static char sccsid[] = "@(#)look.c 8.2 (Berkeley) 5/4/95";
#endif
__RCSID("$NetBSD: look.c,v 1.14 2009/04/26 15:55:50 christos Exp $");
__RCSID("$NetBSD: look.c,v 1.15 2011/09/04 20:29:32 joerg Exp $");
#endif /* not lint */
/*
@ -84,20 +84,17 @@ __RCSID("$NetBSD: look.c,v 1.14 2009/04/26 15:55:50 christos Exp $");
#define FOLD(c) (isascii(c) && isupper(c) ? tolower(c) : (c))
#define DICT(c) (isascii(c) && isalnum(c) ? (c) : NO_COMPARE)
int dflag, fflag;
static int dflag, fflag;
char *binary_search __P((char *, char *, char *));
int compare __P((char *, char *, char *));
char *linear_search __P((char *, char *, char *));
int look __P((char *, char *, char *));
int main __P((int, char **));
void print_from __P((char *, char *, char *));
void usage __P((void));
static char *binary_search(char *, char *, char *);
static int compare(char *, char *, char *);
static char *linear_search(char *, char *, char *);
static int look(char *, char *, char *);
static void print_from(char *, char *, char *);
__dead static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
struct stat sb;
int ch, fd, termchar;
@ -156,9 +153,8 @@ main(argc, argv)
exit(look(string, front, back));
}
int
look(string, front, back)
char *string, *front, *back;
static int
look(char *string, char *front, char *back)
{
int ch;
char *readp, *writep;
@ -224,9 +220,8 @@ look(string, front, back)
#define SKIP_PAST_NEWLINE(p, back) \
while (p < back && *p++ != '\n');
char *
binary_search(string, front, back)
char *string, *front, *back;
static char *
binary_search(char *string, char *front, char *back)
{
char *p;
@ -259,9 +254,8 @@ binary_search(string, front, back)
* o front points at the first character in a line.
* o front is before or at the first line to be printed.
*/
char *
linear_search(string, front, back)
char *string, *front, *back;
static char *
linear_search(char *string, char *front, char *back)
{
while (front < back) {
switch (compare(string, front, back)) {
@ -282,9 +276,8 @@ linear_search(string, front, back)
/*
* Print as many lines as match string, starting at front.
*/
void
print_from(string, front, back)
char *string, *front, *back;
static void
print_from(char *string, char *front, char *back)
{
for (; front < back && compare(string, front, back) == EQUAL; ++front) {
for (; front < back && *front != '\n'; ++front)
@ -308,9 +301,8 @@ print_from(string, front, back)
* The string "s1" is null terminated. The string s2 is '\n' terminated (or
* "back" terminated).
*/
int
compare(s1, s2, back)
char *s1, *s2, *back;
static int
compare(char *s1, char *s2, char *back)
{
int ch;
@ -331,8 +323,8 @@ compare(s1, s2, back)
return (*s1 ? GREATER : EQUAL);
}
void
usage()
static void
usage(void)
{
(void)fprintf(stderr, "usage: look [-df] [-t char] string [file]\n");
exit(2);

View File

@ -1,4 +1,4 @@
/* $NetBSD: findcc.c,v 1.5 2009/04/12 14:23:30 lukem Exp $ */
/* $NetBSD: findcc.c,v 1.6 2011/09/04 20:30:06 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
#if !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
All rights reserved.");
__RCSID("$NetBSD: findcc.c,v 1.5 2009/04/12 14:23:30 lukem Exp $");
__RCSID("$NetBSD: findcc.c,v 1.6 2011/09/04 20:30:06 joerg Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -49,8 +49,7 @@ __RCSID("$NetBSD: findcc.c,v 1.5 2009/04/12 14:23:30 lukem Exp $");
#include "findcc.h"
char *
findcc(progname)
const char *progname;
findcc(const char *progname)
{
char *path, *dir, *next;
char buffer[MAXPATHLEN];

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkdep.c,v 1.39 2011/06/30 20:09:42 wiz Exp $ */
/* $NetBSD: mkdep.c,v 1.40 2011/09/04 20:30:06 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
#if !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
All rights reserved.");
__RCSID("$NetBSD: mkdep.c,v 1.39 2011/06/30 20:09:42 wiz Exp $");
__RCSID("$NetBSD: mkdep.c,v 1.40 2011/09/04 20:30:06 joerg Exp $");
#endif /* not lint */
#include <sys/mman.h>
@ -72,8 +72,8 @@ typedef struct suff_list {
} suff_list_t;
/* tree of includes for -o processing */
opt_t *opt;
int width;
static opt_t *opt;
static int width;
#define DEFAULT_PATH _PATH_DEFPATH
#define DEFAULT_FILENAME ".depend"
@ -81,14 +81,13 @@ int width;
static void save_for_optional(const char *, const char *);
static int write_optional(int, opt_t *, int);
static inline void *
deconst(const void *p)
{
return (const char *)p - (const char *)0 + (char *)0;
}
static void
__dead static void
usage(void)
{
(void)fprintf(stderr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkfifo.c,v 1.12 2008/07/21 14:19:24 lukem Exp $ */
/* $NetBSD: mkfifo.c,v 1.13 2011/09/04 20:30:34 joerg Exp $ */
/*
* Copyright (c) 1990, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\
#if 0
static char sccsid[] = "@(#)mkfifo.c 8.2 (Berkeley) 1/5/94";
#endif
__RCSID("$NetBSD: mkfifo.c,v 1.12 2008/07/21 14:19:24 lukem Exp $");
__RCSID("$NetBSD: mkfifo.c,v 1.13 2011/09/04 20:30:34 joerg Exp $");
#endif /* not lint */
#include <stdio.h>
@ -52,13 +52,10 @@ __RCSID("$NetBSD: mkfifo.c,v 1.12 2008/07/21 14:19:24 lukem Exp $");
#include <unistd.h>
#include <err.h>
int main __P((int, char **));
static void usage __P((void));
__dead static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch, exitval;
void *set;
@ -102,8 +99,8 @@ main(argc, argv)
exit(exitval);
}
void
usage()
static void
usage(void)
{
(void)fprintf(stderr, "usage: mkfifo [-m mode] fifoname ...\n");
exit(1);