Skip to content

earonesty/smx

Repository files navigation

**** ABOUT

smx is a macro-parsing system

it allows the use of text-embedded macros that are delmited
by a "magic character". the traditional magic character is "%"

for example, you can include

%header%

some text

%footer%

in your documents, and then use smx to parse them.

or

%counter(home-hits)

in your web pages

**** PREEQUISITES

yum install or apt-get:

	unixODBC unixODBC-devel sqlite sqlite-devel httpd-devel

optionally, for image support:
	
	gd, gd-devel - for image support
	tdb - for alternative to sqlite for %pset and %counter databases

**** INSTALL

Should be able to run 

	./configure
	make
	make install

If you did a git update, and you get a libtool error, run 

	make clean

smx uses autotools, so you should be able to use --prefix, and other
typical configure settings.

For example, to make a debug build

	make clean all CFLAGS=-ggdb CXXFLAGS=-ggdb

**** APACHE CONFIG

Add this to your apache conf:

	LoadModule /usr/local/lib/libmodsmx.so

And then add

	AddHandler smx-parsed .htm
	AddHandler smx-parsed .html

If you want it to magic-mode-parse html files.  You must put 
%expand% at the top of magic-mode files, or they are 
passed-through to apache as regular html.

Add SMXInit <code-to-run> to your conf, if you want a 
global-init (your probably want this).

These globally defined macros affect the operation 
of the apache module:

	http-user	- defines a basic auth handler
	http-badurl	- defines a 404 handler
	http-init	- defines a per-page expanded macro (good for %module)

You should read about %safe-mode if you have untrusted
users writing macros.  man %safe-mode

**** CGI CONFIG

If you want to run it as a CGI, put

#!/usr/bin/smx -c

At the top of your CGI scripts.  %expand% magic is 
not necessary for CGI

**** FASTCGI SUPPORT

/usr/bin/smx-fcgi is installed as well.  Use this for servers 
that support fast-cgi.  It's much faster than CGI.

The environment varialbe SMX_INIT can be used for initialization macros.

smx-fcgi can be used as an auth filter, but only if the http-user macro
is defined somewhere via SMX_INIT.


**** See also

[Release maintenance](Maintain.md)

**** LICENSE

Copyright 1998-2006 Erik Aronesty. BSD-Style License Follows

        1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

        2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

        3. Original source code, information and documentation is available at www.smxlang.org

THIS SOFTWARE IS PROVIDED 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE SMX AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.