Read config from stdin if config is specified as '-'

This commit is contained in:
moparisthebest 2013-09-04 18:43:39 -04:00
parent ef03d60ba3
commit 1c4cc7bc2b
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ The command line options of
are as follows:
.Bl -tag -width Ds
.It Fl c Ar configfile
Path to the configuration file. The default is
Path to the configuration file, or - to read from stdin. The default is
.Pa $HOME/.imapfilter/config.lua .
.It Fl d Ar debugfile
File that contains debugging information about the full communication with the

View File

@ -78,7 +78,7 @@ start_lua()
"=<command line>") || lua_pcall(lua, 0, LUA_MULTRET, 0))
fatal(ERROR_CONFIG, "%s\n", lua_tostring(lua, -1));
} else {
if (luaL_loadfile(lua, opts.config))
if (luaL_loadfile(lua, strcmp(opts.config, "-") == 0 ? NULL : opts.config))
fatal(ERROR_CONFIG, "%s\n", lua_tostring(lua, -1));
lua_pushcfunction(lua, traceback_handler);
lua_insert(lua, 1);