From: jasper Date: Sun, 13 Jul 2014 09:26:08 +0000 (+0000) Subject: move putchar() into libsa X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3052da2458a13a0594a388815c223e864f79d20b;p=openbsd move putchar() into libsa "sure" miod@ --- diff --git a/sys/arch/amd64/stand/boot/Makefile b/sys/arch/amd64/stand/boot/Makefile index f0c278c5900..2e475c61af4 100644 --- a/sys/arch/amd64/stand/boot/Makefile +++ b/sys/arch/amd64/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.27 2014/07/12 21:54:57 jasper Exp $ +# $OpenBSD: Makefile,v 1.28 2014/07/13 09:26:08 jasper Exp $ COPTS?= MAN?= boot.8 @@ -34,8 +34,8 @@ SRCS+= softraid.c .PATH: ${S}/lib/libsa 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 + putchar.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 2f3c1d9e8dc..b13d29664de 100644 --- a/sys/arch/amd64/stand/cdboot/Makefile +++ b/sys/arch/amd64/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.23 2014/07/12 21:54:57 jasper Exp $ +# $OpenBSD: Makefile,v 1.24 2014/07/13 09:26:08 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 getchar.c strcmp.c strlen.c \ +SRCS+= alloc.c exit.c getchar.c putchar.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 782e3d8249a..b5b8d42f986 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.14 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.15 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -160,37 +160,6 @@ devboot(dev_t bootdev, char *p) *p = '\0'; } -int pch_pos = 0; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do { - cnputc(' '); - } while (++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index 578e377c87d..72b13f83eb8 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.20 2014/07/13 09:26:08 jasper Exp $ MAN= pxeboot.8 @@ -26,8 +26,8 @@ SRCS+= softraid.c SRCS+= boot.c cmd.c vars.c bootarg.c .PATH: ${S}/lib/libsa -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 \ +SRCS+= alloc.c exit.c getchar.c getfile.c gets.c globals.c putchar.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 5ef61b6cc99..da1de624f30 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.10 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: devopen.c,v 1.11 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -144,37 +144,6 @@ devboot(dev_t bootdev, char *p) *p = '\0'; } -int pch_pos = 0; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while (++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/arch/armish/stand/boot/Makefile b/sys/arch/armish/stand/boot/Makefile index b3499d3d892..e9149055cb8 100644 --- a/sys/arch/armish/stand/boot/Makefile +++ b/sys/arch/armish/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.11 2014/07/13 09:26:08 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 getchar.c +SRCS+= ctime.c strtol.c getchar.c putchar.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 061fcf7b60c..5cb7eb3c049 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.3 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: dev_armish.c,v 1.4 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2006 Mark Kettenis @@ -39,38 +39,6 @@ cnspeed(dev_t dev, int sp) return CONSPEED; } -int pch_pos; - -void -putchar(c) - int c; -{ - switch(c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while(++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/arch/hppa/stand/libsa/Makefile b/sys/arch/hppa/stand/libsa/Makefile index 0c9cdccdf2b..71eeca4469b 100644 --- a/sys/arch/hppa/stand/libsa/Makefile +++ b/sys/arch/hppa/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.18 2014/07/12 23:34:54 jasper Exp $ +# $OpenBSD: Makefile,v 1.19 2014/07/13 09:26:08 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -21,7 +21,7 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa.c time.c \ # stand routines 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 + printf.c putchar.c strerror.c strtol.c strchr.c ctime.c snprintf.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c index b716fe8ff0a..8ed4b5212ec 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.16 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: dev_hppa.c,v 1.17 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -167,39 +167,8 @@ devboot(dev, p) *p = '\0'; } -int pch_pos; - -void -putchar(c) - int c; -{ - switch(c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while(++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; + char * ttyname(fd) int fd; diff --git a/sys/arch/hppa64/stand/libsa/Makefile b/sys/arch/hppa64/stand/libsa/Makefile index ab2be284b69..8ce85ee55e1 100644 --- a/sys/arch/hppa64/stand/libsa/Makefile +++ b/sys/arch/hppa64/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2014/07/12 23:34:54 jasper Exp $ +# $OpenBSD: Makefile,v 1.5 2014/07/13 09:26:08 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -22,7 +22,8 @@ SRCS= machdep.c pdc.c itecons.c dev_hppa64.c time.c \ # stand routines 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 + printf.c putchar.c strerror.c strtol.c strchr.c ctime.c loadfile.c \ + snprintf.c # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ diff --git a/sys/arch/hppa64/stand/libsa/dev_hppa64.c b/sys/arch/hppa64/stand/libsa/dev_hppa64.c index adfc7d09312..61110da4171 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.7 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: dev_hppa64.c,v 1.8 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -158,38 +158,6 @@ devboot(dev, p) *p = '\0'; } -int pch_pos; - -void -putchar(c) - int c; -{ - switch(c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while(++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * ttyname(fd) diff --git a/sys/arch/i386/stand/boot/Makefile b/sys/arch/i386/stand/boot/Makefile index d3ef25a9c25..e37b2a54d21 100644 --- a/sys/arch/i386/stand/boot/Makefile +++ b/sys/arch/i386/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.55 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.56 2014/07/13 09:26:08 jasper Exp $ COPTS?= MAN?= boot.8 @@ -43,8 +43,8 @@ SRCS+= softraid.c .PATH: ${S}/lib/libsa 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 + putchar.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 5c0f6f7ed59..f0f036f46f1 100644 --- a/sys/arch/i386/stand/cdboot/Makefile +++ b/sys/arch/i386/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.21 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.22 2014/07/13 09:26:08 jasper Exp $ MAN= cdboot.8 @@ -27,8 +27,8 @@ SRCS+= bootarg.c cmd.c vars.c .PATH: ${S}/lib/libsa 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 + putchar.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 7ae77e3bdfb..32055dac9a7 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.39 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.40 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -160,37 +160,6 @@ devboot(dev_t bootdev, char *p) *p = '\0'; } -int pch_pos = 0; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do { - cnputc(' '); - } while (++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/arch/i386/stand/pxeboot/Makefile b/sys/arch/i386/stand/pxeboot/Makefile index 6ab1a72e98e..f908780b3b8 100644 --- a/sys/arch/i386/stand/pxeboot/Makefile +++ b/sys/arch/i386/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.17 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.18 2014/07/13 09:26:08 jasper Exp $ MAN= pxeboot.8 @@ -28,8 +28,8 @@ SRCS+= boot.c cmd.c vars.c bootarg.c .PATH: ${S}/lib/libsa 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 + printf.c putchar.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 5ef61b6cc99..da1de624f30 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.10 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: devopen.c,v 1.11 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -144,37 +144,6 @@ devboot(dev_t bootdev, char *p) *p = '\0'; } -int pch_pos = 0; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while (++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/arch/landisk/stand/boot/Makefile b/sys/arch/landisk/stand/boot/Makefile index 6dd5ffef6ae..f58688df89f 100644 --- a/sys/arch/landisk/stand/boot/Makefile +++ b/sys/arch/landisk/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.10 2014/07/13 09:26:08 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+= getchar.c strlen.c strlcpy.c +SRCS+= getchar.c putchar.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 e1c27a69b3f..8180dd106dc 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.8 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: devs.c,v 1.9 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -114,35 +114,3 @@ blkdevclose(struct open_file *f) { return 0; } - -int pch_pos = 0; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - scif_putc('\b'); - scif_putc(' '); - case '\b': - scif_putc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - scif_putc(' '); - while (++pch_pos % 8); - break; - case '\n': - scif_putc(c); - case '\r': - scif_putc('\r'); - pch_pos=0; - break; - default: - scif_putc(c); - pch_pos++; - break; - } -} diff --git a/sys/arch/landisk/stand/boot/libsa.h b/sys/arch/landisk/stand/boot/libsa.h index 8265d7b09c8..81a0853d3c8 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.5 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: libsa.h,v 1.6 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -31,6 +31,6 @@ int blkdevclose(struct open_file *); int blkdevstrategy(void *, int, daddr32_t, size_t, void *, size_t *); void scif_init(unsigned int); int getc(void); -void scif_putc(int); +void 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 6f6574b7947..1baf6d01781 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.4 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: scifcons.c,v 1.5 2014/07/13 09:26:08 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 */ @@ -196,7 +196,7 @@ getc(void) } void -scif_putc(int c) +putc(int c) { /* wait for ready */ diff --git a/sys/arch/loongson/stand/boot/machdep.c b/sys/arch/loongson/stand/boot/machdep.c index d28c220d9f7..47956a8a136 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.7 2014/07/12 23:34:54 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.8 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -64,37 +64,6 @@ cnspeed(dev_t dev, int sp) return CONSPEED; } -int pch_pos; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while (++pch_pos % 8) ; - break; - case '\n': - case '\r': - cnputc(c); - pch_pos = 0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char * ttyname(int fd) { diff --git a/sys/arch/loongson/stand/libsa/Makefile b/sys/arch/loongson/stand/libsa/Makefile index a9ceec78cc9..de176e7e5d0 100644 --- a/sys/arch/loongson/stand/libsa/Makefile +++ b/sys/arch/loongson/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.6 2014/07/13 09:26:08 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -17,7 +17,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdinc -mno-abicalls -D_NO_ABICALLS \ # stand routines 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 \ + memcmp.c memcpy.c memset.c printf.c putchar.c \ snprintf.c strchr.c strcmp.c strerror.c strncmp.c strncpy.c strtol.c # io routines diff --git a/sys/arch/macppc/stand/ofwboot/Makefile b/sys/arch/macppc/stand/ofwboot/Makefile index 7e67070e4a6..bcb7c6831ea 100644 --- a/sys/arch/macppc/stand/ofwboot/Makefile +++ b/sys/arch/macppc/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.10 2014/07/13 09:26:08 jasper Exp $ # $NetBSD: Makefile,v 1.2 1997/04/17 07:46:24 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -22,7 +22,8 @@ BINDIR= /usr/mdec .PATH: ${S}/lib/libsa .PATH: ${S}/lib/libkern/arch/powerpc ${S}/lib/libkern -SRCS+= getchar.c strlcpy.c memcpy.c strlen.c strrchr.c strlcat.c ashrdi3.c +SRCS+= getchar.c putchar.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 95bc07afacf..14ecb603d53 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.5 2014/07/12 23:34:54 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.6 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -79,37 +79,6 @@ cnspeed(dev_t dev, int s) return CONSPEED; } -int pch_pos; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while (++pch_pos % 8) ; - break; - case '\n': - case '\r': - cnputc(c); - pch_pos = 0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char * ttyname(int fd) { diff --git a/sys/arch/octeon/stand/libsa/Makefile b/sys/arch/octeon/stand/libsa/Makefile index 65ecba5c9df..3b8c9eff256 100644 --- a/sys/arch/octeon/stand/libsa/Makefile +++ b/sys/arch/octeon/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.4 2014/07/13 09:26:08 jasper Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -17,7 +17,7 @@ CFLAGS+= ${CEXTRAFLAGS} ${SAABI} -nostdinc -mno-abicalls -D_NO_ABICALLS \ # stand routines 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 \ + memcmp.c memcpy.c memset.c printf.c putchar.c \ snprintf.c strchr.c strcmp.c strerror.c strncmp.c strncpy.c strtol.c # io routines diff --git a/sys/arch/socppc/stand/boot/Makefile b/sys/arch/socppc/stand/boot/Makefile index 377b5e69adb..61cabdbc21a 100644 --- a/sys/arch/socppc/stand/boot/Makefile +++ b/sys/arch/socppc/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.15 2014/07/13 09:26:08 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+= getchar.c strlcpy.c strlen.c ashrdi3.c moddi3.c +SRCS+= getchar.c putchar.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 934de580014..7cf9401c51e 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.3 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: dev_socppc.c,v 1.4 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -39,38 +39,6 @@ cnspeed(dev_t dev, int sp) return CONSPEED; } -int pch_pos; - -void -putchar(c) - int c; -{ - switch(c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while(++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/arch/zaurus/stand/zboot/Makefile b/sys/arch/zaurus/stand/zboot/Makefile index 8e45e107256..d6e0a60f6f4 100644 --- a/sys/arch/zaurus/stand/zboot/Makefile +++ b/sys/arch/zaurus/stand/zboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2014/07/12 21:54:58 jasper Exp $ +# $OpenBSD: Makefile,v 1.15 2014/07/13 09:26:08 jasper Exp $ MAN= boot.8 MANSUBDIR=zaurus @@ -29,8 +29,8 @@ 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+= getchar.c strcmp.c strlcpy.c strlen.c strncmp.c strncpy.c write.c \ - ashrdi3.c divsi3.S divdi3.c moddi3.c qdivrem.c +SRCS+= getchar.c putchar.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 SRCS+= alloc.c cmd.c devopen.c diskprobe.c exec.c exit.c loadfile.c \ diff --git a/sys/arch/zaurus/stand/zboot/devopen.c b/sys/arch/zaurus/stand/zboot/devopen.c index e9e424182d2..70eb707c4c6 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.11 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: devopen.c,v 1.12 2014/07/13 09:26:08 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -98,37 +98,6 @@ devboot(dev_t bootdev, char *p) *p = '\0'; } -int pch_pos = 0; - -void -putchar(int c) -{ - switch (c) { - case '\177': /* DEL erases */ - cnputc('\b'); - cnputc(' '); - case '\b': - cnputc('\b'); - if (pch_pos) - pch_pos--; - break; - case '\t': - do - cnputc(' '); - while (++pch_pos % 8); - break; - case '\n': - case '\r': - cnputc(c); - pch_pos=0; - break; - default: - cnputc(c); - pch_pos++; - break; - } -} - char ttyname_buf[8]; char * diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile index 88113b81ff1..3a02abb715c 100644 --- a/sys/lib/libsa/Makefile +++ b/sys/lib/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.24 2013/01/01 18:49:33 miod Exp $ +# $OpenBSD: Makefile,v 1.25 2014/07/13 09:26:08 jasper Exp $ # $NetBSD: Makefile,v 1.13 1996/10/02 16:19:51 ws Exp $ LIB= sa @@ -24,8 +24,8 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD .endif # stand routines -SRCS+= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \ - printf.c snprintf.c strerror.c strcmp.c memset.c memcmp.c \ +SRCS+= alloc.c memcpy.c exit.c getfile.c getchar.c gets.c globals.c \ + printf.c putchar.c snprintf.c strerror.c strcmp.c memset.c memcmp.c \ strncpy.c strncmp.c strchr.c # math from libkern diff --git a/sys/lib/libsa/putchar.c b/sys/lib/libsa/putchar.c new file mode 100644 index 00000000000..f1eeb23f4a7 --- /dev/null +++ b/sys/lib/libsa/putchar.c @@ -0,0 +1,68 @@ +/* $OpenBSD: putchar.c,v 1.1 2014/07/13 09:26:08 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 pch_pos = 0; + +void +putchar(int c) +{ + switch (c) { + case '\177': /* DEL erases */ + cnputc('\b'); + cnputc(' '); + case '\b': + cnputc('\b'); + if (pch_pos) + pch_pos--; + break; + case '\t': + do + cnputc(' '); + while (++pch_pos % 8); + break; + case '\n': + case '\r': + cnputc(c); + pch_pos=0; + break; + default: + cnputc(c); + pch_pos++; + break; + } +} diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h index 63f9b738e6b..40273a5ed3f 100644 --- a/sys/lib/libsa/stand.h +++ b/sys/lib/libsa/stand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stand.h,v 1.57 2014/07/12 21:54:58 jasper Exp $ */ +/* $OpenBSD: stand.h,v 1.58 2014/07/13 09:26:08 jasper Exp $ */ /* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */ /*- @@ -185,7 +185,6 @@ 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 *);