-# $OpenBSD: Makefile,v 1.3 1996/12/08 14:32:35 downsj Exp $
+# $OpenBSD: Makefile,v 1.4 1997/03/07 21:54:48 gene Exp $
# $NetBSD: Makefile,v 1.3 1994/12/07 08:49:07 jtc Exp $
PROG= tput
DPADD= ${LIBTERMCAP}
LDADD= -ltermcap
MLINKS= tput.1 clear.1
-
-beforeinstall:
- ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/clear.sh ${DESTDIR}/usr/bin/clear
+LINKS= ${BINDIR}/tput ${BINDIR}/clear
.include <bsd.prog.mk>
-/* $OpenBSD: tput.c,v 1.3 1997/01/15 23:43:23 millert Exp $ */
+/* $OpenBSD: tput.c,v 1.4 1997/03/07 21:54:48 gene Exp $ */
/* $NetBSD: tput.c,v 1.8 1995/08/31 22:11:37 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)tput.c 8.3 (Berkeley) 4/28/95";
#endif
-static char rcsid[] = "$OpenBSD: tput.c,v 1.3 1997/01/15 23:43:23 millert Exp $";
+static char rcsid[] = "$OpenBSD: tput.c,v 1.4 1997/03/07 21:54:48 gene Exp $";
#endif /* not lint */
#include <termios.h>
extern char *optarg;
extern int optind;
int ch, exitval, n;
- char *cptr, *p, *term, buf[1024], tbuf[1024];
+ char *argv0, *cptr, *p, *term, buf[1024], tbuf[1024];
term = NULL;
while ((ch = getopt(argc, argv, "T:")) != -1)
default:
usage();
}
+ if ((argv0 = (char *)strrchr(argv[0], '/')) != NULL)
+ argv0++;
+ else
+ argv0 = argv[0];
argc -= optind;
argv += optind;
+
if (!term && !(term = getenv("TERM")))
errx(2, "no terminal type specified and no TERM environmental variable.");
if (tgetent(tbuf, term) != 1)
err(2, "tgetent failure");
setospeed();
+ if (strcmp(argv0, "clear") == 0) {
+ *argv = "clear";
+ *(argv+1) = NULL;
+ }
for (exitval = 0; (p = *argv) != NULL; ++argv) {
switch (*p) {
case 'c':