]> skyeroc.xyz Git - dgamelaunch/commitdiff
Add short game name (%s) for string substitutions. From Marc H. Thoben
authorPasi Kallinen <paxed@alt.org>
Thu, 25 Feb 2010 16:52:25 +0000 (16:52 +0000)
committerPasi Kallinen <paxed@alt.org>
Thu, 25 Feb 2010 16:52:25 +0000 (16:52 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@524 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgl-common.c
examples/dgamelaunch.conf

index 2ccb72363ba4905fa6b6aa860e5d12bb643596f3..67581e888bef0dace14fcc03a764c9d43175b6a5 100644 (file)
@@ -113,6 +113,7 @@ dgl_find_menu(char *menuname)
  * %n == user name (string; gotten from 'me', or from 'plrname' if 'me' is null)
  * %r == chroot (string)  (aka "dglroot" config var)
  * %g == game name
+ * %s == short game name
  */
 char *
 dgl_format_str(int game, struct dg_user *me, char *str, char *plrname)
@@ -148,6 +149,12 @@ dgl_format_str(int game, struct dg_user *me, char *str, char *plrname)
                while (*p != '\0')
                    p++;
                break;
+           case 's':
+               if (game >= 0 && game < num_games && myconfig[game]) snprintf (p, end + 1 - p, "%s", myconfig[game]->shortname);
+               else return NULL;
+               while (*p != '\0')
+                   p++;
+               break;
            case 'r':
                snprintf (p, end + 1 - p, "%s", globalconfig.dglroot);
                while (*p != '\0')
index 1bf44d16cacb946494a57447c158fdbd02e8f195..868e64416be356781eae1d2914af371bdbe14894 100644 (file)
@@ -105,6 +105,7 @@ lockfile = "/dgl-lock"
 #   %n = user nick, if user is logged in
 #   %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.
 #
 # eg. commands[login] = mkdir "foo", unlink "bar", setenv "Z" "foo"
 #