]>
Commit | Line | Data |
---|---|---|
fe4da5cc | 1 | /* |
2 | * $Id$ | |
3 | * | |
4 | * $Log$ | |
5 | * Revision 1.2 1997/02/04 17:34:49 mclareni | |
6 | * Merge Winnt and 97a versions | |
7 | * | |
8 | * Revision 1.1.1.1.2.1 1997/01/21 11:29:47 mclareni | |
9 | * All mods for Winnt 96a on winnt branch | |
10 | * | |
11 | * Revision 1.1.1.1 1996/02/15 17:49:28 mclareni | |
12 | * Kernlib | |
13 | * | |
14 | */ | |
15 | #include "kerngen/pilot.h" | |
16 | #include "kerngen/fortranc.h" | |
17 | ||
18 | /*> ROUTINE TMREAD | |
19 | CERN PROGLIB# TMREAD .VERSION KERNFOR 4.37 930715 | |
20 | ORIG. 20/07/90, JZ | |
21 | read the next line from stdin : | |
22 | CALL TMREAD (MAXCH, LINE, NCH, ISTAT) | |
23 | MAXCH maxim. # of characters into LINE | |
24 | NCH actual # of characters read into LINE | |
25 | ISTAT status return, zero : OK -ve : EoF | |
26 | */ | |
27 | #include <stdio.h> | |
28 | #if defined(CERNLIB_QMVAX) | |
29 | #include descrip | |
30 | #endif | |
31 | #if defined(CERNLIB_QX_SC) | |
32 | void type_of_call tmread_(alim, cols, anch, astat) | |
33 | #endif | |
34 | #if defined(CERNLIB_QXNO_SC) | |
35 | void type_of_call tmread(alim, cols, anch, astat) | |
36 | #endif | |
37 | #if defined(CERNLIB_QXCAPT) | |
38 | void type_of_call TMREAD(alim, cols, anch, astat) | |
39 | #endif | |
40 | #if defined(CERNLIB_QMVAX) | |
41 | struct dsc$descriptor_s *cols; | |
42 | #endif | |
43 | #if !defined(CERNLIB_QMVAX) | |
44 | char *cols; | |
45 | #endif | |
46 | int *alim, *anch, *astat; | |
47 | { | |
48 | char *ubuf; | |
49 | int ch, jcol, lim; | |
50 | ||
51 | #if defined(CERNLIB_QMVAX) | |
52 | ubuf = cols->dsc$a_pointer; | |
53 | #endif | |
54 | #if !defined(CERNLIB_QMVAX) | |
55 | ubuf = cols; | |
56 | #endif | |
57 | ||
58 | /*-- read the text */ | |
59 | lim = *alim; | |
60 | jcol = 0; | |
61 | while (lim-- > 0) | |
62 | { ch = getchar(); | |
63 | if (ch == EOF) goto endf; | |
64 | if (ch == '\n') goto endl; | |
65 | *ubuf++ = ch; | |
66 | jcol = jcol + 1; | |
67 | } | |
68 | /* discard excess characters */ | |
69 | loop: ch = getchar(); | |
70 | if (ch == '\n') goto endl; | |
71 | if (ch != EOF) goto loop; | |
72 | ||
73 | endf: *anch = jcol; | |
74 | *astat = -1; | |
75 | clearerr(stdin); | |
76 | return; | |
77 | ||
78 | endl: *anch = jcol; | |
79 | *astat = 0; | |
80 | return; | |
81 | } | |
82 | /*> END <----------------------------------------------------------*/ |