Sync usage with man page.
[netbsd-mini2440.git] / dist / nvi / perl_api / perlsfio.c
blob35d2b4550af03a3550cfd9d00bfee899846a6fa2
1 /* $NetBSD$ */
3 /*-
4 * Copyright (c) 1996
5 * Keith Bostic. All rights reserved.
6 * Copyright (c) 1996
7 * Sven Verdoolaege. All rights reserved.
9 * See the LICENSE file for redistribution information.
12 #ifndef lint
13 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";
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 <EXTERN.h>
31 #include <perl.h>
32 #include <XSUB.h>
34 /* perl redefines them
35 * avoid warnings
37 #undef USE_DYNAMIC_LOADING
38 #undef DEBUG
39 #undef PACKAGE
40 #undef ARGS
41 #define ARGS ARGS
43 #include "config.h"
45 #include "../common/common.h"
46 #include "extern.h"
49 * PUBLIC: #ifdef USE_SFIO
51 #ifdef USE_SFIO
53 #define NIL(type) ((type)0)
55 static int
56 sfnviwrite(f, buf, n, disc)
57 Sfio_t* f; /* stream involved */
58 char* buf; /* buffer to read into */
59 int n; /* number of bytes to read */
60 Sfdisc_t* disc; /* discipline */
62 SCR *scrp;
64 scrp = (SCR *)SvIV((SV*)SvRV(perl_get_sv("curscr", FALSE)));
65 msgq(scrp, M_INFO, "%.*s", n, buf);
66 return n;
70 * sfdcnewnvi --
71 * Create nvi discipline
73 * PUBLIC: Sfdisc_t* sfdcnewnvi __P((SCR*));
76 Sfdisc_t *
77 sfdcnewnvi(scrp)
78 SCR *scrp;
80 Sfdisc_t* disc;
82 MALLOC(scrp, disc, Sfdisc_t*, sizeof(Sfdisc_t));
83 if (!disc) return disc;
85 disc->readf = (Sfread_f)NULL;
86 disc->writef = sfnviwrite;
87 disc->seekf = (Sfseek_f)NULL;
88 disc->exceptf = (Sfexcept_f)NULL;
89 return disc;
93 * PUBLIC: #endif
95 #endif /* USE_SFIO */