home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / testzip.zip / testzip.h < prev    next >
Text File  |  1997-07-23  |  5KB  |  134 lines

  1. /*****************************************************************
  2.  * Testzip version 1.13                                          *
  3.  * Test zip file integrity, Nuke Bad Zips                        *
  4.  * Also prints a list of what it deleted in badfiles.txt         *
  5.  *                                                               *
  6.  * Programmer: Madman, with suggestions from Pantera             *
  7.  * Date: 12/6/96     Version 1.0                                 *
  8.  *                                                               *
  9.  * Modified by: Jeff Hamilton, hjeffrey@wam.umd.edu              *
  10.  * Date: 12/8/96     Version 1.01                                *
  11.  * Date: 12/12/96    Version 1.02                                *
  12.  * Date: 12/13/96    Version 1.03                                *
  13.  * Date: 12/15/96    Version 1.04                                *
  14.  * Date: 1/5/97      Version 1.1                                 *
  15.  *                                                               *
  16.  * See the readme.txt included with this source code for more    *
  17.  * information, and instructions for compiling and using this    *
  18.  * program.                                                      *
  19.  *                                                               *
  20.  * Disclaimer:   DISCLAIM THIS!!!!                               *
  21.  * This program and source code are distributed as is.  There is *
  22.  * NO guarantee that it will work on all systems.  Please test   *
  23.  * it out before using.  The programmers take no responsibilty   *
  24.  * for lost or damaged files, or any other problems that use of  *
  25.  * this software might cause.  USE AT YOUR OWN RISK!!!           *
  26.  *                                                               *
  27.  * Bug Reports:                                                  *
  28.  * If you find a bug, please e-mail a description of your        *
  29.  * operating system, what the bug does, and how to reproduce it  *
  30.  * to hjeffrey@wam.umd.edu  I will make every effort to find and *
  31.  * correct the bug.                                              *
  32.  *****************************************************************/
  33.  
  34. /*  Use default configuration if config file is not found.  Set to FALSE  */
  35. /*  to cause testzip to exit if config is not found.                      */
  36.  
  37. #define CONFIG_DEFAULTS TRUE
  38.  
  39. /*  If testzip can't open the logfile, it will exit.  Set this to true to */
  40. /*  cause it to continue, but disable all logging.                        */
  41.  
  42. #define READONLY_LOG FALSE
  43.  
  44. /*  It is not recommended that you modify any of these values, however,   */
  45. /*  if you know what you are doing, you can customize these to meet your  */
  46. /*  and your system's needs.                                              */
  47.  
  48. #define MAX_LINE_LEN 125
  49. #define MAX_EXTENSION 7
  50. #define MAX_ARCHIVER_NAME 20
  51. #define MAX_TEST_COMMAND 50
  52. #define MAX_ARCHIVERS 10
  53. #define MAX_DIR_LEN 100
  54. #define MAX_CONFIG_NAME 15
  55. #define MAX_LOG_NAME 25
  56.  
  57. /*  Operating System specific settings.  DO NOT change 'STATUS1'.  If you */
  58. /*  do, testzip will not be able to properly test files.                  */
  59.  
  60. #if defined(OS2)
  61.    #define STATUS1 255
  62.    #define CONFIG_NAME "testzip.cfg"
  63.    #define SYS_NULL "nul"
  64. #elif defined(UNIX)
  65.    #define STATUS1 256
  66.    #define CONFIG_PATH "/usr/local/lib"
  67.    #define CONFIG_NAME ".testzipcfg"
  68.    #define SYS_NULL "/dev/null"
  69. #elif defined(DOS)
  70.    #error Sorry...Dos is not supported by this version of Testzip.
  71.    #define CONFIG_NAME "testzip.cfg"
  72.    #define SYS_NULL "nul"
  73. #else
  74.    #error No Operating system specified.
  75. #endif
  76.  
  77.  
  78. /**************************************************************************/
  79. /*  DO NOT Modify anything below this line.  Doing so will cause testzip  */
  80. /*  to work improperly, and possibly not work at all.                     */
  81. /**************************************************************************/
  82.  
  83. #define TRUE 1
  84. #define FALSE 0
  85.  
  86. /*  Testzip Version Number  */
  87.  
  88. #define TZ_VERSION "1.14"
  89.  
  90. /*  Type definitions of Boolean type, and configuration structs.      */
  91.  
  92. typedef short int Bool;
  93.  
  94. typedef struct {
  95.    char name[MAX_ARCHIVER_NAME+1];
  96.    char extension[MAX_EXTENSION+1];
  97.    char option;
  98.    char command[MAX_TEST_COMMAND+1];
  99.    short int total_tested;
  100. } archiver;
  101.  
  102. typedef struct {
  103.    Bool do_delete;
  104.    char dir[MAX_DIR_LEN+1];
  105.    char logname[MAX_LOG_NAME+1];
  106.    short int loglevel;
  107.    Bool overwrite;
  108.    Bool append;
  109.    archiver archive[MAX_ARCHIVERS];
  110.    short int default_num;
  111.    short int num_archivers;
  112.    Bool do_all;
  113.    Bool recursive;
  114.    short int total_good;
  115.    short int total_bad;
  116.    short int total_tested;
  117.    short int total_del;
  118. } config;
  119.  
  120. /*  Function Prototypes  */
  121.  
  122. void recursive_check();
  123. void single_check();
  124. void do_archive_test(char filename[]);
  125. void open_log();
  126. void print_totals();
  127. void read_options(int *argc, char *argv[]);
  128. void strtoupper(char *string);
  129. void check_dir(char *string);
  130. void load_config_defaults();
  131. void print_config();
  132. void read_config();
  133. void check_a_command();
  134.