pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/cgic Initial import of cgic, version 2.02, provide...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/94fedd336dc1
branches:  trunk
changeset: 478275:94fedd336dc1
user:      jmmv <jmmv%pkgsrc.org@localhost>
date:      Tue Jul 20 21:44:29 2004 +0000

description:
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.

diffstat:

 www/cgic/DESCR            |  17 ++++++++++++
 www/cgic/Makefile         |  16 +++++++++++
 www/cgic/PLIST            |  14 ++++++++++
 www/cgic/distinfo         |  10 +++++++
 www/cgic/patches/patch-aa |  65 +++++++++++++++++++++++++++++++++++++++++++++++
 www/cgic/patches/patch-ab |  13 +++++++++
 www/cgic/patches/patch-ac |  56 ++++++++++++++++++++++++++++++++++++++++
 www/cgic/patches/patch-ad |  13 +++++++++
 www/cgic/patches/patch-ae |  34 ++++++++++++++++++++++++
 www/cgic/patches/patch-af |  19 +++++++++++++
 10 files changed, 257 insertions(+), 0 deletions(-)

diffs (297 lines):

diff -r aa4c730e66bf -r 94fedd336dc1 www/cgic/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/DESCR    Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/Makefile Tue Jul 20 21:44:29 2004 +0000
@@ -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@localhost
+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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/PLIST    Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/distinfo Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/patches/patch-aa Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/patches/patch-ab Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/patches/patch-ac Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/patches/patch-ad Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/patches/patch-ae
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/patches/patch-ae Tue Jul 20 21:44:29 2004 +0000
@@ -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 -r aa4c730e66bf -r 94fedd336dc1 www/cgic/patches/patch-af
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/cgic/patches/patch-af Tue Jul 20 21:44:29 2004 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index