1 /*
2  * $Id: defines.h,v 1.8 2004/05/31 16:08:41 andrew_belov Exp $
3  * ---------------------------------------------------------------------------
4  * Various macros, OS-independent types, and so on, are to be declared here.
5  *
6  */
7 
8 #ifndef DEFINES_INCLUDED
9 #define DEFINES_INCLUDED
10 
11 #include <limits.h>
12 
13 /* Nonspecific limits */
14 
15 #ifndef UCHAR_MAX
16  #define UCHAR_MAX               255
17 #endif
18 #ifndef CHAR_BIT
19  #define CHAR_BIT                  8
20 #endif
21 #ifndef LONG_MAX
22  #define LONG_MAX        0x7FFFFFFFL
23 #endif
24 
25 /* Archive header definitions */
26 
27 #define MAXMETHOD                  4    /* v 0.14+ */
28 
29 #define ARJ_VERSION               11    /* Current revision */
30 #define ARJ_ANSI_VERSION           9    /* Version that introduced ANSI CP
31                                            (ARJ32 v 3.00-18/12/1998 ONLY!) */
32 #define ARJ_M_VERSION              6    /* ARJ version that supports archive
33                                            last modification date. */
34 #define ARJ_X_VERSION              1    /* decoder version */
35 #define ARJ_G_VERSION              9    /* enhanced garble version */
36 #define ARJ_NEWCRYPT_VERSION      10    /* New encryption standard version */
37 #define ARJ_XD_VERSION             3    /* Version of decoder that supports
38                                            directories */
39 #define ARJ_XU_VERSION            11    /* Version of decoder with UNIX support */
40 #define ARJ_X_SUPPORTED           11    /* Currently supported level
41                                            (8 in official branch as of v 2.76) */
42 #define ARJ_X_SFX                 11    /* Level supported by ARJSFX
43                                            (5 in official branch as of v 2.76) */
44 #define ARJSEC_VERSION             2    /* Current ARJ-SECURITY version */
45 #define DEFAULT_METHOD             1
46 #define DEFAULT_TYPE               0    /* if type_sw is selected */
47 #define HEADER_ID             0xEA60
48 #define HEADER_ID_HI            0xEA
49 #define HEADER_ID_LO            0x60
50 #define FIRST_HDR_SIZE            30
51 #define FIRST_HDR_SIZE_V          34
52 
53 #define EA_ID                    'E'    /* EA ID in extended header */
54 #define UXSPECIAL_ID             'U'    /* UNIX special file ID */
55 #define OWNER_ID                 'O'    /* Owner ID */
56 #define OWNER_ID_NUM             'o'    /* Numeric owner ID */
57 
58 /* NLS */
59 
60 #define LANG_en                    0    /* English */
61 #define LANG_fr                    1    /* French */
62 #define LANG_de                    2    /* German */
63 #define LANG_ru                    3    /* Russian */
64 
65 /* Registration-related data */
66 
67 #define REG_ID                0xABC0    /* Indicates a registered ARJSFX */
68 #define UNREG_ID              0x1234    /* Indicates an unregistered ARJSFX */
69 #define REG_HDR_SHIFT             20    /* Bytes to skip after signature */
70 #define REG_HDR_LEN               32    /* Header size */
71 #define REG_KEY1_SHIFT (REG_HDR_SHIFT+REG_HDR_LEN)
72 #define REG_KEY1_LEN              10    /* Registration key #1 */
73 #define REG_KEY2_SHIFT (REG_KEY1_SHIFT+REG_KEY1_LEN)
74 #define REG_KEY2_LEN              10    /* Registration key #2 */
75 #define REG_NAME_SHIFT (REG_KEY2_SHIFT+REG_KEY2_LEN)
76 #define REG_NAME_LEN             100    /* Registration name */
77 #define STD_REG_LEN              152    /* Length of the registration field */
78 #define ARJSEC_RECORD_SIZE       120    /* Size of ARJ-SECURITY tail */
79 #define ARJSEC_ITER             1021    /* # of encryption iterations */
80 
81 /* Explicit delays */
82 
83 #define BAD_CRC_DELAY              5    /* Integrity violations */
84 #define SECURITY_DELAY             5    /* ARJ-SECURITY violations */
85 #define STD_CHANGE_VOL_DELAY      10    /* Default delay when changing
86                                            volumes */
87 
88 /* Header flags */
89 
90 #define GARBLED_FLAG            0x01
91 #define OLD_SECURED_FLAG        0x02
92 #define ANSICP_FLAG             0x02    /* Matches with the ARJSEC v 1.x */
93 #define VOLUME_FLAG             0x04
94 #define EXTFILE_FLAG            0x08
95 #define PROT_FLAG               0x08    /* Main header only (v 3.02+) */
96 #define PATHSYM_FLAG            0x10
97 #define BACKUP_FLAG             0x20
98 #define SECURED_FLAG            0x40
99 #define DUAL_NAME_FLAG          0x80    /* ARJ v 2.55+ ("-hf1" mode) */
100 
101 /* Extended header flags.
102    The following encryption flags can NOT be OR'ed together! */
103 
104 #define ENCRYPT_OLD                0    /* Standard encryption in pre-2.60 */
105 #define ENCRYPT_STD                1    /* Standard ARJ encryption */
106 #define ENCRYPT_GOST256            2    /* GOST 256-bit encryption (2.55+) */
107 #define ENCRYPT_GOST256L           3    /* GOST 256-bit encryption (2.62d+)
108                                            allows 64-byte long passwords */
109 #define ENCRYPT_GOST40             4    /* GOST 40-bit encryption (2.61+) */
110 #define ENCRYPT_UNK               16    /* To be encrypted */
111 
112 /* Relocated flags */
113 
114 #define SFXSTUB_FLAG               1    /* Indicates SFXSTUB presence */
115 
116 /* Limits to ARJ archives */
117 
118 #define COMMENT_MAX             2048
119 #define EXTENSION_MAX              9    /* For internal procedures */
120 #define HEADERSIZE_MAX             (FIRST_HDR_SIZE+10+FILENAME_MAX+COMMENT_MAX)
121 #define CHAPTERS_MAX             250    /* Limited by 1 byte for chapter # */
122 #define RESERVED_CHAPTER       32764    /* For special markers */
123 #define HIGHEST_CHAPTER (RESERVED_CHAPTER+1)
124 #define MAX_FILE_SIZE       LONG_MAX    /* Size of compressed file */
125 
126 /* Encoding/decoding constants */
127 
128 #define CODE_BIT                  16
129 #define THRESHOLD                  3
130 #define DICSIZ                 26624
131 #ifdef TILED
132  #define FDICSIZ              DICSIZ
133 #else
134  #define FDICSIZ               32768    /* decode_f() dictionary size */
135 #endif
136 #define DICSIZ_MAX             32750
137 #define BUFSIZ_DEFAULT         16384
138 #define MAXDICBIT                 16
139 #define MATCHBIT                   8
140 #define MAXMATCH                 256
141 #define NC (UCHAR_MAX+MAXMATCH+2-THRESHOLD)
142 #define NP             (MAXDICBIT+1)
143 #define CBIT                       9
144 #define NT              (CODE_BIT+3)
145 #define PBIT                       5
146 #define TBIT                       5
147 
148 #if NT>NP
149 #define NPT NT
150 #else
151 #define NPT NP
152 #endif
153 
154 #define CTABLESIZE              4096
155 #define PTABLESIZE               256
156 
157 #define STRTP                      9
158 #define STOPP                     13
159 
160 #define STRTL                      0
161 #define STOPL                      7
162 
163 #define PUTBIT_SIZE              512
164 
165 #define MIN_CRITICAL_BUFSIZ      512    /* The minimum size allowed by the
166                                            implementation */
167 #define MIN_BUFSIZ              2048
168 #define MAX_BUFSIZ       FAR_BLK_MAX
169 #define MAX_USER_BUFSIZ        65535    /* This one is here for compatibility:
170                                            even if compiler doesn't allow such
171                                            large values, the user should know
172                                            nothing. */
173 #define BUFSIZ_INCREMENT           6
174 
175 /* Message section defines */
176 
177 #define MSGTEXT_MAX              512    /* Maximum length of individual msg
178                                            (for copying far messages). It's
179                                            allowed for near FMSGs to be
180                                            larger */
181 
182 /* Search defines */
183 
184 #define SEARCH_STR_MAX            20    /* Maximum number of search patterns */
185 
186 /* Extended wildcard return status */
187 
188 #define XW_NONE                    0    /* No wildcards */
189 #define XW_OK                      1    /* Indicates successful parsing */
190 #define XW_PREM_END                2    /* Premature end of string */
191 #define XW_OWC                     3    /* Open * wildcard */
192 #define XW_UNPROC                  4    /* Unexpected unprocessed character */
193 #define XW_MISMATCH                5    /* Comparison mismatch */
194 #define XW_TERM                    6    /* Wildcard termination */
195 #define XWP_NONE                   0    /* Parsing was pointless */
196 #define XWP_TERM                  -1    /* Terminating '^' */
197 #define XWP_MDASH                 -2    /* Dash clause: -] or - */
198 #define XWP_OBRACKET              -3    /* Open bracket: [ */
199 #define XWP_NBRACKET              -4    /* Null bracket pair: [] */
200 
201 /* Block operations */
202 
203 #define BOP_NONE                   0    /* No action */
204 #define BOP_LIST                   1    /* List files to stdout ("arj s") */
205 #define BOP_SEARCH                 2    /* Search for a pattern ("arj w") */
206 #define BOP_COMPARE                3    /* Compare against disk files */
207 #define BOP_DISPLAY                5    /* List without pause */
208 
209 /* Changing it would result in loss of compatibility: */
210 
211 #define CRC_MASK         0xFFFFFFFFL
212 
213 /* Console definitions */
214 
215 #define CONSOLE_LINE_LENGTH       80    /* Length of output lines */
216 
217 /* File types and limitations */
218 
219 #define ARJT_BINARY                0
220 #define ARJT_TEXT                  1
221 #define ARJT_COMMENT               2
222 #define ARJT_DIR                   3
223 #define ARJT_LABEL                 4
224 #define ARJT_CHAPTER               5    /* Chapter mark - ARJ v 2.50+ */
225 #define ARJT_UXSPECIAL             6    /* UNIX special file - ARJ v 2.77+ */
226 #define TEXT_LCHAR                 7    /* Minimum displayable character */
227 #define TEXT_UCHAR               127    /* Maximum displayable character */
228 #define MIN_TEXT_SIZE            128    /* Minimum size for text files */
229 
230 /* ARJ commands */
231 
232 #define ARJ_CMD_ADD       ((int)'A')    /* Add files to archive */
233 #define ARJ_CMD_EXEC      ((int)'B')    /* Execute command */
234 #define ARJ_CMD_COMMENT   ((int)'C')    /* Comment archive files */
235 #define ARJ_CMD_DELETE    ((int)'D')    /* Delete files from archive */
236 #define ARJ_CMD_EXTR_NP   ((int)'E')    /* Extract, removing paths */
237 #define ARJ_CMD_FRESHEN   ((int)'F')    /* Freshen files in archive */
238 #define ARJ_CMD_GARBLE    ((int)'G')    /* Garble files in archive */
239 #define ARJ_CMD_CHK_INT   ((int)'I')    /* Check integrity */
240 #define ARJ_CMD_JOIN      ((int)'J')    /* Join archives */
241 #define ARJ_CMD_REM_BAK   ((int)'K')    /* Remove obsolete backup files */
242 #define ARJ_CMD_LIST      ((int)'L')    /* List archive contents */
243 #define ARJ_CMD_MOVE      ((int)'M')    /* Move files to archive */
244 #define ARJ_CMD_RENAME    ((int)'N')    /* Rename files in archive */
245 #define ARJ_CMD_ORDER     ((int)'O')    /* Order archive files */
246 #define ARJ_CMD_PRINT     ((int)'P')    /* List contents */
247 #define ARJ_CMD_RECOVER   ((int)'Q')    /* Recover damaged archive */
248 #define ARJ_CMD_REMPATH   ((int)'R')    /* Remove paths from filenames */
249 #define ARJ_CMD_SAMPLE    ((int)'S')    /* List to screen w/pause */
250 #define ARJ_CMD_TEST      ((int)'T')    /* Test an archive */
251 #define ARJ_CMD_UPDATE    ((int)'U')    /* Update files in archive */
252 #define ARJ_CMD_V_LIST    ((int)'V')    /* Verbosely list contents of archive */
253 #define ARJ_CMD_WHERE     ((int)'W')    /* Text search */
254 #define ARJ_CMD_EXTRACT   ((int)'X')    /* Extract files from archive */
255 #define ARJ_CMD_COPY      ((int)'Y')    /* Copy archive with new options */
256 #define ARJ_CMD_SECURE    ((int)'Z')    /* Create a security envelope */
257 #define ARJ_CMD_ADDC      ((int)'1')    /* Add a file to chapter archive */
258 #define ARJ_CMD_CNVC      ((int)'2')    /* Convert archive to a chapter one */
259 #define ARJ_CMD_DELC      ((int)'3')    /* Delete a chapter */
260 #define ARJDISP_CMD_START ((int)'+')    /* Put ARJDISP banner */
261 #define ARJDISP_CMD_END   ((int)'-')    /* Clear ARJDISP screen */
262 
263 /* Command line limits */
264 
265 #define CMDLINE_MAX              512    /* Length of command-line options */
266 
267 /* ARJ errorlevels */
268 
269 #define ARJ_ERL_SUCCESS            0
270 #define ARJ_ERL_WARNING            1
271 #define ARJ_ERL_FATAL_ERROR        2
272 #define ARJ_ERL_CRC_ERROR          3
273 #define ARJ_ERL_ARJSEC_ERROR       4
274 #define ARJ_ERL_DISK_FULL          5
275 #define ARJ_ERL_CANTOPEN           6
276 #define ARJ_ERL_USER_ERROR         7
277 #define ARJ_ERL_NO_MEMORY          8
278 #define ARJ_ERL_NOT_ARJ_ARCHIVE    9
279 #define ARJ_ERL_XMS_ERROR         10
280 #define ARJ_ERL_BREAK             11
281 #define ARJ_ERL_TOO_MANY_CHAPTERS 12
282 
283 /* ARJSFX errorlevels */
284 
285 #define ARJSFX_ERL_SUCCESS         0
286 #define ARJSFX_ERL_ERROR           1
287 
288 /* ARJSFXJR errorlevels */
289 
290 #define ARJSFXJR_ERL_SUCCESS       0
291 #define ARJSFXJR_ERL_FATAL         1
292 #define ARJSFXJR_ERL_ERROR         2
293 
294 /* REARJ errorlevels */
295 
296 #define REARJ_ERL_SUCCESS          0
297 #define REARJ_ERL_WARNING          1    /* File not found or other warning */
298 #define REARJ_ERL_UNCONFIGURED     2    /* File is not a configured archive
299                                            type */
300 #define REARJ_ERL_TGT_EXISTS       3    /* Target archive already exists */
301 #define REARJ_ERL_DISK_FULL        4    /* Not enough disk space */
302 #define REARJ_ERL_UPD_SKIPPED      5    /* User skipped or user did not select
303                                            update option */
304 #define REARJ_ERL_UNPACK           6    /* UNPACK error */
305 #define REARJ_ERL_PACK             7    /* PACK error */
306 #define REARJ_ERL_DIRECTORIES      8    /* Target cannot support directories */
307 #define REARJ_ERL_COUNT            9    /* Wrong file count */
308 #define REARJ_ERL_SIZE            10    /* Wrong total size */
309 #define REARJ_ERL_INTERNAL        11    /* Internal archive REARJ error */
310 #define REARJ_ERL_RENAME          12    /* Rename archive error */
311 #define REARJ_ERL_VIRUS           13    /* Invoked /v command error (found a
312                                            virus?) */
313 #define REARJ_ERL_OVERGROW        14    /* Output archive is larger */
314 
315 /* REGISTER errorlevels */
316 
317 #define REGISTER_ERL_SUCCESS       0
318 #define REGISTER_ERL_ERROR         1
319 
320 /* Approx. EXE file sizes (currently unused) */
321 
322 #define EXESIZE_ARJ          102400L
323 #define EXESIZE_ARJSFXV       30000L
324 #define EXESIZE_ARJSFX        14000L
325 #define EXESIZE_ARJSFXJR       9000L
326 #define EXESIZE_MINSFX         5000L    /* The smallest header prefix that
327                                            is considered as SFX (actually
328                                            checked as EXESIZE_MINSFX+1) */
329 
330 /* Maximum # of bytes to search for an archive header signature */
331 
332 #if TARGET==DOS
333  #define HSLIMIT_ARJ         524288L
334  #define HSLIMIT_ARJSFX      262144L
335  #define HSLIMIT_ARJSFXJR    131072L
336 #elif TARGET==OS2&&defined(TILED)&&!defined(DEBUG)
337  #define HSLIMIT_ARJ         320000L
338  #define HSLIMIT_ARJSFX       66000L
339  #define HSLIMIT_ARJSFXJR     18000L
340 #else
341  #define HSLIMIT_ARJ       16777216L    /* ...so we don't know/care about it */
342  #define HSLIMIT_ARJSFX     8188608L
343  #define HSLIMIT_ARJSFXJR   4094304L
344 #endif
345 
346 /* Standard queries */
347 
348 #define QUERY_CRITICAL             0    /* Can't be disabled */
349 #define QUERY_APPEND               1    /* -jya */
350 #define QUERY_CREATE_DIR           2    /* -jyc */
351 #define QUERY_DELETE_N_FILES       3    /* -jyd */
352 #define QUERY_LOW_SPACE            4    /* -jyk */
353 #define QUERY_EXTRACT_RENAME       5    /* -jyn */
354 #define QUERY_OVERWRITE            6    /* -jyo */
355 #define QUERY_SCANNED_ENOUGH       8    /* -jys */
356 #define QUERY_NEXT_VOLUME          9    /* -jyv */
357 #define QUERY_UPDATE              11    /* -jy std */
358 #define QUERY_PRESS_ENTER         12    /* "Press ENTER" and default is OK */
359 #define QUERY_ARCH_OP             13    /* archive operations (garble, etc.) */
360 #define TOTAL_QUERIES             14    /* Query array size */
361 
362 /* Standard replies */
363 
364 #define REPLY_YES                  0
365 #define REPLY_NO                   1
366 #define REPLY_QUIT                 2
367 #define REPLY_ALL                  3
368 #define REPLY_SKIP                 4
369 #define REPLY_GLOBAL               5
370 #define REPLY_COMMAND              6
371 #define MAX_REPLY                  6
372 
373 /* Progrss indicator states */
374 
375 #define IND_NORMAL                 0
376 #define IND_NONE                   1
377 #define IND_GRAPH                  2
378 #define IND_PCT_GRAPH              3
379 #define IND_TOTAL_PCT              4
380 #define IND_TOTAL_GRAPH            5
381 #define IND_TOTAL_PCT_GRAPH        6
382 #define IND_TOTAL_PCT_LGRAPH       7    /* -i6 (undocumented in v 2.62c) */
383 
384 /* Multivolume option settings */
385 
386 #define MV_NONE                    0    /* No -v */
387 #define MV_STD                     1    /* Standard -v w/user defined size */
388 #define MV_AVAIL                   2    /* Volume size depends on free space */
389 
390 /* Multivolume command execution settings */
391 
392 #define MVC_NONE                   0    /* No command execution (default) */
393 #define MVC_RUN_CMD                1    /* Execute command (-vs) */
394 #define MVC_RUN_CMD_NOECHO         2    /* Run command w/no echo (-vz) */
395 #define MVC_DELETION               3    /* -vd (deletion) command */
396 
397 /* -* option (quiet mode) settings */
398 
399 #define ARJ_NO_QUIET               0    /* default */
400 #define ARJ_QUIET                  1    /* -* */
401 #define ARJ_SILENT                 2    /* -*1 */
402 #define ARJ_QUIET2                 3    /* -*2 */
403 
404 /* Archive security states */
405 
406 #define ARJSEC_NONE                0    /* No ARJ-SECURITY */
407 #define ARJSEC_SECURED             1    /* Security envelope is present */
408 #define ARJSEC_SIGNED              2    /* Security signature is present */
409 
410 /* ARJ-SECURITY processing options */
411 
412 #define ARJSECP_STD                0    /* Default */
413 #define ARJSECP_SKIP               1    /* Skip test of security envelope */
414 #define ARJSECP_SET_ERROR          2    /* Set error on envelope */
415 
416 /* Filename matching levels */
417 
418 #define FMM_STD                    0    /* Default */
419 #define FMM_FULL_PATH              1    /* Match using full pathnames (-p) */
420 #define FMM_SUBDIRS                2    /* Match pathname w/subdirs (-p1) */
421 
422 /* LFN support modes */
423 
424 #define LFN_DEFAULT                0    /* Default (no -hf) */
425 #define LFN_NONE                   1    /* Use short names only (-hf) */
426 #define LFN_DUAL_EXT               2    /* Extract to W95LNAME.NNN (-hf1) */
427 #define LFN_IGNORE                 3    /* Use LFNs in DOS (-hf2) */
428 #define LFN_DUAL                   4    /* Use dual-mode name storage (-hf3) */
429 #define LFN_ALL                    5    /* Set all files as LFNs (-hf4) */
430 
431 /* Filelist storage classes */
432 
433 #define BST_NONE                   0    /* No memory allocated */
434 #define BST_FAR                    1    /* Block is in the far memory */
435 #define BST_DISK                   2    /* Block is on the disk */
436 #define BST_XMS                    3    /* Block is in the XMS */
437 
438 /* File search logging levels */
439 
440 #define SEARCH_DEFAULT             0    /* Display everything */
441 #define SEARCH_BRIEF               1    /* Display nothing but totals (-hw) */
442 #define SEARCH_SHOW_NAMES          2    /* Display files w/matches (-hw1) */
443 
444 /* GOST encryption modes */
445 
446 #define GOST_NONE                  0    /* No GOST encryption */
447 #define GOST256                    1    /* 256-bit encryption (2.55+) */
448 #define GOST40                     2    /* 40-bit encryption (2.61+) */
449 
450 /* Extract files containing the given text */
451 
452 #define EXTM_NONE                  0    /* No match is required */
453 #define EXTM_MATCHING              1    /* Only extract matching files */
454 #define EXTM_MISMATCHING           2    /* Only extract files w/o matches */
455 
456 /* -d (delete_processed) flags */
457 
458 #define DP_NONE                    0    /* Do not delete processed files */
459 #define DP_STD                     1    /* Standard (-d) */
460 #define DP_ADD                     2    /* On adds */
461 #define DP_STD                     1    /* Standard (-d) - ask permission */
462 #define DP_ADD                     2    /* Same as "ARJ m" */
463 #define DP_ADD_TRUNC               3    /* Same as DP_ADD + truncate
464                                            (ASR fix for 2.78-TCO) */
465 #define DP_EXTRACT                10    /* On extraction */
466 
467 /* Chapter archive update mode */
468 
469 #define CHAP_NONE                  0    /* No support for chapters */
470 #define CHAP_USE                   1    /* Create/update/extract chapters */
471 #define CHAP_REMOVE                2    /* Revert a chapter archive back */
472 
473 /* SFX creation states */
474 
475 #define SFXCRT_NONE                0    /* Do not create a SFX */
476 #define SFXCRT_SFX                 1    /* Create an ARJSFX/ARJSFXV EXE */
477 #define SFXCRT_SFXJR               2    /* Create an ARJSFXJR EXE */
478 
479 /* SFX descriptive identifiers */
480 
481 #define SFXDESC_NONSFX             0    /* Non-ARJSFX module */
482 #define SFXDESC_SFXJR              1    /* ARJSFXJR module */
483 #define SFXDESC_SFX                2    /* ARJSFX module */
484 #define SFXDESC_SFXV               3    /* ARJSFXV module */
485 
486 #define SFXDESC_MIN    SFXDESC_SFXJR    /* Supported range of descriptors */
487 #define SFXDESC_MAX     SFXDESC_SFXV
488 
489 /* Ignore CRC errors (-jr) */
490 
491 #define ICE_NONE                   0    /* Strict header checking */
492 #define ICE_FORMAT                 1    /* Ignore header format errors */
493 #define ICE_CRC                    2    /* Ignore header CRC errors only */
494 
495 /* Ignore archive open errors */
496 
497 #define IAE_NONE                   0    /* All open errors result in failure */
498 #define IAE_ACCESS                 1    /* Ignore open access errors (-hq) */
499 #define IAE_NOTFOUND               2    /* Ignore not found errors (-hq1) */
500 #define IAE_ALL                    3    /* Ignore both of the above (-hq2) */
501 
502 /* ANSI codepage handling options */
503 
504 #define ANSICP_STD                 0    /* Standard processing (depends on
505                                            host OS) */
506 #define ANSICP_CONVERT             1    /* Convert to OEM codepage (-hy) */
507 #define ANSICP_SKIP                2    /* Process only OEM archives (-hy1) */
508 #define ANSICP_USE_OEM             2    /* Process only OEM archives (-hy2) */
509 #define ANSICP_USE_ANSI            4    /* Process only ANSI archives (-hy3) */
510 
511 /* "-h#" (append time stamp) options */
512 
513 #define ATS_NONE                   0    /* Nothing to append */
514 #define ATS_DATE                   1    /* Append date string */
515 #define ATS_TIME                   2    /* Append time string */
516 #define ATS_DUAL                   3    /* Append day number and time */
517 
518 /* Comment display settings */
519 
520 #define CMTD_STD                   0    /* Standard comment handling style */
521 #define CMTD_PCMD                  1    /* Use P command to display ANSI */
522 #define CMTD_NONE                  2    /* Do not display comments */
523 
524 /* Verbose settings */
525 
526 #define VERBOSE_NONE               0    /* Default level */
527 #define VERBOSE_STD                1    /* -jv */
528 #define VERBOSE_ENH                2    /* -jv1 */
529 
530 /* Update and freshen options */
531 
532 #define UC_NONE                    0    /* None (default) */
533 #define UC_NEW_OR_NEWER            1    /* New + newer (-u) */
534 #define UC_NEW_OR_OLDER            2    /* New + older (-u1) */
535 #define UC_NEW_OR_DIFFERENT        3    /* New + different (-u2) */
536 #define UC_NEW_OR_CRC              4    /* New + CRC mismatch (-u3) */
537 #define FC_NONE                    0    /* None (default) */
538 #define FC_EXISTING                1    /* Existing (-f) */
539 #define FC_OLDER                   2    /* Older (-f1) */
540 #define FC_DIFFERENT               3    /* Different (-f2) */
541 #define FC_CRC                     4    /* CRC mismatch (-f3) */
542 
543 /* Selectable file types */
544 
545 #define FT_BINARY                  1    /* Binary (default) */
546 #define FT_TEXT                    2    /* Text */
547 #define FT_TEXT_FORCED             3    /* Forced text type */
548 #define FT_TEXT_GRAPHICS           4    /* Text with graphics */
549 #define FT_NO_OVERRIDE             0    /* No type specified */
550 
551 /* Backup options (-jg) */
552 
553 #define BS_NONE                    0    /* No respect to backup files */
554 #define BS_SELECT                  1    /* Select backup files */
555 #define BS_ONLY                    2    /* Select ONLY backup files */
556 
557 /* Timestamp override modes */
558 
559 #define ATO_NONE                   0    /* Default */
560 #define ATO_NEWEST                 1    /* Set to newest (-s) */
561 #define ATO_SAVE_ORIGINAL          2    /* Save original timestamp (-s1) */
562 #define ATO_SAVE_ARCHIVE           3    /* Save archive timestamp (-s2) */
563 #define ATO_SAVE_BOTH              4    /* Save both timestamps (-s3) */
564 
565 /* Hollow mode settings */
566 
567 #define HM_NONE                    0    /* Standard mode */
568 #define HM_CRC                     1    /* Store only the CRC */
569 #define HM_NO_CRC                  2    /* Store only date/size/attributes */
570 #define HM_RESTORE_ATTRS           3    /* Restore attributes */
571 #define HM_RESTORE_DATES           4    /* Restore dates */
572 #define HM_RESTORE_ALL             5    /* Restore both attributes and dates */
573 
574 /* CRC testing (-jt) options */
575 
576 #define TC_NONE                    0    /* No testing, default */
577 #define TC_ARCHIVE                 1    /* Test entire archive (-jt) */
578 #define TC_CRC_AND_CONTENTS        2    /* Test CRC and contents (-jt1) */
579 #define TC_ADDED_FILES             3    /* Test only added files (-jt2) */
580 #define TC_ATTRIBUTES              4    /* Test only fdate/fsize (-jt3) */
581 
582 /* -2d (compatible Host OS) settings */
583 
584 #define CHO_NATIVE                 0    /* Use native OS */
585 #define CHO_USE_DOS                1    /* Always set host OS to DOS */
586 #define CHO_COMMENT                2    /* Fix comments only */
587 
588 /* Recovery options */
589 
590 #define RB_NONE                    0    /* Default, exit on broken files */
591 #define RB_NORMAL                  1    /* Normal mode, skip CRC errors (-jr) */
592 #define RB_TIGHT                   2    /* Tight mode, skip header errors
593                                            (-jr1) */
594 
595 /* Path exclusion options */
596 
597 #define EP_NONE                    0    /* Default, store the full path */
598 #define EP_PATH                    1    /* Exclude path */
599 #define EP_BASEDIR                 2    /* Exclude base directory */
600 
601 /* Century handling options */
602 
603 #define CENT_DEFAULT               0    /* Default century handling */
604 #define CENT_SKIP                  1    /* Skip century in dates (-2k) */
605 #define CENT_SMART                 2    /* Smart handling (-2k1) */
606 
607 /* Owner storage options */
608 
609 #define OWNSTG_NONE                0    /* No owner storage */
610 #define OWNSTG_CHAR                1    /* Store in character format */
611 #define OWNSTG_ID                  2    /* Store in UID/GID format */
612 #define OWNSTG_CHAR_GID            3    /* Character format + GID */
613 
614 /* OS codes */
615 
616 #define OS_DOS                     0    /* MS-DOS */
617 #define OS_PRIMOS                  1    /* PRIMOS */
618 #define OS_UNIX                    2    /* UNIX-like operating systems */
619 #define OS_AMIGA                   3    /* AMIGA */
620 #define OS_MACOS                   4    /* Macintosh */
621 #define OS_OS2                     5    /* OS/2, WSoD, Warp Server, eCS */
622 #define OS_APPLE                   6    /* Apple GS */
623 #define OS_ATARI                   7    /* ATARI ST */
624 #define OS_NEXT                    8    /* NeXT */
625 #define OS_VAX                     9    /* VAX/VMS */
626 #define OS_WIN95                  10    /* Windows 95/98 */
627 #define OS_WINNT                  11    /* Windows NT/2000 */
628 #define OS_WIN32            OS_WINNT    /* Since ARJ v 2.62c */
629 
630 #define OS_SPECIAL            0xFFFF    /* Reserved for special handling */
631 
632 /* Implementation-independent path separators */
633 
634 #define PATHSEP_UNIX             '/'
635 #define PATHSEP_DOS             '\\'
636 
637 /* List character */
638 
639 #define LISTCHAR_DEFAULT         '!'
640 
641 /* Time filtering capabilities */
642 
643 #define TCHECK_NOTHING             0    /* Time is not checked */
644 #define TCHECK_FTIME               1    /* Last write time */
645 #define TCHECK_NDAYS               2    /* No older than N days */
646 #define TCHECK_CTIME               3    /* Creation time */
647 #define TCHECK_ATIME               4    /* Last access time */
648 
649 #define NULL_TIME                 0L    /* Non-existent timestamp */
650 
651 /* Attributes for tagging */
652 
653 #define TAG_FILES             0x0000    /* All files (-hbf -> -hbndhrs) */
654 #define TAG_ARCH              0x0001    /* Files with FA_ARCH set (-hba) */
655 #define TAG_NOT_ARCH          0x0002    /* Files with FA_ARCH clear (-hbb) */
656 #define TAG_RDONLY            0x0004    /* Read-only files (-hbr) */
657 #define TAG_SYSTEM            0x0008    /* System files (-hbs) */
658 #define TAG_HIDDEN            0x0010    /* Hidden files (-hbf) */
659 #define TAG_DIREC             0x0020    /* Directories (-hbd) */
660 #define TAG_LABEL             0x0040    /* Volume labels (-hbl) */
661 #define TAG_CHAPTER           0x0080    /* Internal chapter labels (-hbc) */
662 #define TAG_NORMAL            0x0100    /* Normal files (-hbn) */
663 #define TAG_WINLFN            0x0200    /* Windows 95 long filenames (-hbw) */
664 #define TAG_UXSPECIAL         0x0400    /* UNIX special files (-hbu) */
665 
666 #define TAG_LIST      "FABRSHDLCNWU"    /* Used in command prompt */
667 
668 /* Archive attribute filtering */
669 
670 #define FAA_NONE                   0    /* Ignore archive bit (default) */
671 #define FAA_BACKUP                 1    /* Backup changed files */
672 #define FAA_BACKUP_CLEAR           2    /* Backup changed, reset archive bits */
673 #define FAA_CLEAR                  3    /* only reset archive bits */
674 #define FAA_RESTORE_CLEAR          4    /* reset archive bit during restore */
675 #define FAA_EXCL_CLEAR             5    /* do not restore bits, reset arc */
676 #define FAA_SKIP_ATTRS             6    /* do not restore any file attributes */
677 
678 /* LFN support state */
679 
680 #define LFN_NOT_SUPPORTED          0    /* Running in pure DOS */
681 #define LFN_SUPPORTED              1    /* Default for '95s */
682 #define LFN_COMP                   2    /* Compatibility mode */
683 
684 /* validate_path actions */
685 
686 #define VALIDATE_ALL               0    /* Remove all relative specs */
687 #define VALIDATE_NOTHING           1    /* Do nothing */
688 #define VALIDATE_DRIVESPEC         2    /* Remove leading drive specs */
689 
690 /* File flags in filelist table. Two different mappings existed in ARJSFXV and
691    ARJ as of v 2.72 (eliminated 17/01/2001 -- ASR) */
692 
693 #define FLFLAG_TO_PROCESS         0    /* To be processed */
694 #define FLFLAG_PROCESSED          1    /* Already processed */
695 #define FLFLAG_SKIPPED            2    /* Forced to skip */
696 #define FLFLAG_DELETED            3    /* Already deleted */
697 
698 /* Special processing actions */
699 
700 #define CFA_NONE                   0    /* No special processing */
701 #define CFA_REMPATH                1    /* Remove paths from filenames */
702 #define CFA_GARBLE                 2    /* Garble files */
703 #define CFA_MARK_INCREMENT         3    /* Marking for chapter archives... */
704 #define CFA_UNMARK                 4
705 #define CFA_MARK                   5
706 #define CFA_MARK_EXT               6
707 #define CFA_UNMARK_EXT             7
708 #define CFA_UNGARBLE               8    /* Decrypt files */
709 
710 /* File list generation options */
711 
712 #define FETCH_DEFAULT              0    /* Standard files */
713 #define FETCH_FILES                1    /* Hidden files, etc. */
714 #define FETCH_DIRS                 2    /* Same + directories */
715 
716 /* Extension serialization types */
717 
718 #define EXT_NO_SERIALIZE           0    /* Do not serialize extensions */
719 #define EXT_SUBSTITUTE             1    /* Substitute extension */
720 #define EXT_INSERT                 2    /* Insert number before extension */
721 
722 /* Operations on final pass  */
723 
724 #define FP_GARBLE               0x02    /* Encryption stamping */
725 #define FP_SECURITY             0x15    /* Security envelope creation */
726 #define FP_VOLUME               0x16    /* Multivolume processing */
727 #define FP_CHAPTER              0x17    /* Chapter operations */
728 #define FP_PROT                 0x18    /* ARJ-PROTECT recovery record */
729 
730 /* Encryption id states */
731 
732 #define ENCID_NONE                 0    /* Default */
733 #define ENCID_GARBLE               1    /* Garble operation */
734 #define ENCID_UNGARBLE             2    /* Ungarble operation */
735 
736 /* Message section validation flag */
737 
738 #define CHKMSG_NOSKIP              0    /* Process CRC32 accumulation */
739 #define CHKMSG_SFX_HELP            1    /* Display ARJSFX help */
740 #define CHKMSG_SKIP               -1    /* Skip CRC32 accumulation */
741 
742 /* Hardlink suppression */
743 
744 #define SHL_NONE                   0    /* Normal processing */
745 #define SHL_DROP                   1    /* Ignore (do not add/extract) */
746 #define SHL_SOFT                   2    /* Ignore on addition, replace
747                                            w/symlinks upon extraction */
748 
749 /* Directory recursion order */
750 
751 #define RO_LAST                    0    /* Contents, then direntry */
752 #define RO_FIRST                   1    /* Direntry, then contents */
753 
754 /* Multivolume processing definitions */
755 
756 #define MULTIVOLUME_RESERVE      604    /* Number of bytes to subtract */
757 #define MULTIVOLUME_INCREMENT    500    /* Criteria of switching to next vol. */
758 #define MIN_VOLUME_SIZE       10000L    /* Minimal allowed volume size */
759 #define MAX_VOLUME_TRIES           9    /* Number of times to check if we can
760                                            switch to the next volume */
761 #define MAX_VOLUME_FT_CHECKS       3    /* Number of times to check the file
762                                            timestamp */
763 
764 /* SFX definitions */
765 
766 #define SFX_COMMAND_SIZE         126    /* Length of SFX options in comment
767                                            (must be less than CHAR_MAX) */
768 
769 /* Color highlighting */
770 
771 #ifdef COLOR_OUTPUT
772 struct color_hl
773 {
774  char color;
775  char arg;
776 };
777 #endif
778 
779 #define H_STD                      0    /* Standard text */
780 #define H_OPER                     1    /* Operation/progress counters */
781 #define H_HL                       2    /* Highlight */
782 #define H_SIG                      3    /* Signal */
783 #define H_ALERT                    4    /* Alert */
784 #define H_PROMPT                   5    /* Prompt */
785 #define H_COLORMASK             0x0F    /* Color index */
786 /* Flags */
787 #define H_WEAK                  0x10    /* After answering "NO" to the pause
788                                            request, the user will be brought
789                                            back to main processing loop */
790 #define H_NFMT                  0x20    /* Revert to H_STD for formatting
791                                            areas (e.g. "%d files") */
792 #define H_FORCE                 0x40    /* Does not go off with "-*",
793                                            needs "-*1" to be silenced */
794 #define H_ERR      (H_ALERT|H_FORCE)    /* Make error msgs visible */
795 
796 /* Line feed is used many times so we prefer to declare is as public in
797    ENVIRON.C and use far references to it: */
798 
799 extern char simple_lf[];
800 #define lf simple_lf
801 extern char simple_cr[];
802 #define cr simple_cr
803 
804 /* An extended file information structure */
805 
806 struct disk_file_info
807 {
808  struct file_properties file_properties;
809  char name[1];                          /* Allocated dynamically */
810 };
811 
812 /* Memory packing */
813 
814 struct mempack
815 {
816  char FAR *comp;
817  char FAR *orig;
818  unsigned int compsize;
819  unsigned int origsize;
820  int method;
821 };
822 
823 #define MEMPACK_OVERHEAD           4    /* CRC32 (for now) */
824 
825 #endif
826