]> git.sur5r.net Git - openldap/commitdiff
Import CR/LF changes from HEAD
authorKurt Zeilenga <kurt@openldap.org>
Thu, 27 Sep 2001 23:55:19 +0000 (23:55 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 27 Sep 2001 23:55:19 +0000 (23:55 +0000)
clients/tools/ldapmodify.c
libraries/libldif/line64.c

index a43d1011aecf3f01b83d8e3bda2f357e33dc3b67..32fc387df301eea6fc9ac4a33009c9834a73ed6a 100644 (file)
@@ -1152,7 +1152,7 @@ read_one_record( FILE *fp )
     while ( fgets( line, sizeof(line), fp ) != NULL ) {
        int len = strlen( line );
 
-               if( len < 2 ) {
+               if( len < 2 || ( len == 3 && *line == '\r' )) {
                        if( buf == NULL ) {
                                continue;
                        } else {
index 947d35a616768dce83bfc28a8fc0bbb98ab3121f..626dc6f556f542ff006d7c00dcf07486dd21e0bf 100644 (file)
@@ -24,7 +24,7 @@ int ldif_debug = 0;
 
 #define RIGHT2                 0x03
 #define RIGHT4                 0x0f
-#define CONTINUED_LINE_MARKER  '\001'
+#define CONTINUED_LINE_MARKER  '\r'
 
 #ifdef CSRIMALLOC
 #define ber_memalloc malloc
@@ -274,15 +274,22 @@ ldif_getline( char **next )
                line = *next;
 
                while ( (*next = strchr( *next, '\n' )) != NULL ) {
-                       unsigned char c = *(*next + 1);
+#if CONTINUED_LINE_MARKER != '\r'
+                       if ( (*next)[-1] == '\r' ) {
+                               (*next)[-1] = CONTINUED_LINE_MARKER;
+                       }
+#endif
 
-                       if ( !isspace( c ) || c == '\n' ) {
+                       if ( (*next)[1] != ' ' ) {
+                               if ( (*next)[1] == '\r' && (*next)[2] == '\n' ) {
+                                       *(*next)++ = '\0';
+                               }
                                *(*next)++ = '\0';
                                break;
                        }
 
                        **next = CONTINUED_LINE_MARKER;
-                       *(*next+1) = CONTINUED_LINE_MARKER;
+                       (*next)[1] = CONTINUED_LINE_MARKER;
                        (*next)++;
                }
        } while( *line == '#' );