Utilities/CR_LF_Conversion [ Functions ]
FUNCTION
Fix CR/LF problems.
If ROBODoc reads a text file that was created on another OS line-endings might not be what ROBODoc expects of the current OS. This function tries to detect and fix this.
INPUTS
- line -- a line of text
RETURN VALUE
- number of characters that were removed.
SOURCE
static int CR_LF_Conversion( char *line ) { int n = strlen( line ); if ( ( n > 1 ) && ( ( ( line[n - 2] == '\r' ) && ( line[n - 1] == '\n' ) ) || ( ( line[n - 2] == '\n' ) && ( line[n - 1] == '\r' ) ) ) ) { line[n - 2] = '\n'; line[n - 1] = '\0'; return 1; } else { /* No problem */ return 0; } }