File:  [gforth] / gforth / gforth-cgi.fs
Revision 1.1: download - view: text, annotated - select for diffs
Fri Mar 2 11:14:59 2007 UTC (17 years ago) by anton
Branches: MAIN
CVS tags: v0-7-0, HEAD
added example cgi script

#! /usr/bin/gforth

\ This file is in the public domain. NO WARRANTY.

\ Example CGI script

.( Content-Type: text/plain; charset=us-ascii) cr
.( Content-Transfer-Encoding: 7bit) cr
cr
: zeroes ( u -- )
    0 +do '0 emit loop ;

: u.rz ( u1 u2 -- )
    >r s>d  <<# #s #> r> over - zeroes type #>> ;

.( It's ) time&date 4 u.rz .( -) 2 u.rz .( -) 2 u.rz space
                    2 u.rz .( :) 2 u.rz .( :) 2 u.rz cr
\ : printargs ( -- )
\     argc @ 0 +do
\         ." arg" i . ." = '" i arg type ." '" cr
\     loop ;
\ printargs
\ s" QUERY_STRING" getenv type cr
\ s" PATH_INFO" getenv type cr
\ s" PATH_TRANSLATED" getenv type
\ s" CONTENT_LENGTH" getenv type
bye

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>