X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=getcgi.c;h=b36ad9b3e2f2d39688c18c06079ecab19f9e1ad7;hb=e17ef1fac72bcfeff58e7c88af18eea6f9d6bc85;hp=ac37cff339d64e523c3b5a5f2db1bcd432aea051;hpb=0f4971d043c38bae1bfb95201622a1405110f899;p=onak.git diff --git a/getcgi.c b/getcgi.c index ac37cff..b36ad9b 100644 --- a/getcgi.c +++ b/getcgi.c @@ -1,16 +1,28 @@ /* * getcgivars.c - routine to read CGI input variables into an array. * - * Jonathan McDowell + * Copyright 2002 Jonathan McDowell * * The x2c() and unescape_url() routines were lifted directly * from NCSA's sample program util.c, packaged with their HTTPD. * - * $Id: getcgi.c,v 1.5 2003/06/04 20:57:07 noodles Exp $ + * 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; version 2 of the License. + * + * 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., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include +#include #include #include "getcgi.h" @@ -188,14 +200,14 @@ char **getcgivars(int argc, char *argv[]) for(i=0; cgiinput[i]; i++) if (cgiinput[i]=='+') cgiinput[i] = ' '; /* First, split on "&" to extract the name-value pairs into pairlist */ - pairlist=(char **) malloc(256*sizeof(char **)); + pairlist= malloc(256*sizeof(char *)); paircount=0; nvpair=strtok(cgiinput, "&"); while (nvpair) { pairlist[paircount++]= strdup(nvpair) ; if (!(paircount%256)) { - pairlist=(char **) realloc(pairlist, - (paircount+256)*sizeof(char **)); + pairlist= realloc(pairlist, + (paircount+256)*sizeof(char *)); } nvpair=strtok(NULL, "&") ; } @@ -204,7 +216,7 @@ char **getcgivars(int argc, char *argv[]) /* Then, from the list of pairs, extract the names and values */ - cgivars=(char **) malloc((paircount*2+1)*sizeof(char **)); + cgivars= malloc((paircount*2+1)*sizeof(char *)); for (i=0; i