]> git.wh0rd.org - dump.git/blobdiff - compat/lib/fstab.c
kill "register".
[dump.git] / compat / lib / fstab.c
index 0cd2250c4023bb0090f421f05bdf59846be5f04b..de95455debc40b916a6f25112eda8ddf1e369cb1 100644 (file)
@@ -1,8 +1,9 @@
 /*
  *     Ported to Linux's Second Extended File System as part of the
  *     dump and restore backup suit
- *     Remy Card <card@Linux.EU.Org>, 1994, 1995, 1996
- *
+ *     Remy Card <card@Linux.EU.Org>, 1994-1997
+ *     Stelian Pop <stelian@popies.net>, 1999-2000
+ *     Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 2000-2002
  */
 
 /*
  * SUCH DAMAGE.
  */
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fstab.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+#ifndef lint
+static const char rcsid[] =
+       "$Id: fstab.c,v 1.13 2002/01/25 15:08:59 stelian Exp $";
+#endif /* not lint */
 
+#include <config.h>
 #include <errno.h>
 #include <fstab.h>
 #include <mntent.h>
@@ -49,6 +52,7 @@ static char sccsid[] = "@(#)fstab.c   8.1 (Berkeley) 6/4/93";
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <bylabel.h>
 
 static FILE *_fs_fp;
 static struct fstab _fs_fstab;
@@ -56,20 +60,28 @@ static struct fstab _fs_fstab;
 static void error __P((int));
 static int fstabscan __P((void));
 
+void msg __P((const char *fmt, ...));
+
 static
-int fstabscan()
+int fstabscan(void)
 {
        struct mntent   *mnt;
-       register char *cp;
+       char *cp;
        int typexx;
 #define        MAXLINELENGTH   1024
        char subline[MAXLINELENGTH];
 
        for (;;) {
+               const char *device_name;
                if (!(mnt = getmntent(_fs_fp)))
                        return 0;
 
-               _fs_fstab.fs_spec = mnt->mnt_fsname;
+               device_name = get_device_name(mnt->mnt_fsname);
+               if (!device_name) {
+                       msg("Warning: unable to translate %s\n", mnt->mnt_fsname);
+                       continue;
+               }
+               _fs_fstab.fs_spec = device_name;
                _fs_fstab.fs_file = mnt->mnt_dir;
                _fs_fstab.fs_vfstype = mnt->mnt_type;
                _fs_fstab.fs_mntops = mnt->mnt_opts;
@@ -110,16 +122,15 @@ int fstabscan()
 }
 
 struct fstab *
-getfsent()
+getfsent(void)
 {
-       if (!_fs_fp && !setfsent() || !fstabscan())
+       if ((!_fs_fp && !setfsent()) || !fstabscan())
                return((struct fstab *)NULL);
        return(&_fs_fstab);
 }
 
 struct fstab *
-getfsspec(name)
-       register const char *name;
+getfsspec(const char *name)
 {
        if (setfsent())
                while (fstabscan())
@@ -129,8 +140,7 @@ getfsspec(name)
 }
 
 struct fstab *
-getfsfile(name)
-       register const char *name;
+getfsfile(const char *name)
 {
        if (setfsent())
                while (fstabscan())
@@ -139,7 +149,8 @@ getfsfile(name)
        return((struct fstab *)NULL);
 }
 
-int setfsent()
+int
+setfsent(void)
 {
        if (_fs_fp) {
                rewind(_fs_fp);
@@ -152,7 +163,7 @@ int setfsent()
 }
 
 void
-endfsent()
+endfsent(void)
 {
        if (_fs_fp) {
                (void)endmntent(_fs_fp);
@@ -161,8 +172,7 @@ endfsent()
 }
 
 static
-void error(err)
-       int err;
+void error(int err)
 {
        char *p;