comparison srogue/main.c @ 217:94a0d9dd5ce1

Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings.
author John "Elwin" Edwards
date Sun, 31 Jan 2016 13:45:07 -0500
parents 3de8058dd549
children b922f66acf4d
comparison
equal deleted inserted replaced
216:b24545357d2e 217:94a0d9dd5ce1
32 #include <sys/time.h> 32 #include <sys/time.h>
33 #endif 33 #endif
34 34
35 #include "rogue.ext" 35 #include "rogue.ext"
36 36
37 char *roguehome(void);
37 void open_records(void); 38 void open_records(void);
38 39
39 extern int scorefd; 40 extern int scorefd;
40 extern FILE *logfile; 41 extern FILE *logfile;
41 42
42 main(argc, argv, envp) 43 int
43 char **argv; 44 main(int argc, char *argv[], char *envp[])
44 char **envp;
45 { 45 {
46 register char *env; 46 register char *env;
47 register struct linked_list *item; 47 register struct linked_list *item;
48 register struct object *obj; 48 register struct object *obj;
49 char alldone, wpt; 49 char alldone, wpt;
50 char *getpass(), *xcrypt(), *strrchr(); 50 char *getpass(), *xcrypt(), *strrchr();
51 int lowtime; 51 int lowtime;
52 time_t now; 52 time_t now;
53 char *roguehome();
54 char *homedir = roguehome(); 53 char *homedir = roguehome();
55 54
56 #ifdef __DJGPP__ 55 #ifdef __DJGPP__
57 _fmode = O_BINARY; 56 _fmode = O_BINARY;
58 #endif 57 #endif
320 /* 319 /*
321 * fatal: 320 * fatal:
322 * Exit the program, printing a message. 321 * Exit the program, printing a message.
323 */ 322 */
324 323
325 fatal(s) 324 void
326 char *s; 325 fatal(char *s)
327 { 326 {
328 clear(); 327 clear();
329 refresh(); 328 refresh();
330 endwin(); 329 endwin();
331 fprintf(stderr,"%s\n\r",s); 330 fprintf(stderr,"%s\n\r",s);
338 * Exit here and reset the users terminal parameters 337 * Exit here and reset the users terminal parameters
339 * to the way they were when he started 338 * to the way they were when he started
340 */ 339 */
341 340
342 void 341 void
343 byebye(how) 342 byebye(int how)
344 int how;
345 { 343 {
346 if (!isendwin()) 344 if (!isendwin())
347 endwin(); 345 endwin();
348 346
349 exit(how); /* exit like flag says */ 347 exit(how); /* exit like flag says */
352 350
353 /* 351 /*
354 * rnd: 352 * rnd:
355 * Pick a very random number. 353 * Pick a very random number.
356 */ 354 */
357 rnd(range) 355 int
358 int range; 356 rnd(int range)
359 { 357 {
360 reg int wh; 358 reg int wh;
361 359
362 if (range == 0) 360 if (range == 0)
363 wh = 0; 361 wh = 0;
370 368
371 /* 369 /*
372 * roll: 370 * roll:
373 * roll a number of dice 371 * roll a number of dice
374 */ 372 */
375 roll(number, sides) 373 int
376 int number, sides; 374 roll(int number, int sides)
377 { 375 {
378 reg int dtotal = 0; 376 reg int dtotal = 0;
379 377
380 while(number-- > 0) 378 while(number-- > 0)
381 dtotal += rnd(sides)+1; 379 dtotal += rnd(sides)+1;
384 382
385 383
386 /* 384 /*
387 ** setup: Setup signal catching functions 385 ** setup: Setup signal catching functions
388 */ 386 */
389 setup() 387 void
388 setup(void)
390 { 389 {
391 md_onsignal_autosave(); 390 md_onsignal_autosave();
392 391
393 nonl(); 392 nonl();
394 cbreak(); 393 cbreak();
398 /* 397 /*
399 ** playit: The main loop of the program. Loop until the game is over, 398 ** playit: The main loop of the program. Loop until the game is over,
400 ** refreshing things and looking at the proper times. 399 ** refreshing things and looking at the proper times.
401 */ 400 */
402 401
403 playit() 402 void
403 playit(void)
404 { 404 {
405 reg char *opts; 405 reg char *opts;
406 406
407 /* parse environment declaration of options */ 407 /* parse environment declaration of options */
408 408
419 419
420 420
421 /* 421 /*
422 ** author: See if a user is an author of the program 422 ** author: See if a user is an author of the program
423 */ 423 */
424 author() 424 bool
425 author(void)
425 { 426 {
426 switch (playuid) { 427 switch (playuid) {
427 case 100: 428 case 100:
428 case 0: 429 case 0:
429 return TRUE; 430 return TRUE;
442 443
443 return(0); 444 return(0);
444 } 445 }
445 446
446 char * 447 char *
447 roguehome() 448 roguehome(void)
448 { 449 {
449 static char path[LINLEN+16]; 450 static char path[LINLEN+16];
450 char *end,*home; 451 char *end,*home;
451 452
452 if ( (home = getenv("ROGUEHOME")) != NULL) 453 if ( (home = getenv("ROGUEHOME")) != NULL)