summaryrefslogtreecommitdiffstats
path: root/tksao/fitsy++/alloc.C
diff options
context:
space:
mode:
Diffstat (limited to 'tksao/fitsy++/alloc.C')
-rw-r--r--tksao/fitsy++/alloc.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/tksao/fitsy++/alloc.C b/tksao/fitsy++/alloc.C
new file mode 100644
index 0000000..f7dde77
--- /dev/null
+++ b/tksao/fitsy++/alloc.C
@@ -0,0 +1,25 @@
+// Copyright (C) 1999-2016
+// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
+// For conditions of distribution and use, see copyright notice in "copyright"
+
+#include <stdio.h>
+#include "alloc.h"
+
+FitsAlloc::FitsAlloc(const char* fn)
+{
+ parse(fn);
+ if (!valid_)
+ return;
+
+ // we need the 'b' for windows...
+ if (!strncmp(pName_, "stdin", 5) ||
+ !strncmp(pName_, "STDIN", 5) ||
+ !strncmp(pName_, "-", 1))
+ stream_ = fdopen(dup(fileno(stdin)), "rb");
+ else
+ stream_ = fopen(pName_, "rb");
+
+ valid_ = stream_ ? 1 : 0;
+}
+
+