Allow defining several game_args with one definition:
game_args = "goo", "bar", .. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@396 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
4f95c35047
commit
9ebb30b417
50
config.y
50
config.y
|
@ -229,7 +229,6 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
game_definition : TYPE_CMDQUEUE
|
game_definition : TYPE_CMDQUEUE
|
||||||
{
|
{
|
||||||
if (myconfig[ncnf]->cmdqueue) {
|
if (myconfig[ncnf]->cmdqueue) {
|
||||||
|
@ -242,6 +241,10 @@ game_definition : TYPE_CMDQUEUE
|
||||||
{
|
{
|
||||||
myconfig[ncnf]->cmdqueue = curr_cmdqueue;
|
myconfig[ncnf]->cmdqueue = curr_cmdqueue;
|
||||||
}
|
}
|
||||||
|
| TYPE_GAME_ARGS '=' game_args_list
|
||||||
|
{
|
||||||
|
/* nothing */
|
||||||
|
}
|
||||||
| KeyType '=' TYPE_VALUE
|
| KeyType '=' TYPE_VALUE
|
||||||
{
|
{
|
||||||
switch ( $1 ) {
|
switch ( $1 ) {
|
||||||
|
@ -280,24 +283,6 @@ game_definition : TYPE_CMDQUEUE
|
||||||
myconfig[ncnf]->inprogressdir = strdup($3);
|
myconfig[ncnf]->inprogressdir = strdup($3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_GAME_ARGS:
|
|
||||||
{
|
|
||||||
char **tmpargs;
|
|
||||||
if (myconfig[ncnf]->bin_args) {
|
|
||||||
myconfig[ncnf]->num_args++;
|
|
||||||
tmpargs = calloc((myconfig[ncnf]->num_args+1), sizeof(char *));
|
|
||||||
memcpy(tmpargs, myconfig[ncnf]->bin_args, (myconfig[ncnf]->num_args * sizeof(char *)));
|
|
||||||
free(myconfig[ncnf]->bin_args);
|
|
||||||
myconfig[ncnf]->bin_args = tmpargs;
|
|
||||||
} else {
|
|
||||||
myconfig[ncnf]->num_args = 1;
|
|
||||||
myconfig[ncnf]->bin_args = calloc(2, sizeof(char *));
|
|
||||||
}
|
|
||||||
myconfig[ncnf]->bin_args[(myconfig[ncnf]->num_args)-1] = strdup($3);
|
|
||||||
myconfig[ncnf]->bin_args[(myconfig[ncnf]->num_args)] = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s:%d: token does not belong into game definition, bailing out\n",
|
fprintf(stderr, "%s:%d: token does not belong into game definition, bailing out\n",
|
||||||
config, line);
|
config, line);
|
||||||
|
@ -306,8 +291,30 @@ game_definition : TYPE_CMDQUEUE
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
game_definitions : game_definitions game_definition
|
game_arg : TYPE_VALUE
|
||||||
| game_definition
|
{
|
||||||
|
char **tmpargs;
|
||||||
|
if (myconfig[ncnf]->bin_args) {
|
||||||
|
myconfig[ncnf]->num_args++;
|
||||||
|
tmpargs = calloc((myconfig[ncnf]->num_args+1), sizeof(char *));
|
||||||
|
memcpy(tmpargs, myconfig[ncnf]->bin_args, (myconfig[ncnf]->num_args * sizeof(char *)));
|
||||||
|
free(myconfig[ncnf]->bin_args);
|
||||||
|
myconfig[ncnf]->bin_args = tmpargs;
|
||||||
|
} else {
|
||||||
|
myconfig[ncnf]->num_args = 1;
|
||||||
|
myconfig[ncnf]->bin_args = calloc(2, sizeof(char *));
|
||||||
|
}
|
||||||
|
myconfig[ncnf]->bin_args[(myconfig[ncnf]->num_args)-1] = strdup($1);
|
||||||
|
myconfig[ncnf]->bin_args[(myconfig[ncnf]->num_args)] = 0;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
game_args_list : game_arg
|
||||||
|
| game_arg ',' game_args_list
|
||||||
|
;
|
||||||
|
|
||||||
|
game_definitions : game_definition
|
||||||
|
| game_definition game_definitions
|
||||||
;
|
;
|
||||||
|
|
||||||
definegame : TYPE_DEFINE_GAME '{'
|
definegame : TYPE_DEFINE_GAME '{'
|
||||||
|
@ -388,7 +395,6 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; }
|
||||||
| TYPE_PATH_PASSWD { $$ = TYPE_PATH_PASSWD; }
|
| TYPE_PATH_PASSWD { $$ = TYPE_PATH_PASSWD; }
|
||||||
| TYPE_PATH_LOCKFILE { $$ = TYPE_PATH_LOCKFILE; }
|
| TYPE_PATH_LOCKFILE { $$ = TYPE_PATH_LOCKFILE; }
|
||||||
| TYPE_PATH_INPROGRESS { $$ = TYPE_PATH_INPROGRESS; }
|
| TYPE_PATH_INPROGRESS { $$ = TYPE_PATH_INPROGRESS; }
|
||||||
| TYPE_GAME_ARGS { $$ = TYPE_GAME_ARGS; }
|
|
||||||
| TYPE_RC_FMT { $$ = TYPE_RC_FMT; }
|
| TYPE_RC_FMT { $$ = TYPE_RC_FMT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -95,11 +95,11 @@ game_name = "NetHack stub"
|
||||||
short_name = "NHstb"
|
short_name = "NHstb"
|
||||||
|
|
||||||
# arguments for when we exec the binary
|
# arguments for when we exec the binary
|
||||||
game_args = "/bin/nethackstub"
|
game_args = "/bin/nethackstub",
|
||||||
game_args = "foo"
|
"foo",
|
||||||
game_args = "user:%n"
|
"user:%n",
|
||||||
game_args = "shed_uid:%u"
|
"shed_uid:%u",
|
||||||
game_args = "bar"
|
"bar"
|
||||||
|
|
||||||
# From inside the jail, where dgamelaunch should put mail - should match up with
|
# From inside the jail, where dgamelaunch should put mail - should match up with
|
||||||
# NetHack settings.
|
# NetHack settings.
|
||||||
|
@ -130,9 +130,7 @@ game_path = "/bin/nethack"
|
||||||
game_name = "NetHack 3.4.3"
|
game_name = "NetHack 3.4.3"
|
||||||
short_name = "NH343"
|
short_name = "NH343"
|
||||||
|
|
||||||
game_args = "/bin/nethack"
|
game_args = "/bin/nethack", "-u", "%n"
|
||||||
game_args = "-u"
|
|
||||||
game_args = "%n"
|
|
||||||
|
|
||||||
spooldir = "/var/mail/"
|
spooldir = "/var/mail/"
|
||||||
rc_template = "/dgl-default-rcfile"
|
rc_template = "/dgl-default-rcfile"
|
||||||
|
@ -166,17 +164,12 @@ game_name = "Crawl Stone Soup 0.1.7"
|
||||||
short_name = "Cr017"
|
short_name = "Cr017"
|
||||||
|
|
||||||
|
|
||||||
game_args = "/bin/crawlss017"
|
game_args = "/bin/crawlss017",
|
||||||
game_args = "-name"
|
"-name", "%n",
|
||||||
game_args = "%n"
|
"-dir", "/crawlss017/",
|
||||||
game_args = "-dir"
|
"-rc", "%rrcfiles/%n.crawlrc",
|
||||||
game_args = "/crawlss017/"
|
"-morgue", "/crawlss017/morgues/",
|
||||||
game_args = "-rc"
|
"-macro", "/crawlss017/macros/%n.macro"
|
||||||
game_args = "%rrcfiles/%n.crawlrc"
|
|
||||||
game_args = "-morgue"
|
|
||||||
game_args = "/crawlss017/morgues/"
|
|
||||||
game_args = "-macro"
|
|
||||||
game_args = "/crawlss017/macros/%n.macro"
|
|
||||||
|
|
||||||
|
|
||||||
rc_template = "/dgl-default-rcfile.crawl"
|
rc_template = "/dgl-default-rcfile.crawl"
|
||||||
|
@ -197,17 +190,12 @@ game_name = "Crawl Stone Soup 0.2.0"
|
||||||
short_name = "Cr020"
|
short_name = "Cr020"
|
||||||
|
|
||||||
|
|
||||||
game_args = "/bin/crawlss020"
|
game_args = "/bin/crawlss020",
|
||||||
game_args = "-name"
|
"-name", "%n",
|
||||||
game_args = "%n"
|
"-dir", "/crawlss020/",
|
||||||
game_args = "-dir"
|
"-rc", "/crawlss020/plr/%n/%n.crawlrc",
|
||||||
game_args = "/crawlss020/"
|
"-morgue", "/crawlss020/plr/%n/",
|
||||||
game_args = "-rc"
|
"-macro", "/crawlss020/plr/%n/"
|
||||||
game_args = "/crawlss020/plr/%n/%n.crawlrc"
|
|
||||||
game_args = "-morgue"
|
|
||||||
game_args = "/crawlss020/plr/%n/"
|
|
||||||
game_args = "-macro"
|
|
||||||
game_args = "/crawlss020/plr/%n/"
|
|
||||||
|
|
||||||
rc_template = "/dgl-default-rcfile.crawl"
|
rc_template = "/dgl-default-rcfile.crawl"
|
||||||
rc_fmt = "/crawlss020/plr/%n/%n.crawlrc"
|
rc_fmt = "/crawlss020/plr/%n/%n.crawlrc"
|
||||||
|
|
Loading…
Reference in New Issue