Lines Matching +full:user +full:- +full:selected
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
56 * is modified by the -n and -u flags. The user is informed when a specific
57 * file arg does not generate any selected files. -n keeps expanding the file
58 * tree arg until one of its files is selected, then skips to the next file
59 * arg. when the user does not supply the file trees as command line args to
77 * options are based on the selection of pax options by the user
79 * also attempt to reset directory access times when -t (tflag) is set.
81 * 0 if there is at least one valid file arg to process, -1 otherwise
89 * use FTS_NOCHDIR, as the user may have to open multiple archives and in ftree_start()
91 * volume in a place where the user did not expect to. in ftree_start()
96 * optional user flags that effect file traversal in ftree_start()
97 * -H command line symlink follow only (half follow) in ftree_start()
98 * -L follow symlinks (logical) in ftree_start()
99 * -P do not follow symlinks (physical). This is the default. in ftree_start()
100 * -X do not cross over mount points in ftree_start()
101 * -t preserve access times on files read. in ftree_start()
102 * -n select only the first member of a file tree when a match is found in ftree_start()
103 * -d do not extract subtrees rooted at a directory arg. in ftree_start()
116 return(-1); in ftree_start()
120 return(-1); in ftree_start()
122 return(-1); in ftree_start()
131 * 0 if added to the linked list, -1 if failed
145 return(-1); in ftree_add()
151 * trailing / the user may pass us. (watch out for / by itself). in ftree_add()
155 return(-1); in ftree_add()
158 if (((len = strlen(str) - 1) > 0) && (str[len] == '/')) in ftree_add()
160 ft->fname = str; in ftree_add()
161 ft->refcnt = 0; in ftree_add()
162 ft->chflg = chflg; in ftree_add()
163 ft->fow = NULL; in ftree_add()
168 fttail->fow = ft; in ftree_add()
175 * this entry has been selected by pax. bump up reference count and handle
176 * -n and -d processing.
188 ftcur->refcnt = 1; in ftree_sel()
191 * if -n we are done with this arg, force a skip to the next arg when in ftree_sel()
193 * if -d we tell fts only to match the directory (if the arg is a dir) in ftree_sel()
199 if (!dflag || (arcn->type != PAX_DIR)) in ftree_sel()
208 * this entry has not been selected by pax.
221 * have a selected member (reference count still 0)
240 for (ft = fthead; ft != NULL; ft = ft->fow) { in ftree_chk()
241 if ((ft->refcnt > 0) || ft->chflg) in ftree_chk()
244 paxwarn(1,"WARNING! These file names were not selected:"); in ftree_chk()
247 (void)fprintf(stderr, "%s\n", ft->fname); in ftree_chk()
254 * list or read from stdin when the user did not them as args to pax. Each
257 * 0 when the next arg is ready to go, -1 if out of file args (or EOF on
281 * the user didn't supply any args, get the file trees in ftree_arg()
285 return(-1); in ftree_arg()
290 * the user supplied the file args as arguments to pax in ftree_arg()
294 else if ((ftcur = ftcur->fow) == NULL) in ftree_arg()
295 return(-1); in ftree_arg()
296 if (ftcur->chflg) { in ftree_arg()
301 return(-1); in ftree_arg()
303 if (chdir(ftcur->fname) < 0) { in ftree_arg()
305 ftcur->fname); in ftree_arg()
306 return(-1); in ftree_arg()
310 farray[0] = ftcur->fname; in ftree_arg()
319 * files (the -n and -d flags need this). If the open is in ftree_arg()
332 * 0 when contents of arcn have been set with the next file, -1 when done.
343 * ftree_sel() might have set the ftree_skip flag if the user has the in next_file()
344 * -n option and a file was selected from this file arg tree. (-n says in next_file()
354 return(-1); in next_file()
367 return(-1); in next_file()
374 switch(ftent->fts_info) { in next_file()
386 * already saw this directory. If the user wants file in next_file()
390 * remember to force the time (this is -t on a read in next_file()
393 if (!tflag || (get_atdir(ftent->fts_statp->st_dev, in next_file()
394 ftent->fts_statp->st_ino, &mtime, &atime) < 0)) in next_file()
396 set_ftime(ftent->fts_path, mtime, atime, 1); in next_file()
402 paxwarn(1,"File system cycle found at %s",ftent->fts_path); in next_file()
405 syswarn(1, ftent->fts_errno, in next_file()
406 "Unable to read directory %s", ftent->fts_path); in next_file()
409 syswarn(1, ftent->fts_errno, in next_file()
414 syswarn(1, ftent->fts_errno, in next_file()
415 "Unable to access %s", ftent->fts_path); in next_file()
423 arcn->skip = 0; in next_file()
424 arcn->pad = 0; in next_file()
425 arcn->ln_nlen = 0; in next_file()
426 arcn->ln_name[0] = '\0'; in next_file()
427 arcn->sb = *(ftent->fts_statp); in next_file()
433 * we may read when the -t flag is specified. files are reset in next_file()
439 switch(S_IFMT & arcn->sb.st_mode) { in next_file()
441 arcn->type = PAX_DIR; in next_file()
444 add_atdir(ftent->fts_path, arcn->sb.st_dev, in next_file()
445 arcn->sb.st_ino, arcn->sb.st_mtime, in next_file()
446 arcn->sb.st_atime); in next_file()
449 arcn->type = PAX_CHR; in next_file()
452 arcn->type = PAX_BLK; in next_file()
461 arcn->type = PAX_REG; in next_file()
462 arcn->skip = arcn->sb.st_size; in next_file()
465 arcn->type = PAX_SLK; in next_file()
469 if ((cnt = readlink(ftent->fts_path, arcn->ln_name, in next_file()
470 PAXPATHLEN - 1)) < 0) { in next_file()
472 ftent->fts_path); in next_file()
479 arcn->ln_name[cnt] = '\0'; in next_file()
480 arcn->ln_nlen = cnt; in next_file()
488 arcn->type = PAX_SCK; in next_file()
491 arcn->type = PAX_FIF; in next_file()
500 arcn->nlen = l_strncpy(arcn->name, ftent->fts_path, sizeof(arcn->name) - 1); in next_file()
501 arcn->name[arcn->nlen] = '\0'; in next_file()
502 arcn->org_name = ftent->fts_path; in next_file()