[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netatalk
Subject:    Re: [netatalk-admins] CR/LF translation
From:       Andras Kadinger <bandit () freeside ! elte ! hu>
Date:       1998-04-16 23:03:22
[Download RAW message or body]

I wonder, what would happen, if instead changing all CR-s to LF-s in one
direction, and changing all LF-s to CR-s in the other, we would exchange
CR-s with LF-s in both directions; this way, even with a translated
file, You get the correct and unaltered binary contents back if You read
it on a Mac.

An actual translate-on-disk subroutine for the case the TYPE later gets
changed from TEXT to something else might also be considered - this way,
even the not so 'clever' MS Word* would work with translation on.

What we would lose is having mixed end-of-line files appear nicely as
LF-only on the unix side, and get back CR-only to the Mac side.

In fact, I thought netatalk was swapping CR-s and LF-s, and I only
recently checked the source to see it behaves differently.

* - [For the ones who doesn't know this yet.] MS Word types it's files a
TEXT first, the writes the contents, and subsequently changes the file
type to the real one; using the old netatalk CR/LF translation the file
would be irrevokably corrupted; with the new one, netatalk would only
have to translate it again to recover the original contents.

Sincerely,
Andras Kadinger
bandit@freeside.elte.hu

PS: I made up a patch which should change the behaviour to the one I
prefer.
The changes are obvious, but I did not actually test this. If people
would try it out and find it beneficial, Adrian could include it in his
next patch set.

Here it is:

--- etc/afpd/Makefile.orig      Fri Apr 17 00:53:13 1998
+++ etc/afpd/Makefile   Fri Apr 17 00:54:23 1998
@@ -14,7 +14,7 @@
 INCPATH=       -I../../include ${AFSINCPATH} ${KRBINCPATH}
${DESINCPATH} \
        ${PAMINCPATH}
 CFLAGS=        ${DEFS} ${AFSDEFS} ${KRBDEFS} ${DESDEFS} ${OPTOPTS}
${INCPATH} \
-       ${PAMDEFS} -DAPPLCNAME -DCRLF # -DDOWNCASE
+       ${PAMDEFS} -DAPPLCNAME -DCRLF -DCRLFTWOWAY # -DDOWNCASE
 LIBS = -latalk ${AFSLIBS} ${KRBLIBS} ${DESLIBS} ${ADDLIBS} ${AFPLIBS} \
        ${TCPWRAPLIBS} ${PAMLIBS}
 LIBDIRS=       -L../../libatalk ${AFSLIBDIRS} ${KRBLIBDIRS} \
--- etc/afpd/fork.c.orig        Fri Apr 17 00:27:27 1998
+++ etc/afpd/fork.c     Fri Apr 17 00:55:17 1998
@@ -471,6 +471,11 @@
            if ( *p == '\012' ) {
                *p = '\015';
            }
+#ifdef CRLFTWOWAY
+           else if ( *p == '\015' ) {
+               *p = '\012';
+           }
+#endif
        }
     }
 #endif CRLF
@@ -743,6 +748,11 @@
            if ( *p == '\015' ) {
                *p = '\012';
            }
+#ifdef CRLFTWOWAY
+           else if ( *p == '\012' ) {
+               *p = '\015';
+           }
+#endif
        }
     }
 #endif CRLF

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic