Revision: 76547
          http://sourceforge.net/p/brlcad/code/76547
Author:   brlcad
Date:     2020-07-28 06:23:56 +0000 (Tue, 28 Jul 2020)
Log Message:
-----------
only make input binary, output asc in text mode (other tools handle both)

Modified Paths:
--------------
    brlcad/trunk/src/util/double-asc.c

Modified: brlcad/trunk/src/util/double-asc.c
===================================================================
--- brlcad/trunk/src/util/double-asc.c  2020-07-28 06:20:40 UTC (rev 76546)
+++ brlcad/trunk/src/util/double-asc.c  2020-07-28 06:23:56 UTC (rev 76547)
@@ -124,12 +124,13 @@
     switch (argc - bu_optind) {
        case 0:
            file_name = "stdin";
-           infd = 0;
+           infd = fileno(stdin);
+           setmode(fileno(stdin), O_BINARY);
            break;
        case 1:
            file_name = argv[bu_optind++];
            ifname = bu_file_realpath(file_name, NULL);
-           if ((infd = open(ifname, O_RDONLY)) == -1) {
+           if ((infd = open(ifname, O_RDONLY|O_BINARY)) == -1) {
                bu_free(ifname, "ifname alloc from bu_file_realpath");
                bu_exit (1, "Cannot open file '%s'\n", file_name);
            }
@@ -163,9 +164,6 @@
 
     bu_setprogname(argv[0]);
 
-    setmode(fileno(stdin), O_BINARY);
-    setmode(fileno(stdout), O_BINARY);
-
     bu_log("DEPRECATION WARNING:  This command is scheduled for removal.  
Please contact the developers if you use this command.\n\n");
     bu_snooze(BU_SEC2USEC(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