OSDN Git Service

MPWで'\r'と'\n'が逆転しているのを元に戻すコードで、#ifdef MPW とするのをやめて、
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 27 Oct 2003 18:37:51 +0000 (18:37 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 27 Oct 2003 18:37:51 +0000 (18:37 +0000)
#if ('\r' == 0x0a && '\n' == 0x0d)
とした。-noMapCRが付いていても付いていなくても対応できる。

src/report.c

index 6950d18..78b209c 100644 (file)
@@ -123,12 +123,23 @@ static int buf_sprintf(BUF *buf, const char *fmt, ...)
 
        if(!tmpbuf) return -1;
 
-#ifdef MAC_MPW
+#if ('\r' == 0x0a && '\n' == 0x0d)
        {
-               /* '\n' is 0x0D and '\r' is 0x0A in MPW. Swap back these. */
+               /*
+                * Originally '\r'= CR (= 0x0d) and '\n'= LF (= 0x0a)
+                * But for MPW (Macintosh Programers Workbench), these
+                * are reversed so that '\r'=LF and '\n'=CR unless the
+                * -noMapCR option is not defined.
+                *
+                * We need to swap back these here since the score
+                * dump text should be written using LF as the end of
+                * line.
+                */
                char *ptr;
                for (ptr = tmpbuf; *ptr; ptr++)
-                       if ('\n' == *ptr) *ptr = '\r';
+               {
+                       if (0x0d == *ptr) *ptr = 0x0a;
+               }
        }
 #endif