fortune.diff

pavalos, 08/04/2006 07:18 PM

Download (19.1 KB)

View differences:

games/fortune/fortune/Makefile 10 Oct 2005 01:31:36 -0000
7 7
CFLAGS+=-DDEBUG -Wall -I${.CURDIR}/../strfile
8 8
DPADD=	${LIBCOMPAT}
9 9
LDADD=	-lcompat
10
WARNS?=	6
10 11

  
11 12
.include "${.CURDIR}/../../Makefile.inc"
12 13
.include <bsd.prog.mk>
games/fortune/fortune/fortune.c 10 Oct 2005 01:38:48 -0000
48 48
# include	<fcntl.h>
49 49
# include	<assert.h>
50 50
# include	<unistd.h>
51
# include	<stdbool.h>
51 52
# include	<stdio.h>
52 53
# include	<ctype.h>
53 54
# include	<stdlib.h>
......
57 58
# include	"strfile.h"
58 59
# include	"pathnames.h"
59 60

  
60
# define	TRUE	1
61
# define	FALSE	0
62
# define	bool	short
63

  
64 61
# define	MINW	6		/* minimum wait if desired */
65 62
# define	CPERS	20		/* # of chars for each sec */
66 63
# define	SLEN	160		/* # of chars in short fortune */
......
81 78
	int		fd, datfd;
82 79
	long            pos;
83 80
	FILE		*inf;
84
	char		*name;
85
	char		*path;
81
	const char	*name;
82
	const char	*path;
86 83
	char		*datfile, *posfile;
87 84
	bool		read_tbl;
88 85
	bool		was_pos_file;
......
93 90
} FILEDESC;
94 91

  
95 92
bool	Found_one;			/* did we find a match? */
96
bool	Find_files	= FALSE;	/* just find a list of proper fortune files */
97
bool    Fortunes_only   = FALSE;        /* check only "fortunes" files */
98
bool	Wait		= FALSE;	/* wait desired after fortune */
99
bool	Short_only	= FALSE;	/* short fortune desired */
100
bool	Long_only	= FALSE;	/* long fortune desired */
101
bool	Offend		= FALSE;	/* offensive fortunes only */
102
bool	All_forts	= FALSE;	/* any fortune allowed */
103
bool	Equal_probs	= FALSE;	/* scatter un-allocted prob equally */
93
bool	Find_files	= false;	/* just find a list of proper fortune files */
94
bool    Fortunes_only   = false;        /* check only "fortunes" files */
95
bool	Wait		= false;	/* wait desired after fortune */
96
bool	Short_only	= false;	/* short fortune desired */
97
bool	Long_only	= false;	/* long fortune desired */
98
bool	Offend		= false;	/* offensive fortunes only */
99
bool	All_forts	= false;	/* any fortune allowed */
100
bool	Equal_probs	= false;	/* scatter un-allocted prob equally */
104 101
#ifndef NO_REGEX
105
bool	Match		= FALSE;	/* dump fortunes matching a pattern */
102
bool	Match		= false;	/* dump fortunes matching a pattern */
106 103
#endif
107 104
#ifdef DEBUG
108
bool	Debug = FALSE;			/* print debug messages */
105
bool	Debug = false;			/* print debug messages */
109 106
#endif
110 107

  
111 108
char	*Fortbuf = NULL;			/* fortune buffer for -m */
......
120 117

  
121 118
STRFILE		Noprob_tbl;		/* sum of data for all no prob files */
122 119

  
123
int	 add_dir (FILEDESC *);
124
int	 add_file (int,
125
	    char *, char *, FILEDESC **, FILEDESC **, FILEDESC *);
120
bool	 add_dir (FILEDESC *);
121
bool	 add_file (int,
122
	    const char *, const char *, FILEDESC **, FILEDESC **, FILEDESC *);
126 123
void	 all_forts (FILEDESC *, char *);
127
char	*copy (char *, u_int);
124
char	*copy (const char *, u_int);
128 125
void	 display (FILEDESC *);
129 126
void	 do_free (void *);
130 127
void	*do_malloc (u_int);
131
int	 form_file_list (char **, int);
128
bool	 form_file_list (char **, int);
132 129
int	 fortlen (void);
133 130
void	 get_fort (void);
134 131
void	 get_pos (FILEDESC *);
135 132
void	 get_tbl (FILEDESC *);
136 133
void	 getargs (int, char *[]);
137 134
void	 init_prob (void);
138
int	 is_dir (char *);
139
int	 is_fortfile (char *, char **, char **, int);
140
int	 is_off_name (char *);
135
bool	 is_dir (const char *);
136
bool	 is_fortfile (const char *, char **, char **, int);
137
bool	 is_off_name (const char *);
141 138
int	 max (int, int);
142 139
FILEDESC *
143 140
	 new_fp (void);
144
char	*off_name (char *);
141
char	*off_name (const char *);
145 142
void	 open_dat (FILEDESC *);
146 143
void	 open_fp (FILEDESC *);
147 144
FILEDESC *
......
294 291
# ifndef NO_REGEX
295 292
	char	*pat;
296 293
# endif	/* NO_REGEX */
297
	extern char *optarg;
298
	extern int optind;
299 294
	int ch;
300 295

  
301
	ignore_case = FALSE;
296
	ignore_case = false;
302 297
# ifndef NO_REGEX
303 298
	pat = NULL;
304 299
# endif /* NO_REGEX */
......
325 320
			break;
326 321
		case 'l':		/* long ones only */
327 322
			Long_only++;
328
			Short_only = FALSE;
323
			Short_only = false;
329 324
			break;
330 325
		case 'o':		/* offensive ones only */
331 326
			Offend++;
332 327
			break;
333 328
		case 's':		/* short ones only */
334 329
			Short_only++;
335
			Long_only = FALSE;
330
			Long_only = false;
336 331
			break;
337 332
		case 'w':		/* give time to read */
338 333
			Wait++;
......
389 384
 * form_file_list:
390 385
 *	Form the file list from the file specifications.
391 386
 */
392
int
387
bool
393 388
form_file_list(char **files, int file_cnt)
394 389
{
395
	int	i, percent;
396
	char	*sp;
390
	bool	i;
391
	int	percent;
392
	const char	*sp;
397 393

  
398 394
	if (file_cnt == 0) {
399 395
		if (Find_files) {
400
			Fortunes_only = TRUE;
396
			Fortunes_only = true;
401 397
			i = add_file(NO_PROB, FORTDIR, NULL, &File_list,
402 398
					&File_tail, NULL);
403
			Fortunes_only = FALSE;
399
			Fortunes_only = false;
404 400
			return i;
405 401
		} else
406 402
			return add_file(NO_PROB, "fortunes", FORTDIR,
......
416 412
				percent = percent * 10 + *sp - '0';
417 413
			if (percent > 100) {
418 414
				fprintf(stderr, "percentages must be <= 100\n");
419
				return FALSE;
415
				return false;
420 416
			}
421 417
			if (*sp == '.') {
422 418
				fprintf(stderr, "percentages must be integers\n");
423
				return FALSE;
419
				return false;
424 420
			}
425 421
			/*
426 422
			 * If the number isn't followed by a '%', then
......
434 430
			else if (*++sp == '\0') {
435 431
				if (++i >= file_cnt) {
436 432
					fprintf(stderr, "percentages must precede files\n");
437
					return FALSE;
433
					return false;
438 434
				}
439 435
				sp = files[i];
440 436
			}
......
442 438
		if (strcmp(sp, "all") == 0)
443 439
			sp = FORTDIR;
444 440
		if (!add_file(percent, sp, NULL, &File_list, &File_tail, NULL))
445
			return FALSE;
441
			return false;
446 442
	}
447
	return TRUE;
443
	return true;
448 444
}
449 445

  
450 446
/*
451 447
 * add_file:
452 448
 *	Add a file to the file list.
453 449
 */
454
int
455
add_file(int percent, char *file, char *dir, FILEDESC **head, FILEDESC **tail, FILEDESC *parent)
450
bool
451
add_file(int percent, const char *file, const char *dir, FILEDESC **head, FILEDESC **tail, FILEDESC *parent)
456 452
{
457 453
	FILEDESC	*fp;
458 454
	int		fd;
459
	char		*path, *offensive;
455
	const char	*path;
456
	char		*tpath, *offensive;
460 457
	bool		was_malloc;
461 458
	bool		isdir;
462 459

  
463 460
	if (dir == NULL) {
464 461
		path = file;
465
		was_malloc = FALSE;
462
		tpath = NULL;
463
		was_malloc = false;
466 464
	}
467 465
	else {
468
		path = do_malloc((unsigned int) (strlen(dir) + strlen(file) + 2));
469
		(void) strcat(strcat(strcpy(path, dir), "/"), file);
470
		was_malloc = TRUE;
466
		tpath = do_malloc((unsigned int) (strlen(dir) + strlen(file) + 2));
467
		(void) strcat(strcat(strcpy(tpath, dir), "/"), file);
468
		path = tpath;
469
		was_malloc = true;
471 470
	}
472 471
	if ((isdir = is_dir(path)) && parent != NULL) {
473 472
		if (was_malloc)
474
			free(path);
475
		return FALSE;	/* don't recurse */
473
			free(tpath);
474
		return false;	/* don't recurse */
476 475
	}
477 476
	offensive = NULL;
478 477
	if (!isdir && parent == NULL && (All_forts || Offend) &&
......
480 479
		offensive = off_name(path);
481 480
		if (Offend) {
482 481
			if (was_malloc)
483
				free(path);
482
				free(tpath);
484 483
			path = offensive;
485 484
			offensive = NULL;
486
			was_malloc = TRUE;
485
			was_malloc = true;
487 486
			DPRINTF(1, (stderr, "\ttrying \"%s\"\n", path));
488 487
			file = off_name(file);
489 488
		}
......
502 501
		 */
503 502
		if (All_forts && offensive != NULL) {
504 503
			if (was_malloc)
505
				free(path);
504
				free(tpath);
506 505
			path = offensive;
507 506
			offensive = NULL;
508
			was_malloc = TRUE;
507
			was_malloc = true;
509 508
			DPRINTF(1, (stderr, "\ttrying \"%s\"\n", path));
510 509
			file = off_name(file);
511 510
			goto over;
......
516 515
		if (parent == NULL)
517 516
			perror(path);
518 517
		if (was_malloc)
519
			free(path);
520
		return FALSE;
518
			free(tpath);
519
		return false;
521 520
	}
522 521

  
523 522
	DPRINTF(2, (stderr, "path = \"%s\"\n", path));
......
538 537
				"fortune:%s not a fortune file or directory\n",
539 538
				path);
540 539
		if (was_malloc)
541
			free(path);
540
			free(tpath);
542 541
		do_free(fp->datfile);
543 542
		do_free(fp->posfile);
544 543
		free((char *) fp);
545 544
		do_free(offensive);
546
		return FALSE;
545
		return false;
547 546
	}
548 547
	/*
549 548
	 * If the user said -a, we need to make this node a pointer to
......
569 568
	fp->was_pos_file = (access(fp->posfile, W_OK) >= 0);
570 569
#endif	/* OK_TO_WRITE_DISK */
571 570

  
572
	return TRUE;
571
	return true;
573 572
}
574 573

  
575 574
/*
......
587 586
	fp->inf = NULL;
588 587
	fp->fd = -1;
589 588
	fp->percent = NO_PROB;
590
	fp->read_tbl = FALSE;
589
	fp->read_tbl = false;
591 590
	fp->next = NULL;
592 591
	fp->prev = NULL;
593 592
	fp->child = NULL;
......
602 601
 *	Return a pointer to the offensive version of a file of this name.
603 602
 */
604 603
char *
605
off_name(char *file)
604
off_name(const char *file)
606 605
{
607 606
	char	*new;
608 607

  
......
614 613
 * is_off_name:
615 614
 *	Is the file an offensive-style name?
616 615
 */
617
int
618
is_off_name(char *file)
616
bool
617
is_off_name(const char *file)
619 618
{
620 619
	int	len;
621 620

  
......
638 637

  
639 638
	if (fp->child != NULL)	/* this is a directory, not a file */
640 639
		return;
641
	if (!is_fortfile(offensive, &datfile, &posfile, FALSE))
640
	if (!is_fortfile(offensive, &datfile, &posfile, false))
642 641
		return;
643 642
	if ((fd = open(offensive, 0)) < 0)
644 643
		return;
......
666 665
		obscene->name = ++sp;
667 666
	obscene->datfile = datfile;
668 667
	obscene->posfile = posfile;
669
	obscene->read_tbl = FALSE;
668
	obscene->read_tbl = false;
670 669
#ifdef	OK_TO_WRITE_DISK
671 670
	obscene->was_pos_file = (access(obscene->posfile, W_OK) >= 0);
672 671
#endif	/* OK_TO_WRITE_DISK */
......
676 675
 * add_dir:
677 676
 *	Add the contents of an entire directory.
678 677
 */
679
int
678
bool
680 679
add_dir(FILEDESC *fp)
681 680
{
682 681
	DIR		*dir;
......
688 687
	fp->fd = -1;
689 688
	if ((dir = opendir(fp->path)) == NULL) {
690 689
		perror(fp->path);
691
		return FALSE;
690
		return false;
692 691
	}
693 692
	tailp = NULL;
694 693
	DPRINTF(1, (stderr, "adding dir \"%s\"\n", fp->path));
......
704 703
	if (fp->num_children == 0) {
705 704
		(void) fprintf(stderr,
706 705
		    "fortune: %s: No fortune files in directory.\n", fp->path);
707
		return FALSE;
706
		return false;
708 707
	}
709
	return TRUE;
708
	return true;
710 709
}
711 710

  
712 711
/*
713 712
 * is_dir:
714
 *	Return TRUE if the file is a directory, FALSE otherwise.
713
 *	Return true if the file is a directory, false otherwise.
715 714
 */
716
int
717
is_dir(char *file)
715
bool
716
is_dir(const char *file)
718 717
{
719 718
	auto struct stat	sbuf;
720 719

  
721 720
	if (stat(file, &sbuf) < 0)
722
		return FALSE;
721
		return false;
723 722
	return (sbuf.st_mode & S_IFDIR);
724 723
}
725 724

  
726 725
/*
727 726
 * is_fortfile:
728
 *	Return TRUE if the file is a fortune database file.  We try and
727
 *	Return true if the file is a fortune database file.  We try and
729 728
 *	exclude files without reading them if possible to avoid
730 729
 *	overhead.  Files which start with ".", or which have "illegal"
731 730
 *	suffixes, as contained in suflist[], are ruled out.
732 731
 */
733 732
/* ARGSUSED */
734
int
735
is_fortfile(char *file, char **datp, char **posp, int check_for_offend)
733
bool
734
is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
736 735
{
737 736
	int	i;
738
	char	*sp;
737
	const char	*sp;
739 738
	char	*datfile;
740
	static char	*suflist[] = {	/* list of "illegal" suffixes" */
739
	static const char	*suflist[] = {	/* list of "illegal" suffixes" */
741 740
				"dat", "pos", "c", "h", "p", "i", "f",
742 741
				"pas", "ftn", "ins.c", "ins,pas",
743 742
				"ins.ftn", "sml",
......
753 752
	if (check_for_offend && !All_forts) {
754 753
		i = strlen(file);
755 754
		if (Offend ^ (file[i - 2] == '-' && file[i - 1] == 'o')) {
756
			DPRINTF(2, (stderr, "FALSE (offending file)\n"));
757
			return FALSE;
755
			DPRINTF(2, (stderr, "false (offending file)\n"));
756
			return false;
758 757
		}
759 758
	}
760 759

  
......
763 762
	else
764 763
		sp++;
765 764
	if (*sp == '.') {
766
		DPRINTF(2, (stderr, "FALSE (file starts with '.')\n"));
767
		return FALSE;
765
		DPRINTF(2, (stderr, "false (file starts with '.')\n"));
766
		return false;
768 767
	}
769 768
	if (Fortunes_only && strncmp(sp, "fortunes", 8) != 0) {
770
		DPRINTF(2, (stderr, "FALSE (check fortunes only)\n"));
771
		return FALSE;
769
		DPRINTF(2, (stderr, "false (check fortunes only)\n"));
770
		return false;
772 771
	}
773 772
	if ((sp = rindex(sp, '.')) != NULL) {
774 773
		sp++;
775 774
		for (i = 0; suflist[i] != NULL; i++)
776 775
			if (strcmp(sp, suflist[i]) == 0) {
777
				DPRINTF(2, (stderr, "FALSE (file has suffix \".%s\")\n", sp));
778
				return FALSE;
776
				DPRINTF(2, (stderr, "false (file has suffix \".%s\")\n", sp));
777
				return false;
779 778
			}
780 779
	}
781 780

  
782 781
	datfile = copy(file, (unsigned int) (strlen(file) + 4)); /* +4 for ".dat" */
783 782
	strcat(datfile, ".dat");
784 783
	if (access(datfile, R_OK) < 0) {
785
		DPRINTF(2, (stderr, "FALSE (no readable \".dat\" file)\n"));
784
		DPRINTF(2, (stderr, "false (no readable \".dat\" file)\n"));
786 785
#ifdef DEBUG
787 786
		if (Debug < 2)
788 787
			DPRINTF(0, (stderr, "Warning: file \"%s\" unreadable\n", datfile));
789 788
#endif
790 789
		free(datfile);
791
		return FALSE;
790
		return false;
792 791
	}
793 792
	if (datp != NULL)
794 793
		*datp = datfile;
......
802 801
		*posp = NULL;
803 802
#endif	/* OK_TO_WRITE_DISK */
804 803
	}
805
	DPRINTF(2, (stderr, "TRUE\n"));
806
	return TRUE;
804
	DPRINTF(2, (stderr, "true\n"));
805
	return true;
807 806
}
808 807

  
809 808
/*
......
811 810
 *	Return a malloc()'ed copy of the string
812 811
 */
813 812
char *
814
copy(char *str, unsigned int len)
813
copy(const char *str, unsigned int len)
815 814
{
816 815
	char	*new, *sp;
817 816

  
......
958 957
			choice = random() % Noprob_tbl.str_numstr;
959 958
			DPRINTF(1, (stderr, "choice = %d (of %ld) \n", choice,
960 959
				    Noprob_tbl.str_numstr));
961
			while (choice >= fp->tbl.str_numstr) {
960
			while ((unsigned int)choice >= fp->tbl.str_numstr) {
962 961
				choice -= fp->tbl.str_numstr;
963 962
				fp = fp->next;
964 963
				DPRINTF(1, (stderr,
......
1009 1008
		choice = random() % parent->tbl.str_numstr;
1010 1009
		DPRINTF(1, (stderr, "    choice = %d (of %ld)\n",
1011 1010
			    choice, parent->tbl.str_numstr));
1012
		for (fp = parent->child; choice >= fp->tbl.str_numstr;
1011
		for (fp = parent->child; (unsigned int)choice >= fp->tbl.str_numstr;
1013 1012
		     fp = fp->next) {
1014 1013
			choice -= fp->tbl.str_numstr;
1015 1014
			DPRINTF(1, (stderr, "\tskip %s, %ld (choice = %d)\n",
......
1028 1027
void
1029 1028
sum_noprobs(FILEDESC *fp)
1030 1029
{
1031
	static bool	did_noprobs = FALSE;
1030
	static bool	did_noprobs = false;
1032 1031

  
1033 1032
	if (did_noprobs)
1034 1033
		return;
......
1038 1037
		sum_tbl(&Noprob_tbl, &fp->tbl);
1039 1038
		fp = fp->next;
1040 1039
	}
1041
	did_noprobs = TRUE;
1040
	did_noprobs = true;
1042 1041
}
1043 1042

  
1044 1043
int
......
1099 1098
		fp->pos = random() % fp->tbl.str_numstr;
1100 1099
#endif /* OK_TO_WRITE_DISK */
1101 1100
	}
1102
	if (++(fp->pos) >= fp->tbl.str_numstr)
1101
	if ((unsigned int)++(fp->pos) >= fp->tbl.str_numstr)
1103 1102
		fp->pos -= fp->tbl.str_numstr;
1104 1103
	DPRINTF(1, (stderr, "pos for %s is %ld\n", fp->name, fp->pos));
1105 1104
}
......
1140 1139
			sum_tbl(&fp->tbl, &child->tbl);
1141 1140
		}
1142 1141
	}
1143
	fp->read_tbl = TRUE;
1142
	fp->read_tbl = true;
1144 1143
}
1145 1144

  
1146 1145
/*
......
1259 1258
	/* extra length, "%\n" is appended */
1260 1259
	Fortbuf = do_malloc((unsigned int) Fort_len + 10);
1261 1260

  
1262
	Found_one = FALSE;
1261
	Found_one = false;
1263 1262
	matches_in_list(File_list);
1264 1263
	return Found_one;
1265 1264
	/* NOTREACHED */
......
1283 1282
		}
1284 1283
		else {
1285 1284
			get_tbl(fp);
1286
			if (fp->tbl.str_longlen > maxlen)
1285
			if (fp->tbl.str_longlen > (unsigned int)maxlen)
1287 1286
				maxlen = fp->tbl.str_longlen;
1288 1287
		}
1289 1288
	}
......
1310 1309
		DPRINTF(1, (stderr, "searching in %s\n", fp->path));
1311 1310
		open_fp(fp);
1312 1311
		sp = Fortbuf;
1313
		in_file = FALSE;
1312
		in_file = false;
1314 1313
		while (fgets(sp, Fort_len, fp->inf) != NULL)
1315 1314
			if (fp->tbl.str_flags & STR_COMMENTS
1316 1315
			    && sp[0] == fp->tbl.str_delim
......
1334 1333
					    fp->tbl.str_delim);
1335 1334
					if (!in_file) {
1336 1335
						printf(" (%s)", fp->name);
1337
						Found_one = TRUE;
1338
						in_file = TRUE;
1336
						Found_one = true;
1337
						in_file = true;
1339 1338
					}
1340 1339
					putchar('\n');
1341 1340
					(void) fwrite(Fortbuf, 1, (sp - Fortbuf), stdout);
games/fortune/strfile/Makefile 10 Oct 2005 01:39:23 -0000
5 5
PROG=	strfile
6 6
MAN=	strfile.8
7 7
MLINKS= strfile.8 unstr.8
8
CFLAGS+= -Wall
8
WARNS?=	6
9 9

  
10 10
.include "${.CURDIR}/../../Makefile.inc"
11 11
.include <bsd.prog.mk>
games/fortune/strfile/strfile.c 10 Oct 2005 01:43:23 -0000
42 42
 */
43 43

  
44 44
# include	<sys/param.h>
45
# include	<stdbool.h>
45 46
# include	<stdio.h>
46 47
# include       <stdlib.h>
47 48
# include	<ctype.h>
......
75 76
 *	Added ordering options.
76 77
 */
77 78

  
78
# define	TRUE	1
79
# define	FALSE	0
80

  
81 79
# define	STORING_PTRS	(Oflag || Rflag)
82 80
# define	CHUNKSIZE	512
83 81

  
......
92 90
			} \
93 91
		}
94 92

  
95
#ifdef NO_VOID
96
# define	void	char
97
#endif
98

  
99 93
typedef struct {
100 94
	char	first;
101 95
	long    pos;
......
105 99
	Outfile[MAXPATHLEN] = "",	/* output file name */
106 100
	Delimch		= '%';		/* delimiting character */
107 101

  
108
int	Cflag		= FALSE;	/* embedded comments */
109
int	Sflag		= FALSE;	/* silent run flag */
110
int	Oflag		= FALSE;	/* ordering flag */
111
int	Iflag		= FALSE;	/* ignore case flag */
112
int	Rflag		= FALSE;	/* randomize order flag */
113
int	Xflag		= FALSE;	/* set rotated bit */
102
int	Cflag		= false;	/* embedded comments */
103
int	Sflag		= false;	/* silent run flag */
104
int	Oflag		= false;	/* ordering flag */
105
int	Iflag		= false;	/* ignore case flag */
106
int	Rflag		= false;	/* randomize order flag */
107
int	Xflag		= false;	/* set rotated bit */
114 108
long	Num_pts		= 0;		/* number of pointers/strings */
115 109

  
116 110
long    *Seekpts;
......
185 179
			if (!length)
186 180
				continue;
187 181
			add_offset(outf, pos);
188
			if (Tbl.str_longlen < length)
182
			if (Tbl.str_longlen < (unsigned long)length)
189 183
				Tbl.str_longlen = length;
190
			if (Tbl.str_shortlen > length)
184
			if (Tbl.str_shortlen > (unsigned long)length)
191 185
				Tbl.str_shortlen = length;
192 186
			first = Oflag;
193 187
		}
......
201 195
			else
202 196
				fp->first = *nsp;
203 197
			fp->pos = Seekpts[Num_pts - 1];
204
			first = FALSE;
198
			first = false;
205 199
		}
206 200
	} while (sp != NULL);
207 201

  
......
401 395
	(void) fseek(Sort_1, p1->pos, 0);
402 396
	(void) fseek(Sort_2, p2->pos, 0);
403 397

  
404
	n1 = FALSE;
405
	n2 = FALSE;
398
	n1 = false;
399
	n2 = false;
406 400
	while (!isalnum(c1 = getc(Sort_1)) && c1 != '\0' && c1 != EOF)
407 401
		SET_N(n1, c1);
408 402
	while (!isalnum(c2 = getc(Sort_2)) && c2 != '\0' && c2 != EOF)
games/fortune/unstr/Makefile 10 Oct 2005 01:44:15 -0000
2 2

  
3 3
PROG=	unstr
4 4
NOMAN=	noman
5
CFLAGS+=-Wall -I${.CURDIR}/../strfile
5
CFLAGS+=-I${.CURDIR}/../strfile
6
WARNS?=	6
6 7

  
7 8
.include "${.CURDIR}/../../Makefile.inc"
8 9
.include <bsd.prog.mk>
games/fortune/unstr/unstr.c 10 Oct 2005 01:47:44 -0000
67 67

  
68 68
FILE	*Inf, *Dataf;
69 69

  
70
void getargs(), order_unstr();
70
void	getargs(char *[]);
71
void	order_unstr(STRFILE *);
71 72

  
72 73
/* ARGSUSED */
73 74
int
74
main(int ac, char **av)
75
main(__unused int ac, char **av)
75 76
{
76 77
	static STRFILE	tbl;		/* description table */
77 78

  
......
116 117
void
117 118
order_unstr(STRFILE *tbl)
118 119
{
119
	int	i;
120
	unsigned int	i;
120 121
	char	*sp;
121 122
	long            pos;
122 123
	char		buf[BUFSIZ];