Source-Changes-HG archive

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

[src/trunk]: src make scandir(3)'s 3rd argument take a function that takes a ...



details:   https://anonhg.NetBSD.org/src/rev/f9972822663d
branches:  trunk
changeset: 484997:f9972822663d
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Apr 16 14:43:56 2000 +0000

description:
make scandir(3)'s 3rd argument take a function that takes a *const*
struct dirent *, rather than non-const.  this makes scandir(3) the
same as the scandir implementations in libiberty and glibc, and the
select function has no need to modify the dirent.

diffstat:

 include/dirent.h                   |   4 ++--
 lib/libc/gen/scandir.3             |   4 ++--
 lib/libc/gen/scandir.c             |   6 +++---
 usr.sbin/lpr/common_source/lp.h    |   4 ++--
 usr.sbin/lpr/common_source/rmjob.c |   6 +++---
 usr.sbin/lpr/lpc/cmds.c            |  14 +++++++-------
 6 files changed, 19 insertions(+), 19 deletions(-)

diffs (159 lines):

diff -r feaae7b563cb -r f9972822663d include/dirent.h
--- a/include/dirent.h  Sun Apr 16 14:19:53 2000 +0000
+++ b/include/dirent.h  Sun Apr 16 14:43:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dirent.h,v 1.16 2000/01/10 16:58:37 kleink Exp $       */
+/*     $NetBSD: dirent.h,v 1.17 2000/04/16 14:43:56 mrg Exp $  */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -99,7 +99,7 @@
 DIR *__opendir2 __P((const char *, int));
 void __seekdir __P((DIR *, long));
 int scandir __P((const char *, struct dirent ***,
-    int (*)(struct dirent *), int (*)(const void *, const void *)));
+    int (*)(const struct dirent *), int (*)(const void *, const void *)));
 int alphasort __P((const void *, const void *));
 int getdirentries __P((int, char *, int, long *));
 int getdents __P((int, char *, size_t));
diff -r feaae7b563cb -r f9972822663d lib/libc/gen/scandir.3
--- a/lib/libc/gen/scandir.3    Sun Apr 16 14:19:53 2000 +0000
+++ b/lib/libc/gen/scandir.3    Sun Apr 16 14:43:56 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: scandir.3,v 1.6 1999/03/22 19:44:44 garbled Exp $
+.\"    $NetBSD: scandir.3,v 1.7 2000/04/16 14:43:57 mrg Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -46,7 +46,7 @@
 .Fd #include <sys/types.h>
 .Fd #include <dirent.h>
 .Ft int
-.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
+.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpconst struct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
 .Ft int
 .Fn alphasort "const void *d1" "const void *d2"
 .Sh DESCRIPTION
diff -r feaae7b563cb -r f9972822663d lib/libc/gen/scandir.c
--- a/lib/libc/gen/scandir.c    Sun Apr 16 14:19:53 2000 +0000
+++ b/lib/libc/gen/scandir.c    Sun Apr 16 14:43:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scandir.c,v 1.17 2000/01/22 22:19:12 mycroft Exp $     */
+/*     $NetBSD: scandir.c,v 1.18 2000/04/16 14:43:57 mrg Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)scandir.c  8.3 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: scandir.c,v 1.17 2000/01/22 22:19:12 mycroft Exp $");
+__RCSID("$NetBSD: scandir.c,v 1.18 2000/04/16 14:43:57 mrg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -79,7 +79,7 @@
 scandir(dirname, namelist, select, dcomp)
        const char *dirname;
        struct dirent ***namelist;
-       int (*select) __P((struct dirent *));
+       int (*select) __P((const struct dirent *));
        int (*dcomp) __P((const void *, const void *));
 {
        struct dirent *d, *p, **names;
diff -r feaae7b563cb -r f9972822663d usr.sbin/lpr/common_source/lp.h
--- a/usr.sbin/lpr/common_source/lp.h   Sun Apr 16 14:19:53 2000 +0000
+++ b/usr.sbin/lpr/common_source/lp.h   Sun Apr 16 14:43:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lp.h,v 1.13 1999/12/07 14:54:44 mrg Exp $      */
+/*     $NetBSD: lp.h,v 1.14 2000/04/16 14:43:58 mrg Exp $      */
 
 /*
  * Copyright (c) 1983, 1993
@@ -116,7 +116,7 @@
 void     header __P((void));
 void     inform __P((char *));
 int      inlist __P((char *, char *));
-int      iscf __P((struct dirent *));
+int      iscf __P((const struct dirent *));
 int      isowner __P((char *, char *));
 void     ldump __P((char *, char *, int));
 int      lockchk __P((char *));
diff -r feaae7b563cb -r f9972822663d usr.sbin/lpr/common_source/rmjob.c
--- a/usr.sbin/lpr/common_source/rmjob.c        Sun Apr 16 14:19:53 2000 +0000
+++ b/usr.sbin/lpr/common_source/rmjob.c        Sun Apr 16 14:43:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmjob.c,v 1.15 1999/12/07 14:54:45 mrg Exp $   */
+/*     $NetBSD: rmjob.c,v 1.16 2000/04/16 14:43:58 mrg Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rmjob.c    8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: rmjob.c,v 1.15 1999/12/07 14:54:45 mrg Exp $");
+__RCSID("$NetBSD: rmjob.c,v 1.16 2000/04/16 14:43:58 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -404,7 +404,7 @@
  */
 int
 iscf(d)
-       struct dirent *d;
+       const struct dirent *d;
 {
        return(d->d_name[0] == 'c' && d->d_name[1] == 'f');
 }
diff -r feaae7b563cb -r f9972822663d usr.sbin/lpr/lpc/cmds.c
--- a/usr.sbin/lpr/lpc/cmds.c   Sun Apr 16 14:19:53 2000 +0000
+++ b/usr.sbin/lpr/lpc/cmds.c   Sun Apr 16 14:43:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.12 1997/10/05 15:12:06 mrg Exp $    */
+/*     $NetBSD: cmds.c,v 1.13 2000/04/16 14:43:58 mrg Exp $    */
 /*
  * Copyright (c) 1983, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: cmds.c,v 1.12 1997/10/05 15:12:06 mrg Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.13 2000/04/16 14:43:58 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -74,7 +74,7 @@
 static void    cleanpr __P((void));
 static void    disablepr __P((void));
 static int     doarg __P((char *));
-static int     doselect __P((struct dirent *));
+static int     doselect __P((const struct dirent *));
 static void    enablepr __P((void));
 static void    prstat __P((void));
 static void    putmsg __P((int, char **));
@@ -267,7 +267,7 @@
 
 static int
 doselect(d)
-       struct dirent *d;
+       const struct dirent *d;
 {
        int c = d->d_name[0];
 
@@ -284,11 +284,11 @@
 sortq(a, b)
        const void *a, *b;
 {
-       struct dirent **d1, **d2;
+       const struct dirent **d1, **d2;
        int c1, c2;
 
-       d1 = (struct dirent **)a;
-       d2 = (struct dirent **)b;
+       d1 = (const struct dirent **)a;
+       d2 = (const struct dirent **)b;
        if ((c1 = strcmp((*d1)->d_name + 3, (*d2)->d_name + 3)) != 0)
                return(c1);
        c1 = (*d1)->d_name[0];



Home | Main Index | Thread Index | Old Index