+
+[22:45] < kerio> paxed: dgamelaunch bug! :D - you *need* a file called dgamelaunch in the root of the jail -
+ otherwise the shared memory craps out
+[22:48] < kerio> anyway, /dgldir/shmkey would've been better
+
+
+
-when no banner file given, try to make a banner automagically?
(needs some way to name the options given as keys... maybe another
format for the keys that includes a string to be used as the name)
server_id { return TYPE_SERVER_ID; }
sortmode { return TYPE_WATCH_SORTMODE; }
commands { return TYPE_CMDQUEUE; }
+postcommands { return TYPE_POSTCMDQUEUE; }
yes { yylval.i = 1; return TYPE_BOOL; }
no { yylval.i = 0; return TYPE_BOOL; }
dglstart { yylval.i = DGLTIME_DGLSTART; return TYPE_CMDQUEUENAME; }
%token TYPE_PATH_PASSWD TYPE_PATH_LOCKFILE TYPE_PATH_TTYREC
%token TYPE_MALSTRING TYPE_PATH_INPROGRESS TYPE_GAME_ARGS TYPE_RC_FMT
%token TYPE_CMDQUEUE TYPE_DEFINE_MENU TYPE_BANNER_FILE TYPE_CURSOR
+%token TYPE_POSTCMDQUEUE
%token TYPE_MAX_IDLE_TIME TYPE_MENU_MAX_IDLE_TIME
%token <s> TYPE_VALUE
%token <i> TYPE_NUMBER TYPE_CMDQUEUENAME
myconfig[ncnf]->cmdqueue = curr_cmdqueue;
curr_cmdqueue = NULL;
}
+ | TYPE_POSTCMDQUEUE
+ {
+ if (myconfig[ncnf]->postcmdqueue) {
+ fprintf(stderr, "%s:%d: postcommand queue defined twice, bailing out\n",
+ config, line);
+ exit(1);
+ }
+ }
+ '=' cmdlist
+ {
+ myconfig[ncnf]->postcmdqueue = curr_cmdqueue;
+ curr_cmdqueue = NULL;
+ }
+
| TYPE_GAME_ARGS '=' game_args_list
{
/* nothing */
NUM_DGLTIMES
} dglcmd_times;
+typedef enum
+{
+ DGLCMD_NONE = 0,
+ DGLCMD_MKDIR, /* mkdir foo */
+ DGLCMD_CHDIR, /* chdir foo */
+ DGLCMD_IF_NX_CP, /* ifnxcp foo bar */
+ DGLCMD_CP, /* cp foo bar */
+ DGLCMD_UNLINK, /* unlink foo */
+ DGLCMD_EXEC, /* exec foo bar */
+ DGLCMD_SETENV, /* setenv foo bar */
+ DGLCMD_WATCH_MENU, /* watch_menu */
+ DGLCMD_LOGIN, /* ask_login */
+ DGLCMD_REGISTER, /* ask_register */
+ DGLCMD_QUIT, /* quit */
+ DGLCMD_CHMAIL, /* chmail */
+ DGLCMD_CHPASSWD, /* chpasswd */
+ DGLCMD_PLAYGAME, /* play_game "foo" */
+ DGLCMD_SUBMENU, /* submenu "foo" */
+ DGLCMD_RETURN /* return */
+} dglcmd_actions;
+
+typedef enum
+{
+ SORTMODE_NONE = 0,
+ SORTMODE_USERNAME,
+ SORTMODE_GAMENUM,
+ SORTMODE_WINDOWSIZE,
+ SORTMODE_STARTTIME,
+ SORTMODE_IDLETIME,
+#ifdef USE_SHMEM
+ SORTMODE_WATCHERS,
+#endif
+ NUM_SORTMODES
+} dg_sortmode;
+
+static const char *SORTMODE_NAME[NUM_SORTMODES] = {
+ "Unsorted",
+ "Username",
+ "Game",
+ "Windowsize",
+ "Starttime",
+ "Idletime",
+#ifdef USE_SHMEM
+ "Watchers",
+#endif
+};
+
struct dg_cmdpart
{
- dglcmd_times cmd;
+ dglcmd_actions cmd;
char *param1;
char *param2;
struct dg_cmdpart *next;
char **bin_args; /* args for game binary */
char *rc_fmt;
struct dg_cmdpart *cmdqueue;
+ struct dg_cmdpart *postcmdqueue;
int max_idle_time;
};
int menu_max_idle_time;
};
-typedef enum
-{
- DGLCMD_NONE = 0,
- DGLCMD_MKDIR, /* mkdir foo */
- DGLCMD_CHDIR, /* chdir foo */
- DGLCMD_IF_NX_CP, /* ifnxcp foo bar */
- DGLCMD_CP, /* cp foo bar */
- DGLCMD_UNLINK, /* unlink foo */
- DGLCMD_EXEC, /* exec foo bar */
- DGLCMD_SETENV, /* setenv foo bar */
- DGLCMD_WATCH_MENU, /* watch_menu */
- DGLCMD_LOGIN, /* ask_login */
- DGLCMD_REGISTER, /* ask_register */
- DGLCMD_QUIT, /* quit */
- DGLCMD_CHMAIL, /* chmail */
- DGLCMD_CHPASSWD, /* chpasswd */
- DGLCMD_PLAYGAME, /* play_game "foo" */
- DGLCMD_SUBMENU, /* submenu "foo" */
- DGLCMD_RETURN /* return */
-} dglcmd_actions;
-
-typedef enum
-{
- SORTMODE_NONE = 0,
- SORTMODE_USERNAME,
- SORTMODE_GAMENUM,
- SORTMODE_WINDOWSIZE,
- SORTMODE_STARTTIME,
- SORTMODE_IDLETIME,
-#ifdef USE_SHMEM
- SORTMODE_WATCHERS,
-#endif
- NUM_SORTMODES
-} dg_sortmode;
-
-static const char *SORTMODE_NAME[NUM_SORTMODES] = {
- "Unsorted",
- "Username",
- "Game",
- "Windowsize",
- "Starttime",
- "Idletime",
-#ifdef USE_SHMEM
- "Watchers",
-#endif
-};
/* Global variables */
/* bin_args = */ NULL,
/* rc_fmt = */ "%rrcfiles/%n.nethackrc", /* [dglroot]rcfiles/[username].nethackrc */
/* cmdqueue = */ NULL,
+ /* postcmdqueue = */ NULL,
/* max_idle_time = */ 0
};
signal (SIGTERM, catch_sighup);
signal(SIGWINCH, sigwinch_func);
+ dgl_exec_cmdqueue(myconfig[userchoice]->postcmdqueue, userchoice, me);
+
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMEEND], userchoice, me);
setproctitle ("%s", me->username);
# login = when user has logged in
# register = right after a new user is registered
# gamestart = just before a game is started
+# gameend = after a game ends (see also per-game "postcommand" define)
#
# <command> is:
# mkdir "foo" = create a directory "foo"
# # We can also define per-game commands, that are executed
# # when the game starts:
# # commands = chdir "/dgldir", mkdir "foo_%u_%g"
+#
+# # We can also define per-game commands executed after the game ends,
+# # but before commands[gameend]
+# postcommands = chdir "/"
#}