On Mon, Nov 04, 2002 at 01:26:36PM +0100, Alexander Gottwald wrote:
>On Sun, 3 Nov 2002, Christopher Faylor wrote:
>
>> It didn't sound like the xkbcomp problem would be solved by linking with
>> automode.o.  Since that was reading a binary file, it would need to be
>> linked with binmode.o.
>
>xkbcomp is reading some textfiles and writes a binary file.

I thought your patch only added a "b" to reads and writes which would
indicate that it needed to operate entirely in "binmode".  However, I
see that in some cases, it doesn't add the "b".  Not sure why.

This seems to be the opposite of what you're implying though.

cgf

Index: programs/Xserver/xkb/ddxLoad.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/xkb/ddxLoad.c,v
retrieving revision 3.30
diff -u -r3.30 ddxLoad.c
--- programs/Xserver/xkb/ddxLoad.c      2002/05/31 18:46:06     3.30
+++ programs/Xserver/xkb/ddxLoad.c      2002/11/03 12:29:17
@@ -413,7 +413,7 @@
        else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
            sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
        if (buf[0] != '\0')
-           file= fopen(buf,"r");
+           file= fopen(buf,"rb");
        else file= NULL;
     }
     else file= NULL;
Index: programs/xkbcomp/xkbcomp.c
===================================================================
RCS file: /cvs/xc/programs/xkbcomp/xkbcomp.c,v
retrieving revision 3.17
diff -u -r3.17 xkbcomp.c
--- programs/xkbcomp/xkbcomp.c  2002/06/05 00:00:37     3.17
+++ programs/xkbcomp/xkbcomp.c  2002/11/03 14:57:04
@@ -873,16 +873,30 @@
                 * -- Branden Robinson
                 */
                int outputFileFd;
+        int binMode = 0;
+        const char *openMode = "w";
                unlink(outputFile);
+#ifdef O_BINARY
+        switch (outputFormat) {
+            case WANT_XKM_FILE:
+                binMode = O_BINARY;
+                openMode = "wb";
+                break;
+            default:
+                binMode = 0;
+                break;
+        }
+#endif
                outputFileFd= open(outputFile, O_WRONLY|O_CREAT|O_EXCL,
-                           S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+                           S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH|binMode);
                if (outputFileFd<0) {
                    ERROR1("Cannot open \"%s\" to write keyboard description\n",
                                                                outputFile);
                    ACTION("Exiting\n");
                    exit(1);
                }
-               out= fdopen(outputFileFd, "w");
+        
+               out= fdopen(outputFileFd, openMode);
                /* end BR */
                if (out==NULL) {
                    ERROR1("Cannot open \"%s\" to write keyboard description\n",

Reply via email to