diff --git a/Makefile.in b/Makefile.in index fc904c7..1405e18 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,43 +8,50 @@ sbindir = @sbindir@ mandir = @mandir@ CC = @CC@ -LIBS = @LIBS@ +LIBS = @LIBS@ CFLAGS = @CFLAGS@ INSTALL = @INSTALL@ LEX = @LEX@ YACC = @YACC@ MKDEP = @MKDEP@ MKDEP_DIRECT = @MKDEP_DIRECT@ +EDITORS = ee virus +EDITORS_SRCS = ee.c virus.c MAN8 = dgamelaunch.8 -EDITOR = @EDITOR@ -STATIC_SRCS = $(EDITOR) dgl-common.c ttyrec.c dgamelaunch.c io.c ttyplay.c mygetnstr.c stripgfx.c strlcpy.c strlcat.c @SETPROCTITLE_C@ +STATIC_SRCS = dgl-common.c ttyrec.c dgamelaunch.c io.c ttyplay.c mygetnstr.c stripgfx.c strlcpy.c strlcat.c @SETPROCTITLE_C@ DYN_SRCS = y.tab.c lex.yy.c EXTRA_SRCS = nethackstub.c -DEP_SRCS := $(STATIC_SRCS) $(EXTRA_SRCS) +DEP_SRCS := $(STATIC_SRCS) $(EXTRA_SRCS) $(EDITORS_SRCS) SRCS := $(STATIC_SRCS) $(DYN_SRCS) OBJS = $(SRCS:.c=.o) -all: .depend $(NAME) +all: .depend $(NAME) $(EDITORS) $(NAME): $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) +ee: ee.c + $(CC) $(CFLAGS) -o $@ $< $(LIBS) + +virus: virus.c + $(CC) $(CFLAGS) -o $@ $< $(LIBS) + clean: - rm -f $(NAME) nethackstub + rm -f $(NAME) nethackstub $(EDITORS) rm -f *.o *~ y.tab.* lex.yy.c .depend .depend.bak distclean: clean rm -f Makefile config.h config.log config.status rm -rf autom4te.cache - + install: all mkdir -p $(DESTDIR)$(sbindir) $(INSTALL) -m 755 $(NAME) $(DESTDIR)$(sbindir) mkdir -p $(DESTDIR)$(mandir)/man8 $(INSTALL) -m 644 $(MAN8) $(mandir)/man8 - + indent: indent -nut -ts2 *.c *.h rm -f *~ @@ -58,7 +65,7 @@ y.tab.c y.tab.h: config.y lex.yy.o: lex.yy.c y.tab.o: y.tab.c -dist: .depend distclean +dist: .depend distclean rm -rf $(NAME)-$(VERSION) autoheader autoconf diff --git a/config.l b/config.l index b5e7b53..2978834 100644 --- a/config.l +++ b/config.l @@ -109,7 +109,6 @@ watch_menu { yylval.i = DGLCMD_WATCH_MENU; return TYPE_DGLCMD0; } ask_login { yylval.i = DGLCMD_LOGIN; return TYPE_DGLCMD0; } ask_register { yylval.i = DGLCMD_REGISTER; return TYPE_DGLCMD0; } quit { yylval.i = DGLCMD_QUIT; return TYPE_DGLCMD0; } -edit_options { yylval.i = DGLCMD_EDITOPTIONS; return TYPE_DGLCMD1; } play_game { yylval.i = DGLCMD_PLAYGAME; return TYPE_DGLCMD1; } submenu { yylval.i = DGLCMD_SUBMENU; return TYPE_DGLCMD1; } return { yylval.i = DGLCMD_RETURN; return TYPE_DGLCMD0; } diff --git a/configure.ac b/configure.ac index b0eafdc..f26c519 100644 --- a/configure.ac +++ b/configure.ac @@ -85,12 +85,6 @@ AC_SEARCH_LIBS(initscr, [ncurses curses], [], [ ]) -AC_ARG_ENABLE(virus, -[AC_HELP_STRING([--enable-virus], [Use the 'virus' vi clone instead of the friendly ee editor.])], -[EDITOR=virus.c], [EDITOR=ee.c]) - -AC_SUBST(EDITOR) - AC_ARG_ENABLE(debugfile, [AC_HELP_STRING([--enable-debugfile], [Enable debugging output to a file.])], diff --git a/dgamelaunch.c b/dgamelaunch.c index 49847a0..cb3eed1 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -95,8 +95,6 @@ extern FILE* yyin; extern int yyparse (); -extern int editor_main (int argc, char **argv); - /* global variables */ char * __progname; @@ -1960,48 +1958,6 @@ write_canned_rcfile (int game, char *target) } -void -editoptions (int game) -{ - FILE *rcfile; - char *myargv[3]; - pid_t editor; - - rcfile = fopen (dgl_format_str(game, me, myconfig[game]->rc_fmt, NULL), "r"); - if (!rcfile) - write_canned_rcfile (game, dgl_format_str(game, me, myconfig[game]->rc_fmt, NULL)); - - /* use whatever editor_main to edit */ - - myargv[0] = ""; - myargv[1] = dgl_format_str(game, me, myconfig[game]->rc_fmt, NULL); - myargv[2] = 0; - - clear(); - refresh(); - endwin (); - - editor = fork(); - - if (editor == -1) - { - perror("fork"); - debug_write("edit fork failed"); - graceful_exit(114); - } - else if (editor == 0) - { - signals_block(); - editor_main (2, myargv); - signals_release(); - exit(0); - } - else - waitpid(editor, NULL, 0); - - initcurses(); - check_retard(1); -} /* ************************************************************* */ diff --git a/dgamelaunch.h b/dgamelaunch.h index a82dec1..b81687d 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -174,7 +174,6 @@ typedef enum DGLCMD_QUIT, /* quit */ DGLCMD_CHMAIL, /* chmail */ DGLCMD_CHPASSWD, /* chpasswd */ - DGLCMD_EDITOPTIONS, /* edit_options "foo" */ DGLCMD_PLAYGAME, /* play_game "foo" */ DGLCMD_SUBMENU, /* submenu "foo" */ DGLCMD_RETURN /* return */ @@ -286,7 +285,6 @@ extern int passwordgood(char *cpw); extern int readfile(int nolock); extern struct dg_user *userexist(char *cname, int isnew); extern void write_canned_rcfile(int game, char *target); -extern void editoptions(int game); extern void writefile(int requirenew); extern void graceful_exit(int status); extern int purge_stale_locks(int game); diff --git a/dgl-common.c b/dgl-common.c index ad8cd63..dbe910a 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -311,20 +311,6 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me) case DGLCMD_RETURN: return_from_submenu = 1; break; - case DGLCMD_EDITOPTIONS: - if (loggedin && p1) { - int i; - for (i = 0; i < num_games; i++) { - if ((!strcmp(myconfig[i]->game_name, p1) || !strcmp(myconfig[i]->shortname, p1)) && myconfig[i]->rcfile) { - idle_alarm_set_enabled(0); - editoptions(i); - idle_alarm_set_enabled(1); - check_retard(1); - break; - } - } - } - break; case DGLCMD_PLAYGAME: if (loggedin && me && p1) { int userchoice, i; diff --git a/dgl-create-chroot b/dgl-create-chroot index cdefea6..e1d0ffe 100755 --- a/dgl-create-chroot +++ b/dgl-create-chroot @@ -86,7 +86,7 @@ LIBS="`findlibs dgamelaunch`" sudo mkdir -p "$CHROOT" cd "$CHROOT" -sudo mkdir dgldir etc lib mail usr +sudo mkdir dgldir etc lib mail usr bin sudo chown "$USRGRP" dgldir mail sudo cp "$CURDIR/dgamelaunch" "$DGLFILE" sudo ln -s "$DGLFILE" dgamelaunch @@ -130,6 +130,12 @@ echo "Edit $CHROOT/etc/dgamelaunch.conf to suit your needs." cd .. +cd bin +sudo cp "$CURDIR/ee" . +sudo cp "$CURDIR/virus" . +echo "Copied text editors 'ee' and 'virus' to chroot." +cd .. + sudo cp "$CURDIR/examples/dgl_menu_main_anon.txt" . sudo cp "$CURDIR/examples/dgl_menu_main_user.txt" . diff --git a/ee.c b/ee.c index 31f34e6..692f102 100644 --- a/ee.c +++ b/ee.c @@ -412,7 +412,7 @@ FILE *fopen(); /* declaration for open function */ #endif /* __STDC__ */ int -editor_main(argc, argv) /* beginning of main program */ +main(argc, argv) /* beginning of main program */ int argc; char *argv[]; { diff --git a/examples/dgamelaunch.conf b/examples/dgamelaunch.conf index 1bd6d55..e642b23 100644 --- a/examples/dgamelaunch.conf +++ b/examples/dgamelaunch.conf @@ -97,13 +97,13 @@ lockfile = "/dgl-lock" # ask_login = do the login prompting, if not logged in # ask_register = do register new user prompting, if not logged in and # registration of new nicks is allowed. -# edit_options "foo" = edit options for game which has the short name "foo" -# (user must be logged in) # play_game "foo" = start game which has the short name "foo" # (user must be logged in) # submenu "foo" = go to submenu "foo" # return = return from submenu # +# NOTE: edit_options-command was removed. use ifnxcp and exec to simulate it. +# # The commands will be done inside the chroot and with the uid and gid # defined above. # Parameters to the commands are subject to variable substitution: @@ -159,7 +159,8 @@ menu["mainmenu_user"] { commands["c"] = chpasswd commands["e"] = chmail commands["w"] = watch_menu - commands["o"] = edit_options "NH343" + commands["o"] = ifnxcp "/dgl-default-rcfile.nh343" "%ruserdata/%n/%n.nh343rc", + exec "/bin/virus" "%ruserdata/%n/%n.nh343rc" commands["p"] = play_game "NH343" commands["q"] = quit } diff --git a/virus.c b/virus.c index dec447d..469173c 100644 --- a/virus.c +++ b/virus.c @@ -304,7 +304,7 @@ static int crashme = 0; extern int -editor_main (int argc, char **argv) +main (int argc, char **argv) { #ifdef BB_FEATURE_VI_YANKMARK int i;