Remove __P

Remove __STDC__ (which means we now use stdarg rather than vararg)
Remove register
Remove main prototype
This commit is contained in:
Warner Losh 2002-02-18 05:15:19 +00:00
parent ab3d6ee098
commit ad64363769
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90828
35 changed files with 267 additions and 300 deletions

View File

@ -94,13 +94,13 @@ int nright, nwrong;
time_t qtime;
#define NQUESTS 20
static void usage __P((void));
int getrandom __P((int, int, int));
void intr __P((int));
int opnum __P((int));
void penalise __P((int, int, int));
int problem __P((void));
void showstats __P((void));
static void usage(void);
int getrandom(int, int, int);
void intr(int);
int opnum(int);
void penalise(int, int, int);
int problem(void);
void showstats(void);
/*
* Select keys from +-x/ to be asked addition, subtraction, multiplication,

View File

@ -41,7 +41,7 @@ static const char rcsid[] =
#include "externs.h"
void convert __P((int));
void convert(int);
int
battlestar_move(thataway, token)

View File

@ -43,7 +43,7 @@ static const char rcsid[] =
#include "externs.h"
#include "pathnames.h"
static void post __P((unsigned int ch));
static void post(unsigned int ch);
int
launch()

View File

@ -254,58 +254,58 @@ int wordtype[NWORD];
int wordcount, wordnumber;
int battlestar_move __P((int, int));
void bury __P((void));
int card __P((const char *, int));
void chime __P((void));
void crash __P((void));
int cypher __P((void));
void die __P((int));
void dig __P((void));
int draw __P((void));
void drink __P((void));
int drive __P((void));
int drop __P((const char *name));
int eat __P((void));
int fight __P((int, int));
int follow __P((void));
char *getcom __P((char *, int, const char *, const char *));
char *getword __P((char *, char *, int));
int give __P((void));
void initialize __P((int));
int jump __P((void));
void kiss __P((void));
int land __P((void));
int launch __P((void));
void light __P((void));
void live __P((void));
void love __P((void));
void murder __P((void));
void news __P((void));
void newway __P((int));
void open_score_file __P((void));
void parse __P((void));
void printobjs __P((void));
int put __P((void));
int puton __P((void));
void ravage __P((void));
const char *rate __P((void));
void restore __P((void));
int ride __P((void));
void save __P((void));
int shoot __P((void));
int take __P((unsigned int from[]));
int battlestar_move(int, int);
void bury(void);
int card(const char *, int);
void chime(void);
void crash(void);
int cypher(void);
void die(int);
void dig(void);
int draw(void);
void drink(void);
int drive(void);
int drop(const char *name);
int eat(void);
int fight(int, int);
int follow(void);
char *getcom(char *, int, const char *, const char *);
char *getword(char *, char *, int);
int give(void);
void initialize(int);
int jump(void);
void kiss(void);
int land(void);
int launch(void);
void light(void);
void live(void);
void love(void);
void murder(void);
void news(void);
void newway (int);
void open_score_file(void);
void parse(void);
void printobjs(void);
int put(void);
int puton(void);
void ravage(void);
const char *rate(void);
void restore(void);
int ride(void);
void save(void);
int shoot(void);
int take(unsigned int from[]);
int takeoff(void);
int throw __P((const char *name));
const char *truedirec __P((int, unsigned int));
int ucard __P((const unsigned int *));
int use __P((void));
int visual __P((void));
int wearit __P((void));
void whichway __P((struct room));
void wordinit __P((void));
void writedes __P((void));
int zzz __P((void));
int throw(const char *name);
const char *truedirec(int, unsigned int);
int ucard(const unsigned int *);
int use(void);
int visual(void);
int wearit(void);
void whichway(struct room);
void wordinit(void);
void writedes(void);
int zzz(void);
/* state of the game */
extern int gclock;

View File

@ -55,13 +55,13 @@ int gclock = 120; /* gtime for all the flights in the game */
char cross = 0;
sig_t oldsig;
static void blast __P((void));
static void endfly __P((void));
static void moveenemy __P((int));
static void notarget __P((void));
static void succumb __P((int));
static void screen __P((void));
static void target __P((void));
static void blast(void);
static void endfly(void);
static void moveenemy(int);
static void notarget(void);
static void succumb(int);
static void screen(void);
static void target(void);
void
succumb(sig)

View File

@ -44,9 +44,9 @@ static const char rcsid[] =
#include <string.h>
#include "externs.h"
static int checkout __P((const char *));
static void getutmp __P((char *));
static int wizard __P((const char *));
static int checkout(const char *);
static void getutmp(char *);
static int wizard(const char *);
void
initialize(startup)

View File

@ -41,9 +41,9 @@ static const char rcsid[] =
#include "externs.h"
static int hash __P((const char *));
static void install __P((struct wlist *));
struct wlist *lookup __P((const char *));
static int hash (const char *);
static void install(struct wlist *);
struct wlist *lookup(const char *);
void
wordinit()

View File

@ -141,9 +141,9 @@ static int salvo, blitz, closepack;
#define PR (void)addstr
static bool checkplace __P((int, ship_t *, int));
static int getcoord __P((int));
int playagain __P((void));
static bool checkplace(int, ship_t *, int);
static int getcoord(int);
int playagain(void);
static void uninitgame(sig)
/* end the game, either normally or due to signal */

View File

@ -78,8 +78,7 @@ double stdf[26] = {
2.62, 0.81, 1.88, 0.23, 2.07, 0.06,
};
int main __P((int, char **));
void printit __P((char *));
void printit(char *);
int
main(argc, argv)

View File

@ -33,6 +33,10 @@
* @(#)cribbage.h 8.1 (Berkeley) 5/31/93
*/
#include <sys/defs.h>
__FBSDID("$FreeBSD$");
extern CARD deck[ CARDS ]; /* a deck */
extern CARD phand[ FULLHAND ]; /* player's hand */
extern CARD chand[ FULLHAND ]; /* computer's hand */
@ -59,54 +63,54 @@ extern BOOLEAN playing; /* currently playing game */
extern char expl[]; /* string for explanation */
void addmsg __P((const char *, ...));
int adjust __P((CARD [], CARD));
int anymove __P((CARD [], int, int));
int anysumto __P((CARD [], int, int, int));
void bye __P((void));
int cchose __P((CARD [], int, int));
void cdiscard __P((BOOLEAN));
int chkscr __P((int *, int));
int comphand __P((CARD [], char *));
void cremove __P((CARD, CARD [], int));
int cut __P((BOOLEAN, int));
int deal __P((int));
void discard __P((BOOLEAN));
void do_wait __P((void));
void endmsg __P((void));
int eq __P((CARD, CARD));
int fifteens __P((CARD [], int));
void game __P((void));
void gamescore __P((void));
char *getline __P((void));
int getuchar __P((void));
int incard __P((CARD *));
int infrom __P((CARD [], int, char *));
void instructions __P((void));
int isone __P((CARD, CARD [], int));
void makeboard __P((void));
void makedeck __P((CARD []));
void makeknown __P((CARD [], int));
void msg __P((const char *, ...));
int msgcard __P((CARD, BOOLEAN));
int msgcrd __P((CARD, BOOLEAN, char *, BOOLEAN));
int number __P((int, int, char *));
int numofval __P((CARD [], int, int));
int pairuns __P((CARD [], int));
int peg __P((BOOLEAN));
int pegscore __P((CARD, CARD [], int, int));
int playhand __P((BOOLEAN));
int plyrhand __P((CARD [], char *));
void prcard __P((WINDOW *, int, int, CARD, BOOLEAN));
void prcrib __P((BOOLEAN, BOOLEAN));
void prhand __P((CARD [], int, WINDOW *, BOOLEAN));
void printcard __P((WINDOW *, int, CARD, BOOLEAN));
void prpeg __P((int, int, BOOLEAN));
void prtable __P((int));
int readchar __P((void));
void rint __P((int));
int score __P((BOOLEAN));
int scorehand __P((CARD [], CARD, int, BOOLEAN, BOOLEAN));
void shuffle __P((CARD []));
void sorthand __P((CARD [], int));
void wait_for __P((int));
void addmsg(const char *, ...);
int adjust(CARD [], CARD);
int anymove(CARD [], int, int);
int anysumto(CARD [], int, int, int);
void bye(void);
int cchose(CARD [], int, int);
void cdiscard(BOOLEAN);
int chkscr(int *, int);
int comphand(CARD [], char *);
void cremove(CARD, CARD [], int);
int cut(BOOLEAN, int);
int deal(int);
void discard(BOOLEAN);
void do_wait(void);
void endmsg(void);
int eq(CARD, CARD);
int fifteens(CARD [], int);
void game(void);
void gamescore(void);
char *getline(void);
int getuchar(void);
int incard(CARD *);
int infrom(CARD [], int, char *);
void instructions(void);
int isone(CARD, CARD [], int);
void makeboard(void);
void makedeck(CARD []);
void makeknown(CARD [], int);
void msg(const char *, ...);
int msgcard(CARD, BOOLEAN);
int msgcrd(CARD, BOOLEAN, char *, BOOLEAN);
int number(int, int, char *);
int numofval(CARD [], int, int);
int pairuns(CARD [], int);
int peg(BOOLEAN);
int pegscore(CARD, CARD [], int, int);
int playhand(BOOLEAN);
int plyrhand(CARD [], char *);
void prcard(WINDOW *, int, int, CARD, BOOLEAN);
void prcrib(BOOLEAN, BOOLEAN);
void prhand(CARD [], int, WINDOW *, BOOLEAN);
void printcard(WINDOW *, int, CARD, BOOLEAN);
void prpeg(int, int, BOOLEAN);
void prtable(int);
int readchar(void);
void rint(int);
int score(BOOLEAN);
int scorehand(CARD [], CARD, int, BOOLEAN, BOOLEAN);
void shuffle(CARD []);
void sorthand(CARD [], int);
void wait_for(int);

View File

@ -42,16 +42,12 @@ static const char rcsid[] =
#include <ctype.h>
#include <curses.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include "deck.h"
#include "cribbage.h"
@ -389,21 +385,11 @@ int Mpos = 0;
static int Newpos = 0;
void
#if __STDC__
msg(const char *fmt, ...)
#else
msg(fmt, va_alist)
char *fmt;
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
va_end(ap);
endmsg();
@ -414,21 +400,11 @@ msg(fmt, va_alist)
* Add things to the current message
*/
void
#if __STDC__
addmsg(const char *fmt, ...)
#else
addmsg(fmt, va_alist)
char *fmt;
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
va_end(ap);
}

View File

@ -68,15 +68,15 @@ static int priority = 0; /* priority game runs at */
static char *game, /* requested game */
*gametty; /* from tty? */
void c_day __P((char *, char *, char *));
void c_tty __P((char *));
void c_game __P((char *, char *, char *, char *));
void hour __P((int));
double load __P((void));
void nogamefile __P((void));
void play __P((char **));
void read_config __P((void));
int users __P((void));
void c_day(char *, char *, char *);
void c_tty(char *);
void c_game(char *, char *, char *, char *);
void hour(int);
double load(void);
void nogamefile(void);
void play(char **);
void read_config(void);
int users(void);
int
main(argc, argv)

View File

@ -88,8 +88,8 @@ extern ubig *pr_limit; /* largest prime in the prime array */
int hflag;
void pr_fact __P((ubig)); /* print factors of a value */
void usage __P((void));
void pr_fact(ubig); /* print factors of a value */
void usage(void);
int
main(argc, argv)

View File

@ -75,21 +75,21 @@ int promode;
int asked[RANKS], comphand[RANKS], deck[RANKS];
int userasked[RANKS], userhand[RANKS];
void chkwinner __P((int player, int *hand));
int compmove __P((void));
int countbooks __P((int *hand));
int countcards __P((int *hand));
int drawcard __P((int player, int *hand));
int gofish __P((int askedfor, int player, int *hand));
void goodmove __P((int player, int move, int *hand, int *opphand));
void init __P((void));
void instructions __P((void));
int nrandom __P((int n));
void printhand __P((int *hand));
void printplayer __P((int player));
int promove __P((void));
void usage __P((void));
int usermove __P((void));
void chkwinner(int player, int *hand);
int compmove(void);
int countbooks(int *hand);
int countcards(int *hand);
int drawcard(int player, int *hand);
int gofish(int askedfor, int player, int *hand);
void goodmove(int player, int move, int *hand, int *opphand);
void init(void);
void instructions(void);
int nrandom(int n);
void printhand(int *hand);
void printplayer(int player);
int promove(void);
void usage(void);
int usermove(void);
int
main(argc, argv)

View File

@ -80,13 +80,13 @@ extern FILE *Dict;
extern off_t Dict_size;
void die __P((int));
void endgame __P((void));
void getguess __P((void));
void getword __P((void));
void playgame __P((void));
void prdata __P((void));
void prman __P((void));
void prword __P((void));
char readch __P((void));
void setup __P((void));
void die(int);
void endgame(void);
void getguess(void);
void getword(void);
void playgame(void);
void prdata(void);
void prman(void);
void prword(void);
char readch(void);
void setup(void);

View File

@ -46,8 +46,8 @@ static const char rcsid[] =
*/
#ifndef EXTRAP
void extrapolate __P((PLAY *));
void undoex __P((void));
void extrapolate(PLAY *);
void undoex(void);
#endif
/*

View File

@ -56,7 +56,7 @@ static const char rcsid[] =
* @(#)mille.c 1.3 (Berkeley) 5/10/83
*/
static void usage __P((void));
static void usage(void);
int
main(ac, av)

View File

@ -232,37 +232,37 @@ extern WINDOW *Board, *Miles, *Score;
* functions
*/
void account __P((CARD));
void calcmove __P((void));
bool canplay __P((PLAY *, PLAY *, CARD));
bool check_ext __P((bool));
void check_more __P((void));
void die __P((int));
void domove __P((void));
bool error __P((char *, ...));
void account(CARD);
void calcmove(void);
bool canplay(PLAY *, PLAY *, CARD);
bool check_ext(bool);
void check_more(void);
void die(int);
void domove(void);
bool error(char *, ...);
#ifdef EXTRAP
void extrapolate __P((PLAY *));
void extrapolate(PLAY *);
#endif
void finalscore __P((PLAY *));
CARD getcard __P((void));
bool getyn __P((int));
void init __P((void));
int isrepair __P((CARD));
void newboard __P((void));
void newscore __P((void));
bool onecard __P((PLAY *));
void prboard __P((void));
void prompt __P((int));
void prscore __P((bool));
char readch __P((void));
bool rest_f __P((char *));
int roll __P((int, int));
void rub __P((int));
CARD safety __P((CARD));
bool save __P((void));
void shuffle __P((void));
void sort __P((CARD *));
void varpush __P((int, int (*)()));
void finalscore(PLAY *);
CARD getcard(void);
bool getyn(int);
void init(void);
int isrepair(CARD);
void newboard(void);
void newscore(void);
bool onecard(PLAY *);
void prboard(void);
void prompt(int);
void prscore(bool);
char readch(void);
bool rest_f(char *);
int roll(int, int);
void rub(int);
CARD safety(CARD);
bool save(void);
void shuffle(void);
void sort(CARD *);
void varpush(int, int (*)());
#ifdef EXTRAP
void undoex __P((void));
void undoex(void);
#endif

View File

@ -60,10 +60,10 @@ const char *Movenames[] = {
"M_DISCARD", "M_DRAW", "M_PLAY", "M_ORDER"
};
static void check_go __P((void));
static void getmove __P((void));
static int haspicked __P((PLAY *));
static bool playcard __P((PLAY *));
static void check_go(void);
static void getmove(void);
static int haspicked(PLAY *);
static bool playcard(PLAY *);
void
domove()

View File

@ -48,8 +48,8 @@ static const char rcsid[] =
# define COMP_STRT 20
# define CARD_STRT 2
static void show_card __P((int, int, CARD, CARD *));
static void show_score __P((int, int, int, int *));
static void show_card(int, int, CARD, CARD *);
static void show_score(int, int, int, int *);
void
prboard() {

View File

@ -78,12 +78,12 @@ static const char *name1[] = {
"novemdecillion", "vigintillion",
};
void convert __P((char *));
int number __P((char *, int));
void pfract __P((int));
void toobig __P((void));
int unit __P((int, char *));
void usage __P((void));
void convert(char *);
int number(char *, int);
void pfract(int);
void toobig(void);
int unit(int, char *);
void usage(void);
int lflag;

View File

@ -1444,7 +1444,7 @@ readmessage()
error(whichfile)
char *whichfile;
{
int (*funcp) __P((const char *, ...));
int (*funcp)(const char *, ...);
if (Windows)
{

View File

@ -61,7 +61,7 @@ main(argc, argv)
char *argv[];
{
char **filename; /* for pointing to file names */
register int fd; /* file descriptor */
int fd; /* file descriptor */
FILE *fp; /* for opening files */
struct stat fbuf; /* for getting files statistics */
int ch;

View File

@ -53,8 +53,8 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
void pigout __P((char *, int));
void usage __P((void));
void pigout(char *, int);
void usage(void);
int
main(argc, argv)

View File

@ -73,10 +73,9 @@ static const char rcsid[] =
#define Nzero 55.204723 /* lunar mean long of node at EPOCH */
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
static void adj360 __P((double *));
static double dtor __P((double));
int main __P((void));
static double potm __P((double));
static void adj360(double *);
static double dtor(double);
static double potm(double);
int
main()

View File

@ -107,9 +107,9 @@ extern int pattern_size; /* length of pattern array */
int hflag;
void primes __P((ubig, ubig));
ubig read_num_buf __P((void));
void usage __P((void));
void primes(ubig, ubig);
ubig read_num_buf(void);
void usage(void);
int
main(argc, argv)

View File

@ -53,6 +53,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -66,16 +67,16 @@ static QE qlist;
static int catone, cattwo, tflag;
static u_int qsize;
char *appdstr __P((char *, char *, size_t));
void downcase __P((char *));
void err __P((const char *, ...));
void get_cats __P((char *, char *));
void get_file __P((char *));
char *next_cat __P((char *));
void quiz __P((void));
void score __P((u_int, u_int, u_int));
void show_index __P((void));
void usage __P((void));
char *appdstr(char *, char *, size_t);
void downcase(char *);
void err(const char *, ...);
void get_cats(char *, char *);
void get_file(char *);
char *next_cat(char *);
void quiz(void);
void score(u_int, u_int, u_int);
void show_index(void);
void usage(void);
int
main(argc, argv)
@ -369,27 +370,11 @@ usage()
exit(1);
}
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
void
#if __STDC__
err(const char *fmt, ...)
#else
err(fmt, va_alist)
char *fmt;
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
(void)fprintf(stderr, "quiz: ");
(void)vfprintf(stderr, fmt, ap);
va_end(ap);

View File

@ -37,6 +37,10 @@
* @(#)quiz.h 8.1 (Berkeley) 5/31/93
*/
#include <sys/defs.h>
__FBSDID("$FreeBSD$");
#define TRUE 1
#define FALSE 0
@ -56,6 +60,6 @@ typedef struct qentry {
extern char rxperr[];
int rxp_compile __P((char *));
char *rxp_expand __P((void));
int rxp_match __P((char *));
int rxp_compile(char *);
char *rxp_expand(void);
int rxp_match(char *);

View File

@ -82,9 +82,9 @@ typedef short Rxp_t; /* type for regexp tokens */
static Rxp_t rxpbuf[RXP_LINE_SZ]; /* compiled regular expression buffer */
char rxperr[128]; /* parser error message */
static int rxp__compile __P((char *, int));
static char *rxp__expand __P((int));
static int rxp__match __P((char *, int, Rxp_t *, Rxp_t *, char *));
static int rxp__compile(char *, int);
static char *rxp__expand(int);
static int rxp__match(char *, int, Rxp_t *, Rxp_t *, char *);
int
rxp_compile(s)

View File

@ -60,7 +60,7 @@ static const char rcsid[] =
volatile sig_atomic_t sig_caught = 0;
static void onsig __P((int sig));
static void onsig(int sig);
int
main(int argc, char **argv)

View File

@ -58,7 +58,7 @@ static const char rcsid[] =
#include <time.h>
#include <unistd.h>
void usage __P((void));
void usage(void);
int
main(argc, argv)

View File

@ -61,12 +61,12 @@ pl_main()
initialize()
{
register struct File *fp;
register struct ship *sp;
struct File *fp;
struct ship *sp;
char captain[80];
char message[60];
int load;
register int n;
int n;
char *nameptr;
int nat[NNATION];

View File

@ -85,17 +85,17 @@ int start_len = LENGTH;
char lastch;
char outbuf[BUFSIZ];
void crash __P((void));
void display __P((struct body *, char));
void leave __P((int));
void life __P((void));
void newpos __P((struct body *));
void prize __P((void));
void process __P((char));
long rnd __P((int));
void setup __P((void));
void suspend __P((int));
void wake __P((int));
void crash(void);
void display(struct body *, char);
void leave(int);
void life(void);
void newpos(struct body *);
void prize(void);
void process(char);
long rnd(int);
void setup(void);
void suspend(int);
void wake(int);
int
main(argc, argv)

View File

@ -179,8 +179,8 @@ static struct worm {
} *worm;
volatile sig_atomic_t sig_caught = 0;
void onsig __P((int));
void nomem(void);
void onsig(int);
int
main(argc, argv)

View File

@ -116,20 +116,20 @@ char answer[20]; /* user input */
int bats_nearby(void);
void cave_init(void);
void clear_things_in_cave(void);
void display_room_stats __P((void));
int getans __P((const char *prompt));
void display_room_stats(void);
int getans(const char *prompt);
void initialize_things_in_cave(void);
void instructions(void);
int int_compare __P((const void *va, const void *vb));
int int_compare(const void *va, const void *vb);
void jump(int where);
void kill_wump(void);
int move_to __P((char *room_number));
int move_to(char *room_number);
void move_wump(void);
void no_arrows(void);
void pit_kill(void);
int pit_nearby(void);
void pit_survive(void);
int shoot __P((char *room_list));
int shoot(char *room_list);
void shoot_self(void);
int take_action(void);
void usage(void);