Date: Mon, 22 Mar 1999 20:00:26 +0100 (CET) From: dada@sbox.tu-graz.ac.at To: FreeBSD-gnats-submit@freebsd.org Subject: ports/10732: c2html port update Message-ID: <199903221900.UAA03648@localhost.tu-graz.ac.at>
next in thread | raw e-mail | index | archive | help
>Number: 10732 >Category: ports >Synopsis: update from 0.1 to 0.3 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Mar 22 11:10:01 PST 1999 >Closed-Date: >Last-Modified: >Originator: Martin Kammerhofer >Release: FreeBSD 2.2.8-STABLE i386 >Organization: Graz University of Technology >Environment: >Description: c2html has been updated on sunsite from 0.1 to 0.3 It's now using autoconf. Patch files patch-a[bcd] are no longer necessary (removed) patch-aa is a very simple patch to Makefile.in now. Maintainer has changed from Andrey Zakhvatov <andy@icc.surw.chel.su> to Martin Kammerhofer (who sent this PR). Of course, I've asked Andrey about it and he gave me his OK to take over this port from him. >How-To-Repeat: >Fix: 0<==cut here======================================================= diff -urN c2html.old/Makefile c2html/Makefile --- c2html.old/Makefile Sat Nov 22 01:30:17 1997 +++ c2html/Makefile Sun Mar 21 19:05:35 1999 @@ -1,26 +1,29 @@ # New ports collection makefile for: c2html -# Version required: 0.1 -# Date created: 28 October 1997 -# Whom: Andrey Zakhvatov +# Version required: 0.3 +# Date created: 21 March 1999 +# Whom: Martin Kammerhofer # -# $Id: Makefile,v 1.1.1.1 1997/11/22 00:30:17 jseger Exp $ +# $Id$ # -DISTNAME= c2html-0.1 +DISTNAME= c2html-0.3 CATEGORIES= textproc www MASTER_SITES= ${MASTER_SITE_SUNSITE} MASTER_SITE_SUBDIR= apps/www/converters -MAINTAINER= andy@icc.surw.chel.su +MAINTAINER= mkamm@gmx.net + +USE_AUTOCONF= yes MAN1= c2html.1 -do-install: - @ ${INSTALL_PROGRAM} ${WRKSRC}/c2html ${PREFIX}/bin - @ ${INSTALL_MAN} ${WRKSRC}/c2html.1 ${PREFIX}/man/man1 - @ ${MKDIR} ${PREFIX}/share/doc/c2html -.for file in COPYING README - @ ${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/share/doc/c2html -.endfor +post-install: + strip ${PREFIX}/bin/c2html +.if !defined(NOPORTDOCS) + ${MKDIR} ${PREFIX}/share/doc/c2html + ${INSTALL_MAN} ${WRKSRC}/AUTHORS ${PREFIX}/share/doc/c2html + ${INSTALL_MAN} ${WRKSRC}/NEWS ${PREFIX}/share/doc/c2html + ${INSTALL_MAN} ${WRKSRC}/README ${PREFIX}/share/doc/c2html +.endif .include <bsd.port.mk> diff -urN c2html.old/files/md5 c2html/files/md5 --- c2html.old/files/md5 Sat Nov 22 01:30:17 1997 +++ c2html/files/md5 Sun Mar 21 19:05:35 1999 @@ -1 +1 @@ -MD5 (c2html-0.1.tar.gz) = 66659aec84aad813e52042576abf6662 +MD5 (c2html-0.3.tar.gz) = 81b404f443f63eb92c1f608673944408 diff -urN c2html.old/patches/patch-aa c2html/patches/patch-aa --- c2html.old/patches/patch-aa Sun Feb 28 20:00:15 1999 +++ c2html/patches/patch-aa Sun Mar 21 19:05:35 1999 @@ -1,18 +1,20 @@ ---- Makefile.orig Mon Sep 1 22:18:51 1997 -+++ Makefile Sun Nov 16 17:24:44 1997 -@@ -2,13 +2,13 @@ +--- Makefile.in~ Wed Mar 10 22:14:48 1999 ++++ Makefile.in Sun Mar 21 18:19:16 1999 +@@ -12,7 +12,7 @@ + # for gzip because otherwise the load on the web server + # grows without having big benefits. + # COMPRESSION = -DCOMPRESSION=4 +-COMPRESSION = -DCOMPRESSION=1 ++COMPRESSION ?= -DCOMPRESSION=1 - CC = gcc - FLEX = flex --CFLAGS = -O2 -Wall -pedantic -ansi -+CFLAGS+= -Wall -pedantic -ansi -DCOMPRESSION=1 + # Dont change things beyond this line. + TARGET = c2html +@@ -40,7 +40,7 @@ + srcdir = @srcdir@ + CPPFLAGS = @CPPFLAGS@ - all: c2html - - c2html: c2html.l - $(FLEX) c2html.l -- $(CC) $(CFLAGS) -o c2html lex.yy.c -static -lfl -+ $(CC) $(CFLAGS) -o c2html lex.yy.c -lfl - clean: - rm -rf *.o *~ c2html +-CFLAGS = -O2 -Wall -pedantic $(COMPRESSION) ++CFLAGS += -O2 -Wall -pedantic $(COMPRESSION) + ALL_CFLAGS = $(CFLAGS) -I$(srcdir) + all: $(TARGET) diff -urN c2html.old/patches/patch-ab c2html/patches/patch-ab --- c2html.old/patches/patch-ab Mon Feb 22 05:22:23 1999 +++ c2html/patches/patch-ab Thu Jan 1 01:00:00 1970 @@ -1,62 +0,0 @@ ---- README.orig Tue Sep 2 04:18:51 1997 -+++ README Sat Jan 16 16:28:33 1999 -@@ -1,8 +1,8 @@ --c2html version 0.1 by Florian Schintke <schintke@cs.tu-berlin.de> --distributed under the GNU Public license. For further information see --the file COPYING. -+c2html version 0.2 by Florian Schintke <schintke@cs.tu-berlin.de> -+CGI features added by Martin Kammerhofer <mkamm@gmx.net> - --%% Datei COPYING mitliefern!!! -+This program is distributed under the GNU Public license. For further -+information see the file COPYING. - - c2html - ====== -@@ -33,7 +33,43 @@ - files. The names of the new files are built by appending ".html" to - the corresponding input filename. - -+How do I convert my C sources on demand only? -+--------------------------------------------- - -- -- -- -+You need a webserver to do this. The webserver must be configured to -+INVOKE c2html as a CGI program to handle all *.c and *.h files. If -+your webserver is apache you can achieve this by adding lines -+ -+ AddType text/x-c .c .h -+ Action text/x-c /cgi-bin/c2html -+ -+to configuration file "srm.conf". c2html expects the pathname of it's -+input file in environment variable PATH_TRANSLATED. CGI mode works by -+checking for environment variables GATEWAY_INTERFACE and -+PATH_TRANSLATED. If both are set a HTTP header line -+ -+ Content-Type: text/html -+ -+is simply prepended to the output. -+ -+Since your sources are converted on-the-fly to HTML you don't need any -+webspace for your html-ized files. Furthermore you don't have to -+bother about keeping your published html-ized sources up to date. :) -+ -+A drawback might be that you cannot HTTP download the plain text -+source files any more. You can always enable the 'Action' directive -+mentioned above for specific directories or virtual hosts only. (You -+can even use symlinks in combination with '<Directory>' to let surfers -+choose themselves between html-ized and plain text representations). -+Another solution might be to set up anonymous ftp in such a way, that -+users simply have to change 'http:' to 'ftp:' in their URLs to get the -+plain text representations of C-sources. -+ -+How can I save bandwidth using c2html as a CGI? -+----------------------------------------------- -+ -+If c2html has been compiled with -DCOMPRESSION=1 it will compress it's -+HTML output with gzip if your browser supports it. This will save -+bandwidth but add additional load to your webserver machine. c2html -+will not have it's output compressed by gzip if you are connected to a -+server on 'localhost'. diff -urN c2html.old/patches/patch-ac c2html/patches/patch-ac --- c2html.old/patches/patch-ac Mon Feb 22 05:22:23 1999 +++ c2html/patches/patch-ac Thu Jan 1 01:00:00 1970 @@ -1,63 +0,0 @@ ---- c2html.orig Tue Sep 2 04:18:51 1997 -+++ c2html.1 Sat Jan 16 16:28:33 1999 -@@ -3,7 +3,7 @@ - c2html \- generates highlighted html-files from C source - .SH SYNOPSIS - .B c2html --[filenames] -+[filename...] - .br - .SH DESCRIPTION - This manual page -@@ -16,9 +16,50 @@ - - If invoked with filenames as arguments - .B c2html --will write the output in new files. The names of the new -+will write it's output into new files. Names of output - files are generated by appending ".html" to the - corresponding input filename. - - You can convert both .c and .h files with - .BR c2html . -+.SS Installing as a CGI program -+.B c2html -+can be installed as a CGI program and convert source files on the -+fly. In order to set this up for apache the webmaster has to add the -+two lines -+.RS -+ AddType text/x-c .c .h -+.P -+ Action text/x-c /cgi-bin/c2html -+.RE -+to the webserver configuration file. -+.B c2html -+depends on the webserver properly setting environment variable -+PATH_TRANSLATED to the pathname of the source file. -+If -+.B c2html -+has been compiled with option -DCOMPRESSION=1 then it will invoke -+.B gzip -+to compress the generated HTML before sending it to the requesting -+browser. Of course -+.B c2html -+takes care to check if the browser accepts gzip encoding. -+.SH OPTIONS -+.BI -t title -+If reading from stdin this sets the title instead of the default -+"stdin". If invoked with filenames as arguments this option is -+ignored. -+ -+.BI -w width -+sets the WIDTH attribute for HTML tag <PRE>. If this option is not -+used a default of 80 is assumed. (Currently most browsers are -+ignoring this attribute). -+ -+.BI -V -+reports the version number of -+.B c2html -+.SH EXIT STATUS -+.B c2html -+returns 0 on success, 1 if input files are not existing/readable, 2 if -+output files are not creatable/writable and 3 if invoked with illegal -+options. diff -urN c2html.old/patches/patch-ad c2html/patches/patch-ad --- c2html.old/patches/patch-ad Mon Feb 22 05:22:23 1999 +++ c2html/patches/patch-ad Thu Jan 1 01:00:00 1970 @@ -1,185 +0,0 @@ ---- c2html.l.orig Mon Sep 1 21:18:51 1997 -+++ c2html.l Sun Feb 21 20:03:48 1999 -@@ -1,15 +1,22 @@ --%{ -+%{ /* $Id: patch-ad,v 1.1 1999/02/22 04:22:23 steve Exp $ -*- mode: C -*- */ - /* - * We build a lexical analyzer that converts a C source file to - * a beautifully highlighted HTML file now. - */ - -+#define C2HTML_VERSION "0.2" -+ - #include <stdio.h> --#include <malloc.h> -+#include <stdlib.h> - #include <string.h> -+#include <unistd.h> - - #include "colors.h" - -+#ifndef COMPRESSION -+#define COMPRESSION 0 -+#endif -+ - FILE *actin; - FILE *actout; - -@@ -293,51 +300,113 @@ - * path this file) into the output file. - */ - -+static char *prog; -+static void usage() { -+ fprintf (stderr, "usage: %s [-t title] [-w width] [file_to_convert ...]\n", prog); -+ exit(3); -+} -+ -+ - int - main(int argc, char *argv[]) - { - char *outfilename; -- int i = 1; -+ int i, ch, width=80, rc=0; -+ char *title=(char *)0, *pt; -+ char gzipcmd[10]; -+ -+ prog = (pt=strrchr(argv[0], '/')) ? ++pt : argv[0]; /* basename */ -+ while ((ch = getopt(argc, argv, "h?t:w:V")) != -1) -+ switch(ch) { -+ case 't': -+ title = optarg; -+ break; -+ case 'w': -+ if (sscanf(optarg, "%d", &width) != 1) -+ usage(); -+ break; -+ case 'V': -+ fprintf(stderr, "c2html version %s%s\n", -+ C2HTML_VERSION, COMPRESSION ? "" : " (no compression)"); -+ exit(0); -+ default: -+ usage(); -+ } -+ argc -= optind; -+ argv += optind; - -- if (1 == argc) -- { -+ if (argc == 0) { - actin = stdin; - actout = stdout; -- fprintf (actout, "<HTML>\n<HEAD>\n"); -- fprintf (actout, "<TITLE>stdout" ); -+ -+ if ((pt=getenv("PATH_TRANSLATED")) && getenv("GATEWAY_INTERFACE")) { -+ /* CGI */ -+ if (!title) -+ title = pt; -+ actin = fopen (pt, "r"); -+ if (!actin) { -+ fprintf (actout, "Content-Type: text/html\n\n"); -+ fprintf (actout, "<HTML><HEAD><TITLE>error in CGI '%s'\ -+</TITLE></HEAD>\n\ -+<BODY><H1>error in CGI program '%s': cannot read file '%s'</H1></BODY>\n\ -+</HTML>\n", prog, prog, pt); -+ exit(1); -+ } -+ fprintf (actout, "Content-Type: text/html\n"); -+#if COMPRESSION -+ /* should we compress output with gzip? */ -+ do { -+ if (!(pt=getenv("HTTP_ACCEPT_ENCODING"))) -+ break; /* no header Accept-Encoding: */ -+ if (!strstr(pt, "gzip")) -+ break; /* browser doesn't understand gzip format */ -+ if ((pt=getenv("REMOTE_ADDR")) && !strncmp(pt, "127", 3)) -+ break; /* never compress to local client */ -+ /* OK, compress output with gzip */ -+ fprintf(actout, "Content-Encoding: x-gzip\n\n"); -+ fflush(actout); -+ snprintf(gzipcmd, sizeof(gzipcmd), "gzip -%d", COMPRESSION); -+ if (!(actout = popen(gzipcmd, "w"))) -+ exit(4); /* cannot fork, gzip not found, ... */ -+ } while (0); -+#endif /* COMPRESSION */ -+ } /* end of CGI section */ -+ fprintf (actout, "\n<HTML>\n<HEAD>\n"); -+ fprintf (actout, "<TITLE>%s", title ? title : "stdin"); - fprintf (actout, "</TITLE>\n</HEAD>\n\n"); - fprintf (actout, "<BODY BGCOLOR=\"%s\">\n", bgcolor); - (void) insert (actout, ownhead); -- fprintf (actout, "<PRE WIDTH=\"80\">"); -- -- yyin = stdin; -- yyout = stdout; -- -+ fprintf (actout, "<PRE WIDTH=\"%d\">", width); -+ -+ yyin = actin; -+ yyout = actout; - yylex(); -- -- fprintf (actout,"</PRE>\n</BODY>\n\n</HTML>\n"); -- } - -- while (i < argc) -- { -+ fprintf (actout,"</PRE>\n</BODY>\n\n</HTML>\n"); -+ } else for (i=0; i < argc; i++) { - actin = fopen (argv[i], "r"); -- if (!actin) -- { -- fprintf (stderr, "usage: %s [files_to_convert]\n", argv[0]); -- fprintf (stderr, "%s: cannot open file %s\n", argv[0], argv[i]); -- exit (1); -+ if (!actin) { -+ fprintf (stderr, "%s: cannot read file '%s'\n", prog, argv[i]); -+ rc = rc < 1 ? 1 : rc; -+ continue; - } - - outfilename = malloc (sizeof (char)*strlen (argv[i]) + 6); - strcat (strcpy (outfilename, argv[i]), ".html"); - actout = fopen (outfilename, "w"); -+ if (!actout) { -+ fprintf (stderr, "%s: cannot write file '%s'\n", prog, outfilename); -+ rc = rc < 2 ? 2 : rc; -+ continue; -+ } -+ outfilename[strlen(outfilename) - 5] = '\0'; /* chop '.html' suffix */ - fprintf (actout, "<HTML>\n<HEAD>\n"); - fprintf (actout, - "<TITLE>%s", outfilename ); - fprintf (actout, "</TITLE>\n</HEAD>\n\n"); - fprintf (actout, "<BODY BGCOLOR=\"%s\">\n", bgcolor); - (void) insert (actout, ownhead); -- fprintf (actout, "<PRE WIDTH=\"80\">"); -+ fprintf (actout, "<PRE WIDTH=\"%d\">", width); - - yyin = actin; - yyout = actout; -@@ -351,9 +420,8 @@ - free (outfilename); - fclose (actin); - fclose (actout); -- i++; -- } -- return 0; -+ } -+ return rc; - } - - int -@@ -372,8 +440,8 @@ - c = fgetc (infile); - } - fclose (infile); -- return (1); -+ return 1; - } - else -- return (0); -+ return 0; - } diff -urN c2html.old/pkg/DESCR c2html/pkg/DESCR --- c2html.old/pkg/DESCR Sat Nov 22 01:30:17 1997 +++ c2html/pkg/DESCR Sun Mar 21 19:05:36 1999 @@ -4,3 +4,8 @@ font colors (as Netscape does) the output will look like highlighted by emacs. Otherwise it will not look so nice, but readability is increased too. + +c2html can also work as a CGI program and convert your sources on the +fly. To use in this way copy it to your /cgi-bin directory and +configure your webserver to call c2html for *.c and *.h files. An +example that works with Apache is described in the manpage. diff -urN c2html.old/pkg/PLIST c2html/pkg/PLIST --- c2html.old/pkg/PLIST Sat Sep 5 10:15:19 1998 +++ c2html/pkg/PLIST Sun Mar 21 19:05:36 1999 @@ -1,4 +1,5 @@ bin/c2html -share/doc/c2html/COPYING +share/doc/c2html/AUTHORS +share/doc/c2html/NEWS share/doc/c2html/README @dirrm share/doc/c2html >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903221900.UAA03648>