summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-02 20:27:45 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-02 20:27:45 +0000
commit25d291e3ecb447937c243c32893949ebce7a26fe (patch)
tree627857b588c1e964956f65414121d630f167d769 /lib
parentd1ee2543c7177efa14ac6f10b93bab129a0ab0c1 (diff)
downloadcoreutils-25d291e3ecb447937c243c32893949ebce7a26fe.tar.xz
(read_file_system_list): Accept bool flag, not int.
(errno): Remove decl; we now assume C89 or better. (xatoi): Remove; replaced by strtoul. Hence device numbers can now go up to ULONG_MAX.
Diffstat (limited to 'lib')
-rw-r--r--lib/mountlist.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/lib/mountlist.c b/lib/mountlist.c
index fe2c9a5a5..af4633b9d 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -35,9 +35,6 @@ char *strstr ();
#endif
#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
@@ -143,39 +140,11 @@ extern int errno;
#include "mountlist.h"
#include "unlocked-io.h"
-#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
-/* Return the value of the hexadecimal number represented by CP.
- No prefix (like '0x') or suffix (like 'h') is expected to be
- part of CP. */
-/* FIXME: this can overflow */
-
-static int
-xatoi (char *cp)
-{
- int val;
-
- val = 0;
- while (*cp)
- {
- if (*cp >= 'a' && *cp <= 'f')
- val = val * 16 + *cp - 'a' + 10;
- else if (*cp >= 'A' && *cp <= 'F')
- val = val * 16 + *cp - 'A' + 10;
- else if (*cp >= '0' && *cp <= '9')
- val = val * 16 + *cp - '0';
- else
- break;
- cp++;
- }
- return val;
-}
-#endif /* MOUNTED_GETMNTENT1. */
-
#if MOUNTED_GETMNTINFO
# if ! HAVE_F_FSTYPENAME_IN_STATFS
static char *
-fstype_to_string (short t)
+fstype_to_string (short int t)
{
switch (t)
{
@@ -298,11 +267,11 @@ fstype_to_string (int t)
/* Return a list of the currently mounted file systems, or NULL on error.
Add each entry to the tail of the list so that they stay in order.
- If NEED_FS_TYPE is nonzero, ensure that the file system type fields in
+ If NEED_FS_TYPE is true, ensure that the file system type fields in
the returned list are valid. Otherwise, they might not be. */
struct mount_entry *
-read_file_system_list (int need_fs_type)
+read_file_system_list (bool need_fs_type)
{
struct mount_entry *mount_list;
struct mount_entry *me;
@@ -360,12 +329,7 @@ read_file_system_list (int need_fs_type)
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
devopt = strstr (mnt->mnt_opts, "dev=");
if (devopt)
- {
- if (devopt[4] == '0' && (devopt[5] == 'x' || devopt[5] == 'X'))
- me->me_dev = xatoi (devopt + 6);
- else
- me->me_dev = xatoi (devopt + 4);
- }
+ me->me_dev = strtoul (devopt + 4, NULL, 16);
else
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */