BSD 4_4_Lite2 release
[unix-history] / usr / src / sbin / restore / interactive.c
index 63d0962..76aa74f 100644 (file)
@@ -2,20 +2,46 @@
  * Copyright (c) 1985, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
  * Copyright (c) 1985, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)interactive.c      8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)interactive.c      8.5 (Berkeley) 5/1/95";
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 
-#include <ufs/ffs/fs.h>
 #include <ufs/ufs/dinode.h>
 #include <ufs/ufs/dir.h>
 #include <ufs/ufs/dinode.h>
 #include <ufs/ufs/dir.h>
+#include <ufs/ffs/fs.h>
 #include <protocols/dumprestore.h>
 
 #include <setjmp.h>
 #include <protocols/dumprestore.h>
 
 #include <setjmp.h>
@@ -590,6 +616,10 @@ mkentry(name, dp, fp)
                fp->postfix = '#';
                break;
 
                fp->postfix = '#';
                break;
 
+       case DT_WHT:
+               fp->postfix = '%';
+               break;
+
        case DT_UNKNOWN:
        case DT_DIR:
                if (inodetype(dp->d_ino) == NODE)
        case DT_UNKNOWN:
        case DT_DIR:
                if (inodetype(dp->d_ino) == NODE)
@@ -685,7 +715,7 @@ glob_readdir(dirp)
        static struct dirent adirent;
 
        while ((dp = rst_readdir(dirp)) != NULL) {
        static struct dirent adirent;
 
        while ((dp = rst_readdir(dirp)) != NULL) {
-               if (dp->d_ino == 0)
+               if (!vflag && dp->d_ino == WINO)
                        continue;
                if (dflag || TSTINO(dp->d_ino, dumpmap))
                        break;
                        continue;
                if (dflag || TSTINO(dp->d_ino, dumpmap))
                        break;
@@ -694,7 +724,7 @@ glob_readdir(dirp)
                return (NULL);
        adirent.d_fileno = dp->d_ino;
        adirent.d_namlen = dp->d_namlen;
                return (NULL);
        adirent.d_fileno = dp->d_ino;
        adirent.d_namlen = dp->d_namlen;
-       bcopy(dp->d_name, adirent.d_name, dp->d_namlen + 1);
+       memmove(adirent.d_name, dp->d_name, dp->d_namlen + 1);
        return (&adirent);
 }
 
        return (&adirent);
 }
 
@@ -709,7 +739,8 @@ glob_stat(name, stp)
        register struct direct *dp;
 
        dp = pathsearch(name);
        register struct direct *dp;
 
        dp = pathsearch(name);
-       if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0))
+       if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) ||
+           (!vflag && dp->d_ino == WINO))
                return (-1);
        if (inodetype(dp->d_ino) == NODE)
                stp->st_mode = IFDIR;
                return (-1);
        if (inodetype(dp->d_ino) == NODE)
                stp->st_mode = IFDIR;