# HG changeset patch # User Christophe Lincoln # Date 1335255995 -7200 # Node ID 524eab3120aee97c60fcf7b69e3a813a4dea182a # Parent 4ea029af10e85dfefce66d85a5cd773630cdbe3c Add libtaz and httphelper man a like documentation diff -r 4ea029af10e8 -r 524eab3120ae Makefile --- a/Makefile Mon Apr 23 23:33:27 2012 +0200 +++ b/Makefile Tue Apr 24 10:26:35 2012 +0200 @@ -33,6 +33,14 @@ install-libtaz: install -m 0744 rootfs/lib/libtaz.sh $(DESTDIR)/lib + install -m 0755 -d $(DESTDIR)/usr/share/doc/slitaz + install -m 0644 doc/libtaz.txt $(DESTDIR)/usr/share/doc/slitaz + +install-httphelper: + install -m 0744 rootfs/usr/lib/slitaz/httphelper.sh \ + $(DESTDIR)/usr/lib/slitaz + install -m 0755 -d $(DESTDIR)/usr/share/doc/slitaz + install -m 0644 doc/httphelper.txt $(DESTDIR)/usr/share/doc/slitaz install-msg: msgfmt install -m 0755 -d $(DESTDIR)$(PREFIX)/share/locale @@ -40,6 +48,8 @@ install: install-msg cp -a rootfs/* $(DESTDIR) + install -m 0755 -d $(DESTDIR)/usr/share/doc/slitaz + cp -a doc/* $(DESTDIR)/usr/share/doc/slitaz chown -R root.root $(DESTDIR) # Clean source diff -r 4ea029af10e8 -r 524eab3120ae doc/httphelper.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/httphelper.txt Tue Apr 24 10:26:35 2012 +0200 @@ -0,0 +1,35 @@ + +SYNOPSIS + . /usr/lib/slitaz/httphelper.sh + function + +DESCRIPTION + Httphelper is a CGI SHell helper providing PHP a like syntax and + usefull functions to encode or crypt strings. Httphelper let you + easily parse QUERY_STRING and work on any webserver supporting CGI. + +FUNCTIONS + GET [var [index]] + POST [var [index]] + COOKIE [var [index]] + FILE [var {name|tmpname|size|type}] + header [strings] + http_urlencode string + urlencode string + urldecode string + htmlentities string + md5crypt string + sha512crypt string + httpinfo + httphelper + +EXAMPLES + header "Content-type: text/html" "Set-Cookie: name=value; HttpOnly" + + value=$(GET name) + if [ "$value" ]; then + echo "Input name has a value: $value" + fi + +AUTHOR + Written by Pascal Bellard and Christophe Lincoln diff -r 4ea029af10e8 -r 524eab3120ae doc/libtaz.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/libtaz.txt Tue Apr 24 10:26:35 2012 +0200 @@ -0,0 +1,25 @@ + +SYNOPSIS + . /lib/libtaz.sh + function + +DESCRIPTION + LibTaz is the base SliTaz SHell library used by almost all tools and + utilities. It provide common SHell script functions, parse the cmdline + options and store values in a variable. The output messages can be + formated for raw/text, gtk, html and by default they are formated for + a standard terminal supporting colors. LibTaz is in the directory + /lib/libtaz.sh since it is used when /usr may not be mounted. + +FUNCTIONS + status + separator + boldify [string] + check_root + +OPTIONS + --output=[raw|gtk|html] + +AUTHOR + Written by Christophe Lincoln + diff -r 4ea029af10e8 -r 524eab3120ae rootfs/lib/libtaz.sh --- a/rootfs/lib/libtaz.sh Mon Apr 23 23:33:27 2012 +0200 +++ b/rootfs/lib/libtaz.sh Tue Apr 24 10:26:35 2012 +0200 @@ -3,10 +3,9 @@ # SliTaz Base functions used from boot scripts to end user tools. Use # gettext and not echo for messages. Keep output suitable for GTK boxes # and Ncurses dialog. LibTaz should not depend on any configuration file. -# No bloated code here, function must be used by at least 3-4 tools. See -# libtaz() for a list of functions and options or run: tazdev libtaz.sh -# Libtaz is located in /lib/libtaz.sh since it is used when /usr may not -# be mounted. +# No bloated code here, function must be used by at least 3-4 tools. +# +# Documentation: man libtaz or /usr/share/doc/slitaz/libtaz.txt # # Copyright (C) 2012 SliTaz GNU/Linux - BSD License # @@ -32,25 +31,6 @@ done [ "$HTTP_REFERER" ] && output="html" -# Help and usage. -libtaz() { - cat << EOT - -Include this library in a script: - . /lib/libtaz.sh - -Functions: - status - separator - boldify string - check_root - -Options: - --output=[raw|gtk|html] - -EOT -} - # Return command status. Default to colored console output. status() { local check=$? diff -r 4ea029af10e8 -r 524eab3120ae rootfs/usr/bin/man --- a/rootfs/usr/bin/man Mon Apr 23 23:33:27 2012 +0200 +++ b/rootfs/usr/bin/man Tue Apr 24 10:26:35 2012 +0200 @@ -3,6 +3,7 @@ # Tiny man fake using online manuals. # Copyright (C) 2009-2012 SliTaz GNU/Linux. # +. /lib/libtaz.sh if [ ! -x /usr/bin/retawq ]; then echo -e "\nMissing Retawq web browser..." @@ -20,7 +21,7 @@ ''|-*) cat <