]>
Commit | Line | Data |
---|---|---|
fe4da5cc | 1 | /* |
2 | * $Id$ | |
3 | * | |
4 | * $Log$ | |
5 | * Revision 1.4 1997/09/02 14:26:54 mclareni | |
6 | * WINNT correction | |
7 | * | |
8 | * Revision 1.3 1997/02/04 17:35:19 mclareni | |
9 | * Merge Winnt and 97a versions | |
10 | * | |
11 | * Revision 1.2 1997/01/15 16:25:46 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:18 mclareni | |
15 | * All mods for Winnt 96a on winnt branch | |
16 | * | |
17 | * Revision 1.1.1.1 1996/02/15 17:49:39 mclareni | |
18 | * Kernlib | |
19 | * | |
20 | */ | |
21 | #include "kerngen/pilot.h" | |
22 | #include "kerngen/fortranc.h" | |
23 | ||
24 | /*> ROUTINE CIPUT | |
25 | CERN PROGLIB# Z311 CIPUT .VERSION KERNFOR 4.37 930715 | |
26 | ORIG. 12/10/91, JZ | |
27 | CALL CIPUT (LUNDES, MBUF, NBPUT, ISTAT) | |
28 | write to the file : | |
29 | LUNDES file descriptor | |
30 | MBUF vector to be written | |
31 | NBPUT number of bytes to be written | |
32 | *ISTAT status, =zero if success | |
33 | */ | |
34 | #include "kerngen/cf_reaw.h" | |
35 | #ifndef WIN32 | |
36 | # include <errno.h> | |
37 | #else | |
38 | # include <stdlib.h> | |
39 | #endif | |
40 | #include "kerngen/cf_xaft.h" | |
41 | #include "kerngen/fortchar.h" | |
42 | #if defined(CERNLIB_QMVAX) | |
43 | #include <descrip.h> | |
44 | #endif | |
45 | #if defined(CERNLIB_QX_SC) | |
46 | void type_of_call ciput_(lundes, mbuf, nbput, stat) | |
47 | #endif | |
48 | #if defined(CERNLIB_QXNO_SC) | |
49 | void type_of_call ciput(lundes, mbuf, nbput, stat) | |
50 | #endif | |
51 | #if defined(CERNLIB_QXCAPT) | |
52 | # ifdef CERNLIB_MSSTDCALL | |
53 | void type_of_call CIPUT(lundes, mbuf, lmbuf, nbput, stat) | |
54 | int lmbuf; | |
55 | # else | |
56 | void type_of_call CIPUT(lundes, mbuf, nbput, stat) | |
57 | # endif | |
58 | #endif | |
59 | #if defined(CERNLIB_QMCRY) | |
60 | _fcd mbuf; | |
61 | #endif | |
62 | #if defined(CERNLIB_QMVAX) | |
63 | struct dsc$descriptor_s *mbuf; | |
64 | #endif | |
65 | #if (!defined(CERNLIB_QMCRY))&&(!defined(CERNLIB_QMVAX)) | |
66 | char *mbuf; | |
67 | #endif | |
68 | int *lundes, *nbput, *stat; | |
69 | { | |
70 | char *ubuf; | |
71 | int fildes; | |
72 | int nbdn, nbdo; | |
73 | ||
74 | *stat = 0; | |
75 | if (*nbput <= 0) return; | |
76 | #if defined(CERNLIB_QMCRY) | |
77 | ubuf = _fcdtocp(mbuf); | |
78 | #endif | |
79 | #if defined(CERNLIB_QMVAX) | |
80 | ubuf = mbuf->dsc$a_pointer; | |
81 | #endif | |
82 | #if (!defined(CERNLIB_QMCRY))&&(!defined(CERNLIB_QMVAX)) | |
83 | ubuf = mbuf; | |
84 | #endif | |
85 | ||
86 | /* write the file */ | |
87 | ||
88 | fildes = *lundes; | |
89 | nbdo = *nbput; | |
90 | nbdn = write (fildes, ubuf, nbdo); | |
91 | if (nbdn < 0) goto trouble; | |
92 | return; | |
93 | ||
94 | #if defined(CERNLIB_PROJSHIFT) | |
95 | trouble: *stat = (serrno ? serrno : (rfio_errno ? rfio_errno : errno)); | |
96 | #else | |
97 | trouble: *stat = errno; | |
98 | #endif | |
99 | perror (" error in CIPUT"); | |
100 | return; | |
101 | } | |
102 | /*> END <----------------------------------------------------------*/ |