mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 06:42:45 +00:00
-Wall fixes.
This commit is contained in:
parent
5f3bfd608d
commit
ee63d901b3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54488
@ -199,6 +199,53 @@ bool startedgame = FALSE, infullgame = FALSE;
|
|||||||
time_t acctstart;
|
time_t acctstart;
|
||||||
int dbfd = -1;
|
int dbfd = -1;
|
||||||
|
|
||||||
|
void askquit __P((int));
|
||||||
|
void cleanup __P((int));
|
||||||
|
void cleanupboard __P((void));
|
||||||
|
void clearabovemovebox __P((void));
|
||||||
|
void clearbelowmovebox __P((void));
|
||||||
|
void clearmsg __P((void));
|
||||||
|
void clearstat __P((void));
|
||||||
|
void destinerror __P((void));
|
||||||
|
bool diffcolor __P((struct cardtype *, struct cardtype *));
|
||||||
|
void dumberror __P((void));
|
||||||
|
bool finish __P((void));
|
||||||
|
void fndbase __P((struct cardtype **, int, int));
|
||||||
|
void getcmd __P((int, int, char *));
|
||||||
|
void initall __P((void));
|
||||||
|
void initdeck __P((struct cardtype *[]));
|
||||||
|
void initgame __P((void));
|
||||||
|
void instruct __P((void));
|
||||||
|
void makeboard __P((void));
|
||||||
|
void movebox __P((void));
|
||||||
|
void movecard __P((void));
|
||||||
|
void movetofound __P((struct cardtype **, int));
|
||||||
|
void movetotalon __P((void));
|
||||||
|
bool notempty __P((struct cardtype *));
|
||||||
|
void printbottombettingbox __P((void));
|
||||||
|
void printbottominstructions __P((void));
|
||||||
|
void printcard __P((int, int, struct cardtype *));
|
||||||
|
void printrank __P((int, int, struct cardtype *, bool));
|
||||||
|
void printtopbettingbox __P((void));
|
||||||
|
void printtopinstructions __P((void));
|
||||||
|
bool rankhigher __P((struct cardtype *, int));
|
||||||
|
bool ranklower __P((struct cardtype *, struct cardtype *));
|
||||||
|
void removecard __P((int, int));
|
||||||
|
bool samesuit __P((struct cardtype *, int));
|
||||||
|
void showcards __P((void));
|
||||||
|
void showstat __P((void));
|
||||||
|
void shuffle __P((struct cardtype *[]));
|
||||||
|
void simpletableau __P((struct cardtype **, int));
|
||||||
|
void startgame __P((void));
|
||||||
|
void suspend __P((void));
|
||||||
|
bool tabok __P((struct cardtype *, int));
|
||||||
|
void tabprint __P((int, int));
|
||||||
|
void tabtotab __P((int, int));
|
||||||
|
void transit __P((struct cardtype **, struct cardtype **));
|
||||||
|
void updatebettinginfo __P((void));
|
||||||
|
void usedstock __P((void));
|
||||||
|
void usedtalon __P((void));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following procedures print the board onto the screen using the
|
* The following procedures print the board onto the screen using the
|
||||||
* addressible cursor. The end of these procedures will also be
|
* addressible cursor. The end of these procedures will also be
|
||||||
@ -206,6 +253,7 @@ int dbfd = -1;
|
|||||||
*
|
*
|
||||||
* procedure to set the move command box
|
* procedure to set the move command box
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
movebox()
|
movebox()
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -240,6 +288,7 @@ movebox()
|
|||||||
/*
|
/*
|
||||||
* print directions above move box
|
* print directions above move box
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printtopinstructions()
|
printtopinstructions()
|
||||||
{
|
{
|
||||||
move(tboxrow, boxcol);
|
move(tboxrow, boxcol);
|
||||||
@ -273,6 +322,7 @@ printtopinstructions()
|
|||||||
/*
|
/*
|
||||||
* Print the betting box.
|
* Print the betting box.
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printtopbettingbox()
|
printtopbettingbox()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -307,6 +357,7 @@ printtopbettingbox()
|
|||||||
/*
|
/*
|
||||||
* clear info above move box
|
* clear info above move box
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
clearabovemovebox()
|
clearabovemovebox()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -322,6 +373,7 @@ clearabovemovebox()
|
|||||||
/*
|
/*
|
||||||
* print instructions below move box
|
* print instructions below move box
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printbottominstructions()
|
printbottominstructions()
|
||||||
{
|
{
|
||||||
move(bboxrow, boxcol);
|
move(bboxrow, boxcol);
|
||||||
@ -335,6 +387,7 @@ printbottominstructions()
|
|||||||
/*
|
/*
|
||||||
* print betting information below move box
|
* print betting information below move box
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printbottombettingbox()
|
printbottombettingbox()
|
||||||
{
|
{
|
||||||
move(bboxrow, boxcol);
|
move(bboxrow, boxcol);
|
||||||
@ -348,6 +401,7 @@ printbottombettingbox()
|
|||||||
/*
|
/*
|
||||||
* clear info below move box
|
* clear info below move box
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
clearbelowmovebox()
|
clearbelowmovebox()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -363,6 +417,7 @@ clearbelowmovebox()
|
|||||||
/*
|
/*
|
||||||
* procedure to put the board on the screen using addressable cursor
|
* procedure to put the board on the screen using addressable cursor
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
makeboard()
|
makeboard()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
@ -401,11 +456,13 @@ makeboard()
|
|||||||
/*
|
/*
|
||||||
* clean up the board for another game
|
* clean up the board for another game
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
cleanupboard()
|
cleanupboard()
|
||||||
{
|
{
|
||||||
int cnt, row, col;
|
int cnt, row, col;
|
||||||
struct cardtype *ptr;
|
struct cardtype *ptr;
|
||||||
|
|
||||||
|
col = 0;
|
||||||
if (Cflag) {
|
if (Cflag) {
|
||||||
clearstat();
|
clearstat();
|
||||||
for(ptr = stock, row = stockrow;
|
for(ptr = stock, row = stockrow;
|
||||||
@ -456,6 +513,7 @@ cleanupboard()
|
|||||||
/*
|
/*
|
||||||
* procedure to create a deck of cards
|
* procedure to create a deck of cards
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
initdeck(deck)
|
initdeck(deck)
|
||||||
struct cardtype *deck[];
|
struct cardtype *deck[];
|
||||||
{
|
{
|
||||||
@ -481,6 +539,7 @@ initdeck(deck)
|
|||||||
/*
|
/*
|
||||||
* procedure to shuffle the deck
|
* procedure to shuffle the deck
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
shuffle(deck)
|
shuffle(deck)
|
||||||
struct cardtype *deck[];
|
struct cardtype *deck[];
|
||||||
{
|
{
|
||||||
@ -504,6 +563,7 @@ shuffle(deck)
|
|||||||
/*
|
/*
|
||||||
* procedure to remove the card from the board
|
* procedure to remove the card from the board
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
removecard(a, b)
|
removecard(a, b)
|
||||||
{
|
{
|
||||||
move(b, a);
|
move(b, a);
|
||||||
@ -513,6 +573,7 @@ removecard(a, b)
|
|||||||
/*
|
/*
|
||||||
* procedure to print the cards on the board
|
* procedure to print the cards on the board
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printrank(a, b, cp, inverse)
|
printrank(a, b, cp, inverse)
|
||||||
struct cardtype *cp;
|
struct cardtype *cp;
|
||||||
bool inverse;
|
bool inverse;
|
||||||
@ -546,6 +607,7 @@ printrank(a, b, cp, inverse)
|
|||||||
/*
|
/*
|
||||||
* procedure to print out a card
|
* procedure to print out a card
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printcard(a, b, cp)
|
printcard(a, b, cp)
|
||||||
int a,b;
|
int a,b;
|
||||||
struct cardtype *cp;
|
struct cardtype *cp;
|
||||||
@ -572,6 +634,7 @@ printcard(a, b, cp)
|
|||||||
* of another location. The pointers always point to the top
|
* of another location. The pointers always point to the top
|
||||||
* of the piles.
|
* of the piles.
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
transit(source, dest)
|
transit(source, dest)
|
||||||
struct cardtype **source, **dest;
|
struct cardtype **source, **dest;
|
||||||
{
|
{
|
||||||
@ -588,6 +651,7 @@ transit(source, dest)
|
|||||||
* Note that it is only called on a foundation pile at the beginning of
|
* Note that it is only called on a foundation pile at the beginning of
|
||||||
* the game, so the pile will have exactly one card in it.
|
* the game, so the pile will have exactly one card in it.
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
fndbase(cp, column, row)
|
fndbase(cp, column, row)
|
||||||
struct cardtype **cp;
|
struct cardtype **cp;
|
||||||
{
|
{
|
||||||
@ -632,6 +696,7 @@ fndbase(cp, column, row)
|
|||||||
/*
|
/*
|
||||||
* procedure to initialize the things necessary for the game
|
* procedure to initialize the things necessary for the game
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
initgame()
|
initgame()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -677,6 +742,7 @@ initgame()
|
|||||||
/*
|
/*
|
||||||
* procedure to print the beginning cards and to start each game
|
* procedure to print the beginning cards and to start each game
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
startgame()
|
startgame()
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
@ -717,6 +783,7 @@ startgame()
|
|||||||
/*
|
/*
|
||||||
* procedure to clear the message printed from an error
|
* procedure to clear the message printed from an error
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
clearmsg()
|
clearmsg()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -733,6 +800,7 @@ clearmsg()
|
|||||||
/*
|
/*
|
||||||
* procedure to print an error message if the move is not listed
|
* procedure to print an error message if the move is not listed
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
dumberror()
|
dumberror()
|
||||||
{
|
{
|
||||||
errmsg = TRUE;
|
errmsg = TRUE;
|
||||||
@ -743,6 +811,7 @@ dumberror()
|
|||||||
/*
|
/*
|
||||||
* procedure to print an error message if the move is not possible
|
* procedure to print an error message if the move is not possible
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
destinerror()
|
destinerror()
|
||||||
{
|
{
|
||||||
errmsg = TRUE;
|
errmsg = TRUE;
|
||||||
@ -822,6 +891,7 @@ tabok(cp, des)
|
|||||||
/*
|
/*
|
||||||
* procedure to turn the cards onto the talon from the deck
|
* procedure to turn the cards onto the talon from the deck
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
movetotalon()
|
movetotalon()
|
||||||
{
|
{
|
||||||
int i, fin;
|
int i, fin;
|
||||||
@ -906,6 +976,7 @@ movetotalon()
|
|||||||
/*
|
/*
|
||||||
* procedure to print card counting info on screen
|
* procedure to print card counting info on screen
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
showstat()
|
showstat()
|
||||||
{
|
{
|
||||||
int row, col;
|
int row, col;
|
||||||
@ -948,6 +1019,7 @@ showstat()
|
|||||||
/*
|
/*
|
||||||
* procedure to clear card counting info from screen
|
* procedure to clear card counting info from screen
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
clearstat()
|
clearstat()
|
||||||
{
|
{
|
||||||
int row;
|
int row;
|
||||||
@ -967,6 +1039,7 @@ clearstat()
|
|||||||
/*
|
/*
|
||||||
* procedure to update card counting base
|
* procedure to update card counting base
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
usedtalon()
|
usedtalon()
|
||||||
{
|
{
|
||||||
removecard(coldcol, coldrow);
|
removecard(coldcol, coldrow);
|
||||||
@ -991,6 +1064,7 @@ usedtalon()
|
|||||||
/*
|
/*
|
||||||
* procedure to update stock card counting base
|
* procedure to update stock card counting base
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
usedstock()
|
usedstock()
|
||||||
{
|
{
|
||||||
stockcnt--;
|
stockcnt--;
|
||||||
@ -1003,6 +1077,7 @@ usedstock()
|
|||||||
/*
|
/*
|
||||||
* let 'em know how they lost!
|
* let 'em know how they lost!
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
showcards()
|
showcards()
|
||||||
{
|
{
|
||||||
struct cardtype *ptr;
|
struct cardtype *ptr;
|
||||||
@ -1050,6 +1125,7 @@ showcards()
|
|||||||
/*
|
/*
|
||||||
* procedure to update the betting values
|
* procedure to update the betting values
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
updatebettinginfo()
|
updatebettinginfo()
|
||||||
{
|
{
|
||||||
long thiscosts, gamecosts, totalcosts;
|
long thiscosts, gamecosts, totalcosts;
|
||||||
@ -1107,6 +1183,7 @@ updatebettinginfo()
|
|||||||
/*
|
/*
|
||||||
* procedure to move a card from the stock or talon to the tableau
|
* procedure to move a card from the stock or talon to the tableau
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
simpletableau(cp, des)
|
simpletableau(cp, des)
|
||||||
struct cardtype **cp;
|
struct cardtype **cp;
|
||||||
{
|
{
|
||||||
@ -1139,6 +1216,7 @@ struct cardtype **cp;
|
|||||||
/*
|
/*
|
||||||
* print the tableau
|
* print the tableau
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
tabprint(sour, des)
|
tabprint(sour, des)
|
||||||
{
|
{
|
||||||
int dlength, slength, i;
|
int dlength, slength, i;
|
||||||
@ -1164,6 +1242,7 @@ tabprint(sour, des)
|
|||||||
/*
|
/*
|
||||||
* procedure to move from the tableau to the tableau
|
* procedure to move from the tableau to the tableau
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
tabtotab(sour, des)
|
tabtotab(sour, des)
|
||||||
int sour, des;
|
int sour, des;
|
||||||
{
|
{
|
||||||
@ -1208,6 +1287,7 @@ rankhigher(cp, let)
|
|||||||
/*
|
/*
|
||||||
* function to determine if two cards are the same suit
|
* function to determine if two cards are the same suit
|
||||||
*/
|
*/
|
||||||
|
bool
|
||||||
samesuit(cp, let)
|
samesuit(cp, let)
|
||||||
struct cardtype *cp;
|
struct cardtype *cp;
|
||||||
{
|
{
|
||||||
@ -1220,6 +1300,7 @@ samesuit(cp, let)
|
|||||||
/*
|
/*
|
||||||
* procedure to move a card to the correct foundation pile
|
* procedure to move a card to the correct foundation pile
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
movetofound(cp, source)
|
movetofound(cp, source)
|
||||||
struct cardtype **cp;
|
struct cardtype **cp;
|
||||||
{
|
{
|
||||||
@ -1270,6 +1351,7 @@ movetofound(cp, source)
|
|||||||
/*
|
/*
|
||||||
* procedure to get a command
|
* procedure to get a command
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
getcmd(row, col, cp)
|
getcmd(row, col, cp)
|
||||||
int row, col;
|
int row, col;
|
||||||
char *cp;
|
char *cp;
|
||||||
@ -1320,6 +1402,7 @@ getcmd(row, col, cp)
|
|||||||
/*
|
/*
|
||||||
* Suspend the game (shell escape if no process control on system)
|
* Suspend the game (shell escape if no process control on system)
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
suspend()
|
suspend()
|
||||||
{
|
{
|
||||||
#ifndef SIGTSTP
|
#ifndef SIGTSTP
|
||||||
@ -1341,11 +1424,14 @@ suspend()
|
|||||||
/*
|
/*
|
||||||
* procedure to evaluate and make the specific moves
|
* procedure to evaluate and make the specific moves
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
movecard()
|
movecard()
|
||||||
{
|
{
|
||||||
int source, dest;
|
int source, dest;
|
||||||
char osrcpile, odestpile;
|
char osrcpile, odestpile;
|
||||||
|
|
||||||
|
source = 0;
|
||||||
|
dest = 0;
|
||||||
done = FALSE;
|
done = FALSE;
|
||||||
errmsg = FALSE;
|
errmsg = FALSE;
|
||||||
do {
|
do {
|
||||||
@ -1536,6 +1622,7 @@ char *bettinginstructions[] = {
|
|||||||
/*
|
/*
|
||||||
* procedure to printout instructions
|
* procedure to printout instructions
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
instruct()
|
instruct()
|
||||||
{
|
{
|
||||||
char **cp;
|
char **cp;
|
||||||
@ -1571,6 +1658,7 @@ instruct()
|
|||||||
/*
|
/*
|
||||||
* procedure to initialize the game
|
* procedure to initialize the game
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
initall()
|
initall()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1638,7 +1726,8 @@ finish()
|
|||||||
* procedure to clean up and exit
|
* procedure to clean up and exit
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cleanup()
|
cleanup(sig)
|
||||||
|
int sig;
|
||||||
{
|
{
|
||||||
|
|
||||||
total.thinktime += 1;
|
total.thinktime += 1;
|
||||||
@ -1661,7 +1750,8 @@ cleanup()
|
|||||||
* Field an interrupt.
|
* Field an interrupt.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
askquit()
|
askquit(sig)
|
||||||
|
int sig;
|
||||||
{
|
{
|
||||||
move(msgrow, msgcol);
|
move(msgrow, msgcol);
|
||||||
printw("Really wish to quit? ");
|
printw("Really wish to quit? ");
|
||||||
@ -1670,13 +1760,14 @@ askquit()
|
|||||||
} while (srcpile != 'y' && srcpile != 'n');
|
} while (srcpile != 'y' && srcpile != 'n');
|
||||||
clearmsg();
|
clearmsg();
|
||||||
if (srcpile == 'y')
|
if (srcpile == 'y')
|
||||||
cleanup();
|
cleanup(0);
|
||||||
signal(SIGINT, askquit);
|
signal(SIGINT, askquit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Can you tell that this used to be a Pascal program?
|
* Can you tell that this used to be a Pascal program?
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
dbfd = open(_PATH_SCORE, O_RDWR);
|
dbfd = open(_PATH_SCORE, O_RDWR);
|
||||||
@ -1713,6 +1804,7 @@ main()
|
|||||||
else
|
else
|
||||||
cleanupboard();
|
cleanupboard();
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup(0);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ static const char rcsid[] =
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
|
||||||
struct betinfo {
|
struct betinfo {
|
||||||
@ -64,6 +65,9 @@ struct betinfo {
|
|||||||
|
|
||||||
int dbfd;
|
int dbfd;
|
||||||
|
|
||||||
|
void printuser __P((struct passwd *, int));
|
||||||
|
|
||||||
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
@ -109,6 +113,7 @@ main(argc, argv)
|
|||||||
/*
|
/*
|
||||||
* print out info for specified password entry
|
* print out info for specified password entry
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
printuser(pw, printfail)
|
printuser(pw, printfail)
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
int printfail;
|
int printfail;
|
||||||
|
Loading…
Reference in New Issue
Block a user