Skip to content

Commit 071074d

Browse files
committed
Make signal handlers void handler(int sig).
1 parent 2760504 commit 071074d

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

hack.cmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "hack.h"
55
#include "def.func_tab.h"
66

7+
/* done1() is now a void function but declaring it int here is ok. */
78
int doredraw(),doredotopl(),dodrop(),dodrink(),doread(),dosearch(),dopickup(),
89
doversion(),doweararm(),dowearring(),doremarm(),doremring(),dopay(),doapply(),
910
dosave(),dowield(),ddoinv(),dozap(),ddocall(),dowhatis(),doengrave(),dotele(),

hack.end.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ extern const char *ordin();
1111

1212
xchar maxdlevel = 1;
1313

14-
done1()
14+
void
15+
done1(int sig)
1516
{
1617
(void) signal(SIGINT,SIG_IGN);
1718
pline("Really quit?");
@@ -20,7 +21,7 @@ done1()
2021
clrlin();
2122
(void) fflush(stdout);
2223
if(multi > 0) nomul(0);
23-
return(0);
24+
return;
2425
}
2526
done("quit");
2627
/* NOTREACHED */
@@ -29,16 +30,18 @@ done1()
2930
int done_stopprint;
3031
int done_hup;
3132

32-
done_intr(){
33+
void
34+
done_intr(int sig){
3335
done_stopprint++;
3436
(void) signal(SIGINT, SIG_IGN);
3537
(void) signal(SIGQUIT, SIG_IGN);
3638
}
3739

38-
done_hangup(){
40+
void
41+
done_hangup(int sig){
3942
done_hup++;
4043
(void) signal(SIGHUP, SIG_IGN);
41-
done_intr();
44+
done_intr(0);
4245
}
4346

4447
done_in_by(mtmp) register struct monst *mtmp; {
@@ -472,7 +475,8 @@ register x;
472475
}
473476

474477
#ifdef NOSAVEONHANGUP
475-
hangup()
478+
void
479+
hangup(int sig)
476480
{
477481
(void) signal(SIGINT, SIG_IGN);
478482
clearlocks();

hack.main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ int (*afternmv)();
1818
int (*occupation)();
1919
char const *occtxt; /* defined when occupation != NULL */
2020

21-
int done1();
22-
int hangup();
21+
void done1(int sig);
22+
void hangup(int sig);
2323

2424
int hackpid; /* current pid */
2525
int locknum; /* max num of players */

hack.pager.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern int CO, LI; /* usually COLNO and ROWNO+2 */
1313
extern char *CD;
1414
extern char quitchars[];
1515
extern char *getenv(), *getlogin();
16-
int done1();
16+
void done1(int sig);
1717

1818
dowhatis()
1919
{
@@ -59,7 +59,8 @@ dowhatis()
5959
/* make the paging of a file interruptible */
6060
static int got_intrup;
6161

62-
intruph(){
62+
void
63+
intruph(int sig){
6364
got_intrup++;
6465
}
6566

@@ -69,7 +70,7 @@ FILE *fp;
6970
int strip; /* nr of chars to be stripped from each line (0 or 1) */
7071
{
7172
register char *bufr, *ep;
72-
int (*prevsig)() = signal(SIGINT, intruph);
73+
void (*prevsig)(int) = signal(SIGINT, intruph);
7374

7475
set_pager(0);
7576
bufr = (char *) alloc((unsigned) CO);

hack.save.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ dosave(){
2323
}
2424

2525
#ifndef NOSAVEONHANGUP
26-
hangup(){
26+
void
27+
hangup(int sig){
2728
(void) dosave0(1);
2829
exit(1);
2930
}

0 commit comments

Comments
 (0)