prf.c revision 1.2
11.2Stsutsui/*	$NetBSD: prf.c,v 1.2 2013/01/21 11:58:12 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.1Stsutsuiint
541.1Stsutsuitgetchar(void)
551.1Stsutsui{
561.1Stsutsui	int c;
571.1Stsutsui
581.2Stsutsui	if ((c = cngetc()) == 0)
591.2Stsutsui        	return 0;
601.1Stsutsui
611.1Stsutsui	if (c == '\r')
621.1Stsutsui		c = '\n';
631.1Stsutsui	else if (c == ('c'&037)) {
641.1Stsutsui		panic("^C");
651.1Stsutsui		/* NOTREACHED */
661.1Stsutsui	}
671.1Stsutsui	return c;
681.1Stsutsui}
691.1Stsutsui
701.1Stsutsuivoid
711.1Stsutsuiputchar(int c)
721.1Stsutsui{
731.1Stsutsui	cnputc(c);
741.1Stsutsui	if (c == '\n')
751.1Stsutsui		cnputc('\r');
761.1Stsutsui}
77