Initial revision
[nvi.git] / perl_api / perlsfio.c
blobbfdffa8179aca567007549c805d292c63c83f599
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 #include "config.h"
12 #ifndef lint
13 static const char sccsid[] = "$Id: perlsfio.c,v 8.1 1996/09/24 21:33:20 bostic Exp $ (Berkeley) $Date: 1996/09/24 21:33:20 $";
14 #endif /* not lint */
16 #include <sys/types.h>
17 #include <sys/queue.h>
18 #include <sys/time.h>
20 #include <bitstring.h>
21 #include <ctype.h>
22 #include <limits.h>
23 #include <signal.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <termios.h>
28 #include <unistd.h>
30 #include "../common/common.h"
32 #include <EXTERN.h>
33 #include <perl.h>
34 #include <XSUB.h>
36 #include "perl_extern.h"
39 * PUBLIC: #ifdef USE_SFIO
41 #ifdef USE_SFIO
43 #define NIL(type) ((type)0)
45 static int
46 sfnviwrite(f, buf, n, disc)
47 Sfio_t* f; /* stream involved */
48 char* buf; /* buffer to read into */
49 int n; /* number of bytes to read */
50 Sfdisc_t* disc; /* discipline */
52 SCR *scrp;
54 scrp = (SCR *)SvIV((SV*)SvRV(perl_get_sv("curscr", FALSE)));
55 msgq(scrp, M_INFO, "%.*s", n, buf);
56 return n;
60 * sfdcnewnvi --
61 * Create nvi discipline
63 * PUBLIC: Sfdisc_t* sfdcnewnvi __P((SCR*));
66 Sfdisc_t *
67 sfdcnewnvi(scrp)
68 SCR *scrp;
70 Sfdisc_t* disc;
72 MALLOC(scrp, disc, Sfdisc_t*, sizeof(Sfdisc_t));
73 if (!disc) return disc;
75 disc->readf = (Sfread_f)NULL;
76 disc->writef = sfnviwrite;
77 disc->seekf = (Sfseek_f)NULL;
78 disc->exceptf = (Sfexcept_f)NULL;
79 return disc;
83 * PUBLIC: #endif
85 #endif /* USE_SFIO */