initial import of triviaserv
This commit is contained in:
parent
0cb1f7afba
commit
e93a83c484
11 changed files with 9347 additions and 0 deletions
10
.gitattributes
vendored
10
.gitattributes
vendored
|
@ -1 +1,11 @@
|
|||
* text=auto !eol
|
||||
/Makefile.in -text
|
||||
/README.TriviaServ -text
|
||||
/TriviaServ.c -text
|
||||
/TriviaServ.h -text
|
||||
/TriviaServ_help.c -text
|
||||
/configure -text
|
||||
/configure.in -text
|
||||
/install-sh -text
|
||||
/modconfig.h.in -text
|
||||
/questions.txt -text
|
||||
|
|
55
Makefile.in
Normal file
55
Makefile.in
Normal file
|
@ -0,0 +1,55 @@
|
|||
#Neostats Module Makefile!
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
DIRECTORY = @DIRINST@/dl/
|
||||
INCLUDES = -I@DIRINST@/include/ -I.
|
||||
|
||||
SRCS= TriviaServ.c TriviaServ_help.c
|
||||
OBJS= ${SRCS:.c=.o}
|
||||
TARGET= triviaserv.so
|
||||
DOCS=README.TriviaServ
|
||||
DATA= questions.txt
|
||||
DISTFILES = $(SRCS) $(DATA) $(DOCS) modconfig.h.in configure install-sh ChangeLog Makefile.in TriviaServ.h
|
||||
DISTDIR = @PACKAGE@-@VERSION@
|
||||
|
||||
|
||||
all: module
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
module: $(OBJS)
|
||||
$(LD) -shared -o $(TARGET) $(LDFLAGS) $(OBJS)
|
||||
|
||||
clean:
|
||||
/bin/rm -rf $(TARGET) *.o Makefile *.log modconfig.h
|
||||
|
||||
install: module
|
||||
$(INSTALL) -m 644 $(TARGET) $(DIRECTORY)
|
||||
$(INSTALL) -m 644 $(DOCS) $(DIRECTORY)../doc/
|
||||
$(INSTALL) -m 644 $(DATA) $(DIRECTORY)../data/
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
dist:
|
||||
@echo -n "Creating Directories"
|
||||
@-rm -rf $(DISTDIR)
|
||||
@mkdir $(DISTDIR)
|
||||
@echo "Done"
|
||||
@echo -n "Copying Core Distribution Files"
|
||||
@for file in $(DISTFILES); do \
|
||||
echo -n "."; \
|
||||
cp -pr $$file $(DISTDIR)/$$file; \
|
||||
done
|
||||
@echo "Done"
|
||||
@tar -czf $(DISTDIR).tar.gz $(DISTDIR)/*
|
||||
@echo "Tar file $(DISTDIR).tar.gz created, Freshmeat Time"
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
TriviaServ.o: TriviaServ.h TriviaServ.c modconfig.h
|
||||
TriviaServ.so: TriviaServ.o TriviaServ_help.o
|
61
README.TriviaServ
Executable file
61
README.TriviaServ
Executable file
|
@ -0,0 +1,61 @@
|
|||
StupidServ 1.0
|
||||
=====================================================================
|
||||
This module is so stupid, I couldnt help but call it StupidServ.
|
||||
It servs absolutly no purpose on your network other than to have a
|
||||
laugh.
|
||||
It takes you text and will translate it to a "language" for you
|
||||
Currently, it has 15 languages available.
|
||||
|
||||
The actual module was inspired by "Talkfilters" which is a libary that
|
||||
was put together to bring them all together.
|
||||
|
||||
More information on "talkfilters" can be found
|
||||
at http://www2.dystance.net:8080/ping/talkfilters/
|
||||
|
||||
This module is *NOT* supported at all. I just thought I'd share it all
|
||||
with you as it was very easy to make, and can be a laugh when your
|
||||
bored
|
||||
|
||||
Fish.
|
||||
fish@dynam.ac
|
||||
http://www.neostats.net/
|
||||
|
||||
|
||||
|
||||
The following is from the original TalkFilters readme file:
|
||||
=====================================================================
|
||||
|
||||
This group of filters serves no utilitarian purpose but is nonetheless
|
||||
quite amusing and hence should be maintained for posterity.
|
||||
|
||||
These programs are maintained by Mark Lindner
|
||||
(mark_a_lindner@yahoo.com). The original authors of these programs are
|
||||
listed in the file `AUTHORS'.
|
||||
|
||||
If you are the author of one of these programs and do not wish to have
|
||||
it distributed in this package, contact the maintainer immediately.
|
||||
|
||||
These filters are provided for amusement only. No racial or societal
|
||||
slurs are intended.
|
||||
|
||||
Some of these filters contain vulgarity, and thus are inappropriate
|
||||
for some audiences. If you find something offensive in one or more of
|
||||
these filters, please do not flame me or ask me to censor or remove
|
||||
the filter(s) in question. Requests of this type will be silently
|
||||
ignored. Note that I am only the package maintainer; I am NOT the
|
||||
author of the translation rules in the filters (with the exception of
|
||||
the `wrap' filter).
|
||||
|
||||
These filters are not guaranteed to be idempotent across all inputs;
|
||||
that is, repeated applications of a given filter on an input may cause
|
||||
the output to differ each time. Moreover, some of the filters use
|
||||
randomization techniques so a given input is not guaranteed to produce
|
||||
the same output across invocations.
|
||||
|
||||
You no longer need to have `flex' (or any other lexer program, for
|
||||
that matter) to build and use this package. However, you *will* need a
|
||||
lexer (specifically, `flex') to recompile if you change any `.l'
|
||||
files.
|
||||
|
||||
Mark Lindner
|
||||
February 8, 2003
|
294
TriviaServ.c
Executable file
294
TriviaServ.c
Executable file
|
@ -0,0 +1,294 @@
|
|||
/* NeoStats - IRC Statistical Services
|
||||
** Copyright (c) 1999-2004 Adam Rutter, Justin Hammond, Mark Hetherington
|
||||
** http://www.neostats.net/
|
||||
**
|
||||
** Portions Copyright (c) 2000-2001 ^Enigma^
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: TriviaServ.c 1604 2004-03-01 00:02:21Z Mark $
|
||||
*/
|
||||
|
||||
/** TriviaServ.c
|
||||
* Trivia Service for NeoStats
|
||||
*/
|
||||
|
||||
#include "neostats.h" /* Neostats API */
|
||||
#include "modconfig.h"
|
||||
#include "TriviaServ.h"
|
||||
#include <strings.h>
|
||||
#include <error.h>
|
||||
|
||||
static void tvs_get_settings();
|
||||
static void tvs_parse_questions();
|
||||
static int tvs_about();
|
||||
static int tvs_version();
|
||||
|
||||
|
||||
static ModUser *tvs_bot;
|
||||
|
||||
|
||||
/**
|
||||
* A string to hold the name of our bot
|
||||
*/
|
||||
char s_TriviaServ[MAXNICK];
|
||||
|
||||
/** Module Info definition
|
||||
* Information about our module
|
||||
* This structure is required for your module to load and run on NeoStats
|
||||
*/
|
||||
ModuleInfo __module_info = {
|
||||
"TriviaServ",
|
||||
"Triva Service for NeoStats.",
|
||||
MODULE_VERSION,
|
||||
__DATE__,
|
||||
__TIME__
|
||||
};
|
||||
Functions __module_functions[] = {
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
static bot_cmd tvs_commands[]=
|
||||
{
|
||||
{"ABOUT", tvs_about, 0, NS_ULEVEL_ADMIN, tvs_help_about, tvs_help_about_oneline },
|
||||
{"VERSION", tvs_version, 0, NS_ULEVEL_ADMIN, tvs_help_version, tvs_help_version_oneline },
|
||||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static bot_setting tvs_settings[]=
|
||||
{
|
||||
{"NICK", &s_TriviaServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick },
|
||||
{"USER", &TriviaServ.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user },
|
||||
{"HOST", &TriviaServ.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host },
|
||||
{"REALNAME", &TriviaServ.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName", NULL, ns_help_set_realname },
|
||||
{"USEEXCLUSIONS", &TriviaServ.use_exc, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "Exclusions", NULL, tvs_help_set_exclusions },
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static int tvs_about(User * u, char **av, int ac)
|
||||
{
|
||||
privmsg_list(u->nick, s_TriviaServ, tvs_help_about);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tvs_version(User * u, char **av, int ac)
|
||||
{
|
||||
SET_SEGV_LOCATION();
|
||||
prefmsg(u->nick, s_TriviaServ, "\2%s Version Information\2", s_TriviaServ);
|
||||
prefmsg(u->nick, s_TriviaServ, "%s Version: %s Compiled %s at %s", __module_info.module_name,
|
||||
__module_info.module_version, __module_info.module_build_date, __module_info.module_build_time);
|
||||
prefmsg(u->nick, s_TriviaServ, "http://www.neostats.net");
|
||||
prefmsg(u->nick, s_TriviaServ, "Loaded %ld Questions out of %ld files", (long)list_count(ql), (long)list_count(qfl));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** Channel message processing
|
||||
* What do we do with messages in channels
|
||||
* This is required if you want your module to respond to channel messages
|
||||
*/
|
||||
int __ChanMessage(char *origin, char **argv, int argc)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Online event processing
|
||||
* What we do when we first come online
|
||||
*/
|
||||
static int Online(char **av, int ac)
|
||||
{
|
||||
/* Introduce a bot onto the network */
|
||||
tvs_bot = init_mod_bot(s_TriviaServ, TriviaServ.user, TriviaServ.host, TriviaServ.realname,
|
||||
services_bot_modes, BOT_FLAG_RESTRICT_OPERS, tvs_commands, tvs_settings, __module_info.module_name);
|
||||
if (tvs_bot) {
|
||||
TriviaServ.isonline = 1;
|
||||
}
|
||||
tvs_parse_questions();
|
||||
return 1;
|
||||
};
|
||||
|
||||
/** Module event list
|
||||
* What events we will act on
|
||||
* This is required if you want your module to respond to events on IRC
|
||||
* see events.h for a list of all events available
|
||||
*/
|
||||
EventFnList __module_events[] = {
|
||||
{EVENT_ONLINE, Online},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/** Init module
|
||||
* Required if you need to do initialisation of your module when
|
||||
* first loaded
|
||||
*/
|
||||
int __ModInit(int modnum, int apiver)
|
||||
{
|
||||
/* Check that our compiled version if compatible with the calling version of NeoStats */
|
||||
if( ircstrncasecmp (me.version, NEOSTATS_VERSION, VERSIONSIZE) !=0) {
|
||||
return NS_ERR_VERSION;
|
||||
}
|
||||
strlcpy(s_TriviaServ, "TriviaServ", MAXNICK);
|
||||
TriviaServ.isonline = 0;
|
||||
TriviaServ.modnum = modnum;
|
||||
|
||||
ql = list_create(-1);
|
||||
qfl = list_create(-1);
|
||||
tch = hash_create(-1, 0, 0);
|
||||
tvs_get_settings();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Init module
|
||||
* Required if you need to do cleanup of your module when it ends
|
||||
*/
|
||||
void __ModFini()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
void tvs_get_settings() {
|
||||
QuestionFiles *qf;
|
||||
lnode_t *node;
|
||||
|
||||
/* temp */
|
||||
ircsnprintf(TriviaServ.user, MAXUSER, "Trivia");
|
||||
ircsnprintf(TriviaServ.host, MAXHOST, "Trivia.com");
|
||||
ircsnprintf(TriviaServ.realname, MAXREALNAME, "Trivia Bot");
|
||||
|
||||
|
||||
qf = malloc(sizeof(QuestionFiles));
|
||||
strncpy(qf->filename, "questions.txt", MAXPATH);
|
||||
qf->fn = 0;
|
||||
node = lnode_create(qf);
|
||||
list_append(qfl, node);
|
||||
|
||||
};
|
||||
|
||||
void tvs_parse_questions() {
|
||||
QuestionFiles *qf;
|
||||
Questions *qe;
|
||||
lnode_t *qfnode, *qenode;
|
||||
char pathbuf[MAXPATH];
|
||||
long i = 0;
|
||||
|
||||
/* run through each file, and only load the offsets into the Questions struct to save memory */
|
||||
qfnode = list_first(qfl);
|
||||
while (qfnode != NULL) {
|
||||
qf = lnode_get(qfnode);
|
||||
ircsnprintf(pathbuf, MAXPATH, "data/%s", qf->filename);
|
||||
nlog(LOG_DEBUG2, LOG_MOD, "Opening %s for reading offsets", pathbuf);
|
||||
qf->fn = fopen(pathbuf, "r");
|
||||
/* if we can't open it, bail out */
|
||||
if (qf->fn == NULL) {
|
||||
nlog(LOG_WARNING, LOG_MOD, "Couldn't Open Question File %s for Reading offsets: %s", qf->filename, strerror(errno));
|
||||
qfnode = list_next(qfl, qfnode);
|
||||
continue;
|
||||
}
|
||||
i = 0;
|
||||
/* ok, now that its opened, we can start reading the offsets into the qe and ql entries. */
|
||||
/* use pathbuf as we don't actuall care about the data */
|
||||
while (fgets(pathbuf, MAXPATH, qf->fn) != NULL) {
|
||||
i++;
|
||||
qe = malloc(sizeof(Questions));
|
||||
bzero(qe, sizeof(Questions));
|
||||
qe->qn = i;
|
||||
qe->offset = ftell(qf->fn);
|
||||
qe->QF = qf;
|
||||
qenode = lnode_create(qe);
|
||||
list_append(ql, qenode);
|
||||
}
|
||||
|
||||
/* leave the filehandle open for later */
|
||||
nlog(LOG_NOTICE, LOG_MOD, "Finished Reading %s for Offsets (%ld)", qf->filename, (long)list_count(ql));
|
||||
qfnode = list_next(qfl, qfnode);
|
||||
}
|
||||
chanalert(s_TriviaServ, "Successfully Loaded information for %ld questions", (long)list_count(ql));
|
||||
}
|
||||
|
||||
|
||||
TriviaChan *FindTChan(char *name) {
|
||||
Chans *c;
|
||||
|
||||
c = findchan(name);
|
||||
|
||||
if (!c) {
|
||||
return NULL;
|
||||
}
|
||||
if (c->moddata[TriviaServ.modnum] != NULL) {
|
||||
return (TriviaChan *)c->moddata[TriviaServ.modnum];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TriviaChan *NewTChan(Chans *c) {
|
||||
TriviaChan *tc;
|
||||
hnode_t *tcn;
|
||||
|
||||
if (!c) {
|
||||
return NULL;
|
||||
}
|
||||
if (c->moddata[TriviaServ.modnum] != NULL) {
|
||||
nlog(LOG_WARNING, LOG_MOD, "Hrm, Chan %s already has a TriviaChanStruct with it", c->name);
|
||||
return NULL;
|
||||
}
|
||||
/* ok, first we lookup in the tch hash, to see if this is a channel that we already have a setting for */
|
||||
tcn = hash_lookup(tch, c->name);
|
||||
if (tcn == NULL) {
|
||||
/* ok, create and insert into hash */
|
||||
tc = malloc(sizeof(TriviaChan));
|
||||
bzero(tc, sizeof(TriviaChan))
|
||||
ircsnprintf(tc->name, CHANLEN, c->name);
|
||||
tc->c = c;
|
||||
c->moddata[TriviaServ.modnum] = tc;
|
||||
tcn = hnode_create(tc);
|
||||
hash_insert(tch, tcn, tc->name);
|
||||
nlog(LOG_DEBUG1, LOG_MOD, "Created New TC entry for Channel %s", c->name);
|
||||
} else {
|
||||
tc = hnode_get(tcn);
|
||||
tc->c = c;
|
||||
c->moddata[TriviaServ.modnum] = tc;
|
||||
nlog(LOG_DEBUG1, LOG_MOD, "Loaded a TC entry from hash for Channel %s", c->name);
|
||||
}
|
||||
return tc;
|
||||
}
|
||||
|
||||
TriviaChan *OfflineTChan(Chans *c) {
|
||||
TriviaChan *tc;
|
||||
if (!c) {
|
||||
return NULL;
|
||||
}
|
||||
if (c->moddata[TriviaServ.modnum] == NULL) {
|
||||
nlog(LOG_WARNING, LOG_MOD, "TriviaChan %s already marked offline?!!?!", c->name);
|
||||
return NULL;
|
||||
}
|
||||
tc = c->moddata[TriviaServ.modnum];
|
||||
c->moddata[TriviaServ.modnum] = NULL;
|
||||
tc->c = NULL;
|
||||
return tc;
|
||||
}
|
||||
|
||||
int DelTChan(TriviaChan *tc) {
|
||||
/* XXX todo */
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
int SaveTChan (TriviaChan *tc) {
|
||||
/* XXX todo */
|
||||
return NS_SUCCESS;
|
||||
}
|
82
TriviaServ.h
Normal file
82
TriviaServ.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
/* NeoStats - IRC Statistical Services Copyright
|
||||
** Copyright (c) 1999-2004 Justin Hammond
|
||||
** http://www.neostats.net/
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: SecureServ.h 235 2004-02-19 22:17:18Z Mark $
|
||||
*/
|
||||
|
||||
#ifndef TRIVIASERV_H
|
||||
#define TRIVIASERV_H
|
||||
|
||||
#include "neostats.h"
|
||||
#include "modconfig.h"
|
||||
|
||||
struct TriviaServ {
|
||||
char user[MAXUSER];
|
||||
char host[MAXHOST];
|
||||
char realname[MAXREALNAME];
|
||||
int isonline;
|
||||
int use_exc;
|
||||
int modnum;
|
||||
} TriviaServ;
|
||||
|
||||
struct QuestFile {
|
||||
FILE *fn;
|
||||
char filename[MAXPATH];
|
||||
};
|
||||
|
||||
typedef struct QuestFile QuestionFiles;
|
||||
|
||||
struct Quests {
|
||||
long qn;
|
||||
long offset;
|
||||
QuestionFiles *QF;
|
||||
char *question;
|
||||
char *answer;
|
||||
int hints;
|
||||
};
|
||||
|
||||
typedef struct Quests Questions;
|
||||
|
||||
struct TChans {
|
||||
char name[CHANLEN];
|
||||
Chans *c;
|
||||
int publiccontrol;
|
||||
Questions *curquest;
|
||||
};
|
||||
|
||||
typedef struct TChans TriviaChan;
|
||||
|
||||
list_t *ql;
|
||||
list_t *qfl;
|
||||
hash_t *tch;
|
||||
|
||||
|
||||
|
||||
|
||||
/* TriviaServ_help.c */
|
||||
extern const char *tvs_help_about[];
|
||||
extern const char tvs_help_about_oneline[];
|
||||
extern const char *tvs_help_version[];
|
||||
extern const char tvs_help_version_oneline[];
|
||||
extern const char *tvs_help_set_exclusions[];
|
||||
|
||||
|
||||
|
||||
#endif /* TRIVIASERV_H */
|
45
TriviaServ_help.c
Normal file
45
TriviaServ_help.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* NeoStats - IRC Statistical Services Copyright (c) 1999-2002 NeoStats Group Inc.
|
||||
** Copyright (c) 1999-2002 Adam Rutter, Justin Hammond
|
||||
** http://www.neostats.net/
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: SecureServ_help.c 225 2004-02-13 19:00:52Z Mark $
|
||||
*/
|
||||
|
||||
#include "modconfig.h"
|
||||
#include "TriviaServ.h"
|
||||
|
||||
const char *tvs_help_about[] = {
|
||||
"help",
|
||||
NULL
|
||||
};
|
||||
const char tvs_help_about_oneline[] = "hello";
|
||||
|
||||
const char *tvs_help_version[] = {
|
||||
"help",
|
||||
NULL
|
||||
};
|
||||
const char tvs_help_version_oneline[] = "hello";
|
||||
|
||||
|
||||
const char *tvs_help_set_exclusions[] = {
|
||||
"help",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
94
configure.in
Normal file
94
configure.in
Normal file
|
@ -0,0 +1,94 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(TriviaServ.c)
|
||||
AC_CONFIG_HEADER(modconfig.h)
|
||||
PACKAGE=TriviaServ
|
||||
MODULE_MAJOR=0
|
||||
MODULE_MINOR=1
|
||||
VERSION=$MODULE_MAJOR.$MODULE_MINOR
|
||||
AC_DEFINE_UNQUOTED(MODULE_VERSION, "$VERSION")
|
||||
AC_DEFINE_UNQUOTED(MODULE_MAJOR, "$MODULE_MAJOR")
|
||||
AC_DEFINE_UNQUOTED(MODULE_MINOR, "$MODULE_MINOR")
|
||||
DIRINST=~/NeoStats/
|
||||
AC_PREFIX_DEFAULT(~/NeoStats/)
|
||||
CFLAGS="$CFLAGS -O2"
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_MSG_CHECKING(Location of NeoStats...)
|
||||
AC_ARG_WITH(neostats,
|
||||
[ --with-neostats=DIR Location of NeoStats installation],
|
||||
[DIRINST=$withval])
|
||||
AC_MSG_RESULT($DIRINST)
|
||||
|
||||
|
||||
AC_CHECK_FILE($DIRINST/include/dl.h,
|
||||
[INCLUDEDIR="$DIRINST/include/"],
|
||||
[AC_MSG_ERROR(Can't find existing NeoStats Installation please supply with --with-neostats option)])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -I$INCLUDEDIR"
|
||||
dnl Check we are running the latest supported version of NeoStats
|
||||
AC_MSG_CHECKING(Version of NeoStats...)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
int main(void) {
|
||||
if (MAJOR >= 2) {
|
||||
if (MINOR >= 5) {
|
||||
if (REV >= 14) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
], ns_version_ok='yes',
|
||||
ns_version_ok='no',
|
||||
ns_version_ok='no')
|
||||
if test "$ns_version_ok" = "yes"; then
|
||||
AC_MSG_RESULT(Compatible Version);
|
||||
else
|
||||
AC_MSG_ERROR(This Module requires NeoStats 2.5.2 or Higher)
|
||||
fi
|
||||
|
||||
|
||||
dnl check if we are running with Debug....
|
||||
AC_MSG_CHECKING(Whether to Enable Debuging...)
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug - Enable Debuging],
|
||||
[ case "$enableval" in
|
||||
yes)
|
||||
CFLAGS="$CFLAGS -Wall -ggdb"
|
||||
AC_DEFINE(DEBUG,1)
|
||||
AC_MSG_RESULT(yes - Watch your Log Files)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
AC_SUBST(DIRINST)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_SUBST(VERSION)
|
||||
AC_OUTPUT(Makefile)
|
||||
echo "(*----------------------------------------------------------*)"
|
||||
echo "(| Important Instructions |)"
|
||||
echo "(*----------------------------------------------------------*)"
|
||||
echo "(| Now that configure is complete, type 'make' to compile |)"
|
||||
echo "(| the module. When the compile has completed, type |)"
|
||||
echo "(| 'make install' to install the module. |)"
|
||||
echo "(| For BSD you might need to use 'gmake' and 'gmake install'|)"
|
||||
echo "(*----------------------------------------------------------*)"
|
||||
echo "(| For Support please visit: |)"
|
||||
echo "(| IRC: /server irc.irc-chat.org |)"
|
||||
echo "(| #neostats channel |)"
|
||||
echo "(| WWW: http://www.neostats.net/boards/ |)"
|
||||
echo "(*----------------------------------------------------------*)"
|
||||
echo "(|This Module was written by: |)"
|
||||
echo "(| fish (fish@dynam.ac) |)"
|
||||
echo "(*----------------------------------------------------------*)"
|
251
install-sh
Executable file
251
install-sh
Executable file
|
@ -0,0 +1,251 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
11
modconfig.h.in
Normal file
11
modconfig.h.in
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* define this to enable debug code for this module */
|
||||
#undef DEBUG
|
||||
|
||||
/* Version number of package */
|
||||
#undef MODULE_VERSION
|
||||
|
||||
/* Major Version */
|
||||
#undef MODULE_MAJOR
|
||||
|
||||
/* Minor Version */
|
||||
#undef MODULE_MINOR
|
5000
questions.txt
Normal file
5000
questions.txt
Normal file
File diff suppressed because it is too large
Load diff
Reference in a new issue