* 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__
This commit is contained in:
tg 2004-11-10 19:58:06 +00:00
parent 53f8234d04
commit c53499b45e
3 changed files with 21 additions and 10 deletions

View File

@ -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 <x86@ePost.de>
@ -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 <ksh.1tbl >mksh.1 || cat ksh.1tbl >mksh.1
nroff -mdoc -Tascii <ksh.1 >mksh.cat1 || rm -f mksh.cat1
nroff -mdoc -Tascii <mksh.1 >mksh.cat1 || rm -f mksh.cat1
man=mksh.cat1
test -s $man || man=mksh.1
test -s $man || man=ksh.1tbl

20
chvt.c
View File

@ -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 <tg@66h.42h.de>
*
* 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 <sys/ioctl.h>
#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
}

6
sh.h
View File

@ -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 */