diff options
author | Jim Meyering <jim@meyering.net> | 1994-07-01 14:04:23 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-07-01 14:04:23 +0000 |
commit | 844a6c1a11956af913c5f5ea3da0b657b77b113f (patch) | |
tree | 9846ad0311ad89258a71e380a8d2e3562966ba0e | |
parent | 9e01db73f9c6b7b902beeb59d38bd70893c98e1b (diff) | |
download | coreutils-844a6c1a11956af913c5f5ea3da0b657b77b113f.tar.xz |
Include alloca directives.
Replace 3 lines with V_STRDUP equivalent.
-rw-r--r-- | lib/userspec.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/userspec.c b/lib/userspec.c index c70453245..a501f60e6 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -28,7 +28,19 @@ #endif #endif -/* FIXME: include alloca junk. */ +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#else +#ifdef _AIX + #pragma alloca +#else +char *alloca (); +#endif +#endif +#endif #include <stdio.h> #include <sys/types.h> @@ -116,7 +128,6 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg) char *spec; /* A copy we can write on. */ struct passwd *pwd; struct group *grp; - int spec_len; char *g, *u, *separator; char *groupname; @@ -124,10 +135,7 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg) *username_arg = *groupname_arg = NULL; groupname = NULL; - /* FIXME: use this instead: V_STRDUP (spec, spec_arg); */ - spec_len = strlen (spec_arg); - spec = (char *) alloca (strlen (spec_arg) + 1); - strcpy (spec, spec_arg); + V_STRDUP (spec, spec_arg); /* Find the separator if there is one. */ separator = index (spec, ':'); |