SCCS-vsn: sbin/restore/interactive.c 5.12
-static char sccsid[] = "@(#)interactive.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)interactive.c 5.12 (Berkeley) %G%";
#endif /* not lint */
#include "restore.h"
#endif /* not lint */
#include "restore.h"
char *fname; /* file name */
short fflags; /* extraction flags, if any */
char ftype; /* file type, e.g. LEAF or NODE */
char *fname; /* file name */
short fflags; /* extraction flags, if any */
char ftype; /* file type, e.g. LEAF or NODE */
+ char finotype; /* file type specified in directory entry */
};
struct arglist {
struct afile *head; /* start of argument list */
};
struct arglist {
struct afile *head; /* start of argument list */
while (*s2++ = *++s1)
/* void */;
}
while (*s2++ = *++s1)
/* void */;
}
- if (mkentry(buf, dp->d_ino, ap) == FAIL)
+ if (mkentry(buf, dp, ap) == FAIL)
(strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0))
continue;
(strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0))
continue;
- if (!mkentry(dp->d_name, dp->d_ino, &alist))
+ if (!mkentry(dp->d_name, dp, &alist))
/*
* Read the contents of a directory.
*/
/*
* Read the contents of a directory.
*/
register struct arglist *ap;
{
register struct afile *fp;
register struct arglist *ap;
{
register struct afile *fp;
if (ap->head == 0)
ap->head = ap->last = ap->base;
fp = ap->last;
if (ap->head == 0)
ap->head = ap->last = ap->base;
fp = ap->last;
+ fp->fnum = dp->d_ino;
+ if (oldinofmt)
+ fp->finotype = DT_UNKNOWN;
+ else
+ fp->finotype = dp->d_type;
fp->fname = savename(name);
fp++;
if (fp == ap->head + ap->nent) {
fp->fname = savename(name);
fp++;
if (fp == ap->head + ap->nent) {
*dp++ = '?';
else
*dp++ = *cp;
*dp++ = '?';
else
*dp++ = *cp;
- if (fp->ftype == NODE)
- *dp++ = '/';
+ switch(fp->finotype) {
+
+ case DT_LNK:
+ *dp++ = '@';
+ break;
+
+ case DT_FIFO:
+ case DT_SOCK:
+ *dp++ = '=';
+ break;
+
+ case DT_CHR:
+ case DT_BLK:
+ *dp++ = '#';
+ break;
+
+ case DT_UNKNOWN:
+ case DT_DIR:
+ if (fp->ftype == NODE)
+ *dp++ = '/';
+ break;
+
+ case DT_REG:
+ /* nothing */
+ break;
+
+ default:
+ fprintf(stderr, "Warning: undefined file type %d\n",
+ fp->finotype);
+ }
*dp++ = 0;
return (fmtres);
}
*dp++ = 0;
return (fmtres);
}