Remove the internal text editor and all the support code; now compiles virus and ee as standalone executables.
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@575 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
ff31d082d1
commit
0321c2713c
25
Makefile.in
25
Makefile.in
|
@ -8,43 +8,50 @@ sbindir = @sbindir@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
LEX = @LEX@
|
LEX = @LEX@
|
||||||
YACC = @YACC@
|
YACC = @YACC@
|
||||||
MKDEP = @MKDEP@
|
MKDEP = @MKDEP@
|
||||||
MKDEP_DIRECT = @MKDEP_DIRECT@
|
MKDEP_DIRECT = @MKDEP_DIRECT@
|
||||||
|
EDITORS = ee virus
|
||||||
|
EDITORS_SRCS = ee.c virus.c
|
||||||
|
|
||||||
MAN8 = dgamelaunch.8
|
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
|
DYN_SRCS = y.tab.c lex.yy.c
|
||||||
EXTRA_SRCS = nethackstub.c
|
EXTRA_SRCS = nethackstub.c
|
||||||
DEP_SRCS := $(STATIC_SRCS) $(EXTRA_SRCS)
|
DEP_SRCS := $(STATIC_SRCS) $(EXTRA_SRCS) $(EDITORS_SRCS)
|
||||||
SRCS := $(STATIC_SRCS) $(DYN_SRCS)
|
SRCS := $(STATIC_SRCS) $(DYN_SRCS)
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
all: .depend $(NAME)
|
all: .depend $(NAME) $(EDITORS)
|
||||||
|
|
||||||
$(NAME): $(OBJS)
|
$(NAME): $(OBJS)
|
||||||
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
|
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
ee: ee.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
|
||||||
|
|
||||||
|
virus: virus.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(NAME) nethackstub
|
rm -f $(NAME) nethackstub $(EDITORS)
|
||||||
rm -f *.o *~ y.tab.* lex.yy.c .depend .depend.bak
|
rm -f *.o *~ y.tab.* lex.yy.c .depend .depend.bak
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile config.h config.log config.status
|
rm -f Makefile config.h config.log config.status
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(DESTDIR)$(sbindir)
|
mkdir -p $(DESTDIR)$(sbindir)
|
||||||
$(INSTALL) -m 755 $(NAME) $(DESTDIR)$(sbindir)
|
$(INSTALL) -m 755 $(NAME) $(DESTDIR)$(sbindir)
|
||||||
mkdir -p $(DESTDIR)$(mandir)/man8
|
mkdir -p $(DESTDIR)$(mandir)/man8
|
||||||
$(INSTALL) -m 644 $(MAN8) $(mandir)/man8
|
$(INSTALL) -m 644 $(MAN8) $(mandir)/man8
|
||||||
|
|
||||||
indent:
|
indent:
|
||||||
indent -nut -ts2 *.c *.h
|
indent -nut -ts2 *.c *.h
|
||||||
rm -f *~
|
rm -f *~
|
||||||
|
@ -58,7 +65,7 @@ y.tab.c y.tab.h: config.y
|
||||||
lex.yy.o: lex.yy.c
|
lex.yy.o: lex.yy.c
|
||||||
y.tab.o: y.tab.c
|
y.tab.o: y.tab.c
|
||||||
|
|
||||||
dist: .depend distclean
|
dist: .depend distclean
|
||||||
rm -rf $(NAME)-$(VERSION)
|
rm -rf $(NAME)-$(VERSION)
|
||||||
autoheader
|
autoheader
|
||||||
autoconf
|
autoconf
|
||||||
|
|
1
config.l
1
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_login { yylval.i = DGLCMD_LOGIN; return TYPE_DGLCMD0; }
|
||||||
ask_register { yylval.i = DGLCMD_REGISTER; return TYPE_DGLCMD0; }
|
ask_register { yylval.i = DGLCMD_REGISTER; return TYPE_DGLCMD0; }
|
||||||
quit { yylval.i = DGLCMD_QUIT; 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; }
|
play_game { yylval.i = DGLCMD_PLAYGAME; return TYPE_DGLCMD1; }
|
||||||
submenu { yylval.i = DGLCMD_SUBMENU; return TYPE_DGLCMD1; }
|
submenu { yylval.i = DGLCMD_SUBMENU; return TYPE_DGLCMD1; }
|
||||||
return { yylval.i = DGLCMD_RETURN; return TYPE_DGLCMD0; }
|
return { yylval.i = DGLCMD_RETURN; return TYPE_DGLCMD0; }
|
||||||
|
|
|
@ -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_ARG_ENABLE(debugfile,
|
||||||
[AC_HELP_STRING([--enable-debugfile], [Enable debugging output to a file.])],
|
[AC_HELP_STRING([--enable-debugfile], [Enable debugging output to a file.])],
|
||||||
|
|
|
@ -95,8 +95,6 @@
|
||||||
extern FILE* yyin;
|
extern FILE* yyin;
|
||||||
extern int yyparse ();
|
extern int yyparse ();
|
||||||
|
|
||||||
extern int editor_main (int argc, char **argv);
|
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
|
|
||||||
char * __progname;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,6 @@ typedef enum
|
||||||
DGLCMD_QUIT, /* quit */
|
DGLCMD_QUIT, /* quit */
|
||||||
DGLCMD_CHMAIL, /* chmail */
|
DGLCMD_CHMAIL, /* chmail */
|
||||||
DGLCMD_CHPASSWD, /* chpasswd */
|
DGLCMD_CHPASSWD, /* chpasswd */
|
||||||
DGLCMD_EDITOPTIONS, /* edit_options "foo" */
|
|
||||||
DGLCMD_PLAYGAME, /* play_game "foo" */
|
DGLCMD_PLAYGAME, /* play_game "foo" */
|
||||||
DGLCMD_SUBMENU, /* submenu "foo" */
|
DGLCMD_SUBMENU, /* submenu "foo" */
|
||||||
DGLCMD_RETURN /* return */
|
DGLCMD_RETURN /* return */
|
||||||
|
@ -286,7 +285,6 @@ extern int passwordgood(char *cpw);
|
||||||
extern int readfile(int nolock);
|
extern int readfile(int nolock);
|
||||||
extern struct dg_user *userexist(char *cname, int isnew);
|
extern struct dg_user *userexist(char *cname, int isnew);
|
||||||
extern void write_canned_rcfile(int game, char *target);
|
extern void write_canned_rcfile(int game, char *target);
|
||||||
extern void editoptions(int game);
|
|
||||||
extern void writefile(int requirenew);
|
extern void writefile(int requirenew);
|
||||||
extern void graceful_exit(int status);
|
extern void graceful_exit(int status);
|
||||||
extern int purge_stale_locks(int game);
|
extern int purge_stale_locks(int game);
|
||||||
|
|
14
dgl-common.c
14
dgl-common.c
|
@ -311,20 +311,6 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
||||||
case DGLCMD_RETURN:
|
case DGLCMD_RETURN:
|
||||||
return_from_submenu = 1;
|
return_from_submenu = 1;
|
||||||
break;
|
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:
|
case DGLCMD_PLAYGAME:
|
||||||
if (loggedin && me && p1) {
|
if (loggedin && me && p1) {
|
||||||
int userchoice, i;
|
int userchoice, i;
|
||||||
|
|
|
@ -86,7 +86,7 @@ LIBS="`findlibs dgamelaunch`"
|
||||||
|
|
||||||
sudo mkdir -p "$CHROOT"
|
sudo mkdir -p "$CHROOT"
|
||||||
cd "$CHROOT"
|
cd "$CHROOT"
|
||||||
sudo mkdir dgldir etc lib mail usr
|
sudo mkdir dgldir etc lib mail usr bin
|
||||||
sudo chown "$USRGRP" dgldir mail
|
sudo chown "$USRGRP" dgldir mail
|
||||||
sudo cp "$CURDIR/dgamelaunch" "$DGLFILE"
|
sudo cp "$CURDIR/dgamelaunch" "$DGLFILE"
|
||||||
sudo ln -s "$DGLFILE" dgamelaunch
|
sudo ln -s "$DGLFILE" dgamelaunch
|
||||||
|
@ -130,6 +130,12 @@ echo "Edit $CHROOT/etc/dgamelaunch.conf to suit your needs."
|
||||||
cd ..
|
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_anon.txt" .
|
||||||
sudo cp "$CURDIR/examples/dgl_menu_main_user.txt" .
|
sudo cp "$CURDIR/examples/dgl_menu_main_user.txt" .
|
||||||
|
|
2
ee.c
2
ee.c
|
@ -412,7 +412,7 @@ FILE *fopen(); /* declaration for open function */
|
||||||
#endif /* __STDC__ */
|
#endif /* __STDC__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
editor_main(argc, argv) /* beginning of main program */
|
main(argc, argv) /* beginning of main program */
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,13 +97,13 @@ lockfile = "/dgl-lock"
|
||||||
# ask_login = do the login prompting, if not logged in
|
# ask_login = do the login prompting, if not logged in
|
||||||
# ask_register = do register new user prompting, if not logged in and
|
# ask_register = do register new user prompting, if not logged in and
|
||||||
# registration of new nicks is allowed.
|
# 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"
|
# play_game "foo" = start game which has the short name "foo"
|
||||||
# (user must be logged in)
|
# (user must be logged in)
|
||||||
# submenu "foo" = go to submenu "foo"
|
# submenu "foo" = go to submenu "foo"
|
||||||
# return = return from submenu
|
# 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
|
# The commands will be done inside the chroot and with the uid and gid
|
||||||
# defined above.
|
# defined above.
|
||||||
# Parameters to the commands are subject to variable substitution:
|
# Parameters to the commands are subject to variable substitution:
|
||||||
|
@ -159,7 +159,8 @@ menu["mainmenu_user"] {
|
||||||
commands["c"] = chpasswd
|
commands["c"] = chpasswd
|
||||||
commands["e"] = chmail
|
commands["e"] = chmail
|
||||||
commands["w"] = watch_menu
|
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["p"] = play_game "NH343"
|
||||||
commands["q"] = quit
|
commands["q"] = quit
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue