home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume8 / unpkmaps2 / path.patch < prev    next >
Encoding:
Text File  |  1989-09-23  |  2.2 KB  |  86 lines

  1. *** config.old.h
  2. --- config.h
  3. **************
  4. *** 11,16
  5.   /* default place for dbm output of makedb (or use -o at run-time) */
  6.   #define    ALIASDB    "/usr/local/lib/palias"
  7.   
  8.   
  9.   
  10.   /**************************************************************************
  11. --- 11,19 -----
  12.   /* default place for dbm output of makedb (or use -o at run-time) */
  13.   #define    ALIASDB    "/usr/local/lib/palias"
  14.   
  15. + /* place for zcat for uncompressing maps inline */
  16. + #define    COMPRESS    "/usr2/clewis/maps/compress12 -d"
  17.   
  18.   
  19.   /**************************************************************************
  20. *** parse.old.y
  21. --- parse.y
  22. **************
  23. *** 402,407
  24.       fixprivate();    /* munge private host definitions */
  25.       Lineno = 1;
  26.       while (optind < Argc) {
  27.           if (freopen((Cfile = Argv[optind++]), "r", stdin) != 0)
  28.               return 0;
  29.           sprintf(errbuf, "%s: %s", Argv[0], Cfile);
  30. --- 402,439 -----
  31.       fixprivate();    /* munge private host definitions */
  32.       Lineno = 1;
  33.       while (optind < Argc) {
  34. + #ifdef    COMPRESS
  35. +         static char Fname[512];
  36. +         char compressed[512];
  37. +         char cmdbuf[512];
  38. +         int dotidx;
  39. +         strcpy(Fname, Cfile = Argv[optind++]);
  40. +         strcpy(compressed, Cfile);
  41. +         dotidx = strlen(Cfile) - 2;
  42. +         if (dotidx >= 0 && strcmp(&Fname[dotidx], ".Z") == 0)
  43. +             Fname[dotidx] = '\0';
  44. +         else
  45. +             strcat(compressed, ".Z");
  46. +         if (access(Fname, 04) != 0) {
  47. +             if (access(compressed, 04) == 0) {
  48. +                 unlink("/tmp/pathfile");
  49. +                 sprintf(cmdbuf, "%s < %s > /tmp/pathfile", COMPRESS,
  50. +                     compressed);
  51. +                 system(cmdbuf);
  52. +                 if (freopen("/tmp/pathfile", "r", stdin) != 0) {
  53. +                     unlink("/tmp/pathfile");
  54. +                     return 0;
  55. +                 }
  56. +                 unlink("/tmp/pathfile");
  57. +             }
  58. +         } else {
  59. +             if (freopen(Fname, "r", stdin) != 0)
  60. +                 return 0;
  61. +         }
  62. + #else
  63.           if (freopen((Cfile = Argv[optind++]), "r", stdin) != 0)
  64.               return 0;
  65.   #endif
  66. **************
  67. *** 404,409
  68.       while (optind < Argc) {
  69.           if (freopen((Cfile = Argv[optind++]), "r", stdin) != 0)
  70.               return 0;
  71.           sprintf(errbuf, "%s: %s", Argv[0], Cfile);
  72.           perror(errbuf);
  73.       }
  74. --- 436,442 -----
  75.   #else
  76.           if (freopen((Cfile = Argv[optind++]), "r", stdin) != 0)
  77.               return 0;
  78. + #endif
  79.           sprintf(errbuf, "%s: %s", Argv[0], Cfile);
  80.           perror(errbuf);
  81.       }
  82.