Source-Changes-HG archive

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

[src/trunk]: src/games/fortune/fortune Use macro NAMLEN rather than dirent->d...



details:   https://anonhg.NetBSD.org/src/rev/45e6268c1cf1
branches:  trunk
changeset: 476636:45e6268c1cf1
user:      jsm <jsm%NetBSD.org@localhost>
date:      Wed Sep 22 18:56:32 1999 +0000

description:
Use macro NAMLEN rather than dirent->d_namlen, for easier portability.

diffstat:

 games/fortune/fortune/fortune.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 700955631f6c -r 45e6268c1cf1 games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c   Wed Sep 22 18:55:14 1999 +0000
+++ b/games/fortune/fortune/fortune.c   Wed Sep 22 18:56:32 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fortune.c,v 1.20 1999/09/18 19:38:49 jsm Exp $ */
+/*     $NetBSD: fortune.c,v 1.21 1999/09/22 18:56:32 jsm Exp $ */
 
 /*-
  * Copyright (c) 1986, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)fortune.c  8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.20 1999/09/18 19:38:49 jsm Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.21 1999/09/22 18:56:32 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -202,6 +202,10 @@
 # endif
 #endif
 
+#ifndef NAMLEN
+#define                NAMLEN(d)       ((d)->d_namlen)
+#endif
+
 int
 main(ac, av)
        int     ac;
@@ -717,9 +721,9 @@
        DPRINTF(1, (stderr, "adding dir \"%s\"\n", fp->path));
        fp->num_children = 0;
        while ((dirent = readdir(dir)) != NULL) {
-               if (dirent->d_namlen == 0)
+               if (NAMLEN(dirent) == 0)
                        continue;
-               name = copy(dirent->d_name, dirent->d_namlen);
+               name = copy(dirent->d_name, NAMLEN(dirent));
                if (add_file(NO_PROB, name, fp->path, &fp->child, &tailp, fp))
                        fp->num_children++;
                else



Home | Main Index | Thread Index | Old Index