1 
2 #include <unistd.h>
3 #include <stdio.h>
4 #include <math.h>
5 #include <stdlib.h>
6 #include <pthread.h>
7 #include "CalculiX.h"
8 /* ---------------------------------------------------------------- */
9 /* ---------------------------------------------------------------- */
10 
11 
12 
13 #include "readfrd.h"
14 
15 
16 /* liest einen Record bis '\n'; uebergibt Anzahl gelesene Zeichen */
frecord(FILE * handle1,char * string)17 int frecord( FILE *handle1,  char *string)
18 {
19   register int i, n, c;
20 
21   for (i=0; i<MAX_LINE_LENGTH-1; i++)
22   {
23     string[i] = getc(handle1);
24     if (string[i] == '\n')
25       {
26       for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = '\0';
27       return(i);
28       }
29     if (string[i] == '\r')
30       {
31       c = getc(handle1);
32       if (c != '\n')
33         ungetc(c, handle1);
34 
35       for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = '\0';
36       return(i);
37      }
38     else if (string[i] == (char)EOF)
39       {
40       for (n=i+1; n<MAX_LINE_LENGTH; ++n) string[n] = '\0';
41       return(i);
42       }
43   }
44   string[MAX_LINE_LENGTH-1] = '\0';
45   return(MAX_LINE_LENGTH-1);
46 }
47 
48 
49