Deleted Added
sdiff udiff text old ( 18406 ) new ( 21149 )
full compact
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 90 unchanged lines hidden (view full) ---

99};
100
101/*
102 * Global variables for this file.
103 */
104static long seekpt;
105static FILE *df, *mf;
106static RST_DIR *dirp;
107static char dirfile[32] = "#"; /* No file */
108static char modefile[32] = "#"; /* No file */
109static char dot[2] = "."; /* So it can be modified */
110
111/*
112 * Format of old style directories.
113 */
114#define ODIRSIZ 14
115struct odirect {
116 u_short d_ino;
117 char d_name[ODIRSIZ];

--- 19 unchanged lines hidden (view full) ---

137void
138extractdirs(genmode)
139 int genmode;
140{
141 register int i;
142 register struct dinode *ip;
143 struct inotab *itp;
144 struct direct nulldir;
145
146 vprintf(stdout, "Extract directories from tape\n");
147 (void) sprintf(dirfile, "%s/rstdir%d", _PATH_TMP, dumpdate);
148 df = fopen(dirfile, "w");
149 if (df == NULL) {
150 fprintf(stderr,
151 "restore: %s - cannot create directory temporary\n",
152 dirfile);
153 fprintf(stderr, "fopen: %s\n", strerror(errno));
154 done(1);
155 }
156 if (genmode != 0) {
157 (void) sprintf(modefile, "%s/rstmode%d", _PATH_TMP, dumpdate);
158 mf = fopen(modefile, "w");
159 if (mf == NULL) {
160 fprintf(stderr,
161 "restore: %s - cannot create modefile \n",
162 modefile);
163 fprintf(stderr, "fopen: %s\n", strerror(errno));
164 done(1);
165 }
166 }
167 nulldir.d_ino = 0;

--- 66 unchanged lines hidden (view full) ---

234 * Pname is a dumped directory name.
235 */
236 if ((*todo)(pname, ino, NODE) == FAIL)
237 return;
238 /*
239 * begin search through the directory
240 * skipping over "." and ".."
241 */
242 (void) strncpy(locname, pname, MAXPATHLEN);
243 (void) strncat(locname, "/", MAXPATHLEN);
244 namelen = strlen(locname);
245 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);
246 dp = rst_readdir(dirp); /* "." */
247 if (dp != NULL && strcmp(dp->d_name, ".") == 0)
248 dp = rst_readdir(dirp); /* ".." */
249 else
250 fprintf(stderr, "Warning: `.' missing from directory %s\n",
251 pname);
252 if (dp != NULL && strcmp(dp->d_name, "..") == 0)
253 dp = rst_readdir(dirp); /* first real entry */
254 else
255 fprintf(stderr, "Warning: `..' missing from directory %s\n",
256 pname);
257 bpt = rst_telldir(dirp);
258 /*
259 * a zero inode signals end of directory
260 */
261 while (dp != NULL && dp->d_ino != 0) {
262 locname[namelen] = '\0';
263 if (namelen + dp->d_namlen >= MAXPATHLEN) {
264 fprintf(stderr, "%s%s: name exceeds %d char\n",
265 locname, dp->d_name, MAXPATHLEN);
266 } else {
267 (void) strncat(locname, dp->d_name, (int)dp->d_namlen);
268 treescan(locname, dp->d_ino, todo);
269 rst_seekdir(dirp, bpt, itp->t_seekpt);
270 }
271 dp = rst_readdir(dirp);
272 bpt = rst_telldir(dirp);
273 }

--- 306 unchanged lines hidden (view full) ---

580 int flags;
581{
582 FILE *mf;
583 struct modeinfo node;
584 struct entry *ep;
585 char *cp;
586
587 vprintf(stdout, "Set directory mode, owner, and times.\n");
588 (void) sprintf(modefile, "%s/rstmode%d", _PATH_TMP, dumpdate);
589 mf = fopen(modefile, "r");
590 if (mf == NULL) {
591 fprintf(stderr, "fopen: %s\n", strerror(errno));
592 fprintf(stderr, "cannot open mode file %s\n", modefile);
593 fprintf(stderr, "directory mode, owner, and times not set\n");
594 return;
595 }
596 clearerr(mf);

--- 38 unchanged lines hidden (view full) ---

635{
636 register struct inotab *itp;
637 int ofile, dp, i, size;
638 char buf[BUFSIZ];
639
640 itp = inotablookup(ino);
641 if (itp == NULL)
642 panic("Cannot find directory inode %d named %s\n", ino, name);
643 if ((ofile = creat(name, 0666)) < 0) {
644 fprintf(stderr, "%s: ", name);
645 (void) fflush(stderr);
646 fprintf(stderr, "cannot create file: %s\n", strerror(errno));
647 return (FAIL);
648 }
649 rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);
650 dp = dup(dirp->dd_fd);
651 for (i = itp->t_size; i > 0; i -= BUFSIZ) {

--- 100 unchanged lines hidden ---