/usr/bin/tntnet-config is in libtntnet-dev 2.0+dfsg1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | #! /bin/sh
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
PATH=$PATH:$prefix/bin
export PATH
usage()
{
cat 1>&2 <<EOF
Usage: $0 [OPTION]
Known values for OPTION are:
--libs print library linking information
--cxxflags print pre-processor and compiler flags
--config[=app] print default configuration-file
--makefile[=app] print simple makefile for a ecpp-project
--properties=app print a properties file
--project=app create a simple ecpp-project-directory
--help display this help and exit
--version output version information
EOF
exit $1
}
template()
{
if test -z "$1"
then
cat <<EOF
# map /webapp/comp.* or /webapp/comp to comp@webapp
MapUrl ^/(.+)/([^.]+)(\..+)? \$2@\$1
# map /comp.* or /comp to comp@comp
MapUrl ^/([^.]+)(\..+)? \$1@\$1
EOF
else
cat <<EOF
# map / to $1@$1
MapUrl ^/$ $1@$1
# map /comp.* or /comp to comp@$1
MapUrl ^/([^.]+)(\..+)? \$1@$1
EOF
fi
cat <<EOF
# listen to a port
Listen 0.0.0.0 8000
# to enable ssl, we need a Certificate and another listen-command
#SslListen 0.0.0.0 8443 tntnet.pem
# this propertyfile defines, what and where to log
PropertyFile tntnet.properties
# set limit to prevent DoS-attacks (default 0=no limit)
#MaxRequestSize 65536
#MaxRequestTime 600 # request timeout for the watchdog, when tntnet runs as a daemon
#User tntnet
#Group tntnet
#Dir /
#Chroot /var/safedir
#PidFile /var/run/tntnet.pid
#Daemon 0
#MinThreads 5
#MaxThreads 100
#ThreadStartDelay 10 # in ms
#QueueSize 1000
#CompPath path
#Load webapp # preload webapplication
#BufferSize 16384
#SocketReadTimeout 10
#SocketWriteTimeout 10000
#KeepAliveTimeout 15000
#KeepAliveMax 1000
#SessionTimeout 300
#ListenBacklog 16
#ListenRetry 5
#EnableCompression no
#MimeDb /etc/mime.types
#MinCompressSize 1024 # in bytes
#MaxUrlMapCache 8192
#DefaultContentType "text/html; charset=UTF-8"
#AccessLog /var/log/tntnet/access.log
EOF
}
properties()
{
cat <<EOF
# sample logging-properties for tntnet application $1
#
# print logging-messages with:
# log_fatal("some fatal message");
# log_error("some error message");
# log_warn("some warn message");
# log_info("some info message");
# log_debug("some debug message");
#
rootLogger=INFO
# define logger-categories
logger.tntnet=INFO
logger.component.$1=INFO
# uncomment if you want to log to a file
#file=tntnet.log
#maxfilesize=1MB
#maxbackupindex=2
#host=localhost:1234 # send log-messages with udp
#disabled=1 # disable logging
#logprocess=1 # log through separate process
#logprocesuser=someuser # change to user in log process
#logprocesgroup=somegroup # change to group in log process
EOF
}
makefile()
{
if test ! -z "$1"
then
cat <<EOF
all: $1.so
test: all
\${TNTNET} tntnet.conf
$1.so: $1.o
\${CXX} -o \$@ \${LDFLAGS} \$^
EOF
fi
cat <<EOF
.SUFFIXES: .ecpp .gif .jpg .css .js .cpp
ECPPC=$prefix/bin/ecppc
TNTNET=$prefix/bin/tntnet
CXXFLAGS+=-I$includedir -fPIC -O2
LDFLAGS+=-shared -L$libdir -ltntnet -lcxxtools
.ecpp.cpp:
\${ECPPC} \${ECPPFLAGS} \${ECPPFLAGS_CPP} -o \$@ \$<
.gif.cpp:
\${ECPPC} \${ECPPFLAGS} -m image/gif \${ECPPFLAGS_GIF} -b -o \$@ \$<
.jpg.cpp:
\${ECPPC} \${ECPPFLAGS} -m image/jpg \${ECPPFLAGS_JPG} -b -o \$@ \$<
.png.cpp:
\${ECPPC} \${ECPPFLAGS} -m image/png \${ECPPFLAGS_PNG} -b -o \$@ \$<
.css.cpp:
\${ECPPC} \${ECPPFLAGS} -m text/css \${ECPPFLAGS_CSS} -b -o \$@ \$<
.js.cpp:
\${ECPPC} \${ECPPFLAGS} -m application/javascript \${ECPPFLAGS_JS} -b -o \$@ \$<
.cpp.o:
\${CXX} \${CPPFLAGS} \${CXXFLAGS} -c \$<
EOF
}
project()
{
P=$1
mkdir $P || exit 1
makefile $P >$P/Makefile
template $P >$P/tntnet.conf
properties $P >$P/tntnet.properties
cat >$P/$P.ecpp <<EOF
<%pre>
// put your includes here
// #include "foo.h"
</%pre>
<%args>
// define the query parameters
// bar;
</%args>
<%session>
// define your session scope variables here
// std::string mySessionState;
</%session>
<%cpp>
// put your C++ code here
</%cpp>
<html>
<head>
<title>ecpp-application $P</title>
</head>
<body>
<h1>$P</h1>
<p>Hello world!</p>
</body>
</html>
EOF
cat <<EOF
Sample ecpp-project "$P" created.
To build change to the directory "$P" and run make.
To run the application execute "tntnet" there.
To view the page navigate your browser to "http://localhost:8000/".
EOF
}
if test $# -eq 0; then
usage
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--version)
echo 2.0
exit 0
;;
--help)
usage
;;
--cxxflags)
echo -I$includedir
;;
--libs)
echo -L$libdir -ltntnet -lcxxtools
;;
--makefile=*)
makefile $optarg
;;
--makefile)
makefile
;;
--config=*)
template $optarg
;;
--config)
template
;;
--properties=*)
properties $optarg
;;
--properties)
properties $2
shift
;;
--project=*)
project $optarg
;;
--project)
project $2
shift
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0
|