1*84d9c625SLionel Sambuc /*- 2*84d9c625SLionel Sambuc * Copyright (c) 1996 3*84d9c625SLionel Sambuc * Keith Bostic. All rights reserved. 4*84d9c625SLionel Sambuc * Copyright (c) 1996 5*84d9c625SLionel Sambuc * Sven Verdoolaege. All rights reserved. 6*84d9c625SLionel Sambuc * 7*84d9c625SLionel Sambuc * See the LICENSE file for redistribution information. 8*84d9c625SLionel Sambuc */ 9*84d9c625SLionel Sambuc 10*84d9c625SLionel Sambuc #ifndef lint 11*84d9c625SLionel Sambuc 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*84d9c625SLionel Sambuc #endif /* not lint */ 13*84d9c625SLionel Sambuc 14*84d9c625SLionel Sambuc #include <sys/types.h> 15*84d9c625SLionel Sambuc #include <sys/queue.h> 16*84d9c625SLionel Sambuc #include <sys/time.h> 17*84d9c625SLionel Sambuc 18*84d9c625SLionel Sambuc #include <bitstring.h> 19*84d9c625SLionel Sambuc #include <ctype.h> 20*84d9c625SLionel Sambuc #include <limits.h> 21*84d9c625SLionel Sambuc #include <signal.h> 22*84d9c625SLionel Sambuc #include <stdio.h> 23*84d9c625SLionel Sambuc #include <stdlib.h> 24*84d9c625SLionel Sambuc #include <string.h> 25*84d9c625SLionel Sambuc #include <termios.h> 26*84d9c625SLionel Sambuc #include <unistd.h> 27*84d9c625SLionel Sambuc 28*84d9c625SLionel Sambuc #include <EXTERN.h> 29*84d9c625SLionel Sambuc #include <perl.h> 30*84d9c625SLionel Sambuc #include <XSUB.h> 31*84d9c625SLionel Sambuc 32*84d9c625SLionel Sambuc /* perl redefines them 33*84d9c625SLionel Sambuc * avoid warnings 34*84d9c625SLionel Sambuc */ 35*84d9c625SLionel Sambuc #undef USE_DYNAMIC_LOADING 36*84d9c625SLionel Sambuc #undef DEBUG 37*84d9c625SLionel Sambuc #undef PACKAGE 38*84d9c625SLionel Sambuc #undef ARGS 39*84d9c625SLionel Sambuc #define ARGS ARGS 40*84d9c625SLionel Sambuc 41*84d9c625SLionel Sambuc #include "config.h" 42*84d9c625SLionel Sambuc 43*84d9c625SLionel Sambuc #include "../common/common.h" 44*84d9c625SLionel Sambuc #include "perl_api_extern.h" 45*84d9c625SLionel Sambuc 46*84d9c625SLionel Sambuc /* 47*84d9c625SLionel Sambuc * PUBLIC: #ifdef USE_SFIO 48*84d9c625SLionel Sambuc */ 49*84d9c625SLionel Sambuc #ifdef USE_SFIO 50*84d9c625SLionel Sambuc 51*84d9c625SLionel Sambuc #define NIL(type) ((type)0) 52*84d9c625SLionel Sambuc 53*84d9c625SLionel Sambuc static int 54*84d9c625SLionel Sambuc sfnviwrite(f, buf, n, disc) 55*84d9c625SLionel Sambuc Sfio_t* f; /* stream involved */ 56*84d9c625SLionel Sambuc char* buf; /* buffer to read into */ 57*84d9c625SLionel Sambuc int n; /* number of bytes to read */ 58*84d9c625SLionel Sambuc Sfdisc_t* disc; /* discipline */ 59*84d9c625SLionel Sambuc { 60*84d9c625SLionel Sambuc SCR *scrp; 61*84d9c625SLionel Sambuc 62*84d9c625SLionel Sambuc scrp = (SCR *)SvIV((SV*)SvRV(perl_get_sv("curscr", FALSE))); 63*84d9c625SLionel Sambuc msgq(scrp, M_INFO, "%.*s", n, buf); 64*84d9c625SLionel Sambuc return n; 65*84d9c625SLionel Sambuc } 66*84d9c625SLionel Sambuc 67*84d9c625SLionel Sambuc /* 68*84d9c625SLionel Sambuc * sfdcnewnvi -- 69*84d9c625SLionel Sambuc * Create nvi discipline 70*84d9c625SLionel Sambuc * 71*84d9c625SLionel Sambuc * PUBLIC: Sfdisc_t* sfdcnewnvi __P((SCR*)); 72*84d9c625SLionel Sambuc */ 73*84d9c625SLionel Sambuc 74*84d9c625SLionel Sambuc Sfdisc_t * 75*84d9c625SLionel Sambuc sfdcnewnvi(scrp) 76*84d9c625SLionel Sambuc SCR *scrp; 77*84d9c625SLionel Sambuc { 78*84d9c625SLionel Sambuc Sfdisc_t* disc; 79*84d9c625SLionel Sambuc 80*84d9c625SLionel Sambuc MALLOC(scrp, disc, Sfdisc_t*, sizeof(Sfdisc_t)); 81*84d9c625SLionel Sambuc if (!disc) return disc; 82*84d9c625SLionel Sambuc 83*84d9c625SLionel Sambuc disc->readf = (Sfread_f)NULL; 84*84d9c625SLionel Sambuc disc->writef = sfnviwrite; 85*84d9c625SLionel Sambuc disc->seekf = (Sfseek_f)NULL; 86*84d9c625SLionel Sambuc disc->exceptf = (Sfexcept_f)NULL; 87*84d9c625SLionel Sambuc return disc; 88*84d9c625SLionel Sambuc } 89*84d9c625SLionel Sambuc 90*84d9c625SLionel Sambuc /* 91*84d9c625SLionel Sambuc * PUBLIC: #endif 92*84d9c625SLionel Sambuc */ 93*84d9c625SLionel Sambuc #endif /* USE_SFIO */ 94