1 /* ------------------------------------------------------------------------ */
3 /* lharc.c -- append to archive */
5 /* Copyright (C) MCMLXXXIX Yooichi.Tagawa */
6 /* Modified Nobutaka Watazaki */
7 /* Thanks to H.Yoshizaki. (MS-DOS LHarc) */
9 /* Ver. 0.00 Original 1988.05.23 Y.Tagawa */
10 /* Ver. 0.01 Alpha Version (for 4.2BSD) 1989.05.28 Y.Tagawa */
11 /* Ver. 0.02 Alpha Version Rel.2 1989.05.29 Y.Tagawa */
12 /* Ver. 0.03 Release #3 Beta Version 1989.07.02 Y.Tagawa */
13 /* Ver. 0.03a Debug 1989.07.03 Y.Tagawa */
14 /* Ver. 0.03b Modified 1989.07.13 Y.Tagawa */
15 /* Ver. 0.03c Debug (Thanks to void@rena.dit.junet) */
16 /* 1989.08.09 Y.Tagawa */
17 /* Ver. 0.03d Modified (quiet and verbose) 1989.09.14 Y.Tagawa */
18 /* V1.00 Fixed 1989.09.22 Y.Tagawa */
19 /* V1.01 Bug Fixed 1989.12.25 Y.Tagawa */
21 /* DOS-Version Original LHx V C2.01 (C) H.Yohizaki */
23 /* V2.00 UNIX Lharc + DOS LHx -> OSK LHx 1990.11.01 Momozou */
24 /* V2.01 Minor Modified 1990.11.24 Momozou */
26 /* Ver. 0.02 LHx for UNIX 1991.11.18 M.Oki */
27 /* Ver. 0.03 LHa for UNIX 1991.12.17 M.Oki */
28 /* Ver. 0.04 LHa for UNIX beta version 1992.01.20 M.Oki */
29 /* Ver. 1.00 LHa for UNIX Fixed 1992.03.19 M.Oki */
31 /* Ver. 1.10 for Symbolic Link 1993.06.25 N.Watazaki */
32 /* Ver. 1.11 for Symbolic Link Bug Fixed 1993.08.18 N.Watazaki */
33 /* Ver. 1.12 for File Date Check 1993.10.28 N.Watazaki */
34 /* Ver. 1.13 Bug Fixed (Idicator calcurate) 1994.02.21 N.Watazaki */
35 /* Ver. 1.13a Bug Fixed (Sym. Link delete) 1994.03.11 N.Watazaki */
36 /* Ver. 1.13b Bug Fixed (Sym. Link delete) 1994.07.29 N.Watazaki */
37 /* Ver. 1.14 Source All chagned 1995.01.14 N.Watazaki */
38 /* Ver. 1.14b,c Bug Fixed 1996.03.07 t.okamoto */
39 /* Ver. 1.14d Version up 1997.01.12 t.okamoto */
40 /* Ver. 1.14g Bug Fixed 2000.05.06 t.okamoto */
41 /* Ver. 1.14i Modified 2000.10.06 t.okamoto */
42 /* ------------------------------------------------------------------------ */
47 static int cmd = CMD_UNKNOWN;
48 static int error_occurred;
50 /* static functions */
51 static void sort_files();
52 static void print_version();
54 extern int optional_archive_kanji_code;
55 extern int optional_system_kanji_code;
57 /* ------------------------------------------------------------------------ */
59 init_variable() /* Added N.Watazaki */
65 noexec = FALSE; /* debugging option */
68 compress_method = DEFAULT_LZHUFF_METHOD; /* defined in config.h */
70 header_level = 2; /* level 2 */
77 /* view command flags */
78 verbose_listing = FALSE;
80 /* extract command flags */
81 output_to_stdout = FALSE;
83 /* append command flags */
85 update_if_newer = FALSE;
86 delete_after_append = FALSE;
87 generic_format = FALSE;
89 remove_temporary_at_error = FALSE;
90 recover_archive_when_interrupt = FALSE;
91 remove_extracting_file_when_interrupt = FALSE;
92 get_filename_from_stdin = FALSE;
93 ignore_directory = FALSE;
97 noconvertcase = FALSE;
99 extract_directory = NULL;
102 #if BACKUP_OLD_ARCHIVE
103 backup_old_archive = TRUE;
105 backup_old_archive = FALSE;
109 /* ------------------------------------------------------------------------ */
110 /* NOTES : Text File Format */
111 /* GENERATOR NewLine */
112 /* [generic] 0D 0A */
114 /* [OS9][MacOS] 0D */
116 /* ------------------------------------------------------------------------ */
121 usage: lha [-]<commands>[<options>] [-<options> ...] archive_file [file...]\n\
122 commands: [axelvudmcpt]\n\
123 options: [q[012]vnfto[567]dizg012e[w=<dir>|x=<pattern>]]\n");
130 LHarc for UNIX V 1.02 Copyright(C) 1989 Y.Tagawa\n\
131 LHx for MSDOS V C2.01 Copyright(C) 1990 H.Yoshizaki\n\
132 LHx(arc) for OSK V 2.01 Modified 1990 Momozou\n\
133 LHa for UNIX V 1.00 Copyright(C) 1992 Masaru Oki\n\
134 LHa for UNIX V 1.14 Modified 1995 Nobutaka Watazaki\n\
135 LHa for UNIX V 1.14i Modified 2000 Tsugio Okamoto\n\
136 Autoconfiscated 2001-2003 Koji Arai\n\
142 commands: options:\n\
143 a Add(or replace) to archive q{num} quiet (num:quiet mode)\n\
144 x,e EXtract from archive v verbose\n\
145 l,v List / Verbose List n not execute\n\
146 u Update newer files to archive f force (over write at extract)\n\
147 d Delete from archive t FILES are TEXT file\n");
150 m Move to archive (means 'ad') o[567] compression method (a/u/c)\n\
155 m Move to archive (means 'ad') o use LHarc compatible method (a/u/c)\n\
159 c re-Construct new archive d delete FILES after (a/u/c)\n\
160 p Print to STDOUT from archive i ignore directory path (x/e)\n\
161 t Test file CRC in archive z files not compress (a/u/c)\n\
162 g Generic format (for compatibility)\n\
163 or not convert case when extracting\n\
164 0/1/2 header level (a/u/c)\n\
168 e TEXT code convert from/to EUC\n\
172 w=<dir> specify extract directory (x/e)\n\
173 x=<pattern> eXclude files (a/u/c)\n\
175 #if IGNORE_DOT_FILES /* experimental feature */
177 X ignore dot files (a/u/c)\n\
183 parse_option(int argc, char **argv)
188 argv++; argc--; /* exclude command name */
195 if (strcmp(*argv, "--help") == 0) {
199 if (strcmp(*argv, "--version") == 0) {
204 if (argc == 1 && **argv != '-') {
205 archive_name = *argv++; argc--;
212 opt = *argv++; argc--;
225 output_to_stdout = TRUE;
243 update_if_newer = TRUE;
248 delete_after_append = TRUE;
253 verbose_listing = TRUE;
267 error("unknown command `-%c'", *opt);
279 case '0': /* no quiet */
280 case '1': /* no use the incremental indicator */
281 quiet_mode = *p - '0';
284 case '2': /* no output */
288 /* In quiet mode, no confirm to overwrite */
313 generic_format = TRUE;
314 noconvertcase = TRUE;
318 delete_after_append = TRUE;
323 compress_method = LZHUFF1_METHOD_NUM;
327 compress_method = LZHUFF5_METHOD_NUM;
332 compress_method = LZHUFF6_METHOD_NUM;
336 compress_method = LZHUFF7_METHOD_NUM;
341 error("invalid compression method 'o%c'", *p);
346 compress_method = LZHUFF0_METHOD_NUM; /* Changed N.Watazaki */
349 ignore_directory = TRUE;
355 for (i = 0; exclude_files && exclude_files[i]; i++)
357 exclude_files = (char**)xrealloc(exclude_files,
358 sizeof(char*) * (i+2));
362 error("exclude files does not specified for `-x'");
365 exclude_files[i] = *argv++; argc--;
366 exclude_files[i+1] = 0;
370 exclude_files[i] = p;
371 exclude_files[i+1] = 0;
375 #if IGNORE_DOT_FILES /* experimental feature */
377 for (i = 0; exclude_files && exclude_files[i]; i++)
379 exclude_files = (char**)xrealloc(exclude_files,
380 sizeof(char*) * (i+2));
382 exclude_files[i] = xstrdup(".*");
383 exclude_files[i+1] = 0;
391 error("working directory does not specified for `-w'");
394 extract_directory = *argv++; argc--;
398 extract_directory = p;
412 error("unknown option `-%c'.", p[-1]);
419 if (!opt || opt[0] != '-')
422 /* special archive name */
423 if (strcmp(opt, "-") == 0)
426 /* GNU style long options */
427 if (opt[0] == '-' && opt[1] == '-') {
430 if (strncmp(opt, "system-kanji-code=",
431 sizeof("system-kanji-code=")-1) == 0) {
432 opt += sizeof("system-kanji-code=")-1;
433 if (strcmp(opt, "euc") == 0) {
434 optional_system_kanji_code = CODE_EUC;
436 else if (strcmp(opt, "sjis") == 0) {
437 optional_system_kanji_code = CODE_SJIS;
439 else if (strcmp(opt, "utf8") == 0) {
440 optional_system_kanji_code = CODE_UTF8;
442 else if (strcmp(opt, "cap") == 0) {
443 optional_system_kanji_code = CODE_CAP;
446 error("unknown kanji code \"%s\"", opt);
450 else if (strncmp(opt, "archive-kanji-code=",
451 sizeof("archive-kanji-code=")-1) == 0) {
452 opt += sizeof("archive-kanji-code=")-1;
453 if (strcmp(opt, "euc") == 0) {
454 optional_archive_kanji_code = CODE_EUC;
456 else if (strcmp(opt, "sjis") == 0) {
457 optional_archive_kanji_code = CODE_SJIS;
459 else if (strcmp(opt, "utf8") == 0) {
460 optional_archive_kanji_code = CODE_UTF8;
462 else if (strcmp(opt, "cap") == 0) {
463 optional_archive_kanji_code = CODE_CAP;
466 error("unknown kanji code \"%s\"", opt);
471 error("unknown long option \"--%s\"", opt);
482 archive_name = *argv++; argc--;
491 /* ------------------------------------------------------------------------ */
501 init_variable(); /* Added N.Watazaki */
503 if (parse_option(argc, argv) == -1) {
510 error("archive file does not specified");
516 if (!strcmp(archive_name, "-")) {
517 if (!isatty(1) && cmd == CMD_ADD)
520 #if 0 /* Comment out; IMHO, this feature is useless. by Koji Arai */
522 if (argc == 3 && !isatty(0)) { /* 1999.7.18 */
523 /* Bug(?) on MinGW, isatty() return 0 on Cygwin console.
524 mingw-runtime-1.3-2 and Cygwin 1.3.10(0.51/3/2) on Win2000 */
525 get_filename_from_stdin = TRUE;
530 /* target file name */
531 if (get_filename_from_stdin) {
537 xfilev = (char **)xmalloc(sizeof(char *) * xfilec);
538 while (fgets(inpbuf, sizeof(inpbuf), stdin)) {
539 /* delete \n if it exist */
541 while (i < sizeof(inpbuf) && p != 0) {
549 if (cmd_filec >= xfilec) {
551 xfilev = (char **) xrealloc(xfilev,
552 sizeof(char *) * xfilec);
554 if (strlen(inpbuf) < 1)
556 xfilev[cmd_filec++] = xstrdup(inpbuf);
558 xfilev[cmd_filec] = NULL;
588 /* ------------------------------------------------------------------------ */
592 /* macro PACKAGE_NAME, PACKAGE_VERSION and PLATFORM are
593 defined in config.h by configure script */
594 fprintf(stderr, "%s version %s (%s)\n",
595 PACKAGE_NAME, PACKAGE_VERSION, PLATFORM);
600 message(char *fmt, ...)
602 message(fmt, va_alist)
607 int errno_sv = errno;
610 fprintf(stderr, "LHa: ");
613 vfprintf(stderr, fmt, v);
621 /* ------------------------------------------------------------------------ */
624 warning(char *fmt, ...)
626 warning(fmt, va_alist)
631 int errno_sv = errno;
634 fprintf(stderr, "LHa: Warning: ");
637 vfprintf(stderr, fmt, v);
645 /* ------------------------------------------------------------------------ */
648 error(char *fmt, ...)
655 int errno_sv = errno;
658 fprintf(stderr, "LHa: Error: ");
661 vfprintf(stderr, fmt, v);
673 fatal_error(char *fmt, ...)
675 fatal_error(fmt, va_alist)
680 int errno_sv = errno;
683 fprintf(stderr, "LHa: Fatal error: ");
686 vfprintf(stderr, fmt, v);
690 fprintf(stderr, ": %s\n", strerror(errno_sv));
694 if (remove_temporary_at_error) {
695 if (temporary_fd != -1)
697 unlink(temporary_name);
703 /* ------------------------------------------------------------------------ */
708 message("Interrupted");
710 if (temporary_fd != -1)
712 unlink(temporary_name);
713 if (recover_archive_when_interrupt)
714 rename(backup_archive_name, archive_name);
715 if (remove_extracting_file_when_interrupt) {
716 message("Removing: %s", writing_filename);
717 unlink(writing_filename);
719 signal(SIGINT, SIG_DFL);
721 signal(SIGHUP, SIG_DFL);
723 kill(getpid(), signo);
726 /* ------------------------------------------------------------------------ */
728 /* ------------------------------------------------------------------------ */
733 register char *p, *q;
737 if (generic_format) {
739 c1 = *(unsigned char *) p++;
740 c2 = *(unsigned char *) q++;
752 while (*p == *q && *p != '\0')
754 return *(unsigned char *) p - *(unsigned char *) q;
758 /* ------------------------------------------------------------------------ */
763 qsort(cmd_filev, cmd_filec, sizeof(char *), sort_by_ascii);
766 /* ------------------------------------------------------------------------ */
771 void *p = malloc(size);
773 fatal_error("Not enough memory");
777 /* ------------------------------------------------------------------------ */
783 void *p = (char *) realloc(old, size);
785 fatal_error("Not enough memory");
793 int len = strlen(str);
794 char *p = (char *)xmalloc(len + 1);
799 /* ------------------------------------------------------------------------ */
801 /* ------------------------------------------------------------------------ */
804 +-------------+-------------+------+-------------+----------+
805 | N A M E 1 \0| N A M E 2 \0| .... | N A M E n \0| |
806 +-------------+-------------+------+-------------+----------+
807 ^ ^ ^ buffer+0 buffer+used buffer+size
810 +---------------+---------------+------------- -----------------+
811 | pointer to | pointer to | pointer to ... pointer to |
812 | stringpool | N A M E 1 | N A M E 2 ... N A M E n |
813 +---------------+---------------+------------- -------------+
814 ^ malloc base returned
817 /* ------------------------------------------------------------------------ */
820 struct string_pool *sp;
822 sp->size = 1024 - 8; /* any ( >=0 ) */
825 sp->buffer = (char *) xmalloc(sp->size * sizeof(char));
828 /* ------------------------------------------------------------------------ */
830 add_sp(sp, name, len)
831 struct string_pool *sp;
832 char *name; /* stored '\0' at tail */
833 int len; /* include '\0' */
835 while (sp->used + len > sp->size) {
837 sp->buffer = (char *) xrealloc(sp->buffer, sp->size * sizeof(char));
839 memmove(sp->buffer + sp->used, name, len);
844 /* ------------------------------------------------------------------------ */
846 finish_sp(sp, v_count, v_vector)
847 register struct string_pool *sp;
855 v = (char **) xmalloc((sp->n + 1) * sizeof(char *));
860 for (i = sp->n; i; i--) {
867 /* ------------------------------------------------------------------------ */
873 free(*vector); /* free string pool */
878 /* ------------------------------------------------------------------------ */
879 /* READ DIRECTORY FILES */
880 /* ------------------------------------------------------------------------ */
882 include_path_p(path, name)
888 return (path[-1] == '/' && *n == '\0');
889 return (*n == '/' || (n != name && path[-1] == '/' && n[-1] == '/'));
892 /* ------------------------------------------------------------------------ */
894 cleaning_files(v_filec, v_filev)
901 register char **filev = *v_filev;
902 register int filec = *v_filec;
909 flags = xmalloc(filec * sizeof(char));
911 /* flags & 0x01 : 1: ignore */
912 /* flags & 0x02 : 1: directory, 0 : regular file */
913 /* flags & 0x04 : 1: need delete */
915 for (i = 0; i < filec; i++)
916 if (GETSTAT(filev[i], &stbuf) < 0) {
918 warning("Cannot access \"%s\" : %s; ignored.", filev[i],
922 if (is_regularfile(&stbuf))
924 else if (is_directory(&stbuf))
927 else if (is_symlink(&stbuf)) /* t.okamoto */
932 warning("Cannot archive \"%s\", ignored.", filev[i]);
936 for (i = 0; i < filec; i++) {
938 if ((flags[i] & 0x07) == 0x00) { /* regular file, not
940 for (j = i + 1; j < filec; j++) {
941 if ((flags[j] & 0x07) == 0x00) { /* regular file, not
943 if (STREQU(p, filev[j]))
944 flags[j] = 0x04; /* delete */
948 else if ((flags[i] & 0x07) == 0x02) { /* directory, not
950 for (j = i + 1; j < filec; j++) {
951 if ((flags[j] & 0x07) == 0x00) { /* regular file, not
953 if (include_path_p(p, filev[j]))
954 flags[j] = 0x04; /* delete */
956 else if ((flags[j] & 0x07) == 0x02) { /* directory, not
958 if (include_path_p(p, filev[j]))
959 flags[j] = 0x04; /* delete */
965 for (i = j = 0; i < filec; i++) {
966 if ((flags[i] & 0x04) == 0) {
977 /* ------------------------------------------------------------------------ */
979 find_files(name, v_filec, v_filev)
984 struct string_pool sp;
985 char newname[FILENAME_LENGTH];
989 struct stat tmp_stbuf, arc_stbuf, fil_stbuf;
990 int exist_tmp = 1, exist_arc = 1;
992 strcpy(newname, name);
994 if (len > 0 && newname[len - 1] != '/') {
995 newname[len++] = '/';
999 dirp = opendir(name);
1005 if (GETSTAT(temporary_name, &tmp_stbuf) == -1)
1007 if (GETSTAT(archive_name, &arc_stbuf) == -1)
1010 while ((dp = readdir(dirp)) != NULL) {
1013 /* exclude '.' and '..' */
1014 if (strncmp(dp->d_name, ".", n) == 0
1015 || strncmp(dp->d_name, "..", n) == 0)
1018 /* exclude exclude_files supplied by user */
1019 for (i = 0; exclude_files && exclude_files[i]; i++) {
1020 if (fnmatch(exclude_files[i], dp->d_name,
1021 FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD) == 0)
1025 if (len + n >= sizeof(newname)) {
1026 warning("filename is too long");
1030 strncpy(newname + len, dp->d_name, n);
1031 newname[len + n] = '\0';
1032 if (GETSTAT(newname, &fil_stbuf) < 0)
1035 #if defined(HAVE_STRUCT_STAT_ST_INO) && !__MINGW32__
1036 /* MinGW has meaningless st_ino */
1038 /* exclude temporary file, archive file and these links */
1040 tmp_stbuf.st_dev == fil_stbuf.st_dev &&
1041 tmp_stbuf.st_ino == fil_stbuf.st_ino)
1045 arc_stbuf.st_dev == fil_stbuf.st_dev &&
1046 arc_stbuf.st_ino == fil_stbuf.st_ino)
1049 add_sp(&sp, newname, len+n+1);
1054 finish_sp(&sp, v_filec, v_filev);
1056 qsort(*v_filev, *v_filec, sizeof(char *), sort_by_ascii);
1057 cleaning_files(v_filec, v_filev);
1062 /* ------------------------------------------------------------------------ */
1064 free_files(filec, filev)
1071 /* ------------------------------------------------------------------------ */
1073 /* ------------------------------------------------------------------------ */
1074 /* Build temporary file name and store to TEMPORARY_NAME */
1076 build_temporary_name()
1078 #ifdef TMP_FILENAME_TEMPLATE
1079 /* "/tmp/lhXXXXXX" etc. */
1080 if (extract_directory == NULL) {
1081 strcpy(temporary_name, TMP_FILENAME_TEMPLATE);
1084 xsnprintf(temporary_name, sizeof(temporary_name),
1085 "%s/lhXXXXXX", extract_directory);
1090 strcpy(temporary_name, archive_name);
1091 for (p = temporary_name, s = (char *) 0; *p; p++)
1094 strcpy((s ? s + 1 : temporary_name), "lhXXXXXX");
1100 old_umask = umask(077);
1101 fd = mkstemp(temporary_name);
1109 mktemp(temporary_name);
1110 flags = O_CREAT|O_EXCL|O_RDWR;
1114 return open(temporary_name, flags, 0600);
1119 /* ------------------------------------------------------------------------ */
1121 modify_filename_extention(buffer, ext)
1125 register char *p, *dot;
1127 for (p = buffer, dot = (char *) 0; *p; p++) {
1140 /* ------------------------------------------------------------------------ */
1141 /* build backup file name */
1143 build_backup_name(buffer, original)
1147 strcpy(buffer, original);
1148 modify_filename_extention(buffer, BACKUPNAME_EXTENTION); /* ".bak" */
1151 /* ------------------------------------------------------------------------ */
1153 build_standard_archive_name(buffer, orginal)
1157 strcpy(buffer, orginal);
1158 modify_filename_extention(buffer, ARCHIVENAME_EXTENTION); /* ".lzh" */
1161 /* ------------------------------------------------------------------------ */
1163 /* ------------------------------------------------------------------------ */
1173 for (i = 0; i < cmd_filec; i++) {
1174 if (patmatch(cmd_filev[i], name, 0))
1187 if ((fp = fopen(name, mode)) == NULL)
1188 fatal_error("Cannot open file \"%s\"", name);
1193 /* ------------------------------------------------------------------------ */
1195 /* ------------------------------------------------------------------------ */
1197 open_old_archive_1(name, v_fp)
1204 if (stat(name, &stbuf) >= 0 &&
1205 is_regularfile(&stbuf) &&
1206 (fp = fopen(name, READ_BINARY)) != NULL) {
1208 archive_file_gid = stbuf.st_gid;
1209 archive_file_mode = stbuf.st_mode;
1214 archive_file_gid = -1;
1218 /* ------------------------------------------------------------------------ */
1224 static char expanded_archive_name[FILENAME_LENGTH];
1226 if (!strcmp(archive_name, "-")) {
1227 if (cmd == CMD_EXTRACT || cmd == CMD_LIST) {
1229 setmode(fileno(stdin), O_BINARY);
1236 p = strrchr(archive_name, '.');
1238 if (strcasecmp(".LZH", p) == 0
1239 || strcasecmp(".LZS", p) == 0
1240 || strcasecmp(".COM", p) == 0 /* DOS SFX */
1241 || strcasecmp(".EXE", p) == 0
1242 || strcasecmp(".X", p) == 0 /* HUMAN SFX */
1243 || strcasecmp(".BAK", p) == 0) { /* for BackUp */
1244 open_old_archive_1(archive_name, &fp);
1249 if (open_old_archive_1(archive_name, &fp))
1251 xsnprintf(expanded_archive_name, sizeof(expanded_archive_name),
1252 "%s.lzh", archive_name);
1253 if (open_old_archive_1(expanded_archive_name, &fp)) {
1254 archive_name = expanded_archive_name;
1258 * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
1259 * expanded_archive_name; return NULL; }
1261 xsnprintf(expanded_archive_name, sizeof(expanded_archive_name),
1262 "%s.lzs", archive_name);
1263 if (open_old_archive_1(expanded_archive_name, &fp)) {
1264 archive_name = expanded_archive_name;
1268 * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
1269 * expanded_archive_name; return NULL; }
1272 * sprintf( expanded_archive_name , "%s.lzh",archive_name);
1273 * archive_name = expanded_archive_name;
1278 /* ------------------------------------------------------------------------ */
1280 inquire(msg, name, selective)
1281 char *msg, *name, *selective;
1287 fprintf(stderr, "%s %s ", name, msg);
1290 fgets(buffer, 1024, stdin);
1292 for (p = selective; *p; p++)
1293 if (buffer[0] == *p)
1294 return p - selective;
1299 /* ------------------------------------------------------------------------ */
1301 write_archive_tail(nafp)
1307 /* ------------------------------------------------------------------------ */
1309 copy_old_one(oafp, nafp, hdr)
1314 fseeko(oafp, hdr->header_size + hdr->packed_size, SEEK_CUR);
1317 reading_filename = archive_name;
1318 writing_filename = temporary_name;
1319 copyfile(oafp, nafp, hdr->header_size + hdr->packed_size, 0, 0);