summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/hiscores.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-17 09:48:33 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-17 09:48:33 +0000
commit9dd7a1b6250fea48dfc8901afabf7845a3487eff (patch)
tree2d35306b7e669db4660a06bc522241f858f18036 /crawl-ref/source/hiscores.cc
parentc960be760562d28f6e69d1d6e3abbf2869b7db28 (diff)
downloadcrawl-ref-9dd7a1b6250fea48dfc8901afabf7845a3487eff.tar.gz
crawl-ref-9dd7a1b6250fea48dfc8901afabf7845a3487eff.zip
Let scorefile be '-' for reading from standard input, following
Shawn Moore's request in 1617269. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@648 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/hiscores.cc')
-rw-r--r--crawl-ref/source/hiscores.cc6
1 files changed, 5 insertions, 1 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