Martin Schulte <dtaus@ratinganwendung.de>: Corrected handling for
authorJoey Schulze <joey@infodrom.org>
Wed, 4 Aug 2004 17:01:42 +0000 (17:01 +0000)
committerJoey Schulze <joey@infodrom.org>
Wed, 4 Aug 2004 17:01:42 +0000 (17:01 +0000)
stdin/stdout ("-") in the main program

main.c

diff --git a/main.c b/main.c
index 1cb9502..7f4a9d1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -89,15 +89,21 @@ int main (int argc, char **argv)
   }
 
   if (action == DTAUS) {
-    if (!stat((char *)control, &sbuf)) {
-      if (control2dtaus ((char *)control, (char *)dtaus, (char *)beleg, (char *)check) == 0)
+    if (!strcmp("-", control) || !stat(control, &sbuf)) {
+      if (control2dtaus (control, dtaus, beleg, check) == 0)
        exit (1);
     }
-    else exit (1);
+    else {
+      fprintf( stderr, "Can't stat %s\n", control);
+      exit (1);
+    }
   } else if (action == CONTROL) {
-    if (!stat((char *)dtaus, &sbuf))
-      dtaus2control ((char *)dtaus, (char *)control);
-    else exit (1);
+    if (!strcmp("-",dtaus) || !stat(dtaus, &sbuf))
+      dtaus2control (dtaus, control);
+    else {
+      fprintf( stderr, "Can't stat %s\n", dtaus);
+      exit (1);
+    }
   } else {
     printf ("Keine Routine angegeben (-dtaus bzw. -control vergessen).\n");
     exit (1);