Module Name: othersrc Committed By: lukem Date: Wed Mar 20 07:29:59 UTC 2013
Modified Files: othersrc/usr.bin/tnftp/libnetbsd: glob.c Log Message: Remove some unportable assumptions that crept in in rev 1.9: * Just include "tnftp.h" instead of all the system headers * Restore a fix for AIX 4.1.5 * Use "unsigned char" instead of "u_char" (reinstate part of rev 1.7) To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 othersrc/usr.bin/tnftp/libnetbsd/glob.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/usr.bin/tnftp/libnetbsd/glob.c diff -u othersrc/usr.bin/tnftp/libnetbsd/glob.c:1.9 othersrc/usr.bin/tnftp/libnetbsd/glob.c:1.10 --- othersrc/usr.bin/tnftp/libnetbsd/glob.c:1.9 Sat Mar 2 17:11:31 2013 +++ othersrc/usr.bin/tnftp/libnetbsd/glob.c Wed Mar 20 07:29:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: glob.c,v 1.9 2013/03/02 17:11:31 christos Exp $ */ +/* $NetBSD: glob.c,v 1.10 2013/03/20 07:29:59 lukem Exp $ */ /* from: NetBSD: glob.c,v 1.34 2013/02/21 18:17:43 christos Exp */ /* @@ -33,8 +33,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> - /* * glob(3) -- a superset of the one defined in POSIX 1003.2. * @@ -61,6 +59,10 @@ * Number of matches in the current invocation of glob. */ +#include "tnftp.h" + +#if 0 + #include <sys/param.h> #include <sys/stat.h> @@ -75,7 +77,7 @@ #include <string.h> #include <unistd.h> -#include "ftpglob.h" +#endif #define NO_GETPW_R @@ -92,6 +94,8 @@ struct glob_limit { size_t l_brace; }; +#undef TILDE /* XXX: AIX 4.1.5 has this in <sys/ioctl.h> */ + /* * XXX: For NetBSD 1.4.x compatibility. (kill me l8r) */ @@ -127,7 +131,7 @@ struct glob_limit { #define M_MASK 0xffff #define M_ASCII 0x00ff -typedef u_short Char; +typedef unsigned short Char; #else @@ -178,14 +182,14 @@ int glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *, int), glob_t * __restrict pglob) { - const u_char *patnext; + const unsigned char *patnext; int c; Char *bufnext, *bufend, patbuf[MAXPATHLEN+1]; struct glob_limit limit = { 0, 0, 0, 0 }; _DIAGASSERT(pattern != NULL); - patnext = (const u_char *) pattern; + patnext = (const unsigned char *) pattern; if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; pglob->gl_pathv = NULL; @@ -765,7 +769,7 @@ glob3(Char *pathbuf, Char *pathend, Char else readdirfunc = (struct dirent *(*)(void *)) readdir; while ((dp = (*readdirfunc)(dirp)) != NULL) { - u_char *sc; + unsigned char *sc; Char *dc; if ((pglob->gl_flags & GLOB_LIMIT) && @@ -796,7 +800,7 @@ glob3(Char *pathbuf, Char *pathend, Char * The resulting string contains EOS, so we can * use the pathlim character, if it is the nul */ - for (sc = (u_char *) dp->d_name, dc = pathend; + for (sc = (unsigned char *) dp->d_name, dc = pathend; dc <= pathlim && (*dc++ = *sc++) != EOS;) continue;