X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FBarCode.c;h=122ad6b1f5289691dbd43f25441799523715d88d;hp=fbea4aee3eb8a5fa8f1cbe83750c6d5ec42ed423;hb=e3e15ed6d698e5cc35f3b7f4c5db96adc38255c3;hpb=da8455a295d5e2e237711cd930b7052f1b30ea38 diff --git a/sources/BarCode.c b/sources/BarCode.c index fbea4ae..122ad6b 100644 --- a/sources/BarCode.c +++ b/sources/BarCode.c @@ -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.7 2003/01/06 16:44:20 piccardi Exp $ * ****************************************************************/ /* @@ -48,8 +48,6 @@ #include #include"macros.h" -void WriteMess(char *mess); - /* Program begin */ int main(int argc, char *argv[], char *envp[]) @@ -67,9 +65,8 @@ int main(int argc, char *argv[], char *envp[]) }; char content[]="Content-type: image/png\n\n"; int i; - /* write mime-type to stout */ + /* write mime-type to stdout */ 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("
\n"); -}