diff options
author | jmmv <jmmv> | 2004-07-20 21:44:29 +0000 |
---|---|---|
committer | jmmv <jmmv> | 2004-07-20 21:44:29 +0000 |
commit | d7d845e735ea3290e679fd78586e65193cc2c4a5 (patch) | |
tree | e6ad0ab0b7727d41aeb46531ab74672f42c86dba | |
parent | 4988b4d6fa1ffc50e0cdc3523f3ce6466f87d236 (diff) | |
download | pkgsrc-d7d845e735ea3290e679fd78586e65193cc2c4a5.tar.gz |
Initial import of cgic, version 2.02, provided by cinnion at ka8zrt.com:
This is the code written to accompany Thomas Boutell's book "CGI
Programming in C & Perl". It provides a library of routines for use
in CGI programming, and unlike cgilib-0.5, this library handles the
"multipart/form-data" encoding required to use the FILE input control
type as defined in the HTML specification.
NOTE: It should be aware that there were a few developer visible changes
made from Thomas Boutell's original distribution when integrating it
with the NetBSD packages environment. They are:
1) Instead of being yet another source file which is used in building
the application, the package have been converted totally into a
library format. This library is linked using "-lcgic".
2) As a result of the first item, the developer no longer writes their
entry point under the function name of cgiMain(). Instead, the
user will provide their own main(), and will need to call cgiInit()
before any other cgic function is called.
-rw-r--r-- | www/cgic/DESCR | 17 | ||||
-rw-r--r-- | www/cgic/Makefile | 16 | ||||
-rw-r--r-- | www/cgic/PLIST | 14 | ||||
-rw-r--r-- | www/cgic/distinfo | 10 | ||||
-rw-r--r-- | www/cgic/patches/patch-aa | 65 | ||||
-rw-r--r-- | www/cgic/patches/patch-ab | 13 | ||||
-rw-r--r-- | www/cgic/patches/patch-ac | 56 | ||||
-rw-r--r-- | www/cgic/patches/patch-ad | 13 | ||||
-rw-r--r-- | www/cgic/patches/patch-ae | 34 | ||||
-rw-r--r-- | www/cgic/patches/patch-af | 19 |
10 files changed, 257 insertions, 0 deletions
diff --git a/www/cgic/DESCR b/www/cgic/DESCR new file mode 100644 index 00000000000..263da45c7f6 --- /dev/null +++ b/www/cgic/DESCR @@ -0,0 +1,17 @@ +This is the code written to accompany Thomas Boutell's book "CGI +Programming in C & Perl". It provides a library of routines for use +in CGI programming, and unlike cgilib-0.5, this library handles the +"multipart/form-data" encoding required to use the FILE input control +type as defined in the HTML specification. + +NOTE: It should be aware that there were a few developer visible changes +made from Thomas Boutell's original distribution when integrating it +with the NetBSD packages environment. They are: + +1) Instead of being yet another source file which is used in building + the application, the package have been converted totally into a + library format. This library is linked using "-lcgic". +2) As a result of the first item, the developer no longer writes their + entry point under the function name of cgiMain(). Instead, the + user will provide their own main(), and will need to call cgiInit() + before any other cgic function is called. diff --git a/www/cgic/Makefile b/www/cgic/Makefile new file mode 100644 index 00000000000..d7c87968cef --- /dev/null +++ b/www/cgic/Makefile @@ -0,0 +1,16 @@ +# $NetBSD: Makefile,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ +# + +DISTNAME= cgic202 +PKGNAME= cgic-2.02 +CATEGORIES= www +MASTER_SITES= http://www.boutell.com/cgic/ + +MAINTAINER= cinnion@ka8zrt.com +HOMEPAGE= http://www.boutell.com/cgic/ +COMMENT= Thomas Boutell's ANSI C library for CGI Programming + +USE_BUILDLINK3= yes +USE_LIBTOOL= yes + +.include "../../mk/bsd.pkg.mk" diff --git a/www/cgic/PLIST b/www/cgic/PLIST new file mode 100644 index 00000000000..c40789c4a29 --- /dev/null +++ b/www/cgic/PLIST @@ -0,0 +1,14 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ +include/cgic.h +lib/libcgic.a +lib/libcgic.la +lib/libcgic.so +lib/libcgic.so.0 +lib/libcgic.so.0.0 +libexec/cgi-bin/capture +libexec/cgi-bin/cgictest +share/doc/html/cgiclib/cgic.html +share/examples/cgiclib/capture.c +share/examples/cgiclib/cgictest.c +@dirrm share/examples/cgiclib +@dirrm share/doc/html/cgiclib diff --git a/www/cgic/distinfo b/www/cgic/distinfo new file mode 100644 index 00000000000..6b00c3bc7bd --- /dev/null +++ b/www/cgic/distinfo @@ -0,0 +1,10 @@ +$NetBSD: distinfo,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +SHA1 (cgic202.tar.gz) = 8db924f00a7443f8953ea37a084025332e0efbb1 +Size (cgic202.tar.gz) = 49531 bytes +SHA1 (patch-aa) = 1799e30492707962a9fdf927697657021e7afdce +SHA1 (patch-ab) = 42e8ee71eeb363e702dfab66344811a8967d382d +SHA1 (patch-ac) = 948ba16e838bb50c60b14e75ccffc942ec01144a +SHA1 (patch-ad) = 6ef230a6cc265121dbcbaef392bc1d9c43d167b0 +SHA1 (patch-ae) = 30c7170033e3fce8dea2991456d76cdd26e5cae2 +SHA1 (patch-af) = e143b77cabe7cb8ac44bd74419ed875800dc1d1d diff --git a/www/cgic/patches/patch-aa b/www/cgic/patches/patch-aa new file mode 100644 index 00000000000..12168fe243d --- /dev/null +++ b/www/cgic/patches/patch-aa @@ -0,0 +1,65 @@ +$NetBSD: patch-aa,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +--- Makefile.orig Sun Jan 12 13:59:43 2003 ++++ Makefile +@@ -1,27 +1,42 @@ +-CFLAGS=-g -Wall ++CFLAGS += -g -Wall + CC=gcc + AR=ar +-LIBS=-L./ -lcgic ++LIBS = libcgic.la + +-all: libcgic.a cgictest.cgi capture ++OBJS = cgic.o + +-install: libcgic.a +- cp libcgic.a /usr/local/lib +- cp cgic.h /usr/local/include +- @echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include. ++all: libcgic.la cgictest capture + +-libcgic.a: cgic.o cgic.h +- rm -f libcgic.a +- $(AR) rc libcgic.a cgic.o ++.SUFFIXES: .lo + +-#mingw32 and cygwin users: replace .cgi with .exe +- +-cgictest.cgi: cgictest.o libcgic.a +- gcc cgictest.o -o cgictest.cgi ${LIBS} +- +-capture: capture.o libcgic.a +- gcc capture.o -o capture ${LIBS} ++.c.lo: ++ ${LIBTOOL} --mode=compile ${CC} ${CFLAGS} -o $@ -c $< ++ ++libcgic.la: $(OBJS:.o=.lo) ++ ${LIBTOOL} --mode=link ${CC} -o $@ ${OBJS:.o=.lo} \ ++ -rpath ${PREFIX}/lib \ ++ -version-info 0:0 ++ ++cgictest: cgictest.lo libcgic.la ++ ${LIBTOOL} --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ cgictest.lo $(LIBS) ++ ++capture: capture.lo libcgic.la ++ ${LIBTOOL} --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ cgictest.lo $(LIBS) ++ ++install: libcgic.la cgictest ++ -mkdir -p ${PREFIX}/libexec/cgi-bin ++ -mkdir -p ${PREFIX}/share/examples/cgiclib ++ ${INSTALL} -c -m 444 capture.c ${PREFIX}/share/examples/cgiclib ++ ${INSTALL} -c -m 444 cgictest.c ${PREFIX}/share/examples/cgiclib ++ ${LIBTOOL} --mode=install ${INSTALL} -c -m 444 libcgic.la ${PREFIX}/lib ++ ${LIBTOOL} --mode=install ${INSTALL} -c -m 755 capture ${PREFIX}/libexec/cgi-bin ++ ${LIBTOOL} --mode=install ${INSTALL} -c -m 755 cgictest ${PREFIX}/libexec/cgi-bin ++ ${INSTALL} -c -m 444 cgic.h ${PREFIX}/include ++ -mkdir -p ${PREFIX}/share/doc/html/cgiclib ++ for i in *.html; do \ ++ ${INSTALL} -c -m 444 $$i ${PREFIX}/share/doc/html/cgiclib ; \ ++ done + + clean: +- rm -f *.o *.a cgictest.cgi capture ++ rm -f *.o *.la cgictest capture + diff --git a/www/cgic/patches/patch-ab b/www/cgic/patches/patch-ab new file mode 100644 index 00000000000..8b782376587 --- /dev/null +++ b/www/cgic/patches/patch-ab @@ -0,0 +1,13 @@ +$NetBSD: patch-ab,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +--- capture.c.orig Sun Jan 12 13:59:43 2003 ++++ capture.c +@@ -1,6 +1,7 @@ + #include "cgic.h" + +-int cgiMain() { ++int main() { ++ cgiInit(); + cgiWriteEnvironment("/CHANGE/THIS/PATH/capcgi.dat"); + cgiHeaderContentType("text/html"); + fprintf(cgiOut, "<title>Captured</title>\n"); diff --git a/www/cgic/patches/patch-ac b/www/cgic/patches/patch-ac new file mode 100644 index 00000000000..eb7a2089d20 --- /dev/null +++ b/www/cgic/patches/patch-ac @@ -0,0 +1,56 @@ +$NetBSD: patch-ac,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +--- cgic.c.orig Sun Jan 12 13:59:43 2003 ++++ cgic.c +@@ -124,8 +124,9 @@ static int cgiStrBeginsNc(char *s1, char + + static int firstCookie = 1; + +-int main(int argc, char *argv[]) { +- int result; ++int ++cgiInit(void) ++{ + char *cgiContentLengthString; + char *e; + cgiSetupConstants(); +@@ -211,17 +212,6 @@ int main(int argc, char *argv[]) { + cgiOut = stdout; + cgiRestored = 0; + +- +- /* These five lines keep compilers from +- producing warnings that argc and argv +- are unused. They have no actual function. */ +- if (argc) { +- if (argv[0]) { +- cgiRestored = 0; +- } +- } +- +- + if (cgiStrEqNc(cgiRequestMethod, "post")) { + #ifdef CGICDEBUG + CGICDEBUGSTART +@@ -290,9 +280,9 @@ int main(int argc, char *argv[]) { + } + } + firstCookie = 1; +- result = cgiMain(); +- cgiFreeResources(); +- return result; ++ ++ atexit(cgiFreeResources); ++ return(0); + } + + static void cgiGetenv(char **s, char *var){ +@@ -1995,7 +1985,7 @@ cgiEnvironmentResultType cgiReadEnvironm + FILE *in; + cgiFormEntry *e = 0, *p; + char *version; +- cgiEnvironmentResultType result; ++ cgiEnvironmentResultType result = cgiEnvironmentSuccess; + /* Free any existing data first */ + cgiFreeResources(); + /* Be sure to open in binary mode */ diff --git a/www/cgic/patches/patch-ad b/www/cgic/patches/patch-ad new file mode 100644 index 00000000000..8b516985c99 --- /dev/null +++ b/www/cgic/patches/patch-ad @@ -0,0 +1,13 @@ +$NetBSD: patch-ad,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +--- cgic.h.orig Sun Jan 12 13:59:43 2003 ++++ cgic.h +@@ -90,6 +90,8 @@ typedef enum { + /* These functions are used to retrieve form data. See + cgic.html for documentation. */ + ++extern int cgiInit(void); ++ + extern cgiFormResultType cgiFormString( + char *name, char *result, int max); + diff --git a/www/cgic/patches/patch-ae b/www/cgic/patches/patch-ae new file mode 100644 index 00000000000..d548a8f53aa --- /dev/null +++ b/www/cgic/patches/patch-ae @@ -0,0 +1,34 @@ +$NetBSD: patch-ae,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +--- cgic.html.orig Sun Jan 12 13:59:43 2003 ++++ cgic.html +@@ -365,6 +365,29 @@ cgic.c to your project?</strong> + If none of the above proves effective, please see the + section regarding <a href="#support">support</a>. + <h3><a name="howto">How to write a cgic application</a></h3> ++ ++<strong><em>Important Note for NetBSD packages users from the package maintainer: </em> ++<p> ++This section does not work for users of cgic who have it installed via ++a NetBSD package. While mostly true, there are several very important ++differences which were created during the port to the NetBSD pkgsrc ++environment: ++ ++<ul> ++<li> Linking is now done against libcgic instead of cgic.c itself. This ++ is done by adding a "-lcgic" and other command line options as needed ++ when linking. ++<li> The application must now provide its own main() function, which calls the ++ cgiInit() function before any of the other functions are called. This ++ function returns 0 upon success, and -1 upon failure. It also registers ++ a function, cgiFreeResources(), via atexit() to be called at exit time. ++</ul> ++ ++While this removes the ability to compile cgic with DEBUG defined, it ++aligns the cgic library with the model followed by other libraries. ++</strong> ++<p> ++ + <em>Note: </em> All cgic applications must be linked to the cgic.c module + itself. How to do this depends on your operating system; under Unix, + just use the provided Makefile as an example. diff --git a/www/cgic/patches/patch-af b/www/cgic/patches/patch-af new file mode 100644 index 00000000000..0fc93cd0c7c --- /dev/null +++ b/www/cgic/patches/patch-af @@ -0,0 +1,19 @@ +$NetBSD: patch-af,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $ + +--- cgictest.c.orig Sun Jan 12 13:59:43 2003 ++++ cgictest.c +@@ -33,7 +33,13 @@ void Cookies(); + void LoadEnvironment(); + void SaveEnvironment(); + +-int cgiMain() { ++int main() { ++ ++ /* ++ * Initialize the library environment. ++ */ ++ cgiInit(); ++ + #ifdef DEBUG + LoadEnvironment(); + #endif /* DEBUG */ |