From: jasper Date: Sat, 12 Jul 2014 21:54:57 +0000 (+0000) Subject: move getchar() into libsa where applicable X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=825dcd8d3aaedf158f3bca6fa135ef4e86e3a3d4;p=openbsd move getchar() into libsa where applicable ok miod@ --- diff --git a/sys/arch/amd64/stand/boot/Makefile b/sys/arch/amd64/stand/boot/Makefile index a3c5fa8ed4f..f0c278c5900 100644 --- a/sys/arch/amd64/stand/boot/Makefile +++ b/sys/arch/amd64/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.26 2013/12/28 15:16:28 jsing Exp $ +# $OpenBSD: Makefile,v 1.27 2014/07/12 21:54:57 jasper Exp $ COPTS?= MAN?= boot.8 @@ -33,8 +33,9 @@ SRCS+= softraid.c .endif .PATH: ${S}/lib/libsa -SRCS+= alloc.c ctime.c exit.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ - strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c strtoll.c +SRCS+= alloc.c ctime.c exit.c getchar.c memcmp.c memcpy.c memset.c printf.c \ + snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c \ + strtoll.c SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ lseek.c open.c read.c readdir.c stat.c SRCS+= elf32.c elf64.c loadfile.c diff --git a/sys/arch/amd64/stand/cdboot/Makefile b/sys/arch/amd64/stand/cdboot/Makefile index f3d3fb37a91..2f3c1d9e8dc 100644 --- a/sys/arch/amd64/stand/cdboot/Makefile +++ b/sys/arch/amd64/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.22 2013/12/28 02:51:06 deraadt Exp $ +# $OpenBSD: Makefile,v 1.23 2014/07/12 21:54:57 jasper Exp $ MAN= cdboot.8 @@ -24,7 +24,7 @@ SRCS+= softraid.c SRCS+= cmd.c vars.c bootarg.c .PATH: ${S}/lib/libsa -SRCS+= alloc.c exit.c strcmp.c strlen.c \ +SRCS+= alloc.c exit.c getchar.c strcmp.c strlen.c \ strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c lseek.c \ diff --git a/sys/arch/amd64/stand/libsa/dev_i386.c b/sys/arch/amd64/stand/libsa/dev_i386.c index 9a26a6cbdee..782e3d8249a 100644 --- a/sys/arch/amd64/stand/libsa/dev_i386.c +++ b/sys/arch/amd64/stand/libsa/dev_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_i386.c,v 1.13 2012/10/30 14:06:29 jsing Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.14 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -191,22 +191,6 @@ putchar(int c) } } -int -getchar(void) -{ - register int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - char ttyname_buf[8]; char * diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index f2fe87207a5..578e377c87d 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.18 2013/12/28 02:51:07 deraadt Exp $ +# $OpenBSD: Makefile,v 1.19 2014/07/12 21:54:58 jasper Exp $ MAN= pxeboot.8 @@ -26,7 +26,7 @@ SRCS+= softraid.c SRCS+= boot.c cmd.c vars.c bootarg.c .PATH: ${S}/lib/libsa -SRCS+= alloc.c exit.c getfile.c gets.c globals.c strcmp.c strlen.c \ +SRCS+= alloc.c exit.c getchar.c getfile.c gets.c globals.c strcmp.c strlen.c \ strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c strlcat.c SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c diff --git a/sys/arch/amd64/stand/pxeboot/devopen.c b/sys/arch/amd64/stand/pxeboot/devopen.c index e3d8cecf88e..5ef61b6cc99 100644 --- a/sys/arch/amd64/stand/pxeboot/devopen.c +++ b/sys/arch/amd64/stand/pxeboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.9 2011/06/26 23:19:11 tedu Exp $ */ +/* $OpenBSD: devopen.c,v 1.10 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -175,22 +175,6 @@ putchar(int c) } } -int -getchar(void) -{ - register int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - char ttyname_buf[8]; char * diff --git a/sys/arch/armish/stand/boot/Makefile b/sys/arch/armish/stand/boot/Makefile index f08b6043d2e..b3499d3d892 100644 --- a/sys/arch/armish/stand/boot/Makefile +++ b/sys/arch/armish/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2012/09/11 17:11:35 deraadt Exp $ +# $OpenBSD: Makefile,v 1.10 2014/07/12 21:54:58 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -22,7 +22,7 @@ SRCS= start.S SRCS+= boot.c cmd.c vars.c SRCS+= conf.c devopen.c exec.c machdep.c dev_armish.c time.c SRCS+= clock.c ns16550.c wd.c wdc.c pciide.c -SRCS+= ctime.c strtol.c +SRCS+= ctime.c strtol.c getchar.c .PATH: ${S}/lib/libkern/arch/arm ${S}/lib/libkern SRCS+= divsi3.S divdi3.c moddi3.c qdivrem.c strlcpy.c strlen.c ashrdi3.c diff --git a/sys/arch/armish/stand/boot/dev_armish.c b/sys/arch/armish/stand/boot/dev_armish.c index 860b9ad2d62..061fcf7b60c 100644 --- a/sys/arch/armish/stand/boot/dev_armish.c +++ b/sys/arch/armish/stand/boot/dev_armish.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_armish.c,v 1.2 2010/12/06 18:44:49 jasper Exp $ */ +/* $OpenBSD: dev_armish.c,v 1.3 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2006 Mark Kettenis @@ -71,22 +71,6 @@ putchar(c) } } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return(c); - - putchar(c); - - return(c); -} - char ttyname_buf[8]; char * diff --git a/sys/arch/hppa/stand/libsa/Makefile b/sys/arch/hppa/stand/libsa/Makefile index ec004b01eac..7747c256ca8 100644 --- a/sys/arch/hppa/stand/libsa/Makefile +++ b/sys/arch/hppa/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2012/08/31 16:13:20 pascal Exp $ +# $OpenBSD: Makefile,v 1.17 2014/07/12 21:54:58 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -20,7 +20,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa.c time.c \ ct.c dk.c lf.c lif.c cmd_hppa.c loadfile.c elf32.c elf64.c # stand routines -SRCS+= alloc.c exit.c getfile.c gets.c globals.c \ +SRCS+= alloc.c exit.c getfile.c gets.c getchar.c globals.c \ printf.c strerror.c strtol.c strchr.c ctime.c snprintf.c # io routines diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c index c885f24ec2c..b716fe8ff0a 100644 --- a/sys/arch/hppa/stand/libsa/dev_hppa.c +++ b/sys/arch/hppa/stand/libsa/dev_hppa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_hppa.c,v 1.15 2012/02/25 20:12:00 miod Exp $ */ +/* $OpenBSD: dev_hppa.c,v 1.16 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -199,22 +199,6 @@ putchar(c) } } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return(c); - - putchar(c); - - return(c); -} - char ttyname_buf[8]; char * ttyname(fd) diff --git a/sys/arch/hppa64/stand/libsa/Makefile b/sys/arch/hppa64/stand/libsa/Makefile index a87f2cb9e66..a0594b69a5c 100644 --- a/sys/arch/hppa64/stand/libsa/Makefile +++ b/sys/arch/hppa64/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2012/08/21 14:46:18 pascal Exp $ +# $OpenBSD: Makefile,v 1.3 2014/07/12 21:54:58 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -21,7 +21,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa64.c time.c \ ct.c dk.c lf.c lif.c cmd_hppa64.c # stand routines -SRCS+= alloc.c exit.c getfile.c gets.c globals.c \ +SRCS+= alloc.c exit.c getfile.c gets.c getchar.c globals.c \ printf.c strerror.c strtol.c strchr.c ctime.c loadfile.c snprintf.c # io routines diff --git a/sys/arch/hppa64/stand/libsa/dev_hppa64.c b/sys/arch/hppa64/stand/libsa/dev_hppa64.c index ad05788bcbe..adfc7d09312 100644 --- a/sys/arch/hppa64/stand/libsa/dev_hppa64.c +++ b/sys/arch/hppa64/stand/libsa/dev_hppa64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_hppa64.c,v 1.6 2012/02/25 20:12:00 miod Exp $ */ +/* $OpenBSD: dev_hppa64.c,v 1.7 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -190,22 +190,6 @@ putchar(c) } } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return(c); - - putchar(c); - - return(c); -} - char ttyname_buf[8]; char * ttyname(fd) diff --git a/sys/arch/i386/stand/boot/Makefile b/sys/arch/i386/stand/boot/Makefile index 04d92fedb76..d3ef25a9c25 100644 --- a/sys/arch/i386/stand/boot/Makefile +++ b/sys/arch/i386/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.54 2013/12/28 15:16:28 jsing Exp $ +# $OpenBSD: Makefile,v 1.55 2014/07/12 21:54:58 jasper Exp $ COPTS?= MAN?= boot.8 @@ -42,8 +42,9 @@ SRCS+= softraid.c .endif .PATH: ${S}/lib/libsa -SRCS+= alloc.c ctime.c exit.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ - strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c strtoll.c +SRCS+= alloc.c ctime.c exit.c getchar.c memcmp.c memcpy.c memset.c printf.c \ + snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c \ + strtoll.c SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ lseek.c open.c read.c readdir.c stat.c SRCS+= elf32.c elf64.c loadfile.c diff --git a/sys/arch/i386/stand/cdboot/Makefile b/sys/arch/i386/stand/cdboot/Makefile index 3457d5e50f0..5c0f6f7ed59 100644 --- a/sys/arch/i386/stand/cdboot/Makefile +++ b/sys/arch/i386/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.20 2013/12/28 02:51:07 deraadt Exp $ +# $OpenBSD: Makefile,v 1.21 2014/07/12 21:54:58 jasper Exp $ MAN= cdboot.8 @@ -26,8 +26,9 @@ SRCS+= softraid.c SRCS+= bootarg.c cmd.c vars.c .PATH: ${S}/lib/libsa -SRCS+= alloc.c ctime.c exit.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ - strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c strtoll.c +SRCS+= alloc.c ctime.c exit.c getchar.c memcmp.c memcpy.c memset.c printf.c \ + snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c \ + strtoll.c SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ lseek.c open.c read.c readdir.c stat.c SRCS+= elf32.c elf64.c loadfile.c diff --git a/sys/arch/i386/stand/libsa/dev_i386.c b/sys/arch/i386/stand/libsa/dev_i386.c index 7f8b81971a4..7ae77e3bdfb 100644 --- a/sys/arch/i386/stand/libsa/dev_i386.c +++ b/sys/arch/i386/stand/libsa/dev_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_i386.c,v 1.38 2012/11/01 00:55:38 jsing Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.39 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -191,22 +191,6 @@ putchar(int c) } } -int -getchar(void) -{ - register int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - char ttyname_buf[8]; char * diff --git a/sys/arch/i386/stand/pxeboot/Makefile b/sys/arch/i386/stand/pxeboot/Makefile index df0ece2ddc0..6ab1a72e98e 100644 --- a/sys/arch/i386/stand/pxeboot/Makefile +++ b/sys/arch/i386/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2013/12/28 02:51:07 deraadt Exp $ +# $OpenBSD: Makefile,v 1.17 2014/07/12 21:54:58 jasper Exp $ MAN= pxeboot.8 @@ -27,9 +27,9 @@ SRCS+= softraid.c SRCS+= boot.c cmd.c vars.c bootarg.c .PATH: ${S}/lib/libsa -SRCS+= alloc.c ctime.c exit.c globals.c memcmp.c memcpy.c memset.c printf.c \ - snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c \ - strtoll.c +SRCS+= alloc.c ctime.c exit.c getchar.c globals.c memcmp.c memcpy.c memset.c \ + printf.c snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c \ + strtol.c strtoll.c SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ lseek.c read.c readdir.c stat.c SRCS+= elf32.c elf64.c loadfile.c diff --git a/sys/arch/i386/stand/pxeboot/devopen.c b/sys/arch/i386/stand/pxeboot/devopen.c index e3d8cecf88e..5ef61b6cc99 100644 --- a/sys/arch/i386/stand/pxeboot/devopen.c +++ b/sys/arch/i386/stand/pxeboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.9 2011/06/26 23:19:11 tedu Exp $ */ +/* $OpenBSD: devopen.c,v 1.10 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -175,22 +175,6 @@ putchar(int c) } } -int -getchar(void) -{ - register int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - char ttyname_buf[8]; char * diff --git a/sys/arch/landisk/stand/boot/Makefile b/sys/arch/landisk/stand/boot/Makefile index 76a67930893..6dd5ffef6ae 100644 --- a/sys/arch/landisk/stand/boot/Makefile +++ b/sys/arch/landisk/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2012/09/02 16:21:05 deraadt Exp $ +# $OpenBSD: Makefile,v 1.9 2014/07/12 21:54:58 jasper Exp $ MAN= boot.8 MLINKS= boot.8 boot.conf.5 @@ -23,7 +23,7 @@ AFLAGS+= -fno-pie SRCS+= boot.c cmd.c vars.c bootarg.c .PATH: ${S}/lib/libkern/arch/sh ${S}/lib/libkern -SRCS+= strlen.c strlcpy.c +SRCS+= getchar.c strlen.c strlcpy.c SAREL= SA_ZLIB= diff --git a/sys/arch/landisk/stand/boot/devs.c b/sys/arch/landisk/stand/boot/devs.c index dd0120e0c07..e1c27a69b3f 100644 --- a/sys/arch/landisk/stand/boot/devs.c +++ b/sys/arch/landisk/stand/boot/devs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devs.c,v 1.7 2011/03/13 00:13:53 deraadt Exp $ */ +/* $OpenBSD: devs.c,v 1.8 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -146,18 +146,3 @@ putchar(int c) break; } } - -int -getchar(void) -{ - int c = scif_getc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - return c; -} diff --git a/sys/arch/landisk/stand/boot/libsa.h b/sys/arch/landisk/stand/boot/libsa.h index fa6158fbce6..8265d7b09c8 100644 --- a/sys/arch/landisk/stand/boot/libsa.h +++ b/sys/arch/landisk/stand/boot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.4 2011/03/13 00:13:53 deraadt Exp $ */ +/* $OpenBSD: libsa.h,v 1.5 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -30,7 +30,7 @@ int blkdevopen(struct open_file *, ...); int blkdevclose(struct open_file *); int blkdevstrategy(void *, int, daddr32_t, size_t, void *, size_t *); void scif_init(unsigned int); -int scif_getc(void); +int getc(void); void scif_putc(int); void cache_flush(void); void cache_disable(void); diff --git a/sys/arch/landisk/stand/boot/scifcons.c b/sys/arch/landisk/stand/boot/scifcons.c index d2ef9517f7e..6f6574b7947 100644 --- a/sys/arch/landisk/stand/boot/scifcons.c +++ b/sys/arch/landisk/stand/boot/scifcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scifcons.c,v 1.3 2008/06/27 06:03:08 ray Exp $ */ +/* $OpenBSD: scifcons.c,v 1.4 2014/07/12 21:54:58 jasper Exp $ */ /* $NetBSD: scifcons.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /* NetBSD: scif.c,v 1.38 2004/12/13 02:14:13 chs Exp */ @@ -162,7 +162,7 @@ scif_init(unsigned int bps) } int -scif_getc(void) +getc(void) { unsigned char c, err_c; unsigned short err_c2; diff --git a/sys/arch/loongson/stand/boot/machdep.c b/sys/arch/loongson/stand/boot/machdep.c index df618a2adae..d1ac2b714ca 100644 --- a/sys/arch/loongson/stand/boot/machdep.c +++ b/sys/arch/loongson/stand/boot/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.5 2013/09/30 19:27:02 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.6 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -64,22 +64,6 @@ cnspeed(dev_t dev, int sp) return 9600; } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - int pch_pos; void diff --git a/sys/arch/loongson/stand/libsa/Makefile b/sys/arch/loongson/stand/libsa/Makefile index 0aef0b99ce8..a9ceec78cc9 100644 --- a/sys/arch/loongson/stand/libsa/Makefile +++ b/sys/arch/loongson/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2013/01/02 12:29:33 deraadt Exp $ +# $OpenBSD: Makefile,v 1.5 2014/07/12 21:54:58 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -16,7 +16,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdinc -mno-abicalls -D_NO_ABICALLS \ -I${.OBJDIR} # stand routines -SRCS= alloc.c cons.c ctime.c exit.c getfile.c gets.c globals.c \ +SRCS= alloc.c cons.c ctime.c exit.c getchar.c getfile.c gets.c globals.c \ memcmp.c memcpy.c memset.c printf.c \ snprintf.c strchr.c strcmp.c strerror.c strncmp.c strncpy.c strtol.c diff --git a/sys/arch/macppc/stand/Locore.c b/sys/arch/macppc/stand/Locore.c index 9cdde862594..351183ad7ef 100644 --- a/sys/arch/macppc/stand/Locore.c +++ b/sys/arch/macppc/stand/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.15 2008/05/25 16:55:31 miod Exp $ */ +/* $OpenBSD: Locore.c,v 1.16 2014/07/12 21:54:58 jasper Exp $ */ /* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */ /* @@ -515,22 +515,6 @@ putchar(int c) OF_write(stdout, &ch, 1); } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return(c); - - putchar(c); - - return(c); -} - void ofc_probe(struct consdev *cn) { diff --git a/sys/arch/macppc/stand/ofwboot/Makefile b/sys/arch/macppc/stand/ofwboot/Makefile index 073c4e02224..7e67070e4a6 100644 --- a/sys/arch/macppc/stand/ofwboot/Makefile +++ b/sys/arch/macppc/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2012/09/02 23:07:26 deraadt Exp $ +# $OpenBSD: Makefile,v 1.9 2014/07/12 21:54:58 jasper Exp $ # $NetBSD: Makefile,v 1.2 1997/04/17 07:46:24 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -22,7 +22,7 @@ BINDIR= /usr/mdec .PATH: ${S}/lib/libsa .PATH: ${S}/lib/libkern/arch/powerpc ${S}/lib/libkern -SRCS+= strlcpy.c memcpy.c strlen.c strrchr.c strlcat.c ashrdi3.c +SRCS+= getchar.c strlcpy.c memcpy.c strlen.c strrchr.c strlcat.c ashrdi3.c SRCS+= moddi3.c NEWVERSWHAT= "OpenFirmware Boot" diff --git a/sys/arch/octeon/stand/boot/machdep.c b/sys/arch/octeon/stand/boot/machdep.c index 78d6ae877a2..6675c7aa83e 100644 --- a/sys/arch/octeon/stand/boot/machdep.c +++ b/sys/arch/octeon/stand/boot/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.3 2014/07/12 20:36:52 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.4 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -79,22 +79,6 @@ cnspeed(dev_t dev, int s) return (CONSPEED); } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - int pch_pos; void diff --git a/sys/arch/octeon/stand/libsa/Makefile b/sys/arch/octeon/stand/libsa/Makefile index c0b134c38de..65ecba5c9df 100644 --- a/sys/arch/octeon/stand/libsa/Makefile +++ b/sys/arch/octeon/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2013/06/05 01:32:11 jasper Exp $ +# $OpenBSD: Makefile,v 1.3 2014/07/12 21:54:58 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -16,7 +16,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdinc -mno-abicalls -D_NO_ABICALLS \ -I${.OBJDIR} # stand routines -SRCS= alloc.c cons.c ctime.c exit.c getfile.c gets.c globals.c \ +SRCS= alloc.c cons.c ctime.c exit.c getchar.c getfile.c gets.c globals.c \ memcmp.c memcpy.c memset.c printf.c \ snprintf.c strchr.c strcmp.c strerror.c strncmp.c strncpy.c strtol.c diff --git a/sys/arch/socppc/stand/boot/Makefile b/sys/arch/socppc/stand/boot/Makefile index 527e9bc6fd3..377b5e69adb 100644 --- a/sys/arch/socppc/stand/boot/Makefile +++ b/sys/arch/socppc/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2012/09/02 17:22:53 pascal Exp $ +# $OpenBSD: Makefile,v 1.14 2014/07/12 21:54:58 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -27,7 +27,7 @@ SRCS+= clock.c ns16550.c wd.c wdc.c pciide.c wdc_obio.c fdt.c SRCS+= ctime.c strtol.c cmd_socppc.c .PATH: ${S}/lib/libkern/arch/powerpc ${S}/lib/libkern -SRCS+= strlcpy.c strlen.c ashrdi3.c moddi3.c +SRCS+= getchar.c strlcpy.c strlen.c ashrdi3.c moddi3.c ### find out what to use for libz Z_AS= library diff --git a/sys/arch/socppc/stand/boot/dev_socppc.c b/sys/arch/socppc/stand/boot/dev_socppc.c index 204fa315022..934de580014 100644 --- a/sys/arch/socppc/stand/boot/dev_socppc.c +++ b/sys/arch/socppc/stand/boot/dev_socppc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_socppc.c,v 1.2 2010/12/06 18:44:49 jasper Exp $ */ +/* $OpenBSD: dev_socppc.c,v 1.3 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -71,22 +71,6 @@ putchar(c) } } -int -getchar() -{ - int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return(c); - - putchar(c); - - return(c); -} - char ttyname_buf[8]; char * diff --git a/sys/arch/zaurus/stand/zboot/Makefile b/sys/arch/zaurus/stand/zboot/Makefile index c89143ebc3c..8e45e107256 100644 --- a/sys/arch/zaurus/stand/zboot/Makefile +++ b/sys/arch/zaurus/stand/zboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2013/09/10 21:00:26 deraadt Exp $ +# $OpenBSD: Makefile,v 1.14 2014/07/12 21:54:58 jasper Exp $ MAN= boot.8 MANSUBDIR=zaurus @@ -29,7 +29,7 @@ SRCS+= close.c closeall.c cons.c ctime.c disklabel.c dkcksum.c fstat.c \ readdir.c snprintf.c stat.c strerror.c strtol.c ufs.c .PATH: ${S}/lib/libkern/arch/arm ${S}/lib/libkern -SRCS+= strcmp.c strlcpy.c strlen.c strncmp.c strncpy.c write.c \ +SRCS+= getchar.c strcmp.c strlcpy.c strlen.c strncmp.c strncpy.c write.c \ ashrdi3.c divsi3.S divdi3.c moddi3.c qdivrem.c # local overrides and additions diff --git a/sys/arch/zaurus/stand/zboot/devopen.c b/sys/arch/zaurus/stand/zboot/devopen.c index 442f30af831..e9e424182d2 100644 --- a/sys/arch/zaurus/stand/zboot/devopen.c +++ b/sys/arch/zaurus/stand/zboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.10 2011/06/26 23:19:11 tedu Exp $ */ +/* $OpenBSD: devopen.c,v 1.11 2014/07/12 21:54:58 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -129,22 +129,6 @@ putchar(int c) } } -int -getchar(void) -{ - register int c = cngetc(); - - if (c == '\r') - c = '\n'; - - if ((c < ' ' && c != '\n') || c == '\177') - return c; - - putchar(c); - - return c; -} - char ttyname_buf[8]; char * diff --git a/sys/lib/libsa/getchar.c b/sys/lib/libsa/getchar.c new file mode 100644 index 00000000000..9df45c7b657 --- /dev/null +++ b/sys/lib/libsa/getchar.c @@ -0,0 +1,53 @@ +/* $OpenBSD: getchar.c,v 1.1 2014/07/12 21:54:58 jasper Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include "stand.h" + +int +getchar(void) +{ + int c = cngetc(); + + if (c == '\r') + c = '\n'; + + if ((c < ' ' && c != '\n') || c == '\177') + return c; + + putchar(c); + + return c; +} diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h index 75c92df9c52..63f9b738e6b 100644 --- a/sys/lib/libsa/stand.h +++ b/sys/lib/libsa/stand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stand.h,v 1.56 2013/12/28 02:51:07 deraadt Exp $ */ +/* $OpenBSD: stand.h,v 1.57 2014/07/12 21:54:58 jasper Exp $ */ /* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */ /*- @@ -185,6 +185,7 @@ void cnputc(int); int cngetc(void); int cnischar(void); int cnspeed(dev_t, int); +int getchar(void); u_int sleep(u_int); void usleep(u_int); char *ctime(const time_t *);