]> skyeroc.xyz Git - dgamelaunch/commitdiff
Add %t string formatting, for the TTYREC of the last played game. (Edoardo Spadolini...
authorPasi Kallinen <paxed@alt.org>
Fri, 7 Oct 2011 14:41:21 +0000 (14:41 +0000)
committerPasi Kallinen <paxed@alt.org>
Fri, 7 Oct 2011 14:41:21 +0000 (14:41 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@612 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.h
dgl-common.c
examples/dgamelaunch.conf
ttyrec.c

index 23a54f51146506ef7607c97958cca791b2219df3..a74f59d952ff2801de2a491fc4d599e53b10d4df 100644 (file)
@@ -262,6 +262,8 @@ extern mode_t default_fmode;
 extern int dgl_local_COLS;
 extern int dgl_local_LINES;
 
+extern char last_ttyrec[512];
+
 /* dgamelaunch.c */
 extern void create_config(void);
 extern void ttyrec_getmaster(void);
index 0b197f6203dc747cc29c285adb8f793a724f2ecc..eee4d5acee7a739d64f87608f1cc9f627773f7d6 100644 (file)
@@ -107,6 +107,7 @@ dgl_find_menu(char *menuname)
  * %r == chroot (string)  (aka "dglroot" config var)
  * %g == game name
  * %s == short game name
+ * %t == ttyrec file (full path&name) of the last game played.
  */
 char *
 dgl_format_str(int game, struct dg_user *me, char *str, char *plrname)
@@ -160,6 +161,11 @@ dgl_format_str(int game, struct dg_user *me, char *str, char *plrname)
                while (*p != '\0')
                    p++;
                break;
+           case 't':
+               snprintf (p, end + 1 - p, "%s", last_ttyrec);
+               while (*p != '\0')
+                   p++;
+               break;
            default:
                *p = *f;
                if (p < end)
index 374502c46de4dd560db855572ea970a006786ac0..4f9cd9e72b67dc7b5ca6a0f2cc9eb24f17e39651 100644 (file)
@@ -137,6 +137,7 @@ lockfile = "/dgl-lock"
 #   %u = shed_uid, as defined above, but numeric
 #   %g = game name, if user has selected a game.
 #   %s = short game name, if user has selected a game.
+#   %t = ttyrec path & filename of the last game played.
 #
 # eg. commands[login] = mkdir "foo", unlink "bar", setenv "Z" "foo"
 #
index 720589df6699a3eb38232f285d729260b3ddd99b..4ed7e4d40cc936a06d486c14292249bf9515ec66 100644 (file)
--- a/ttyrec.c
+++ b/ttyrec.c
@@ -87,6 +87,8 @@ int master;
 struct termios tt;
 struct winsize win;
 
+char last_ttyrec[512] = { '\0' };
+
 int ancient_encoding = 0;
 
 void
@@ -160,6 +162,8 @@ ttyrec_main (int game, char *username, char *ttyrec_path, char* ttyrec_filename)
   if (ancient_encoding == -1)
       query_encoding(game, username);
 
+  snprintf(last_ttyrec, 512, "%s", dirname);
+
   atexit(&remove_ipfile);
   if ((fscript = fopen (dirname, "w")) == NULL)
     {