X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FBarCode.c;fp=sources%2FBarCode.c;h=0000000000000000000000000000000000000000;hp=122ad6b1f5289691dbd43f25441799523715d88d;hb=d12bc3e1e4b3ee762036d1c226c3b2ba1a720fb9;hpb=e3e15ed6d698e5cc35f3b7f4c5db96adc38255c3 diff --git a/sources/BarCode.c b/sources/BarCode.c deleted file mode 100644 index 122ad6b..0000000 --- a/sources/BarCode.c +++ /dev/null @@ -1,85 +0,0 @@ -/* BarCode.c - * - * Copyright (C) 2002 Simone Piccardi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/**************************************************************** - * - * Program barcode - * CGI for barcode generation - * - * Author: Simone Piccardi - * Jun. 2002 - * - * Usage: cgi-bin for apache. - * Called by downloading something like: - * http://localhost/cgi-bin/barcode?string - * where string is the code to be converted - * - * $Id: BarCode.c,v 1.7 2003/01/06 16:44:20 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"macros.h" - -/* Program begin */ -int main(int argc, char *argv[], char *envp[]) -{ -/* - * Variables definition - */ - FILE *pipe[4]; - FILE *pipein; - char *cmd_string[4]={ - "pnmtopng", - "pnmmargin -white 10", - "pnmcrop", - "gs -sDEVICE=ppmraw -sOutputFile=- -sNOPAUSE -q - -c showpage -c quit" - }; - char content[]="Content-type: image/png\n\n"; - int i; - /* 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"); - dup2(fileno(pipe[i]), STDOUT_FILENO); - } - /* create barcode (in PS) */ - 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); -}