diff options
-rw-r--r-- | crawl-ref/source/hiscores.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/initfile.cc | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 8ebe79f1c6..da3061564c 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -418,6 +418,10 @@ static bool unlock_file_handle( FILE *handle ) FILE *hs_open( const char *mode, const std::string &scores ) { + // allow reading from standard input + if ( scores == "-" ) + return stdin; + FILE *handle = fopen(scores.c_str(), mode); #ifdef SHARED_FILES_CHMOD_PUBLIC chmod(scores.c_str(), SHARED_FILES_CHMOD_PUBLIC); @@ -442,7 +446,7 @@ void hs_close( FILE *handle, const char *mode, const std::string &scores ) { UNUSED( mode ); - if (handle == NULL) + if (handle == NULL || handle == stdin) return; #ifdef USE_FILE_LOCKING diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 2476147206..b476f5558c 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -2288,7 +2288,7 @@ bool parse_args( int argc, char **argv, bool rc_only ) bool next_is_param = false; if (next_arg != NULL) { - if (next_arg[0] != '-') + if (next_arg[0] != '-' || strlen(next_arg) == 1) next_is_param = true; } |