From b42d170041d08fc8a67d6807c306058f81fc2287 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 9 Oct 2011 19:09:43 +0000 Subject: [PATCH] Add configurable default filemode. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@617 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- config.l | 1 + config.y | 8 +++++++- examples/dgamelaunch.conf | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.l b/config.l index 8e517da..3820643 100644 --- a/config.l +++ b/config.l @@ -95,6 +95,7 @@ postcommands { return TYPE_POSTCMDQUEUE; } encoding { return TYPE_ENCODING; } locale { return TYPE_LOCALE; } utf8esc { return TYPE_UTF8ESC; } +filemode { return TYPE_FILEMODE; } yes { yylval.i = 1; return TYPE_BOOL; } no { yylval.i = 0; return TYPE_BOOL; } dglstart { yylval.i = DGLTIME_DGLSTART; return TYPE_CMDQUEUENAME; } diff --git a/config.y b/config.y index 07ed0ec..0216abe 100644 --- a/config.y +++ b/config.y @@ -59,7 +59,7 @@ static int sortmode_number(const char *sortmode_name) { %token TYPE_CMDQUEUE TYPE_DEFINE_MENU TYPE_BANNER_FILE TYPE_CURSOR %token TYPE_POSTCMDQUEUE %token TYPE_MAX_IDLE_TIME TYPE_MENU_MAX_IDLE_TIME TYPE_EXTRA_INFO_FILE -%token TYPE_ENCODING TYPE_LOCALE TYPE_UTF8ESC +%token TYPE_ENCODING TYPE_LOCALE TYPE_UTF8ESC TYPE_FILEMODE %token TYPE_VALUE %token TYPE_NUMBER TYPE_CMDQUEUENAME %type KeyType @@ -206,6 +206,10 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']' globalconfig.locale = strdup($3); break; + case TYPE_FILEMODE: + default_fmode = strtoul($3, NULL, 8); + break; + default: fprintf(stderr, "%s:%d: token %s does not take a string, bailing out\n", config, line, lookup_token($1)); @@ -640,6 +644,7 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; } | TYPE_UTF8ESC { $$ = TYPE_UTF8ESC; } | TYPE_RC_FMT { $$ = TYPE_RC_FMT; } | TYPE_WATCH_SORTMODE { $$ = TYPE_WATCH_SORTMODE; } + | TYPE_FILEMODE { $$ = TYPE_FILEMODE; } ; %% @@ -674,6 +679,7 @@ const char* lookup_token (int t) case TYPE_BANNERVARS: return "bannervars"; case TYPE_LOCALE: return "locale"; case TYPE_UTF8ESC: return "utf8esc"; + case TYPE_FILEMODE: return "filemode"; default: abort(); } } diff --git a/examples/dgamelaunch.conf b/examples/dgamelaunch.conf index a5f92c0..41f860d 100644 --- a/examples/dgamelaunch.conf +++ b/examples/dgamelaunch.conf @@ -155,6 +155,9 @@ commands[login] = mkdir "%ruserdata/%n", mkdir "%ruserdata/%n/dumplog", mkdir "%ruserdata/%n/ttyrec" +# file mode for when commands copy files. +# readable and writable by all. you could use eg. "0644" to be more secure. +filemode = "0666"