kernel - TMPFS - Bug fixing pass
[dragonfly.git] / contrib / nvi / perl_api / perlsfio.c
blobd507585aa48d365bb34c3b2bec6c245ba94c2044
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[] = "@(#)perlsfio.c 8.1 (Berkeley) 9/24/96";
14 #endif /* not lint */
16 #include <sys/types.h>
17 #include <sys/param.h>
18 #include <sys/queue.h>
19 #include <sys/time.h>
21 #include <bitstring.h>
22 #include <ctype.h>
23 #include <limits.h>
24 #include <signal.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <termios.h>
29 #include <unistd.h>
30 #include <errno.h>
32 #include "../common/common.h"
34 #include <EXTERN.h>
35 #include <perl.h>
36 #include <XSUB.h>
38 #include "perl_extern.h"
41 * PUBLIC: #ifdef USE_SFIO
43 #ifdef USE_SFIO
45 #define NIL(type) ((type)0)
47 static int
48 sfnviwrite(f, buf, n, disc)
49 Sfio_t* f; /* stream involved */
50 char* buf; /* buffer to read into */
51 int n; /* number of bytes to read */
52 Sfdisc_t* disc; /* discipline */
54 SCR *scrp;
56 scrp = (SCR *)SvIV((SV*)SvRV(perl_get_sv("curscr", FALSE)));
57 msgq(scrp, M_INFO, "%.*s", n, buf);
58 return n;
62 * sfdcnewnvi --
63 * Create nvi discipline
65 * PUBLIC: Sfdisc_t* sfdcnewnvi __P((SCR*));
68 Sfdisc_t *
69 sfdcnewnvi(scrp)
70 SCR *scrp;
72 Sfdisc_t* disc;
74 MALLOC(scrp, disc, Sfdisc_t*, sizeof(Sfdisc_t));
75 if (!disc) return disc;
77 disc->readf = (Sfread_f)NULL;
78 disc->writef = sfnviwrite;
79 disc->seekf = (Sfseek_f)NULL;
80 disc->exceptf = (Sfexcept_f)NULL;
81 return disc;
85 * PUBLIC: #endif
87 #endif /* USE_SFIO */