use three-argument AC_DEFINE instead of acconfig.h
[nvi.git] / perl_api / perlsfio.c
blob1bd0b1adcc68c815e776ff56b794784354f7f1ff
1 /*-
2 * Copyright (c) 1996
3 * Keith Bostic. All rights reserved.
4 * Copyright (c) 1996
5 * Sven Verdoolaege. All rights reserved.
7 * See the LICENSE file for redistribution information.
8 */
10 #ifndef lint
11 static const char sccsid[] = "$Id: perlsfio.c,v 8.3 2000/04/30 17:00:15 skimo Exp $ (Berkeley) $Date: 2000/04/30 17:00:15 $";
12 #endif /* not lint */
14 #include <sys/types.h>
15 #include <sys/queue.h>
16 #include <sys/time.h>
18 #include <bitstring.h>
19 #include <ctype.h>
20 #include <limits.h>
21 #include <signal.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <termios.h>
26 #include <unistd.h>
28 #include <EXTERN.h>
29 #include <perl.h>
30 #include <XSUB.h>
32 /* perl redefines them
33 * avoid warnings
35 #undef USE_DYNAMIC_LOADING
36 #undef DEBUG
37 #undef PACKAGE
38 #undef ARGS
39 #define ARGS ARGS
41 #include "config.h"
43 #include "../common/common.h"
44 #include "extern.h"
47 * PUBLIC: #ifdef USE_SFIO
49 #ifdef USE_SFIO
51 #define NIL(type) ((type)0)
53 static int
54 sfnviwrite(f, buf, n, disc)
55 Sfio_t* f; /* stream involved */
56 char* buf; /* buffer to read into */
57 int n; /* number of bytes to read */
58 Sfdisc_t* disc; /* discipline */
60 SCR *scrp;
62 scrp = (SCR *)SvIV((SV*)SvRV(perl_get_sv("curscr", FALSE)));
63 msgq(scrp, M_INFO, "%.*s", n, buf);
64 return n;
68 * sfdcnewnvi --
69 * Create nvi discipline
71 * PUBLIC: Sfdisc_t* sfdcnewnvi __P((SCR*));
74 Sfdisc_t *
75 sfdcnewnvi(scrp)
76 SCR *scrp;
78 Sfdisc_t* disc;
80 MALLOC(scrp, disc, Sfdisc_t*, sizeof(Sfdisc_t));
81 if (!disc) return disc;
83 disc->readf = (Sfread_f)NULL;
84 disc->writef = sfnviwrite;
85 disc->seekf = (Sfseek_f)NULL;
86 disc->exceptf = (Sfexcept_f)NULL;
87 return disc;
91 * PUBLIC: #endif
93 #endif /* USE_SFIO */