Module Name:    src
Committed By:   dholland
Date:           Thu Aug 27 01:40:27 UTC 2009

Modified Files:
        src/games/fortune/fortune: fortune.c

Log Message:
ANSIfy function definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/games/fortune/fortune/fortune.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/fortune/fortune/fortune.c
diff -u src/games/fortune/fortune/fortune.c:1.56 src/games/fortune/fortune/fortune.c:1.57
--- src/games/fortune/fortune/fortune.c:1.56	Thu Aug 27 01:19:38 2009
+++ src/games/fortune/fortune/fortune.c	Thu Aug 27 01:40:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fortune.c,v 1.56 2009/08/27 01:19:38 dholland Exp $	*/
+/*	$NetBSD: fortune.c,v 1.57 2009/08/27 01:40:27 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)fortune.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.56 2009/08/27 01:19:38 dholland Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.57 2009/08/27 01:40:27 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -214,9 +214,7 @@
 #endif
 
 int
-main(ac, av)
-	int	ac;
-	char	*av[];
+main(int ac, char *av[])
 {
 	struct timeval tv;
 #ifdef	OK_TO_WRITE_DISK
@@ -271,9 +269,7 @@
 }
 
 static void
-rot13(line, len)
-	char *line;
-	int len;
+rot13(char *line, int len)
 {
 	char	*p, ch;
 
@@ -288,8 +284,7 @@
 }
 
 static void
-display(fp)
-	FILEDESC	*fp;
+display(FILEDESC *fp)
 {
 	char	line[BUFSIZ];
 
@@ -309,7 +304,7 @@
  *	Return the length of the fortune.
  */
 static size_t
-fortlen()
+fortlen(void)
 {
 	size_t	nchar;
 	char	line[BUFSIZ];
@@ -332,9 +327,7 @@
  *	This routine evaluates the arguments on the command line
  */
 static void
-getargs(argc, argv)
-	int	argc;
-	char	**argv;
+getargs(int argc, char **argv)
 {
 	int	ignore_case;
 # ifndef NO_REGEX
@@ -435,9 +428,7 @@
  *	Form the file list from the file specifications.
  */
 static int
-form_file_list(files, file_cnt)
-	char	**files;
-	int	file_cnt;
+form_file_list(char **files, int file_cnt)
 {
 	int	i, percent;
 	const char	*sp;
@@ -496,12 +487,8 @@
  *	Add a file to the file list.
  */
 static int
-add_file(percent, file, dir, head, tail, parent)
-	int		 percent;
-	const char	*file;
-	const char	*dir;
-	FILEDESC	**head, **tail;
-	FILEDESC	*parent;
+add_file(int percent, const char *file, const char *dir,
+	 FILEDESC **head, FILEDESC **tail, FILEDESC *parent)
 {
 	FILEDESC	*fp;
 	int		fd;
@@ -640,7 +627,7 @@
  *	Return a pointer to an initialized new FILEDESC.
  */
 static FILEDESC *
-new_fp()
+new_fp(void)
 {
 	FILEDESC	*fp;
 
@@ -665,8 +652,7 @@
  *	Return a pointer to the offensive version of a file of this name.
  */
 static char *
-off_name(file)
-	const char	*file;
+off_name(const char *file)
 {
 	char	*new;
 
@@ -679,8 +665,7 @@
  *	Is the file an offensive-style name?
  */
 static int
-is_off_name(file)
-	const char	*file;
+is_off_name(const char *file)
 {
 	int	len;
 
@@ -694,9 +679,7 @@
  *	there are two children to be a parent of.
  */
 static void
-all_forts(fp, offensive)
-	FILEDESC	*fp;
-	const char	*offensive;
+all_forts(FILEDESC *fp, const char *offensive)
 {
 	char		*sp;
 	FILEDESC	*scene, *obscene;
@@ -746,8 +729,7 @@
  *	Add the contents of an entire directory.
  */
 static int
-add_dir(fp)
-	FILEDESC	*fp;
+add_dir(FILEDESC *fp)
 {
 	DIR		*dir;
 	struct dirent	*dirent;
@@ -784,8 +766,7 @@
  *	Return TRUE if the file is a directory, FALSE otherwise.
  */
 static int
-is_dir(file)
-	const char	*file;
+is_dir(const char *file)
 {
 	struct stat	sbuf;
 
@@ -803,14 +784,7 @@
  */
 /* ARGSUSED */
 static int
-is_fortfile(file, datp, posp, check_for_offend)
-	const char	*file;
-	char		**datp, **posp
-# ifndef OK_TO_WRITE_DISK
-	__unused
-# endif
-	;
-	int	check_for_offend;
+is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
 {
 	int	i;
 	const char	*sp;
@@ -867,6 +841,10 @@
 		*posp = copy(file, strlen(file) + 4); /* +4 for ".dat" */
 		(void) strcat(*posp, ".pos");
 	}
+#else
+	if (posp != NULL) {
+		/*  *posp = NULL; -- not quite yet */
+	}
 #endif	/* OK_TO_WRITE_DISK */
 	DPRINTF(2, (stderr, "TRUE\n"));
 	return TRUE;
@@ -877,9 +855,7 @@
  *	Return a malloc()'ed copy of the string
  */
 static char *
-copy(str, len)
-	const char	*str;
-	size_t	len;
+copy(const char *str, size_t len)
 {
 	char	*new, *sp;
 
@@ -910,8 +886,7 @@
  *	Free malloc'ed space, if any.
  */
 static void
-do_free(ptr)
-	void	*ptr;
+do_free(void *ptr)
 {
 	if (ptr != NULL)
 		free(ptr);
@@ -922,7 +897,7 @@
  *	Initialize the fortune probabilities.
  */
 static void
-init_prob()
+init_prob(void)
 {
 	FILEDESC	*fp, *last;
 	int		percent, num_noprob, frac;
@@ -985,7 +960,7 @@
  *	Get the fortune data file's seek pointer for the next fortune.
  */
 static void
-get_fort()
+get_fort(void)
 {
 	FILEDESC	*fp;
 	int		choice;
@@ -1048,8 +1023,7 @@
  *	Pick a child from a chosen parent.
  */
 static FILEDESC *
-pick_child(parent)
-	FILEDESC	*parent;
+pick_child(FILEDESC *parent)
 {
 	FILEDESC	*fp;
 	int		 choice;
@@ -1085,8 +1059,7 @@
  *	Sum up all the noprob probabilities, starting with fp.
  */
 static void
-sum_noprobs(fp)
-	FILEDESC	*fp;
+sum_noprobs(FILEDESC *fp)
 {
 	static bool	did_noprobs = FALSE;
 
@@ -1102,8 +1075,7 @@
 }
 
 static int
-max(i, j)
-	int	i, j;
+max(int i, int j)
 {
 	return (i >= j ? i : j);
 }
@@ -1113,8 +1085,7 @@
  *	Assocatiate a FILE * with the given FILEDESC.
  */
 static void
-open_fp(fp)
-	FILEDESC	*fp;
+open_fp(FILEDESC *fp)
 {
 	if (fp->inf == NULL && (fp->inf = fdopen(fp->fd, "r")) == NULL)
 		err(1, "Cannot open `%s'", fp->path);
@@ -1138,8 +1109,7 @@
  *	return a random number.
  */
 static void
-get_pos(fp)
-	FILEDESC	*fp;
+get_pos(FILEDESC *fp)
 {
 #ifdef	OK_TO_WRITE_DISK
 	int	fd;
@@ -1170,8 +1140,7 @@
  *	Get the tbl data file the datfile.
  */
 static void
-get_tbl(fp)
-	FILEDESC	*fp;
+get_tbl(FILEDESC *fp)
 {
 	int	 	fd;
 	FILEDESC	*child;
@@ -1206,8 +1175,7 @@
  *	Zero out the fields we care about in a tbl structure.
  */
 static void
-zero_tbl(tp)
-	STRFILE	*tp;
+zero_tbl(STRFILE *tp)
 {
 	tp->str_numstr = 0;
 	tp->str_longlen = 0;
@@ -1219,8 +1187,7 @@
  *	Merge the tbl data of t2 into t1.
  */
 static void
-sum_tbl(t1, t2)
-	STRFILE	*t1, *t2;
+sum_tbl(STRFILE *t1, STRFILE *t2)
 {
 	t1->str_numstr += t2->str_numstr;
 	if (t1->str_longlen < t2->str_longlen)
@@ -1236,7 +1203,7 @@
  *	Print out the file list
  */
 static void
-print_file_list()
+print_file_list(void)
 {
 	print_list(File_list, 0);
 }
@@ -1246,9 +1213,7 @@
  *	Print out the actual list, recursively.
  */
 static void
-print_list(list, lev)
-	FILEDESC	*list;
-	int		 lev;
+print_list(FILEDESC *list, int lev)
 {
 	while (list != NULL) {
 		fprintf(stderr, "%*s", lev * 4, "");
@@ -1272,8 +1237,7 @@
  *	Convert the pattern to an ignore-case equivalent.
  */
 static char *
-conv_pat(orig)
-	char	*orig;
+conv_pat(char *orig)
 {
 	char		*sp;
 	unsigned int	 cnt;
@@ -1313,7 +1277,7 @@
  *	Find all the fortunes which match the pattern we've been given.
  */
 static int
-find_matches()
+find_matches(void)
 {
 	Fort_len = maxlen_in_list(File_list);
 	DPRINTF(2, (stderr, "Maximum length is %d\n", Fort_len));
@@ -1331,8 +1295,7 @@
  *	Return the maximum fortune len in the file list.
  */
 static size_t
-maxlen_in_list(list)
-	FILEDESC	*list;
+maxlen_in_list(FILEDESC *list)
 {
 	FILEDESC	*fp;
 	size_t len, maxlen;
@@ -1357,8 +1320,7 @@
  *	Print out the matches from the files in the list.
  */
 static void
-matches_in_list(list)
-	FILEDESC	*list;
+matches_in_list(FILEDESC *list)
 {
 	char		*sp;
 	FILEDESC	*fp;
@@ -1407,7 +1369,7 @@
 # endif	/* NO_REGEX */
 
 static void
-usage()
+usage(void)
 {
 
 	(void) fprintf(stderr, "Usage: %s [-ae", getprogname());

Reply via email to