summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-08-05 03:06:41 +0000
committerJim Meyering <jim@meyering.net>1995-08-05 03:06:41 +0000
commit351cf87351aba092d6959f2958909d8e55e28a3c (patch)
tree4c03e1b6e2e92fc0f7a28098423d1c4322c0121a
parent3139de97260c85832caea8eb6b1174885ef907cc (diff)
downloadcoreutils-351cf87351aba092d6959f2958909d8e55e28a3c.tar.xz
(isnumber): Rename to is_number to avoid conflict with
FreeBSD 2.0.5 macro definition. Reported by David O'Brien (obrien@sea.legent.com).
-rw-r--r--src/install.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/install.c b/src/install.c
index c0ec2ae12..0d916119e 100644
--- a/src/install.c
+++ b/src/install.c
@@ -97,7 +97,6 @@ static int change_attributes ();
static int copy_file ();
static int install_file_in_dir ();
static int install_file_in_file ();
-static int isnumber ();
static void get_ids ();
static void strip ();
static void usage ();
@@ -470,6 +469,21 @@ strip (path)
}
}
+/* Return nonzero if STR is an ASCII representation of a nonzero
+ decimal integer, zero if not. */
+
+static int
+is_number (str)
+ char *str;
+{
+ if (*str == 0)
+ return 0;
+ for (; *str; str++)
+ if (!ISDIGIT (*str))
+ return 0;
+ return 1;
+}
+
/* Initialize the user and group ownership of the files to install. */
static void
@@ -483,8 +497,10 @@ get_ids ()
pw = getpwnam (owner_name);
if (pw == NULL)
{
- if (!isnumber (owner_name))
+ if (!is_number (owner_name))
error (1, 0, "invalid user `%s'", owner_name);
+ /* FIXME: atoi won't warn about overflow. Use xstrtoul. */
+ /* FIXME: eliminate is_number altogether! */
owner_id = atoi (owner_name);
}
else
@@ -499,8 +515,9 @@ get_ids ()
gr = getgrnam (group_name);
if (gr == NULL)
{
- if (!isnumber (group_name))
+ if (!is_number (group_name))
error (1, 0, "invalid group `%s'", group_name);
+ /* FIXME: atoi won't warn about overflow. Use xstrtoul. */
group_id = atoi (group_name);
}
else
@@ -511,21 +528,6 @@ get_ids ()
group_id = getgid ();
}
-/* Return nonzero if STR is an ASCII representation of a nonzero
- decimal integer, zero if not. */
-
-static int
-isnumber (str)
- char *str;
-{
- if (*str == 0)
- return 0;
- for (; *str; str++)
- if (!ISDIGIT (*str))
- return 0;
- return 1;
-}
-
static void
usage (status)
int status;