X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FBarCode.c;h=872eacedf6fcc246126b9288029b25dd38dc59af;hp=4164acf1b2392782a0d74808fefb5ea1d310057f;hb=fa15a3f1ecd64efd8440e46d398fd9976abc3d25;hpb=31ab2d2cca0ca061a00cd688c850fca860827e26 diff --git a/sources/BarCode.c b/sources/BarCode.c index 4164acf..872eace 100644 --- a/sources/BarCode.c +++ b/sources/BarCode.c @@ -29,27 +29,22 @@ * http://localhost/cgi-bin/barcode?string * where string is the code to be converted * - * $Id: BarCode.c,v 1.5 2002/06/28 21:07:21 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers */ -#include /* predefined types */ -#include /* stat deinitiions */ -#include /* include unix standard library */ -/* */ -#include /* include standard I/O library */ -#include /* include standard library */ -#include /* include string library */ -#include /* include wait call */ -#include -#include -#include +#include /* primitive system data types */ +#include /* file characteristics constants and functions */ +#include /* unix standard library */ +#include /* standard I/O library */ +#include /* C standard library */ +#include /* C strings library */ +#include /* process termination constants and functions */ +#include /* file control functions */ +#include /* C assertion functions */ +#include /* date and time constants, types and functions */ #include"macros.h" -void WriteMess(char *mess); - /* Program begin */ int main(int argc, char *argv[], char *envp[]) @@ -67,7 +62,7 @@ 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++) { @@ -78,18 +73,10 @@ int main(int argc, char *argv[], char *envp[]) pipein = popen("barcode", "w"); /* send barcode string to barcode program */ write(fileno(pipein), argv[1], strlen(argv[1])); + 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"); -}