From c53499b45ea4adf2085126c59ee819ac00b8d326 Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 10 Nov 2004 19:58:06 +0000 Subject: [PATCH] * Build.sh: bail out early if build failure * Build.sh: fix manpage name * chvt.c: Solaris: chvt.c:57: `TIOCSCTTY' undeclared (first use in this function) * chvt.c: GNU/Linux: /tmp/ccrAeq0h.o(.text+0x5e): In function `chvt': : warning: warning: revoke is not implemented and will always fail * sh.h: let it only change to .section .comment ifdef __ELF__ --- Build.sh | 5 +++-- chvt.c | 20 +++++++++++++------- sh.h | 6 +++++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Build.sh b/Build.sh index f599bd7..5bba156 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $MirBSD: Build.sh,v 1.14 2004/11/10 17:13:10 tg Exp $ +# $MirBSD: Build.sh,v 1.15 2004/11/10 19:58:06 tg Exp $ #- # Copyright (c) 2004 # Thorsten "mirabile" Glaser @@ -56,9 +56,10 @@ if test -e strlfun.c; then $SHELL ./emacs-gen.sh emacs.c >emacs.out echo "Building..." $CC $COPTS $CFLAGS $CPPFLAGS $LDFLAGS -o ksh.unstripped *.c + test -e ksh.unstripped || exit 1 echo "Finalizing..." tbl mksh.1 || cat ksh.1tbl >mksh.1 - nroff -mdoc -Tascii mksh.cat1 || rm -f mksh.cat1 + nroff -mdoc -Tascii mksh.cat1 || rm -f mksh.cat1 man=mksh.cat1 test -s $man || man=mksh.1 test -s $man || man=ksh.1tbl diff --git a/chvt.c b/chvt.c index e8d0d09..1b19405 100644 --- a/chvt.c +++ b/chvt.c @@ -1,15 +1,15 @@ -/** $MirBSD: chvt.c,v 1.1 2004/10/31 22:28:41 tg Exp $ */ +/** $MirBSD: chvt.c,v 1.2 2004/11/10 19:58:06 tg Exp $ */ /*- * Copyright (c) 2004 * Thorsten "mirabile" Glaser * * Licensee is hereby permitted to deal in this work without restric- - * tion, including unlimited rights to use, publically perform, modi- - * fy, merge, distribute, sell, give away or sublicence, provided the - * above copyright notices, these terms and the disclaimer are retai- - * ned in all redistributions, or reproduced in accompanying documen- - * tation or other materials provided with binary redistributions. + * tion, including unlimited rights to use, publicly perform, modify, + * merge, distribute, sell, give away or sublicence, provided all co- + * pyright notices above, these terms and the disclaimer are retained + * in all redistributions or reproduced in accompanying documentation + * or other materials provided with binary redistributions. * * Licensor hereby provides this work "AS IS" and WITHOUT WARRANTY of * any kind, expressed or implied, to the maximum extent permitted by @@ -24,20 +24,23 @@ #include #include "ksh_stat.h" -__RCSID("$MirBSD: chvt.c,v 1.1 2004/10/31 22:28:41 tg Exp $"); +__RCSID("$MirBSD: chvt.c,v 1.2 2004/11/10 19:58:06 tg Exp $"); char * chvt(char *f) { +#ifdef TIOCSCTTY int fd; if (chown(f, 0, 0)) return "chown"; if (chmod(f, 0600)) return "chmod"; +#ifndef linux if (revoke(f)) return "revoke"; +#endif if ((fd = open(f, O_RDWR)) == -1) { sleep(1); @@ -63,4 +66,7 @@ chvt(char *f) close(fd); return NULL; +#else + return "TIOCSCTTY not implemented"; +#endif } diff --git a/sh.h b/sh.h index 7e053d2..8538e13 100644 --- a/sh.h +++ b/sh.h @@ -1,4 +1,4 @@ -/** $MirBSD: sh.h,v 1.18 2004/11/10 17:31:38 tg Exp $ */ +/** $MirBSD: sh.h,v 1.19 2004/11/10 19:58:06 tg Exp $ */ /* $OpenBSD: sh.h,v 1.18 2004/05/31 10:36:35 otto Exp $ */ #ifndef SH_H @@ -723,8 +723,12 @@ EXTERN int x_cols I__(80); /* tty columns */ #undef I__ #ifndef __RCSID +#ifdef __ELF__ #define __RCSID(x) static const char __rcsid[] \ GCC_FUNC_ATTR(section(".comment")) = (x) +#else +#define __RCSID(x) static const char __rcsid[] = (x) +#endif #endif #endif /* ndef SH_H */