[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#74862: tetex-bin: makeindex does not like DOS line-endings



On 07.05.04 Florent Rougon (f.rougon@free.fr) wrote:
> Frank Küster <frank@debian.org> wrote:

Hi *,

> > Then what is the right name in C files? Lines like this:
> >
> > (c != TAB) && (c != LFD) && (c != EOF))
> >
> > should probably be
> >
> > (c != TAB) && (c != LFD) && (c != "carriage return") && (c != EOF))
> 
> Well, it is 13. Or 0x0d. Or '\r'. TAB and LFD are not standard C macros,
> either. They are defined in texk/makeindexk/mkind.h:
> 
>   #define TAB '\t'
>   #define LFD '\n'
> 
> So, for consistency, you should perhaps go for this:
> 
>   #define CRN '\r'
> 
> although I've never seen CRN written for Carriage Return. CR and LF
> are very common, but Carriage Return in 3 letters, I don't know...
> 
This is a stupid implementation of the ideas given. I've checked with
ist-files with ^M (pure and mixture [some lines has ^M, some not])
and ist-files with pure UNIX-enter signs. makeindex works and LaTeX
runs smoothly. I didn't check if the dvi-file still remains the same,
however the size didn't change and a strings command over both
dvi-files differs only in the time stamp.

H. 
-- 
sigmentation fault
diff -urN makeindexk.orig/mkind.h makeindexk/mkind.h
--- makeindexk.orig/mkind.h	Wed Oct  2 14:35:05 2002
+++ makeindexk/mkind.h	Sat May  8 12:17:28 2004
@@ -208,6 +208,7 @@
 
 #define TAB '\t'
 #define LFD '\n'
+#define CRN '\r'
 #define SPC ' '
 #define LSQ '['
 #define RSQ ']'
diff -urN makeindexk.orig/scanst.c makeindexk/scanst.c
--- makeindexk.orig/scanst.c	Sat Jan 24 13:11:26 1998
+++ makeindexk/scanst.c	Sat May  8 12:23:07 2004
@@ -294,7 +294,7 @@
 
     spec[0] = TOLOWER(c);
     while ((i++ < STRING_MAX) && ((c = GET_CHAR(sty_fp)) != SPC) &&
-	   (c != TAB) && (c != LFD) && (c != EOF))
+	   (c != TAB) && (c != LFD) && (c != CRN) && (c != EOF))
 	spec[i] = TOLOWER(c);
     if (i < STRING_MAX) {
 	spec[i] = NUL;
@@ -304,7 +304,7 @@
 		      spec);
 	    return (-1);
 	}
-	if (c == LFD)
+	if ((c == LFD) || (c == CRN))
 	    sty_lc++;
 	return (TRUE);
     } else {
@@ -327,6 +327,8 @@
 
 	case LFD:
 	    sty_lc++;
+	case CRN:
+	    sty_lc++;
 	case SPC:
 	case TAB:
 	    break;
@@ -369,6 +371,9 @@
 		case 'n':
 		    clone[i++] = LFD;
 		    break;
+		case 'r':
+		    clone[i++] = CRN;
+		    break;
 
 		default:
 		    clone[i++] = (char) c;
@@ -376,7 +381,7 @@
 		}
 		break;
 	    default:
-		if (c == LFD)
+		if ((c == LFD) || (c == CRN))
 		    sty_lc++;
 		if (i < ARRAY_MAX)
 		    clone[i++] = (char) c;
@@ -421,6 +426,8 @@
 	    return (FALSE);
 	case LFD:
 	    sty_lc++;
+	case CRN:
+	    sty_lc++;
 	case EOF:
 	    STY_ERROR("No character (premature EOF).\n", "");
 	    return (FALSE);
@@ -460,7 +467,7 @@
     int     n = 0;
 
     while (str[i] != NUL) {
-	if (str[i] == LFD)
+	if ((str[i] == LFD) || (str[i] == CRN))
 	    n++;
 	i++;
     }

Reply to: