diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-11-29 02:15:45 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-11-29 02:15:45 +0000 |
commit | 1e87be8757cbe08120f7c18840ffee4fb5ab557d (patch) | |
tree | a984d28d5f20f0b7adc6856d8dd43ecb96f18f7c | |
parent | 36563650e8f70470f880cd5c1a85e86cc4b105b5 (diff) |
Change scandir()'s 'select' argument from
int (*)(struct dirent *)
to
int (*)(const struct dirent *)
to match POSIX.
ok millert@, ports check by naddy@
-rw-r--r-- | include/dirent.h | 4 | ||||
-rw-r--r-- | lib/libc/gen/scandir.3 | 14 | ||||
-rw-r--r-- | lib/libc/gen/scandir.c | 4 | ||||
-rw-r--r-- | usr.bin/diff/diffdir.c | 6 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/lp.h | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/rmjob.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/lpc/cmds.c | 6 |
7 files changed, 25 insertions, 17 deletions
diff --git a/include/dirent.h b/include/dirent.h index e5c08235809..f5d90842893 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.28 2012/03/24 01:53:51 guenther Exp $ */ +/* $OpenBSD: dirent.h,v 1.29 2012/11/29 02:15:44 guenther Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /*- @@ -95,7 +95,7 @@ int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict); #endif #if __POSIX_VISIBLE >= 200809 -int scandir(const char *, struct dirent ***, int (*)(struct dirent *), +int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)); int alphasort(const struct dirent **, const struct dirent **); #elif __BSD_VISIBLE diff --git a/lib/libc/gen/scandir.3 b/lib/libc/gen/scandir.3 index 92eb6d3ed66..20c2ab7f005 100644 --- a/lib/libc/gen/scandir.3 +++ b/lib/libc/gen/scandir.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: scandir.3,v 1.11 2012/03/24 18:52:42 guenther Exp $ +.\" $OpenBSD: scandir.3,v 1.12 2012/11/29 02:15:44 guenther Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: March 24 2012 $ +.Dd $Mdocdate: November 29 2012 $ .Dt SCANDIR 3 .Os .Sh NAME @@ -38,7 +38,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 struct dirent **, const struct dirent **\*(rp" +.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp" "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp" .Ft int .Fn alphasort "const struct dirent **d1" "const struct dirent **d2" .Sh DESCRIPTION @@ -124,3 +124,11 @@ and then finally changed by .St -p1003.1-2008 to their current form of .Vt "const struct dirent **" . +Similarly, the +.Fn select +argument to +.Fn scandir +was originally +.Vt "struct dirent *" +until it was changed to its current form of +.Vt "const struct dirent *" . diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c index cbd7148f28b..3e3f7eb11b3 100644 --- a/lib/libc/gen/scandir.c +++ b/lib/libc/gen/scandir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scandir.c,v 1.14 2012/03/22 04:11:53 matthew Exp $ */ +/* $OpenBSD: scandir.c,v 1.15 2012/11/29 02:15:44 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -57,7 +57,7 @@ int scandir(const char *dirname, struct dirent ***namelist, - int (*select)(struct dirent *), + int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **, const struct dirent **)) { struct dirent *d, *p, **names = NULL; diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c index 80fff5c3bff..cb8a6acd883 100644 --- a/usr.bin/diff/diffdir.c +++ b/usr.bin/diff/diffdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffdir.c,v 1.40 2010/11/14 18:24:43 millert Exp $ */ +/* $OpenBSD: diffdir.c,v 1.41 2012/11/29 02:15:44 guenther Exp $ */ /* * Copyright (c) 2003, 2010 Todd C. Miller <Todd.Miller@courtesan.com> @@ -37,7 +37,7 @@ #include "diff.h" #include "xmalloc.h" -static int selectfile(struct dirent *); +static int selectfile(const struct dirent *); static void diffit(struct dirent *, char *, size_t, char *, size_t, int); #define d_status d_type /* we need to store status for -l */ @@ -232,7 +232,7 @@ diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2, * diff, else 0. Checks the excludes list. */ static int -selectfile(struct dirent *dp) +selectfile(const struct dirent *dp) { struct excludes *excl; diff --git a/usr.sbin/lpr/common_source/lp.h b/usr.sbin/lpr/common_source/lp.h index 09f914f976c..0ba45de74eb 100644 --- a/usr.sbin/lpr/common_source/lp.h +++ b/usr.sbin/lpr/common_source/lp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lp.h,v 1.15 2012/03/04 04:05:15 fgsch Exp $ */ +/* $OpenBSD: lp.h,v 1.16 2012/11/29 02:15:44 guenther Exp $ */ /* $NetBSD: lp.h,v 1.14 2000/04/16 14:43:58 mrg Exp $ */ /* @@ -135,7 +135,7 @@ int getport(char *, int); int getq(struct queue ***); void header(void); int inlist(char *, char *); -int iscf(struct dirent *); +int iscf(const struct dirent *); int isowner(char *, char *); void ldump(char *, char *, int); void prank(int); diff --git a/usr.sbin/lpr/common_source/rmjob.c b/usr.sbin/lpr/common_source/rmjob.c index 526523c7b4d..54d9f8a5333 100644 --- a/usr.sbin/lpr/common_source/rmjob.c +++ b/usr.sbin/lpr/common_source/rmjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rmjob.c,v 1.19 2012/03/04 04:05:15 fgsch Exp $ */ +/* $OpenBSD: rmjob.c,v 1.20 2012/11/29 02:15:44 guenther Exp $ */ /* $NetBSD: rmjob.c,v 1.16 2000/04/16 14:43:58 mrg Exp $ */ /* @@ -393,7 +393,7 @@ alarmer(int s) * Return 1 if the filename begins with 'cf' */ int -iscf(struct dirent *d) +iscf(const struct dirent *d) { return(d->d_name[0] == 'c' && d->d_name[1] == 'f'); } diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c index c9a444b59ae..7fe784578c9 100644 --- a/usr.sbin/lpr/lpc/cmds.c +++ b/usr.sbin/lpr/lpc/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.23 2012/03/22 01:44:19 guenther Exp $ */ +/* $OpenBSD: cmds.c,v 1.24 2012/11/29 02:15:44 guenther Exp $ */ /* $NetBSD: cmds.c,v 1.12 1997/10/05 15:12:06 mrg Exp $ */ /* @@ -59,7 +59,7 @@ static void abortpr(int); static void cleanpr(void); static void disablepr(void); static int doarg(char *); -static int doselect(struct dirent *); +static int doselect(const struct dirent *); static void enablepr(void); static void prstat(void); static void putmsg(int, char **); @@ -251,7 +251,7 @@ clean(int argc, char **argv) } static int -doselect(struct dirent *d) +doselect(const struct dirent *d) { int c = d->d_name[0]; |