30 using namespace basis;
35 #define LOG(s) program_wide_logger::get().log(s, 0)
40 #define DEFAULT_FORTUNE_FILE "fortunes.dat"
42 int main(
int argc,
char *argv[])
60 LOG(
astring(
"nechung:: file name is too short (") + name +
").");
65 int end = index_file_name.
raw().
end();
71 tmp.
zap( (end + 1) - extension.
length(), end);
76 LOG(
astring(
"index file is ") + index_file_name);
78 index = index_file_name;
82 printf(
"content-type: text/html\n\n");
87 printf(
"<tt style=\"font-weight: bold;\">\n");
88 printf(
"<font size=\"+1\">\n");
92 for (
int i = 0; i < to_show.
length(); i++) {
93 if (to_show[i] ==
' ') {
97 }
else if (to_show[i] ==
'\t') {
99 int to_add = 8 - line_posn % 8;
100 for (
int j = 0; j < to_add; j++) printf(
" ");
102 }
else if (to_show[i] ==
'\r')
104 else if (to_show[i] ==
'\n') {
105 printf(
"<br>%c", to_show[i]);
108 printf(
"%c", to_show[i]);
120 #ifdef __BUILD_STATIC_APPLICATION__
int main(int argc, char *argv[])
#define DEFAULT_FORTUNE_FILE
Provides a dynamically resizable ASCII character string.
virtual void zap(int start, int end)
Deletes the characters between "start" and "end" inclusively.
int end() const
returns the index of the last (non-null) character in the string.
int length() const
Returns the current length of the string.
static astring TMP()
provides a single place to get the temporary directory.
static astring get(const astring &variable_name)
looks up the "variable_name" in the current environment variables.
Provides operations commonly needed on file names.
basis::astring extension() const
returns the extension for the file, if one is present.
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
filename basename() const
returns the base of the filename; no directory.
basis::astring pick_random()
#define SETUP_CONSOLE_LOGGER
< a macro that retasks the program-wide logger as a console_logger.
The guards collection helps in testing preconditions and reporting errors.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.