]> skyeroc.xyz Git - dgamelaunch/commitdiff
Remove the internal text editor and all the support code; now compiles virus and...
authorPasi Kallinen <paxed@alt.org>
Tue, 18 May 2010 20:39:32 +0000 (20:39 +0000)
committerPasi Kallinen <paxed@alt.org>
Tue, 18 May 2010 20:39:32 +0000 (20:39 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@575 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

Makefile.in
config.l
configure.ac
dgamelaunch.c
dgamelaunch.h
dgl-common.c
dgl-create-chroot
ee.c
examples/dgamelaunch.conf
virus.c

index fc904c747e177deac4f25bef6c6b512962a3af8e..1405e18eb0b39f429437ada33c8ef2abd9180f35 100644 (file)
@@ -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
index b5e7b53cf813a46561f9c2548014c8453f706480..2978834899961a6aaa8b31fc3bbc976c01039779 100644 (file)
--- 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; }
index b0eafdcf3917d6e09c25449be70ee9fdc48c8b99..f26c5195926a1f78a8d2963c6011913cd0a070e8 100644 (file)
@@ -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.])],
index 49847a094e67b615a334dbc54bc58f82674e664f..cb3eed14a3e41ffe54fae0ce97302ef6736e1ded 100644 (file)
@@ -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);
-}
 
 /* ************************************************************* */
 
index a82dec11b7565ebfa40fbc876e1a712e160e23d2..b81687d0bd901a7c10f00e75160f9498a7411f37 100644 (file)
@@ -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);
index ad8cd63c7273353e61a7ab1e06ec54b2b2249107..dbe910a12ea32e02cac92c88956614d12b1bbd5b 100644 (file)
@@ -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;
index cdefea663ea68dcb6b6b09459b42538e44362cca..e1d0ffe50ae0d4907783244d62a92fad47b86f66 100755 (executable)
@@ -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 31f34e6d7196d20bef5e3bcf7c74ba703ffc9d93..692f10242539404e51ec13c6e6b17aed9b71cd9e 100644 (file)
--- 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[];
 {
index 1bd6d555b7922aeb7e9fd96def3e7279982cab47..e642b23a36722163d2aac2565cd8ebfab316c01b 100644 (file)
@@ -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 dec447df23712144c7b0758014406d3fa97405f7..469173cb6af298a8a0f5f9eb659b13edc434947b 100644 (file)
--- 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;