]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/packlib/kernlib/kerngen/ccgenci/ciget.c
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgenci / ciget.c
CommitLineData
fe4da5cc 1/*
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.4 1997/09/02 14:26:49 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:16 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 CIGET
25 CERN PROGLIB# Z311 CIGET .VERSION KERNFOR 4.37 930715
26 ORIG. 12/10/91, JZ
27 CALL CIGET (LUNDES, MBUF, NBDO, NBDONE, ISTAT)
28 read from the file :
29 LUNDES file descriptor
30 *MBUF vector to be read into
31 NBDO number of bytes to be read
32 *NBDONE number of bytes 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/fortchar.h"
43#if defined(CERNLIB_QMVAX)
44#include <descrip.h>
45#endif
46#if defined(CERNLIB_QX_SC)
47void type_of_call ciget_(lundes, mbuf, nbdo, nbdone, stat)
48#endif
49#if defined(CERNLIB_QXNO_SC)
50void type_of_call ciget(lundes, mbuf, nbdo, nbdone, stat)
51#endif
52#if defined(CERNLIB_QXCAPT)
53# ifdef CERNLIB_MSSTDCALL
54 void type_of_call CIGET(lundes, mbuf, lmbuf, nbdo, nbdone, stat)
55 int lmbuf;
56# else
57 void type_of_call CIGET(lundes, mbuf, nbdo, nbdone, stat)
58# endif
59#endif
60#if defined(CERNLIB_QMCRY)
61 _fcd mbuf;
62#endif
63#if defined(CERNLIB_QMVAX)
64 struct dsc$descriptor_s *mbuf;
65#endif
66#if (!defined(CERNLIB_QMCRY))&&(!defined(CERNLIB_QMVAX))
67 char *mbuf;
68#endif
69 int *lundes, *nbdo, *nbdone, *stat;
70{
71 char *ubuf;
72 int fildes;
73 int nbdn, nbxq;
74
75 *stat = 0;
76 if (*nbdo <= 0) return;
77#if defined(CERNLIB_QMCRY)
78 ubuf = _fcdtocp(mbuf);
79#endif
80#if defined(CERNLIB_QMVAX)
81 ubuf = mbuf->dsc$a_pointer;
82#endif
83#if (!defined(CERNLIB_QMCRY))&&(!defined(CERNLIB_QMVAX))
84 ubuf = mbuf;
85#endif
86
87/* read the file */
88
89 fildes = *lundes;
90 nbxq = *nbdo;
91 nbdn = read (fildes, ubuf, nbxq);
92 if (nbdn == 0) goto heof;
93 if (nbdn < 0) goto herror;
94 *nbdone = nbdn;
95 return;
96
97/* Handle exceptions */
98
99heof: *stat = -1;
100 return;
101
102#if defined(CERNLIB_PROJSHIFT)
103herror: *stat = (serrno ? serrno : (rfio_errno ? rfio_errno : errno));
104#else
105herror: *stat = errno;
106#endif
107 perror (" error in CIGET");
108 return;
109}
110/*> END <----------------------------------------------------------*/