Aggiunta semop
[gapil.git] / sources / BarCode.c
index fbea4aee3eb8a5fa8f1cbe83750c6d5ec42ed423..6525889b1932eb92e1721a8f267c5f922e24dd17 100644 (file)
@@ -29,7 +29,7 @@
  * http://localhost/cgi-bin/barcode?string
  * where string is the code to be converted
  *
- * $Id: BarCode.c,v 1.4 2002/06/28 17:59:24 piccardi Exp $ 
+ * $Id: BarCode.c,v 1.6 2002/06/30 13:26:17 piccardi Exp $ 
  *
  ****************************************************************/
 /* 
@@ -48,8 +48,6 @@
 #include <time.h>
 
 #include"macros.h"
-void WriteMess(char *mess);
-
 
 /* Program begin */
 int main(int argc, char *argv[], char *envp[])
@@ -69,7 +67,6 @@ int main(int argc, char *argv[], char *envp[])
     int i;
     /* write mime-type to stout */ 
     write(STDOUT_FILENO, content, strlen(content));
-    
     /* execute chain of command */
     for (i=0; i<4; i++) {
        pipe[i] = popen(cmd_string[i], "w");
@@ -77,20 +74,12 @@ int main(int argc, char *argv[], char *envp[])
     }
     /* create barcode (in PS) */
     pipein = popen("barcode", "w");
-    /* send barcode string */
+    /* send barcode string to barcode program */
     write(fileno(pipein), argv[1], strlen(argv[1]));
-    /* close all pipes */
+    pclose(pipein);
+    /* close all pipes (in reverse order) */
     for (i=4; i==0; i--) {
        pclose((pipe[i]));
     }
     exit(0);
 }
-/*
- * Routine to produce an HTML error message on output 
- */
-void WriteMess(char *mess)
-{
-    printf("Content-type: text/html\n\n");
-    perror(mess);
-    printf("<br>\n");
-}