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 recover_archive_when_interrupt = FALSE;
90 remove_extracting_file_when_interrupt = FALSE;
91 get_filename_from_stdin = FALSE;
92 ignore_directory = FALSE;
96 noconvertcase = FALSE;
98 extract_directory = NULL;
101 #if BACKUP_OLD_ARCHIVE
102 backup_old_archive = TRUE;
104 backup_old_archive = FALSE;
108 /* ------------------------------------------------------------------------ */
109 /* NOTES : Text File Format */
110 /* GENERATOR NewLine */
111 /* [generic] 0D 0A */
113 /* [OS9][MacOS] 0D */
115 /* ------------------------------------------------------------------------ */
120 usage: lha [-]<commands>[<options>] [-<options> ...] archive_file [file...]\n\
121 commands: [axelvudmcpt]\n\
122 options: [q[012]vnfto[567]dizg012e[w=<dir>|x=<pattern>]]\n");
129 LHarc for UNIX V 1.02 Copyright(C) 1989 Y.Tagawa\n\
130 LHx for MSDOS V C2.01 Copyright(C) 1990 H.Yoshizaki\n\
131 LHx(arc) for OSK V 2.01 Modified 1990 Momozou\n\
132 LHa for UNIX V 1.00 Copyright(C) 1992 Masaru Oki\n\
133 LHa for UNIX V 1.14 Modified 1995 Nobutaka Watazaki\n\
134 LHa for UNIX V 1.14i Modified 2000 Tsugio Okamoto\n\
135 Autoconfiscated 2001-2003 Koji Arai\n\
141 commands: options:\n\
142 a Add(or replace) to archive q{num} quiet (num:quiet mode)\n\
143 x,e EXtract from archive v verbose\n\
144 l,v List / Verbose List n not execute\n\
145 u Update newer files to archive f force (over write at extract)\n\
146 d Delete from archive t FILES are TEXT file\n");
149 m Move to archive (means 'ad') o[567] compression method (a/u/c)\n\
154 m Move to archive (means 'ad') o use LHarc compatible method (a/u/c)\n\
158 c re-Construct new archive d delete FILES after (a/u/c)\n\
159 p Print to STDOUT from archive i ignore directory path (x/e)\n\
160 t Test file CRC in archive z files not compress (a/u/c)\n\
161 g Generic format (for compatibility)\n\
162 or not convert case when extracting\n\
163 0/1/2 header level (a/u/c)\n\
167 e TEXT code convert from/to EUC\n\
171 w=<dir> specify extract directory (x/e)\n\
172 x=<pattern> eXclude files (a/u/c)\n\
174 #if IGNORE_DOT_FILES /* experimental feature */
176 X ignore dot files (a/u/c)\n\
182 parse_option(int argc, char **argv)
187 argv++; argc--; /* exclude command name */
194 if (strcmp(*argv, "--help") == 0) {
198 if (strcmp(*argv, "--version") == 0) {
203 if (argc == 1 && **argv != '-') {
204 archive_name = *argv++; argc--;
211 opt = *argv++; argc--;
224 output_to_stdout = TRUE;
242 update_if_newer = TRUE;
247 delete_after_append = TRUE;
252 verbose_listing = TRUE;
266 error("unknown command `-%c'", *opt);
278 case '0': /* no quiet */
279 case '1': /* no use the incremental indicator */
280 quiet_mode = *p - '0';
283 case '2': /* no output */
287 /* In quiet mode, no confirm to overwrite */
312 generic_format = TRUE;
313 noconvertcase = TRUE;
317 delete_after_append = TRUE;
322 compress_method = LZHUFF1_METHOD_NUM;
326 compress_method = LZHUFF5_METHOD_NUM;
331 compress_method = LZHUFF6_METHOD_NUM;
335 compress_method = LZHUFF7_METHOD_NUM;
340 error("invalid compression method 'o%c'", *p);
345 compress_method = LZHUFF0_METHOD_NUM; /* Changed N.Watazaki */
348 ignore_directory = TRUE;
354 for (i = 0; exclude_files && exclude_files[i]; i++)
356 exclude_files = (char**)xrealloc(exclude_files,
357 sizeof(char*) * (i+2));
361 error("exclude files does not specified for `-x'");
364 exclude_files[i] = *argv++; argc--;
365 exclude_files[i+1] = 0;
369 exclude_files[i] = p;
370 exclude_files[i+1] = 0;
374 #if IGNORE_DOT_FILES /* experimental feature */
376 for (i = 0; exclude_files && exclude_files[i]; i++)
378 exclude_files = (char**)xrealloc(exclude_files,
379 sizeof(char*) * (i+2));
381 exclude_files[i] = xstrdup(".*");
382 exclude_files[i+1] = 0;
390 error("working directory does not specified for `-w'");
393 extract_directory = *argv++; argc--;
397 extract_directory = p;
411 error("unknown option `-%c'.", p[-1]);
418 if (!opt || opt[0] != '-')
421 /* special archive name */
422 if (strcmp(opt, "-") == 0)
425 /* GNU style long options */
426 if (opt[0] == '-' && opt[1] == '-') {
429 if (strncmp(opt, "system-kanji-code=",
430 sizeof("system-kanji-code=")-1) == 0) {
431 opt += sizeof("system-kanji-code=")-1;
432 if (strcmp(opt, "euc") == 0) {
433 optional_system_kanji_code = CODE_EUC;
435 else if (strcmp(opt, "sjis") == 0) {
436 optional_system_kanji_code = CODE_SJIS;
438 else if (strcmp(opt, "utf8") == 0) {
439 optional_system_kanji_code = CODE_UTF8;
441 else if (strcmp(opt, "cap") == 0) {
442 optional_system_kanji_code = CODE_CAP;
445 error("unknown kanji code \"%s\"", opt);
449 else if (strncmp(opt, "archive-kanji-code=",
450 sizeof("archive-kanji-code=")-1) == 0) {
451 opt += sizeof("archive-kanji-code=")-1;
452 if (strcmp(opt, "euc") == 0) {
453 optional_archive_kanji_code = CODE_EUC;
455 else if (strcmp(opt, "sjis") == 0) {
456 optional_archive_kanji_code = CODE_SJIS;
458 else if (strcmp(opt, "utf8") == 0) {
459 optional_archive_kanji_code = CODE_UTF8;
461 else if (strcmp(opt, "cap") == 0) {
462 optional_archive_kanji_code = CODE_CAP;
465 error("unknown kanji code \"%s\"", opt);
470 error("unknown long option \"--%s\"", opt);
481 archive_name = *argv++; argc--;
490 /* ------------------------------------------------------------------------ */
500 init_variable(); /* Added N.Watazaki */
502 if (parse_option(argc, argv) == -1) {
509 error("archive file does not specified");
515 if (!strcmp(archive_name, "-")) {
516 if (!isatty(1) && cmd == CMD_ADD)
519 #if 0 /* Comment out; IMHO, this feature is useless. by Koji Arai */
521 if (argc == 3 && !isatty(0)) { /* 1999.7.18 */
522 /* Bug(?) on MinGW, isatty() return 0 on Cygwin console.
523 mingw-runtime-1.3-2 and Cygwin 1.3.10(0.51/3/2) on Win2000 */
524 get_filename_from_stdin = TRUE;
529 /* target file name */
530 if (get_filename_from_stdin) {
536 xfilev = (char **)xmalloc(sizeof(char *) * xfilec);
537 while (fgets(inpbuf, sizeof(inpbuf), stdin)) {
538 /* delete \n if it exist */
540 while (i < sizeof(inpbuf) && p != 0) {
548 if (cmd_filec >= xfilec) {
550 xfilev = (char **) xrealloc(xfilev,
551 sizeof(char *) * xfilec);
553 if (strlen(inpbuf) < 1)
555 xfilev[cmd_filec++] = xstrdup(inpbuf);
557 xfilev[cmd_filec] = NULL;
587 /* ------------------------------------------------------------------------ */
591 /* macro PACKAGE_NAME, PACKAGE_VERSION and PLATFORM are
592 defined in config.h by configure script */
593 fprintf(stderr, "%s version %s (%s)\n",
594 PACKAGE_NAME, PACKAGE_VERSION, PLATFORM);
599 message(char *fmt, ...)
601 message(fmt, va_alist)
606 int errno_sv = errno;
609 fprintf(stderr, "LHa: ");
612 vfprintf(stderr, fmt, v);
620 /* ------------------------------------------------------------------------ */
623 warning(char *fmt, ...)
625 warning(fmt, va_alist)
630 int errno_sv = errno;
633 fprintf(stderr, "LHa: Warning: ");
636 vfprintf(stderr, fmt, v);
644 /* ------------------------------------------------------------------------ */
647 error(char *fmt, ...)
654 int errno_sv = errno;
657 fprintf(stderr, "LHa: Error: ");
660 vfprintf(stderr, fmt, v);
672 fatal_error(char *fmt, ...)
674 fatal_error(fmt, va_alist)
679 int errno_sv = errno;
682 fprintf(stderr, "LHa: Fatal error: ");
685 vfprintf(stderr, fmt, v);
689 fprintf(stderr, ": %s\n", strerror(errno_sv));
699 if (temporary_fd != -1) {
702 unlink(temporary_name);
705 if (recover_archive_when_interrupt) {
706 rename(backup_archive_name, archive_name);
707 recover_archive_when_interrupt = FALSE;
709 if (remove_extracting_file_when_interrupt) {
710 message("Removing: %s", writing_filename);
711 unlink(writing_filename);
712 remove_extracting_file_when_interrupt = FALSE;
720 message("Interrupted");
724 signal(SIGINT, SIG_DFL);
726 signal(SIGHUP, SIG_DFL);
728 kill(getpid(), signo);
731 /* ------------------------------------------------------------------------ */
733 /* ------------------------------------------------------------------------ */
738 register char *p, *q;
742 if (generic_format) {
744 c1 = *(unsigned char *) p++;
745 c2 = *(unsigned char *) q++;
757 while (*p == *q && *p != '\0')
759 return *(unsigned char *) p - *(unsigned char *) q;
763 /* ------------------------------------------------------------------------ */
768 qsort(cmd_filev, cmd_filec, sizeof(char *), sort_by_ascii);
771 /* ------------------------------------------------------------------------ */
776 void *p = malloc(size);
778 fatal_error("Not enough memory");
782 /* ------------------------------------------------------------------------ */
788 void *p = (char *) realloc(old, size);
790 fatal_error("Not enough memory");
798 int len = strlen(str);
799 char *p = (char *)xmalloc(len + 1);
804 /* ------------------------------------------------------------------------ */
806 /* ------------------------------------------------------------------------ */
809 +-------------+-------------+------+-------------+----------+
810 | N A M E 1 \0| N A M E 2 \0| .... | N A M E n \0| |
811 +-------------+-------------+------+-------------+----------+
812 ^ ^ ^ buffer+0 buffer+used buffer+size
815 +---------------+---------------+------------- -----------------+
816 | pointer to | pointer to | pointer to ... pointer to |
817 | stringpool | N A M E 1 | N A M E 2 ... N A M E n |
818 +---------------+---------------+------------- -------------+
819 ^ malloc base returned
822 /* ------------------------------------------------------------------------ */
825 struct string_pool *sp;
827 sp->size = 1024 - 8; /* any ( >=0 ) */
830 sp->buffer = (char *) xmalloc(sp->size * sizeof(char));
833 /* ------------------------------------------------------------------------ */
835 add_sp(sp, name, len)
836 struct string_pool *sp;
837 char *name; /* stored '\0' at tail */
838 int len; /* include '\0' */
840 while (sp->used + len > sp->size) {
842 sp->buffer = (char *) xrealloc(sp->buffer, sp->size * sizeof(char));
844 memmove(sp->buffer + sp->used, name, len);
849 /* ------------------------------------------------------------------------ */
851 finish_sp(sp, v_count, v_vector)
852 register struct string_pool *sp;
860 v = (char **) xmalloc((sp->n + 1) * sizeof(char *));
865 for (i = sp->n; i; i--) {
872 /* ------------------------------------------------------------------------ */
878 free(*vector); /* free string pool */
883 /* ------------------------------------------------------------------------ */
884 /* READ DIRECTORY FILES */
885 /* ------------------------------------------------------------------------ */
887 include_path_p(path, name)
893 return (path[-1] == '/' && *n == '\0');
894 return (*n == '/' || (n != name && path[-1] == '/' && n[-1] == '/'));
897 /* ------------------------------------------------------------------------ */
899 cleaning_files(v_filec, v_filev)
906 register char **filev = *v_filev;
907 register int filec = *v_filec;
914 flags = xmalloc(filec * sizeof(char));
916 /* flags & 0x01 : 1: ignore */
917 /* flags & 0x02 : 1: directory, 0 : regular file */
918 /* flags & 0x04 : 1: need delete */
920 for (i = 0; i < filec; i++)
921 if (GETSTAT(filev[i], &stbuf) < 0) {
923 warning("Cannot access \"%s\" : %s; ignored.", filev[i],
927 if (is_regularfile(&stbuf))
929 else if (is_directory(&stbuf))
932 else if (is_symlink(&stbuf)) /* t.okamoto */
937 warning("Cannot archive \"%s\", ignored.", filev[i]);
941 for (i = 0; i < filec; i++) {
943 if ((flags[i] & 0x07) == 0x00) { /* regular file, not
945 for (j = i + 1; j < filec; j++) {
946 if ((flags[j] & 0x07) == 0x00) { /* regular file, not
948 if (STREQU(p, filev[j]))
949 flags[j] = 0x04; /* delete */
953 else if ((flags[i] & 0x07) == 0x02) { /* directory, not
955 for (j = i + 1; j < filec; j++) {
956 if ((flags[j] & 0x07) == 0x00) { /* regular file, not
958 if (include_path_p(p, filev[j]))
959 flags[j] = 0x04; /* delete */
961 else if ((flags[j] & 0x07) == 0x02) { /* directory, not
963 if (include_path_p(p, filev[j]))
964 flags[j] = 0x04; /* delete */
970 for (i = j = 0; i < filec; i++) {
971 if ((flags[i] & 0x04) == 0) {
982 /* ------------------------------------------------------------------------ */
984 find_files(name, v_filec, v_filev)
989 struct string_pool sp;
990 char newname[FILENAME_LENGTH];
994 struct stat tmp_stbuf, arc_stbuf, fil_stbuf;
995 int exist_tmp = 1, exist_arc = 1;
997 strcpy(newname, name);
999 if (len > 0 && newname[len - 1] != '/') {
1000 newname[len++] = '/';
1004 dirp = opendir(name);
1010 if (GETSTAT(temporary_name, &tmp_stbuf) == -1)
1012 if (GETSTAT(archive_name, &arc_stbuf) == -1)
1015 while ((dp = readdir(dirp)) != NULL) {
1018 /* exclude '.' and '..' */
1019 if (strncmp(dp->d_name, ".", n) == 0
1020 || strncmp(dp->d_name, "..", n) == 0)
1023 /* exclude exclude_files supplied by user */
1024 for (i = 0; exclude_files && exclude_files[i]; i++) {
1025 if (fnmatch(exclude_files[i], dp->d_name,
1026 FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD) == 0)
1030 if (len + n >= sizeof(newname)) {
1031 warning("filename is too long");
1035 strncpy(newname + len, dp->d_name, n);
1036 newname[len + n] = '\0';
1037 if (GETSTAT(newname, &fil_stbuf) < 0)
1040 #if defined(HAVE_STRUCT_STAT_ST_INO) && !__MINGW32__
1041 /* MinGW has meaningless st_ino */
1043 /* exclude temporary file, archive file and these links */
1045 tmp_stbuf.st_dev == fil_stbuf.st_dev &&
1046 tmp_stbuf.st_ino == fil_stbuf.st_ino)
1050 arc_stbuf.st_dev == fil_stbuf.st_dev &&
1051 arc_stbuf.st_ino == fil_stbuf.st_ino)
1054 add_sp(&sp, newname, len+n+1);
1059 finish_sp(&sp, v_filec, v_filev);
1061 qsort(*v_filev, *v_filec, sizeof(char *), sort_by_ascii);
1062 cleaning_files(v_filec, v_filev);
1067 /* ------------------------------------------------------------------------ */
1069 free_files(filec, filev)
1076 /* ------------------------------------------------------------------------ */
1078 /* ------------------------------------------------------------------------ */
1079 /* Build temporary file name and store to TEMPORARY_NAME */
1081 build_temporary_name()
1083 #ifdef TMP_FILENAME_TEMPLATE
1084 /* "/tmp/lhXXXXXX" etc. */
1085 if (extract_directory == NULL) {
1086 strcpy(temporary_name, TMP_FILENAME_TEMPLATE);
1089 xsnprintf(temporary_name, sizeof(temporary_name),
1090 "%s/lhXXXXXX", extract_directory);
1095 strcpy(temporary_name, archive_name);
1096 for (p = temporary_name, s = (char *) 0; *p; p++)
1099 strcpy((s ? s + 1 : temporary_name), "lhXXXXXX");
1105 old_umask = umask(077);
1106 fd = mkstemp(temporary_name);
1114 mktemp(temporary_name);
1115 flags = O_CREAT|O_EXCL|O_RDWR;
1119 return open(temporary_name, flags, 0600);
1124 /* ------------------------------------------------------------------------ */
1126 modify_filename_extention(buffer, ext)
1130 register char *p, *dot;
1132 for (p = buffer, dot = (char *) 0; *p; p++) {
1145 /* ------------------------------------------------------------------------ */
1146 /* build backup file name */
1148 build_backup_name(buffer, original)
1152 strcpy(buffer, original);
1153 modify_filename_extention(buffer, BACKUPNAME_EXTENTION); /* ".bak" */
1156 /* ------------------------------------------------------------------------ */
1158 build_standard_archive_name(buffer, orginal)
1162 strcpy(buffer, orginal);
1163 modify_filename_extention(buffer, ARCHIVENAME_EXTENTION); /* ".lzh" */
1166 /* ------------------------------------------------------------------------ */
1168 /* ------------------------------------------------------------------------ */
1178 for (i = 0; i < cmd_filec; i++) {
1179 if (patmatch(cmd_filev[i], name, 0))
1192 if ((fp = fopen(name, mode)) == NULL)
1193 fatal_error("Cannot open file \"%s\"", name);
1198 /* ------------------------------------------------------------------------ */
1200 /* ------------------------------------------------------------------------ */
1202 open_old_archive_1(name, v_fp)
1209 if (stat(name, &stbuf) >= 0 &&
1210 is_regularfile(&stbuf) &&
1211 (fp = fopen(name, READ_BINARY)) != NULL) {
1213 archive_file_gid = stbuf.st_gid;
1214 archive_file_mode = stbuf.st_mode;
1219 archive_file_gid = -1;
1223 /* ------------------------------------------------------------------------ */
1229 static char expanded_archive_name[FILENAME_LENGTH];
1231 if (!strcmp(archive_name, "-")) {
1232 if (cmd == CMD_EXTRACT || cmd == CMD_LIST) {
1234 setmode(fileno(stdin), O_BINARY);
1241 p = strrchr(archive_name, '.');
1243 if (strcasecmp(".LZH", p) == 0
1244 || strcasecmp(".LZS", p) == 0
1245 || strcasecmp(".COM", p) == 0 /* DOS SFX */
1246 || strcasecmp(".EXE", p) == 0
1247 || strcasecmp(".X", p) == 0 /* HUMAN SFX */
1248 || strcasecmp(".BAK", p) == 0) { /* for BackUp */
1249 open_old_archive_1(archive_name, &fp);
1254 if (open_old_archive_1(archive_name, &fp))
1256 xsnprintf(expanded_archive_name, sizeof(expanded_archive_name),
1257 "%s.lzh", archive_name);
1258 if (open_old_archive_1(expanded_archive_name, &fp)) {
1259 archive_name = expanded_archive_name;
1263 * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
1264 * expanded_archive_name; return NULL; }
1266 xsnprintf(expanded_archive_name, sizeof(expanded_archive_name),
1267 "%s.lzs", archive_name);
1268 if (open_old_archive_1(expanded_archive_name, &fp)) {
1269 archive_name = expanded_archive_name;
1273 * if ( (errno&0xffff)!=E_PNNF ) { archive_name =
1274 * expanded_archive_name; return NULL; }
1277 * sprintf( expanded_archive_name , "%s.lzh",archive_name);
1278 * archive_name = expanded_archive_name;
1283 /* ------------------------------------------------------------------------ */
1285 inquire(msg, name, selective)
1286 char *msg, *name, *selective;
1292 fprintf(stderr, "%s %s ", name, msg);
1295 fgets(buffer, 1024, stdin);
1297 for (p = selective; *p; p++)
1298 if (buffer[0] == *p)
1299 return p - selective;
1304 /* ------------------------------------------------------------------------ */
1306 write_archive_tail(nafp)
1312 /* ------------------------------------------------------------------------ */
1314 copy_old_one(oafp, nafp, hdr)
1319 fseeko(oafp, hdr->header_size + hdr->packed_size, SEEK_CUR);
1322 reading_filename = archive_name;
1323 writing_filename = temporary_name;
1324 copyfile(oafp, nafp, hdr->header_size + hdr->packed_size, 0, 0);