"Fossies" - the Fresh Open Source Software Archive

Member "rman-3.2/contrib/gzip.patch" (26 Jul 2003, 1220 Bytes) of package /linux/www/old/rman-3.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 --- rman.c.~1~  Wed Nov 20 13:33:52 1996
    2 +++ rman.c  Fri Oct 24 00:10:56 1997
    3 @@ -3583,6 +3583,43 @@
    4             }
    5             free(sobuf);
    6         }
    7 +   } else {
    8 +#define GZIP "/bin/gzip"
    9 +       char * gz = malloc(strlen(p)+3+1);
   10 +       sprintf(gz, "%s.gz", p);
   11 +       if (stat(gz, &fileinfo)==0) {
   12 +           /* first, figure out how big */
   13 +           char * cmd = malloc(strlen(gz) + strlen(GZIP) + 7 + 1);
   14 +           char buffer[512];
   15 +           unsigned long compr, uncomp;
   16 +           FILE * proc;
   17 +           sprintf(cmd, "%s -l \"%s\"", GZIP, gz);
   18 +           proc = popen(cmd, "r");
   19 +           fgets(buffer, sizeof buffer, proc); /* label line */
   20 +           fgets(buffer, sizeof buffer, proc); /* length line */
   21 +           sscanf(buffer, "%lu %lu", &compr, &uncomp);
   22 +           fclose(proc);
   23 +           /* Boy, don't you wish stat would do that? */
   24 +           sobuf = malloc(uncomp + 1);
   25 +           if (sobuf!=NULL) {
   26 +               /* suck in entire file, as above */
   27 +               sprintf(cmd, "%s -dc \"%s\"", GZIP, gz);
   28 +               proc = popen(cmd, "r");
   29 +               if (proc!=NULL) {
   30 +                   if(fread(sobuf, 1, uncomp, proc)) {
   31 +                       sobuf[uncomp]='\0';
   32 +                       for (q=sobuf; (q=strstr(q," \\}"))!=NULL; q+=3) *q='\n';
   33 +                       source_subfile(sobuf);
   34 +                       err = 0;
   35 +                   }
   36 +                   fclose(proc);
   37 +               }
   38 +               free(sobuf);
   39 +           }
   40 +           free(cmd);
   41 +       }
   42 +       free(gz);
   43 +
   44     }
   45  
   46     if (err) {