Revision: 77479
          http://sourceforge.net/p/brlcad/code/77479
Author:   brlcad
Date:     2020-10-18 08:02:36 +0000 (Sun, 18 Oct 2020)
Log Message:
-----------
add special case handling of '-' as representing standard input for 
bu_file_same() and bu_file_exits() but not for all the other lower-lever file 
handling functions.

Modified Paths:
--------------
    brlcad/trunk/src/libbu/file.c

Modified: brlcad/trunk/src/libbu/file.c
===================================================================
--- brlcad/trunk/src/libbu/file.c       2020-10-18 07:54:36 UTC (rev 77478)
+++ brlcad/trunk/src/libbu/file.c       2020-10-18 08:02:36 UTC (rev 77479)
@@ -73,6 +73,17 @@
        return 0;
     }
 
+    /* stdin is special case */
+    if (BU_STR_EQUAL(path, "-")) {
+       if (fd) {
+           *fd = fileno(stdin);
+       }
+       if (UNLIKELY(bu_debug & BU_DEBUG_PATHS)) {
+           bu_log("YES\n");
+       }
+       return 1;
+    }
+
     /* capture file descriptor if requested */
     if (fd) {
        *fd = open(path, O_RDONLY);
@@ -191,7 +202,7 @@
     }
 
     /* stdin is a special case */
-    if (BU_STR_EQUAL(rp1, rp2) && BU_STR_EQUAL(rp1, "-"))
+    if (BU_STR_EQUAL(rp1, rp2) && BU_STR_EQUAL(rp1, "-")) {
        return 1;
     }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to