]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MINICERN/packlib/kernlib/kerngen/ccgenci/cigetw.c
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgenci / cigetw.c
1 /*
2  * $Id$
3  *
4  * $Log$
5  * Revision 1.4  1997/09/02 14:26:50  mclareni
6  * WINNT correction
7  *
8  * Revision 1.3  1997/02/04 17:35:17  mclareni
9  * Merge Winnt and 97a versions
10  *
11  * Revision 1.2  1997/01/15 16:25:44  cernlib
12  * fix from F.Hemmer to return rfio return code
13  *
14  * Revision 1.1.1.1.2.1  1997/01/21 11:30:17  mclareni
15  * All mods for Winnt 96a on winnt branch
16  *
17  * Revision 1.1.1.1  1996/02/15 17:49:37  mclareni
18  * Kernlib
19  *
20  */
21 #include "kerngen/pilot.h"
22 #include "kerngen/fortranc.h"
23
24 /*>    ROUTINE CIGETW
25   CERN PROGLIB# Z311    CIGETW          .VERSION KERNFOR  4.31  911111
26   ORIG. 12/10/91, JZ
27       CALL CIGETW (LUNDES, MBUF, NWDO, NWDONE, ISTAT)
28       read from the file :
29        LUNDES  file descriptor
30       *MBUF    vector to be read into
31        NWDO    number of full words to be read
32       *NWDONE  number of full words actually read
33       *ISTAT   status, =zero if success
34 */
35 #include "kerngen/cf_reaw.h"
36 #ifndef WIN32
37 #  include <errno.h>
38 #else
39 #  include <stdlib.h>
40 #endif
41 #include "kerngen/cf_xaft.h"
42 #include "kerngen/wordsizc.h"
43 #if defined(CERNLIB_QX_SC)
44 void type_of_call cigetw_(lundes, mbuf, nwdo, nwdone, stat)
45 #endif
46 #if defined(CERNLIB_QXNO_SC)
47 void type_of_call cigetw(lundes, mbuf, nwdo, nwdone, stat)
48 #endif
49 #if defined(CERNLIB_QXCAPT)
50 void type_of_call CIGETW(lundes, mbuf, nwdo, nwdone, stat)
51 #endif
52       int  *mbuf;
53       int  *lundes, *nwdo, *nwdone, *stat;
54 {
55       int  fildes;
56       int  nbdn, nbxq;
57
58       *stat = 0;
59       if (*nwdo <= 0)            return;
60
61 /*        read the file      */
62
63       fildes = *lundes;
64       nbxq   = *nwdo * NBYTPW;
65       nbdn   = read (fildes, mbuf, nbxq);
66       if (nbdn == 0)               goto heof;
67       if (nbdn <  0)               goto herror;
68       *nwdone = nbdn / NBYTPW;
69       return;
70
71 /*        Handle exceptions        */
72
73 heof:     *stat = -1;
74           return;
75
76 #if defined(CERNLIB_PROJSHIFT)
77 herror:   *stat = (serrno ? serrno : (rfio_errno ? rfio_errno : errno));
78 #else
79 herror:   *stat = errno;
80 #endif
81           perror (" error in CIGETW");
82           return;
83 }
84 /*> END <----------------------------------------------------------*/