/* * Takes a list of entries and removes them from the smoptstbl. */ PUBLIC int unsmoptscmd(void *v) { struct name *np; char **ap; for (ap = v; *ap != NULL; ap++) for (np = name_expand(*ap, GTO); np; np = np->n_flink) delsmopts(np->n_name); return 0; }
/* * Takes a list of entries, expands them, and adds the results to the * smopts table. */ PUBLIC int smoptscmd(void *v) { struct name *np; char **argv; argv = v; if (*argv == NULL) { printsmoptstbl(); return 0; } np = name_expand(argv[0], GTO); if (argv[1] == NULL) { for (/*EMPTY*/; np; np = np->n_flink) printsmopts(np->n_name); return 0; } for (/*EMPTY*/; np; np = np->n_flink) smopts_core(np->n_name, argv); return 0; }
/* Implement the 'r' (add files to end of archive), and 'u' (add files to end of archive if they arent there, or are more up to date than the version in the archive.) commands.*/ void update_archive () { int found_end = 0; int status = 3; int prev_status; char *p; struct name *name; extern void dump_file (); name_gather (); if (cmd_mode == CMD_UPDATE) name_expand (); open_archive (2); /* Open for updating */ do { prev_status = status; status = read_header (); switch (status) { case EOF: found_end = 1; break; case 0: /* A bad record */ userec (head); switch (prev_status) { case 3: msg ("This doesn't look like a tar archive."); /* FALL THROUGH */ case 2: case 1: msg ("Skipping to next header"); case 0: break; } break; /* A good record */ case 1: /* printf("File %s\n",head->header.name); */ /* head->header.name[NAMSIZ-1]='\0'; */ if (cmd_mode == CMD_UPDATE && (name = name_scan (current_file_name))) { /* struct stat hstat; */ struct stat nstat; int head_standard; decode_header (head, &hstat, &head_standard, 0); if (stat (current_file_name, &nstat) < 0) { msg_perror ("can't stat %s:", current_file_name); } else { if (hstat.st_mtime >= nstat.st_mtime) name->found++; } } userec (head); if (head->header.isextended) skip_extended_headers (); skip_file ((long) hstat.st_size); break; case 2: ar_record = head; found_end = 1; break; } } while (!found_end); reset_eof (); time_to_start_writing = 1; output_start = ar_record->charptr; while (p = name_from_list ()) { if (f_confirm && !confirm ("add", p)) continue; if (cmd_mode == CMD_CAT) append_file (p); else dump_file (p, -1, 1); } write_eot (); close_archive (); names_notfound (); }