File: pdbio.c

package info (click to toggle)
pact 980714-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 13,096 kB
  • ctags: 26,034
  • sloc: ansic: 109,076; lisp: 9,645; csh: 7,147; fortran: 1,050; makefile: 136; lex: 95; sh: 32
file content (93 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * PDBIO.C - handle file I/O for PDBLib
 *         - do things so that it can work over networks and so on
 *
 * Source Version: 9.0
 * Software Release #92-0043
 *
 */

#include "cpyright.h"

#include "pdb.h"

static char
 Pbuffer[LRG_TXT_BUFFER];

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

/* _PD_PIO_CLOSE - close the file wherever it is */

int _PD_pio_close(stream)
   FILE *stream;
   {int ret;

    if (stream == NULL)
       return(EOF);
   
    ret = fclose(stream);

    return(ret);}

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

/* _PD_PIO_SEEK - do an fseek on the file wherever it is */

int _PD_pio_seek(stream, addr, offset)
   FILE *stream;
   long addr;
   int offset;
   {int ret;

    if (stream == NULL)
       return(EOF);
   
    ret = fseek(stream, addr, offset);

#ifdef LINUX
    ret = FALSE;
#endif

    return(ret);}

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

/* _PD_PIO_PRINTF - do an fprintf style write to the given file
 *                - wherever it is
 */

#ifdef PCC

int _PD_pio_printf(fp, fmt, va_alist)
   FILE *fp;
   char *fmt;
   va_dcl

#endif

#ifdef ANSI

int _PD_pio_printf(FILE *fp, char *fmt, ...)

#endif

   {size_t ni, nw;

    nw = 0;

    if (fp != NULL)
       {SC_VA_START(fmt);
	SC_VSPRINTF(Pbuffer, fmt);
	SC_VA_END;

	ni = strlen(Pbuffer);
	nw = io_write(Pbuffer, (size_t) 1, ni, fp);};

    return((int) nw);}

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/