Modernization effort for bin/c*:
o __P has been reoved 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. Approved by: arch@, new style(9)
This commit is contained in:
parent
ef44ec93a7
commit
41e5cc1a95
128
bin/chio/chio.c
128
bin/chio/chio.c
@ -56,29 +56,29 @@ static const char rcsid[] =
|
||||
|
||||
extern char *__progname; /* from crt0.o */
|
||||
|
||||
static void usage __P((void));
|
||||
static void cleanup __P((void));
|
||||
static int parse_element_type __P((char *));
|
||||
static int parse_element_unit __P((char *));
|
||||
static const char * element_type_name __P((int et));
|
||||
static int parse_special __P((char *));
|
||||
static int is_special __P((char *));
|
||||
static const char *bits_to_string __P((ces_status_flags, const char *));
|
||||
static void usage(void);
|
||||
static void cleanup(void);
|
||||
static int parse_element_type(char *);
|
||||
static int parse_element_unit(char *);
|
||||
static const char * element_type_name(int et);
|
||||
static int parse_special(char *);
|
||||
static int is_special(char *);
|
||||
static const char *bits_to_string(ces_status_flags, const char *);
|
||||
|
||||
static void find_element __P((char *, u_int16_t *, u_int16_t *));
|
||||
static void find_element(char *, u_int16_t *, u_int16_t *);
|
||||
static struct changer_element_status *get_element_status
|
||||
__P((unsigned int, unsigned int));
|
||||
(unsigned int, unsigned int);
|
||||
|
||||
static int do_move __P((const char *, int, char **));
|
||||
static int do_exchange __P((const char *, int, char **));
|
||||
static int do_position __P((const char *, int, char **));
|
||||
static int do_params __P((const char *, int, char **));
|
||||
static int do_getpicker __P((const char *, int, char **));
|
||||
static int do_setpicker __P((const char *, int, char **));
|
||||
static int do_status __P((const char *, int, char **));
|
||||
static int do_ielem __P((const char *, int, char **));
|
||||
static int do_return __P((const char *, int, char **));
|
||||
static int do_voltag __P((const char *, int, char **));
|
||||
static int do_move(const char *, int, char **);
|
||||
static int do_exchange(const char *, int, char **);
|
||||
static int do_position(const char *, int, char **);
|
||||
static int do_params(const char *, int, char **);
|
||||
static int do_getpicker(const char *, int, char **);
|
||||
static int do_setpicker(const char *, int, char **);
|
||||
static int do_status(const char *, int, char **);
|
||||
static int do_ielem(const char *, int, char **);
|
||||
static int do_return(const char *, int, char **);
|
||||
static int do_voltag(const char *, int, char **);
|
||||
|
||||
#ifndef CHET_VT
|
||||
#define CHET_VT 10 /* Completely Arbitrary */
|
||||
@ -121,9 +121,7 @@ static int changer_fd;
|
||||
static const char *changer_name;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch, i;
|
||||
|
||||
@ -176,10 +174,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_move(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_move(const char *cname, int argc, char **argv)
|
||||
{
|
||||
struct changer_move cmd;
|
||||
int val;
|
||||
@ -257,10 +252,7 @@ do_move(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_exchange(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_exchange(const char *cname, int argc, char **argv)
|
||||
{
|
||||
struct changer_exchange cmd;
|
||||
int val;
|
||||
@ -369,10 +361,7 @@ do_exchange(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_position(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_position(const char *cname, int argc, char **argv)
|
||||
{
|
||||
struct changer_position cmd;
|
||||
int val;
|
||||
@ -433,10 +422,7 @@ do_position(cname, argc, argv)
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
do_params(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_params(const char *cname, int argc, char **argv)
|
||||
{
|
||||
struct changer_params data;
|
||||
int picker;
|
||||
@ -479,10 +465,7 @@ do_params(cname, argc, argv)
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
do_getpicker(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_getpicker(const char *cname, int argc, char **argv)
|
||||
{
|
||||
int picker;
|
||||
|
||||
@ -509,10 +492,7 @@ do_getpicker(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_setpicker(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_setpicker(const char *cname, int argc, char **argv)
|
||||
{
|
||||
int picker;
|
||||
|
||||
@ -540,10 +520,7 @@ do_setpicker(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_status(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_status(const char *cname, int argc, char **argv)
|
||||
{
|
||||
struct changer_params cp;
|
||||
struct changer_element_status_request cesr;
|
||||
@ -762,10 +739,7 @@ do_status(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_ielem(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_ielem(const char *cname, int argc, char **argv)
|
||||
{
|
||||
int timeout = 0;
|
||||
|
||||
@ -788,10 +762,7 @@ do_ielem(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
do_voltag(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_voltag(const char *cname, int argc, char **argv)
|
||||
{
|
||||
int force = 0;
|
||||
int clear = 0;
|
||||
@ -876,8 +847,7 @@ do_voltag(cname, argc, argv)
|
||||
}
|
||||
|
||||
static int
|
||||
parse_element_type(cp)
|
||||
char *cp;
|
||||
parse_element_type(char *cp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -890,8 +860,7 @@ parse_element_type(cp)
|
||||
}
|
||||
|
||||
static const char *
|
||||
element_type_name(et)
|
||||
int et;
|
||||
element_type_name(int et)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -903,8 +872,7 @@ element_type_name(et)
|
||||
}
|
||||
|
||||
static int
|
||||
parse_element_unit(cp)
|
||||
char *cp;
|
||||
parse_element_unit(char *cp)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
@ -917,8 +885,7 @@ parse_element_unit(cp)
|
||||
}
|
||||
|
||||
static int
|
||||
parse_special(cp)
|
||||
char *cp;
|
||||
parse_special(char *cp)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -931,8 +898,7 @@ parse_special(cp)
|
||||
}
|
||||
|
||||
static int
|
||||
is_special(cp)
|
||||
char *cp;
|
||||
is_special(char *cp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -944,9 +910,7 @@ is_special(cp)
|
||||
}
|
||||
|
||||
static const char *
|
||||
bits_to_string(v, cp)
|
||||
ces_status_flags v;
|
||||
const char *cp;
|
||||
bits_to_string(ces_status_flags v, const char *cp)
|
||||
{
|
||||
const char *np;
|
||||
char f, sep, *bp;
|
||||
@ -977,10 +941,7 @@ bits_to_string(v, cp)
|
||||
* element back to its source slot.
|
||||
*/
|
||||
static int
|
||||
do_return(cname, argc, argv)
|
||||
const char *cname;
|
||||
int argc;
|
||||
char **argv;
|
||||
do_return(const char *cname, int argc, char **argv)
|
||||
{
|
||||
struct changer_element_status *ces;
|
||||
struct changer_move cmd;
|
||||
@ -1043,9 +1004,7 @@ do_return(cname, argc, argv)
|
||||
* should free() it when done.
|
||||
*/
|
||||
static struct changer_element_status *
|
||||
get_element_status(type, element)
|
||||
unsigned int type;
|
||||
unsigned int element;
|
||||
get_element_status(unsigned int type, unsigned int element)
|
||||
{
|
||||
struct changer_element_status_request cesr;
|
||||
struct changer_element_status *ces;
|
||||
@ -1082,10 +1041,7 @@ get_element_status(type, element)
|
||||
* and iterate until we find a match, or crap out.
|
||||
*/
|
||||
static void
|
||||
find_element(voltag, et, eu)
|
||||
char *voltag;
|
||||
u_int16_t *et;
|
||||
u_int16_t *eu;
|
||||
find_element(char *voltag, u_int16_t *et, u_int16_t *eu)
|
||||
{
|
||||
struct changer_params cp;
|
||||
struct changer_element_status_request cesr;
|
||||
@ -1205,16 +1161,16 @@ find_element(voltag, et, eu)
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup()
|
||||
cleanup(void)
|
||||
{
|
||||
/* Simple enough... */
|
||||
(void)close(changer_fd);
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void) fprintf(stderr, "usage: %s [-f changer] command [-<flags>] "
|
||||
(void)fprintf(stderr, "usage: %s [-f changer] command [-<flags>] "
|
||||
"arg1 arg2 [arg3 [...]]\n", __progname);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ struct element_type {
|
||||
struct changer_command {
|
||||
const char *cc_name; /* command name */
|
||||
/* command handler */
|
||||
int (*cc_handler) __P((const char *, int, char **));
|
||||
int (*cc_handler)(const char *, int, char **);
|
||||
};
|
||||
|
||||
struct special_word {
|
||||
|
@ -57,13 +57,11 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main __P((int, char *[]));
|
||||
void usage __P((void));
|
||||
int main(int, char *[]);
|
||||
void usage(void);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FTS *ftsp;
|
||||
FTSENT *p;
|
||||
@ -74,7 +72,7 @@ main(argc, argv)
|
||||
int vflag;
|
||||
char *ep, *mode;
|
||||
int newmode;
|
||||
int (*change_mode) __P((const char *, mode_t));
|
||||
int (*change_mode)(const char *, mode_t);
|
||||
|
||||
set = NULL;
|
||||
omode = 0;
|
||||
@ -222,7 +220,7 @@ done: argv += optind;
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: chmod [-fhv] [-R [-H | -L | -P]] mode file ...\n");
|
||||
|
16
bin/cp/cp.c
16
bin/cp/cp.c
@ -88,13 +88,11 @@ int Rflag, iflag, pflag, rflag, fflag, vflag;
|
||||
|
||||
enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
|
||||
|
||||
int copy __P((char *[], enum op, int));
|
||||
int mastercmp __P((const FTSENT **, const FTSENT **));
|
||||
int copy(char *[], enum op, int);
|
||||
int mastercmp(const FTSENT **, const FTSENT **);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct stat to_stat, tmp_stat;
|
||||
enum op type;
|
||||
@ -238,10 +236,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
int
|
||||
copy(argv, type, fts_options)
|
||||
char *argv[];
|
||||
enum op type;
|
||||
int fts_options;
|
||||
copy(char *argv[], enum op type, int fts_options)
|
||||
{
|
||||
struct stat to_stat;
|
||||
FTS *ftsp;
|
||||
@ -460,8 +455,7 @@ copy(argv, type, fts_options)
|
||||
* files first reduces seeking.
|
||||
*/
|
||||
int
|
||||
mastercmp(a, b)
|
||||
const FTSENT **a, **b;
|
||||
mastercmp(const FTSENT **a, const FTSENT **b)
|
||||
{
|
||||
int a_info, b_info;
|
||||
|
||||
|
@ -46,10 +46,10 @@ extern int iflag, pflag, fflag, vflag;
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int copy_fifo __P((struct stat *, int));
|
||||
int copy_file __P((FTSENT *, int));
|
||||
int copy_link __P((FTSENT *, int));
|
||||
int copy_special __P((struct stat *, int));
|
||||
int setfile __P((struct stat *, int));
|
||||
void usage __P((void));
|
||||
int copy_fifo(struct stat *, int);
|
||||
int copy_file(FTSENT *, int);
|
||||
int copy_link(FTSENT *, int);
|
||||
int copy_special(struct stat *, int);
|
||||
int setfile(struct stat *, int);
|
||||
void usage(void);
|
||||
__END_DECLS
|
||||
|
@ -59,9 +59,7 @@ static const char rcsid[] =
|
||||
#include "extern.h"
|
||||
|
||||
int
|
||||
copy_file(entp, dne)
|
||||
FTSENT *entp;
|
||||
int dne;
|
||||
copy_file(FTSENT *entp, int dne)
|
||||
{
|
||||
static char buf[MAXBSIZE];
|
||||
struct stat *fs;
|
||||
@ -190,9 +188,7 @@ copy_file(entp, dne)
|
||||
}
|
||||
|
||||
int
|
||||
copy_link(p, exists)
|
||||
FTSENT *p;
|
||||
int exists;
|
||||
copy_link(FTSENT *p, int exists)
|
||||
{
|
||||
int len;
|
||||
char link[PATH_MAX];
|
||||
@ -214,9 +210,7 @@ copy_link(p, exists)
|
||||
}
|
||||
|
||||
int
|
||||
copy_fifo(from_stat, exists)
|
||||
struct stat *from_stat;
|
||||
int exists;
|
||||
copy_fifo(struct stat *from_stat, int exists)
|
||||
{
|
||||
if (exists && unlink(to.p_path)) {
|
||||
warn("unlink: %s", to.p_path);
|
||||
@ -230,9 +224,7 @@ copy_fifo(from_stat, exists)
|
||||
}
|
||||
|
||||
int
|
||||
copy_special(from_stat, exists)
|
||||
struct stat *from_stat;
|
||||
int exists;
|
||||
copy_special(struct stat *from_stat, int exists)
|
||||
{
|
||||
if (exists && unlink(to.p_path)) {
|
||||
warn("unlink: %s", to.p_path);
|
||||
@ -249,9 +241,7 @@ copy_special(from_stat, exists)
|
||||
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
|
||||
int
|
||||
setfile(fs, fd)
|
||||
register struct stat *fs;
|
||||
int fd;
|
||||
setfile(struct stat *fs, int fd)
|
||||
{
|
||||
static struct timeval tv[2];
|
||||
struct stat ts;
|
||||
@ -308,7 +298,7 @@ setfile(fs, fd)
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
|
Loading…
Reference in New Issue
Block a user