Skip to content

Commit

Permalink
Add short game name (%s) for string substitutions. From Marc H. Thoben
Browse files Browse the repository at this point in the history
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@524 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
  • Loading branch information
paxed committed Feb 25, 2010
1 parent 11eef77 commit cd69271
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dgl-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions examples/dgamelaunch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#
Expand Down

0 comments on commit cd69271

Please sign in to comment.