diff --git a/include/fts.h b/include/fts.h index 965bea29ed98..684f41a714ca 100644 --- a/include/fts.h +++ b/include/fts.h @@ -1,4 +1,4 @@ -/* $NetBSD: fts.h,v 1.6 1997/10/21 00:55:10 fvdl Exp $ */ +/* $NetBSD: fts.h,v 1.7 1997/10/22 00:53:48 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -38,9 +38,17 @@ #ifndef _FTS_H_ #define _FTS_H_ -/* - * fts_options flags - */ +typedef struct { + struct _ftsent *fts_cur; /* current node */ + struct _ftsent *fts_child; /* linked list of children */ + struct _ftsent **fts_array; /* sort array */ + dev_t fts_dev; /* starting device # */ + char *fts_path; /* path for this descent */ + int fts_rfd; /* fd for root */ + int fts_pathlen; /* sizeof(path) */ + int fts_nitems; /* elements in the sort array */ + int (*fts_compar)(); /* compare function */ + #define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ #define FTS_LOGICAL 0x002 /* logical walk */ #define FTS_NOCHDIR 0x004 /* don't change directories */ @@ -53,74 +61,9 @@ #define FTS_NAMEONLY 0x100 /* (private) child names only */ #define FTS_STOP 0x200 /* (private) unrecoverable error */ - -typedef struct { - struct _ftsent12 *fts_cur; /* current node */ - struct _ftsent12 *fts_child; /* linked list of children */ - struct _ftsent12 **fts_array; /* sort array */ - dev_t fts_dev; /* starting device # */ - char *fts_path; /* path for this descent */ - int fts_rfd; /* fd for root */ - int fts_pathlen; /* sizeof(path) */ - int fts_nitems; /* elements in the sort array */ - int (*fts_compar)(); /* compare function */ - - int fts_options; /* fts_open options, global flags */ -} FTS12; - -typedef struct { - struct _ftsent *fts_cur; /* current node */ - struct _ftsent *fts_child; /* linked list of children */ - struct _ftsent **fts_array; /* sort array */ - dev_t fts_dev; /* starting device # */ - char *fts_path; /* path for this descent */ - int fts_rfd; /* fd for root */ - int fts_pathlen; /* sizeof(path) */ - int fts_nitems; /* elements in the sort array */ - int (*fts_compar)(); /* compare function */ - int fts_options; /* fts_open options, global flags */ } FTS; -/* - * fts_level defines. - */ -#define FTS_ROOTPARENTLEVEL -1 -#define FTS_ROOTLEVEL 0 - -/* - * fts_info defines - */ -#define FTS_D 1 /* preorder directory */ -#define FTS_DC 2 /* directory that causes cycles */ -#define FTS_DEFAULT 3 /* none of the above */ -#define FTS_DNR 4 /* unreadable directory */ -#define FTS_DOT 5 /* dot or dot-dot */ -#define FTS_DP 6 /* postorder directory */ -#define FTS_ERR 7 /* error; errno is set */ -#define FTS_F 8 /* regular file */ -#define FTS_INIT 9 /* initialized only */ -#define FTS_NS 10 /* stat(2) failed */ -#define FTS_NSOK 11 /* no stat(2) requested */ -#define FTS_SL 12 /* symbolic link */ -#define FTS_SLNONE 13 /* symbolic link without target */ -#define FTS_W 14 /* whiteout object */ - -/* - * fts_flags defines - */ -#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ -#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ -#define FTS_ISW 0x04 /* this is a whiteout object */ - -/* - * fts_set instructions - */ -#define FTS_AGAIN 1 /* read node again */ -#define FTS_FOLLOW 2 /* follow symbolic link */ -#define FTS_NOINSTR 3 /* no instructions */ -#define FTS_SKIP 4 /* discard node */ - typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ @@ -136,71 +79,70 @@ typedef struct _ftsent { ino_t fts_ino; /* inode */ dev_t fts_dev; /* device */ +#ifdef __LIBC12_SOURCE__ + u_int16_t fts_nlink; /* link count */ +#else nlink_t fts_nlink; /* link count */ +#endif +#define FTS_ROOTPARENTLEVEL -1 +#define FTS_ROOTLEVEL 0 short fts_level; /* depth (-1 to N) */ +#define FTS_D 1 /* preorder directory */ +#define FTS_DC 2 /* directory that causes cycles */ +#define FTS_DEFAULT 3 /* none of the above */ +#define FTS_DNR 4 /* unreadable directory */ +#define FTS_DOT 5 /* dot or dot-dot */ +#define FTS_DP 6 /* postorder directory */ +#define FTS_ERR 7 /* error; errno is set */ +#define FTS_F 8 /* regular file */ +#define FTS_INIT 9 /* initialized only */ +#define FTS_NS 10 /* stat(2) failed */ +#define FTS_NSOK 11 /* no stat(2) requested */ +#define FTS_SL 12 /* symbolic link */ +#define FTS_SLNONE 13 /* symbolic link without target */ +#define FTS_W 14 /* whiteout object */ u_short fts_info; /* user flags for FTSENT structure */ +#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ +#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ +#define FTS_ISW 0x04 /* this is a whiteout object */ u_short fts_flags; /* private flags for FTSENT structure */ +#define FTS_AGAIN 1 /* read node again */ +#define FTS_FOLLOW 2 /* follow symbolic link */ +#define FTS_NOINSTR 3 /* no instructions */ +#define FTS_SKIP 4 /* discard node */ u_short fts_instr; /* fts_set() instructions */ +#ifdef __LIBC12_SOURCE__ + struct stat12 *fts_statp; /* stat(2) information */ +#else struct stat *fts_statp; /* stat(2) information */ +#endif char fts_name[1]; /* file name */ } FTSENT; -typedef struct _ftsent12 { - struct _ftsent12 *fts_cycle; /* cycle node */ - struct _ftsent12 *fts_parent; /* parent directory */ - struct _ftsent12 *fts_link; /* next file in directory */ - long fts_number; /* local numeric value */ - void *fts_pointer; /* local address value */ - char *fts_accpath; /* access path */ - char *fts_path; /* root path */ - int fts_errno; /* errno for this node */ - int fts_symfd; /* fd for symlink */ - u_short fts_pathlen; /* strlen(fts_path) */ - u_short fts_namelen; /* strlen(fts_name) */ - - ino_t fts_ino; /* inode */ - dev_t fts_dev; /* device */ - u_int16_t fts_nlink; /* link count */ - - short fts_level; /* depth (-1 to N) */ - - u_short fts_info; /* user flags for FTSENT structure */ - - u_short fts_flags; /* private flags for FTSENT structure */ - - u_short fts_instr; /* fts_set() instructions */ - - struct stat12 *fts_statp; /* stat(2) information */ - char fts_name[1]; /* file name */ -} FTSENT12; - #include __BEGIN_DECLS -FTSENT12 *fts_children __P((FTS12 *, int)); -int fts_close __P((FTS12 *)); -FTS12 *fts_open __P((char * const *, int, - int (*)(const FTSENT12 **, const FTSENT12 **))); -FTSENT12 *fts_read __P((FTS12 *)); -int fts_set __P((FTS12 *, FTSENT12 *, int)); - -FTSENT *__fts_children13 __P((FTS *, int)); -int __fts_close13 __P((FTS *)); -FTS *__fts_open13 __P((char * const *, int, +#ifdef __LIBC12_SOURCE__ +FTSENT *fts_children __P((FTS *, int)); +int fts_close __P((FTS *)); +FTS *fts_open __P((char * const *, int, int (*)(const FTSENT **, const FTSENT **))); -FTSENT *__fts_read13 __P((FTS *)); -int __fts_set13 __P((FTS *, FTSENT *, int)); +FTSENT *fts_read __P((FTS *)); +int fts_set __P((FTS *, FTSENT *, int)); +#else +FTSENT *fts_children __P((FTS *, int)) __RENAME("__fts_children13"); +int fts_close __P((FTS *)) __RENAME("__fts_close13"); +FTS *fts_open __P((char * const *, int, + int (*)(const FTSENT **, const FTSENT **))) + __RENAME("__fts_open13"); +FTSENT *fts_read __P((FTS *)) __RENAME("__fts_read13"); +int fts_set __P((FTS *, FTSENT *, int)) __RENAME("__fts_set13"); +#endif __END_DECLS -#define fts_children(f,i) __fts_children13(f,i) -#define fts_close(f) __fts_close13(f) -#define fts_open(p,i,f) __fts_open13(p,i,f) -#define fts_read(f) __fts_read13(f) -#define fts_set(f,g,i) __fts_set13(f,g,i) - #endif /* !_FTS_H_ */ diff --git a/include/glob.h b/include/glob.h index cf9062e79df2..ccba502db76a 100644 --- a/include/glob.h +++ b/include/glob.h @@ -1,4 +1,4 @@ -/* $NetBSD: glob.h,v 1.6 1997/10/21 00:55:16 fvdl Exp $ */ +/* $NetBSD: glob.h,v 1.7 1997/10/22 00:53:55 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -62,29 +62,13 @@ typedef struct { void (*gl_closedir) __P((void *)); struct dirent *(*gl_readdir) __P((void *)); void *(*gl_opendir) __P((const char *)); +#ifdef __LIBC12_SOURCE__ int (*gl_lstat) __P((const char *, struct stat12 *)); int (*gl_stat) __P((const char *, struct stat12 *)); -} glob12_t; - -typedef struct { - int gl_pathc; /* Count of total paths so far. */ - int gl_matchc; /* Count of paths matching pattern. */ - int gl_offs; /* Reserved at beginning of gl_pathv. */ - int gl_flags; /* Copy of flags parameter to glob. */ - char **gl_pathv; /* List of paths matching pattern. */ - /* Copy of errfunc parameter to glob. */ - int (*gl_errfunc) __P((const char *, int)); - - /* - * Alternate filesystem access methods for glob; replacement - * versions of closedir(3), readdir(3), opendir(3), stat(2) - * and lstat(2). - */ - void (*gl_closedir) __P((void *)); - struct dirent *(*gl_readdir) __P((void *)); - void *(*gl_opendir) __P((const char *)); +#else int (*gl_lstat) __P((const char *, struct stat *)); int (*gl_stat) __P((const char *, struct stat *)); +#endif } glob_t; #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ @@ -107,14 +91,14 @@ typedef struct { #define GLOB_ABEND (-2) /* Unignored error. */ __BEGIN_DECLS -int glob __P((const char *, int, int (*)(const char *, int), glob12_t *)); -void globfree __P((glob12_t *)); - -int __glob13 __P((const char *, int, int (*)(const char *, int), glob_t *)); -void __globfree13 __P((glob_t *)); +#ifdef __LIBC12_SOURCE__ +int glob __P((const char *, int, int (*)(const char *, int), glob_t *)); +void globfree __P((glob_t *)); +#else +int glob __P((const char *, int, int (*)(const char *, int), glob_t *)) + __RENAME("__glob13"); +void globfree __P((glob_t *)) __RENAME("__globfree13"); +#endif __END_DECLS -#define glob(c,i,f,g) __glob13(c,i,f,g) -#define globfree(g) __globfree13(g) - #endif /* !_GLOB_H_ */ diff --git a/include/vis.h b/include/vis.h index b13a13fa84da..fe4e2c9fa786 100644 --- a/include/vis.h +++ b/include/vis.h @@ -1,4 +1,4 @@ -/* $NetBSD: vis.h,v 1.6 1997/10/20 22:05:40 thorpej Exp $ */ +/* $NetBSD: vis.h,v 1.7 1997/10/22 00:54:01 fvdl Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -80,10 +80,12 @@ char *vis __P((char *, int, int, int)); int strvis __P((char *, const char *, int)); int strvisx __P((char *, const char *, size_t, int)); int strunvis __P((char *, const char *)); +#ifdef __LIBC12_SOURCE__ int unvis __P((char *, char, int *, int)); int __unvis13 __P((char *, int, int *, int)); +#else +int unvis __P((char *, int, int *, int)) __RENAME("__unvis13"); +#endif __END_DECLS -#define unvis(p,c,i,j) __unvis13(p,c,i,j) - #endif /* !_VIS_H_ */ diff --git a/lib/libc/gen/__fts13.c b/lib/libc/gen/__fts13.c index 9ca2096f3469..cc0ac1a30a50 100644 --- a/lib/libc/gen/__fts13.c +++ b/lib/libc/gen/__fts13.c @@ -1,4 +1,4 @@ -/* $NetBSD: __fts13.c,v 1.1 1997/10/21 00:56:47 fvdl Exp $ */ +/* $NetBSD: __fts13.c,v 1.2 1997/10/22 00:54:57 fvdl Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #else -__RCSID("$NetBSD: __fts13.c,v 1.1 1997/10/21 00:56:47 fvdl Exp $"); +__RCSID("$NetBSD: __fts13.c,v 1.2 1997/10/22 00:54:57 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -55,11 +55,11 @@ __RCSID("$NetBSD: __fts13.c,v 1.1 1997/10/21 00:56:47 fvdl Exp $"); #include #ifdef __weak_alias -__weak_alias(__fts_children13,___fts_children13); -__weak_alias(__fts_close13,___fts_close13); -__weak_alias(__fts_open13,___fts_open13); -__weak_alias(__fts_read13,___fts_read13); -__weak_alias(__fts_set13,___fts_set13); +__weak_alias(__fts_children13,____fts_children13); +__weak_alias(__fts_close13,____fts_close13); +__weak_alias(__fts_open13,____fts_open13); +__weak_alias(__fts_read13,____fts_read13); +__weak_alias(__fts_set13,____fts_set13); #endif static FTSENT *fts_alloc __P((FTS *, char *, int)); @@ -87,7 +87,7 @@ static u_short fts_stat __P((FTS *, FTSENT *, int)); #define BREAD 3 /* fts_read */ FTS * -__fts_open13(argv, options, compar) +fts_open(argv, options, compar) char * const *argv; register int options; int (*compar) __P((const FTSENT **, const FTSENT **)); @@ -221,7 +221,7 @@ fts_load(sp, p) } int -__fts_close13(sp) +fts_close(sp) FTS *sp; { register FTSENT *freep, *p; @@ -274,7 +274,7 @@ __fts_close13(sp) p->fts_path[0] == '/' ? 0 : p->fts_pathlen) FTSENT * -__fts_read13(sp) +fts_read(sp) register FTS *sp; { register FTSENT *p, *tmp; @@ -466,7 +466,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent); */ /* ARGSUSED */ int -__fts_set13(sp, p, instr) +fts_set(sp, p, instr) FTS *sp; FTSENT *p; int instr; @@ -481,7 +481,7 @@ __fts_set13(sp, p, instr) } FTSENT * -__fts_children13(sp, instr) +fts_children(sp, instr) register FTS *sp; int instr; { diff --git a/lib/libc/gen/__glob13.c b/lib/libc/gen/__glob13.c index d51e7d53b789..9d34cfb0c8df 100644 --- a/lib/libc/gen/__glob13.c +++ b/lib/libc/gen/__glob13.c @@ -1,4 +1,4 @@ -/* $NetBSD: __glob13.c,v 1.1 1997/10/21 00:56:49 fvdl Exp $ */ +/* $NetBSD: __glob13.c,v 1.2 1997/10/22 00:55:08 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -__RCSID("$NetBSD: __glob13.c,v 1.1 1997/10/21 00:56:49 fvdl Exp $"); +__RCSID("$NetBSD: __glob13.c,v 1.2 1997/10/22 00:55:08 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -162,7 +162,7 @@ static void qprintf __P((const char *, Char *)); #endif int -__glob13(pattern, flags, errfunc, pglob) +glob(pattern, flags, errfunc, pglob) const char *pattern; int flags, (*errfunc) __P((const char *, int)); glob_t *pglob; @@ -735,7 +735,7 @@ match(name, pat, patend) /* Free allocated data belonging to a glob_t structure. */ void -__globfree13(pglob) +globfree(pglob) glob_t *pglob; { register int i; diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index f98ab480e036..963985d631b8 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $NetBSD: fts.c,v 1.20 1997/10/21 00:56:51 fvdl Exp $ */ +/* $NetBSD: fts.c,v 1.21 1997/10/22 00:55:17 fvdl Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -38,10 +38,12 @@ #if 0 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #else -__RCSID("$NetBSD: fts.c,v 1.20 1997/10/21 00:56:51 fvdl Exp $"); +__RCSID("$NetBSD: fts.c,v 1.21 1997/10/22 00:55:17 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ +#define __LIBC12_SOURCE__ + #include "namespace.h" #include #include @@ -54,18 +56,6 @@ __RCSID("$NetBSD: fts.c,v 1.20 1997/10/21 00:56:51 fvdl Exp $"); #include #include -#undef fts_children -#undef fts_close -#undef fts_open -#undef fts_read -#undef fts_set -#undef stat -#undef fstat -#undef lstat - -#define FTSENT FTSENT12 -#define FTS FTS12 - #ifdef __weak_alias __weak_alias(fts_children,_fts_children); __weak_alias(fts_close,_fts_close); diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index 946f380beb9e..19f4fe8e5375 100644 --- a/lib/libc/gen/glob.c +++ b/lib/libc/gen/glob.c @@ -1,4 +1,4 @@ -/* $NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $ */ +/* $NetBSD: glob.c,v 1.9 1997/10/22 00:55:26 fvdl Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -__RCSID("$NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $"); +__RCSID("$NetBSD: glob.c,v 1.9 1997/10/22 00:55:26 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -69,11 +69,11 @@ __RCSID("$NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $"); * gl_matchc: * Number of matches in the current invocation of glob. */ +#define __LIBC12_SOURCE__ #include "namespace.h" #include #include - #include #include #include @@ -84,12 +84,6 @@ __RCSID("$NetBSD: glob.c,v 1.8 1997/10/21 00:56:55 fvdl Exp $"); #include #include -#undef glob -#undef globfree -#undef fstat -#undef lstat -#undef stat - #ifdef __weak_alias __weak_alias(glob,_glob); __weak_alias(globfree,_globfree); @@ -147,21 +141,21 @@ typedef char Char; static int compare __P((const void *, const void *)); static void g_Ctoc __P((const Char *, char *)); -static int g_lstat __P((Char *, struct stat12 *, glob12_t *)); -static DIR *g_opendir __P((Char *, glob12_t *)); +static int g_lstat __P((Char *, struct stat12 *, glob_t *)); +static DIR *g_opendir __P((Char *, glob_t *)); static Char *g_strchr __P((Char *, int)); #ifdef notdef static Char *g_strcat __P((Char *, const Char *)); #endif -static int g_stat __P((Char *, struct stat12 *, glob12_t *)); -static int glob0 __P((const Char *, glob12_t *)); -static int glob1 __P((Char *, glob12_t *)); -static int glob2 __P((Char *, Char *, Char *, glob12_t *)); -static int glob3 __P((Char *, Char *, Char *, Char *, glob12_t *)); -static int globextend __P((const Char *, glob12_t *)); -static const Char * globtilde __P((const Char *, Char *, glob12_t *)); -static int globexp1 __P((const Char *, glob12_t *)); -static int globexp2 __P((const Char *, const Char *, glob12_t *, int *)); +static int g_stat __P((Char *, struct stat12 *, glob_t *)); +static int glob0 __P((const Char *, glob_t *)); +static int glob1 __P((Char *, glob_t *)); +static int glob2 __P((Char *, Char *, Char *, glob_t *)); +static int glob3 __P((Char *, Char *, Char *, Char *, glob_t *)); +static int globextend __P((const Char *, glob_t *)); +static const Char * globtilde __P((const Char *, Char *, glob_t *)); +static int globexp1 __P((const Char *, glob_t *)); +static int globexp2 __P((const Char *, const Char *, glob_t *, int *)); static int match __P((Char *, Char *, Char *)); #ifdef DEBUG static void qprintf __P((const char *, Char *)); @@ -171,7 +165,7 @@ int glob(pattern, flags, errfunc, pglob) const char *pattern; int flags, (*errfunc) __P((const char *, int)); - glob12_t *pglob; + glob_t *pglob; { const u_char *patnext; int c; @@ -221,7 +215,7 @@ glob(pattern, flags, errfunc, pglob) */ static int globexp1(pattern, pglob) const Char *pattern; - glob12_t *pglob; + glob_t *pglob; { const Char* ptr = pattern; int rv; @@ -245,7 +239,7 @@ static int globexp1(pattern, pglob) */ static int globexp2(ptr, pattern, pglob, rv) const Char *ptr, *pattern; - glob12_t *pglob; + glob_t *pglob; int *rv; { int i; @@ -352,7 +346,7 @@ static const Char * globtilde(pattern, patbuf, pglob) const Char *pattern; Char *patbuf; - glob12_t *pglob; + glob_t *pglob; { struct passwd *pwd; char *h; @@ -413,7 +407,7 @@ globtilde(pattern, patbuf, pglob) static int glob0(pattern, pglob) const Char *pattern; - glob12_t *pglob; + glob_t *pglob; { const Char *qpatnext; int c, err, oldpathc; @@ -505,7 +499,7 @@ compare(p, q) static int glob1(pattern, pglob) Char *pattern; - glob12_t *pglob; + glob_t *pglob; { Char pathbuf[MAXPATHLEN+1]; @@ -523,7 +517,7 @@ glob1(pattern, pglob) static int glob2(pathbuf, pathend, pattern, pglob) Char *pathbuf, *pathend, *pattern; - glob12_t *pglob; + glob_t *pglob; { struct stat12 sb; Char *p, *q; @@ -574,7 +568,7 @@ glob2(pathbuf, pathend, pattern, pglob) static int glob3(pathbuf, pathend, pattern, restpattern, pglob) Char *pathbuf, *pathend, *pattern, *restpattern; - glob12_t *pglob; + glob_t *pglob; { register struct dirent *dp; DIR *dirp; @@ -638,7 +632,7 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob) /* - * Extend the gl_pathv member of a glob12_t structure to accomodate a new item, + * Extend the gl_pathv member of a glob_t structure to accomodate a new item, * add the new item, and update gl_pathc. * * This assumes the BSD realloc, which only copies the block when its size @@ -647,14 +641,14 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob) * * Return 0 if new item added, error code if memory couldn't be allocated. * - * Invariant of the glob12_t structure: + * Invariant of the glob_t structure: * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and * gl_pathv points to (gl_offs + gl_pathc + 1) items. */ static int globextend(path, pglob) const Char *path; - glob12_t *pglob; + glob_t *pglob; { register char **pathv; register int i; @@ -739,10 +733,10 @@ match(name, pat, patend) return(*name == EOS); } -/* Free allocated data belonging to a glob12_t structure. */ +/* Free allocated data belonging to a glob_t structure. */ void globfree(pglob) - glob12_t *pglob; + glob_t *pglob; { register int i; register char **pp; @@ -759,7 +753,7 @@ globfree(pglob) static DIR * g_opendir(str, pglob) register Char *str; - glob12_t *pglob; + glob_t *pglob; { char buf[MAXPATHLEN]; @@ -778,7 +772,7 @@ static int g_lstat(fn, sb, pglob) register Char *fn; struct stat12 *sb; - glob12_t *pglob; + glob_t *pglob; { char buf[MAXPATHLEN]; @@ -792,7 +786,7 @@ static int g_stat(fn, sb, pglob) register Char *fn; struct stat12 *sb; - glob12_t *pglob; + glob_t *pglob; { char buf[MAXPATHLEN]; diff --git a/lib/libc/gen/unvis.c b/lib/libc/gen/unvis.c index 27478d4d6680..b05a5a68ec3b 100644 --- a/lib/libc/gen/unvis.c +++ b/lib/libc/gen/unvis.c @@ -1,4 +1,4 @@ -/* $NetBSD: unvis.c,v 1.9 1997/10/20 22:05:32 thorpej Exp $ */ +/* $NetBSD: unvis.c,v 1.10 1997/10/22 00:55:33 fvdl Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -38,10 +38,12 @@ #if 0 static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: unvis.c,v 1.9 1997/10/20 22:05:32 thorpej Exp $"); +__RCSID("$NetBSD: unvis.c,v 1.10 1997/10/22 00:55:33 fvdl Exp $"); #endif #endif /* LIBC_SCCS and not lint */ +#define __LIBC12_SOURCE__ + #include "namespace.h" #include #include @@ -50,6 +52,7 @@ __RCSID("$NetBSD: unvis.c,v 1.9 1997/10/20 22:05:32 thorpej Exp $"); #ifdef __weak_alias __weak_alias(strunvis,_strunvis); __weak_alias(unvis,_unvis); +__weak_alias(__unvis13,___unvis13); #endif /* @@ -65,8 +68,6 @@ __weak_alias(unvis,_unvis); #define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') -#undef unvis - int unvis(cp, c, astate, flag) char *cp; diff --git a/lib/libc/sys/msync.c b/lib/libc/sys/msync.c index 84ae35d1d688..ed826b7ab05a 100644 --- a/lib/libc/sys/msync.c +++ b/lib/libc/sys/msync.c @@ -1,4 +1,4 @@ -/* $NetBSD: msync.c,v 1.1 1997/10/20 22:05:29 thorpej Exp $ */ +/* $NetBSD: msync.c,v 1.2 1997/10/22 00:56:32 fvdl Exp $ */ /* * Copyright (c) 1997 Frank van der Linden @@ -31,11 +31,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define __LIBC12_SOURCE__ + #include #include -#undef msync - int msync(addr, size) void *addr; diff --git a/lib/libc/sys/stat.c b/lib/libc/sys/stat.c index fba1e16f5133..2d29021c630b 100644 --- a/lib/libc/sys/stat.c +++ b/lib/libc/sys/stat.c @@ -1,4 +1,4 @@ -/* $NetBSD: stat.c,v 1.1 1997/10/20 22:05:28 thorpej Exp $ */ +/* $NetBSD: stat.c,v 1.2 1997/10/22 00:56:39 fvdl Exp $ */ /* * Copyright (c) 1997 Frank van der Linden @@ -31,13 +31,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define __LIBC12_SOURCE__ + #include #include -#undef stat -#undef lstat -#undef fstat - /* * Convert from a new to an old stat structure. */ diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index ed5f7148b496..a72329e18f8a 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.18 1997/06/18 19:09:50 christos Exp $ */ +/* $NetBSD: cdefs.h,v 1.19 1997/10/22 00:51:45 fvdl Exp $ */ /* * Copyright (c) 1991, 1993 @@ -140,4 +140,16 @@ #define __COPYRIGHT(s) __IDSTRING(copyright,s) #endif +#ifndef __RENAME +#ifdef __GNUC__ +#ifdef __ELF__ +#define __RENAME(s) asm(s) +#else +#define __RENAME(s) asm(__CONCAT("_", s)) +#endif +#else +#error "No function renaming possible" +#endif +#endif + #endif /* !_SYS_CDEFS_H_ */ diff --git a/sys/sys/mman.h b/sys/sys/mman.h index d92ebaba97b8..f03046a60c4f 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -1,4 +1,4 @@ -/* $NetBSD: mman.h,v 1.14 1997/10/20 22:05:25 thorpej Exp $ */ +/* $NetBSD: mman.h,v 1.15 1997/10/22 00:51:52 fvdl Exp $ */ /*- * Copyright (c) 1982, 1986, 1993 @@ -95,15 +95,17 @@ __BEGIN_DECLS void *mmap __P((void *, size_t, int, int, int, off_t)); int munmap __P((void *, size_t)); int mprotect __P((void *, size_t, int)); +#ifdef __LIBC12_SOURCE__ int msync __P((void *, size_t)); int __msync13 __P((void *, size_t, int)); +#else +int msync __P((void *, size_t, int)) __RENAME("__msync13"); +#endif int mlock __P((void *, size_t)); int munlock __P((void *, size_t)); int madvise __P((void *, size_t, int)); __END_DECLS -#define msync(p,s,f) __msync13(p,s,f) - #endif /* !_KERNEL */ #endif /* !_SYS_MMAN_H_ */ diff --git a/sys/sys/stat.h b/sys/sys/stat.h index f755f6d24ff5..83b5c21bbb87 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -1,4 +1,4 @@ -/* $NetBSD: stat.h,v 1.26 1997/10/20 22:05:24 thorpej Exp $ */ +/* $NetBSD: stat.h,v 1.27 1997/10/22 00:51:59 fvdl Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -217,24 +217,30 @@ __BEGIN_DECLS int chmod __P((const char *, mode_t)); int mkdir __P((const char *, mode_t)); int mkfifo __P((const char *, mode_t)); +#ifdef __LIBC12_SOURCE__ int stat __P((const char *, struct stat12 *)); int fstat __P((int, struct stat12 *)); int __stat13 __P((const char *, struct stat *)); int __fstat13 __P((int, struct stat *)); +#else +int stat __P((const char *, struct stat *)) __RENAME("__stat13"); +int fstat __P((int, struct stat *)) __RENAME("__fstat13"); +#endif mode_t umask __P((mode_t)); #ifndef _POSIX_SOURCE int chflags __P((const char *, u_long)); int fchflags __P((int, u_long)); int fchmod __P((int, mode_t)); int lchmod __P((const char *, mode_t)); +#ifdef __LIBC12_SOURCE__ int lstat __P((const char *, struct stat12 *)); int __lstat13 __P((const char *, struct stat *)); +#else +int lstat __P((const char *, struct stat *)) __RENAME("__lstat13"); +#endif #endif -__END_DECLS -#define stat(f,b) __stat13(f,b) -#define fstat(f,b) __fstat13(f,b) -#define lstat(f,b) __lstat13(f,b) +__END_DECLS #endif #endif /* !_SYS_STAT_H_ */