]> Pileus Git - ~andy/rsl/commitdiff
Revert binary mode for popen lug/aweather
authorAndy Spencer <andy753421@gmail.com>
Thu, 8 Sep 2011 07:27:24 +0000 (07:27 +0000)
committerAndy Spencer <andy753421@gmail.com>
Thu, 8 Sep 2011 07:27:24 +0000 (07:27 +0000)
Unlike fopen, popen only supports "r" and "w"

src/gzip.c
src/image_gen.c

index 8a34fa4e580e189278375afff79a0fe0ad3cb5f9..9c2ef315a16aaf97adebf701b321f00cfcca7c13 100644 (file)
@@ -81,7 +81,7 @@ FILE *uncompress_pipe (FILE *fp)
     return NULL;
   }
 
-  fpipe = popen("gzip -q -d -f --stdout", "rb");
+  fpipe = popen("gzip -q -d -f --stdout", "r");
   if (fpipe == NULL) perror("uncompress_pipe");
   close(0);
   if (dup(save_fd) < 0) {
@@ -108,7 +108,7 @@ FILE *compress_pipe (FILE *fp)
     return NULL;
   }
 
-  fpipe = popen("gzip -q -1 -c", "wb");
+  fpipe = popen("gzip -q -1 -c", "w");
   if (fpipe == NULL) perror("compress_pipe");
   close(1);
   if (dup(save_fd) < 0) {
index 3c69b7b34966e095dab775bbe624ee09ae9f08d8..f5e79715b28bc6a08e086326d4d56465e3bd9f94 100644 (file)
@@ -522,7 +522,7 @@ void RSL_write_gif(char *outfile, unsigned char *image, int xdim, int ydim, char
   fpipe = NULL;
   nbytes = xdim*ydim;
   (void)sprintf(pipecmd, "ppmtogif > %s 2>/dev/null", outfile);
-  fpipe = popen(pipecmd, "wb");  /* Global FILE * */
+  fpipe = popen(pipecmd, "w");  /* Global FILE * */
   if (fpipe == NULL) {
        perror("RSL_write_gif1");
        return;
@@ -563,7 +563,7 @@ void RSL_write_pict(char *outfile, unsigned char *image, int xdim, int ydim, cha
   }
   nbytes = xdim*ydim;
   (void)sprintf(pipecmd, "ppmtopict > %s 2>/dev/null", outfile);
-  fpipe = popen(pipecmd, "wb");  /* Global FILE * */
+  fpipe = popen(pipecmd, "w");  /* Global FILE * */
   fprintf(fpipe, "P6\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
   for (i=0; i<nbytes; i++)
          if (fwrite(c_table[image[i]], sizeof(char), 3, fpipe) != 3)
@@ -616,7 +616,7 @@ void RSL_write_pgm(char *outfile, unsigned char *image, int xdim, int ydim)
   }
   nbytes = xdim*ydim;
   (void)sprintf(pipecmd, "gzip > %s.gz 2>/dev/null", outfile);
-  fpipe = popen(pipecmd, "wb");  /* Global FILE * */
+  fpipe = popen(pipecmd, "w");  /* Global FILE * */
   fprintf(fpipe, "P5\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
   if (fwrite(image, sizeof(char), nbytes, fpipe) != nbytes)
        fprintf(stderr, "RSL_write_pgm: short write\n");