prf.c revision 1.1
11.1Stsutsui/*	$NetBSD: prf.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $	*/
21.1Stsutsui
31.1Stsutsui/*
41.1Stsutsui * Copyright (c) 1982, 1986, 1990, 1993
51.1Stsutsui *	The Regents of the University of California.  All rights reserved.
61.1Stsutsui *
71.1Stsutsui * Redistribution and use in source and binary forms, with or without
81.1Stsutsui * modification, are permitted provided that the following conditions
91.1Stsutsui * are met:
101.1Stsutsui * 1. Redistributions of source code must retain the above copyright
111.1Stsutsui *    notice, this list of conditions and the following disclaimer.
121.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
131.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
141.1Stsutsui *    documentation and/or other materials provided with the distribution.
151.1Stsutsui * 3. Neither the name of the University nor the names of its contributors
161.1Stsutsui *    may be used to endorse or promote products derived from this software
171.1Stsutsui *    without specific prior written permission.
181.1Stsutsui *
191.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
201.1Stsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
211.1Stsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
221.1Stsutsui * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
231.1Stsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241.1Stsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
251.1Stsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
261.1Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
271.1Stsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
281.1Stsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
291.1Stsutsui * SUCH DAMAGE.
301.1Stsutsui *
311.1Stsutsui *	@(#)prf.c	8.1 (Berkeley) 6/10/93
321.1Stsutsui */
331.1Stsutsui
341.1Stsutsui#include <lib/libsa/stand.h>
351.1Stsutsui#include <luna68k/stand/boot/samachdep.h>
361.1Stsutsui
371.1Stsutsuiint
381.1Stsutsuigetchar(void)
391.1Stsutsui{
401.1Stsutsui	int c;
411.1Stsutsui
421.1Stsutsui	while ((c = cngetc()) == 0)
431.1Stsutsui		;
441.1Stsutsui	if (c == '\r')
451.1Stsutsui		c = '\n';
461.1Stsutsui	else if (c == ('c'&037)) {
471.1Stsutsui		panic("^C");
481.1Stsutsui		/* NOTREACHED */
491.1Stsutsui	}
501.1Stsutsui	return c;
511.1Stsutsui}
521.1Stsutsui
531.1Stsutsui#if 0
541.1Stsutsuiint
551.1Stsutsuitgetchar(void)
561.1Stsutsui{
571.1Stsutsui	int c;
581.1Stsutsui
591.1Stsutsui	if ((c = cnscan()) == -1)
601.1Stsutsui        	return -1;
611.1Stsutsui
621.1Stsutsui	if (c == '\r')
631.1Stsutsui		c = '\n';
641.1Stsutsui	else if (c == ('c'&037)) {
651.1Stsutsui		panic("^C");
661.1Stsutsui		/* NOTREACHED */
671.1Stsutsui	}
681.1Stsutsui	return c;
691.1Stsutsui}
701.1Stsutsui#endif
711.1Stsutsui
721.1Stsutsuivoid
731.1Stsutsuiputchar(int c)
741.1Stsutsui{
751.1Stsutsui	cnputc(c);
761.1Stsutsui	if (c == '\n')
771.1Stsutsui		cnputc('\r');
781.1Stsutsui}
79