cuserid.c \
dirname.c \
environ.c \
+ err.c \
+ errx.c \
errno.c \
fdopen.c \
ffs.c \
getopt_long.c \
getpagesize.c \
getpass.c \
+ getprogname.c \
getpwent.c \
getttyent.c \
getw.c \
popen.c \
putenv.c \
putw.c \
+ pwcache.c \
random.c \
realpath.c \
rindex.c \
rlimit.c \
setenv.c \
+ setmode.c \
settimeofday.c \
stderr.c \
strdup.c \
strlcat.c \
strlcpy.c \
+ strmode.c \
strtok_r.c \
strtoll.c \
swab.c \
v8regexp.c \
v8regsub.c \
vectorio.c \
+ verr.c \
+ verrx.c \
+ vwarn.c \
vwarnx.c \
+ warn.c \
warnx.c
#include <stdlib.h>
-#ifdef __weak_alias
-__weak_alias(getprogname,_getprogname)
-#endif
-
-extern const char *__progname;
+extern const char **__prognamep; /* Copy of argv[]. */
+extern int __argc; /* Copy of argc. */
const char *
getprogname(void)
{
-
- return (__progname);
+ if(__argc > 0 && __prognamep)
+ return __prognamep[0];
+ return NULL;
}
* ISO C (C90) section. Most names in libc aren't in ISO C, so they
* should be here. Most aren't here...
*/
-#define err _err
-#define warn _warn
#define nsdispatch _nsdispatch
/*
#define getdirentries _getdirentries
#define getlogin _getlogin
#define getpeername _getpeername
-#define getprogname _getprogname
#define getsockname _getsockname
#define getsockopt _getsockopt
#define ioctl _ioctl
* function pointers to various name lookup routines.
* these may be changed as necessary.
*/
+#ifndef __minix
static int (*_pwcache_setgroupent)(int) = setgroupent;
+static int (*_pwcache_setpassent)(int) = setpassent;
+#else
+static int (*_pwcache_setgroupent)(int) = NULL;
+static int (*_pwcache_setpassent)(int) = NULL;
+#endif
static void (*_pwcache_endgrent)(void) = endgrent;
static struct group * (*_pwcache_getgrnam)(const char *) = getgrnam;
static struct group * (*_pwcache_getgrgid)(gid_t) = getgrgid;
-static int (*_pwcache_setpassent)(int) = setpassent;
static void (*_pwcache_endpwent)(void) = endpwent;
static struct passwd * (*_pwcache_getpwnam)(const char *) = getpwnam;
static struct passwd * (*_pwcache_getpwuid)(uid_t) = getpwuid;
static int usrtb_start(void);
static int grptb_start(void);
+#define _DIAGASSERT assert
static u_int
st_hash(const char *name, size_t len, int tabsz)
if (!pwopn) {
if (_pwcache_setpassent != NULL)
(*_pwcache_setpassent)(1);
+ else
+ setpwent();
++pwopn;
}
if (!gropn) {
if (_pwcache_setgroupent != NULL)
(*_pwcache_setgroupent)(1);
+ else
+ setgrent();
++gropn;
}
if (!pwopn) {
if (_pwcache_setpassent != NULL)
(*_pwcache_setpassent)(1);
+ else
+ setpwent();
++pwopn;
}
if (!gropn) {
if (_pwcache_setgroupent != NULL)
(*_pwcache_setgroupent)(1);
+ else
+ setgrent();
++gropn;
}
#define CMD2_OBITS 0x08
#define CMD2_UBITS 0x10
-static BITCMD *addcmd __P((BITCMD *, mode_t, mode_t, mode_t, mode_t));
-static void compress_mode __P((BITCMD *));
+#define _DIAGASSERT assert
+
+static BITCMD *addcmd (BITCMD *, mode_t, mode_t, mode_t, mode_t);
+static void compress_mode (BITCMD *);
#ifdef SETMODE_DEBUG
-static void dumpmode __P((BITCMD *));
+static void dumpmode (BITCMD *);
#endif
/*
}
if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
goto out;
- if (lval & ~(STANDARD_BITS|S_ISTXT)) {
+ if (lval & ~(STANDARD_BITS
+#ifdef S_ISTXT
+ |S_ISTXT
+#endif
+ )) {
errno = EINVAL;
goto out;
}
perm = (mode_t)lval;
- ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
+ ADDCMD('=', (STANDARD_BITS
+#ifdef S_ISTXT
+ |S_ISTXT
+#endif
+ ), perm, mask);
set->cmd = 0;
return (saveset);
}
* each clause of the symbolic mode.
*/
for (;;) {
+
/* First, find out which bits might be modified. */
for (who = 0;; ++p) {
switch (*p) {
goto getop;
}
}
-
-getop: if ((op = *p++) != '+' && op != '-' && op != '=') {
+getop:
+ op = *p;
+ p++;
+ if (op != '+' && op != '-' && op != '=') {
errno = EINVAL;
goto out;
}
if (op == '=')
equalopdone = 0;
+#ifdef S_ISTXT
who &= ~S_ISTXT;
+#endif
for (perm = 0, permXbits = 0;; ++p) {
switch (*p) {
case 'r':
if (who == 0 || (who & ~S_IRWXO))
perm |= S_ISUID|S_ISGID;
break;
+#ifdef S_ISTXT
case 't':
/*
* If specific bits where requested and
who |= S_ISTXT;
perm |= S_ISTXT;
}
+#endif
break;
case 'w':
perm |= S_IWUSR|S_IWGRP|S_IWOTH;
}
static BITCMD *
-addcmd(set, op, who, oparg, mask)
- BITCMD *set;
- mode_t oparg, who, op, mask;
+addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask)
{
_DIAGASSERT(set != NULL);
#include <assert.h>
#include <unistd.h>
+#define _DIAGASSERT assert
+
#if !HAVE_STRMODE
void
strmode(mode, p)
#undef getdirentries
#undef getlogin
#undef getpeername
-#undef getprogname
#undef getsockname
#undef getsockopt
#undef ioctl
int _flock(int, int);
#endif
-#undef err
-#undef warn
#undef nsdispatch
#endif /* _UN_NAMESPACE_H_ */