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 *~
lex.yy.o: lex.yy.c
y.tab.o: y.tab.c
-dist: .depend distclean
+dist: .depend distclean
rm -rf $(NAME)-$(VERSION)
autoheader
autoconf
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; }
])
-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.])],
extern FILE* yyin;
extern int yyparse ();
-extern int editor_main (int argc, char **argv);
-
/* global variables */
char * __progname;
}
-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);
-}
/* ************************************************************* */
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 */
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);
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;
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
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" .
#endif /* __STDC__ */
int
-editor_main(argc, argv) /* beginning of main program */
+main(argc, argv) /* beginning of main program */
int argc;
char *argv[];
{
# 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:
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
}
extern int
-editor_main (int argc, char **argv)
+main (int argc, char **argv)
{
#ifdef BB_FEATURE_VI_YANKMARK
int i;