Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/fortune/fortune ANSIfy function definitions.



details:   https://anonhg.NetBSD.org/src/rev/bee11a47948f
branches:  trunk
changeset: 747003:bee11a47948f
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Aug 27 01:40:27 2009 +0000

description:
ANSIfy function definitions.

diffstat:

 games/fortune/fortune/fortune.c |  118 +++++++++++++--------------------------
 1 files changed, 40 insertions(+), 78 deletions(-)

diffs (truncated from 370 to 300 lines):

diff -r c19e027d8bbf -r bee11a47948f games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c   Thu Aug 27 01:19:38 2009 +0000
+++ b/games/fortune/fortune/fortune.c   Thu Aug 27 01:40:27 2009 +0000
@@ -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)
 {



Home | Main Index | Thread Index | Old Index