Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pkg_install Properly re-implement hilighting of the...
details: https://anonhg.NetBSD.org/src/rev/0c9448a3ed77
branches: trunk
changeset: 538710:0c9448a3ed77
user: hubertf <hubertf%NetBSD.org@localhost>
date: Sat Oct 26 14:43:43 2002 +0000
description:
Properly re-implement hilighting of the dialogue with the ftp(1)
process.
Thanks again for the throughout notification I got before that
was removed! :(
diffstat:
usr.sbin/pkg_install/Makefile.inc | 4 ++--
usr.sbin/pkg_install/lib/ftpio.c | 27 ++++++++++++++++++++++-----
2 files changed, 24 insertions(+), 7 deletions(-)
diffs (99 lines):
diff -r f985d8247efd -r 0c9448a3ed77 usr.sbin/pkg_install/Makefile.inc
--- a/usr.sbin/pkg_install/Makefile.inc Sat Oct 26 13:50:17 2002 +0000
+++ b/usr.sbin/pkg_install/Makefile.inc Sat Oct 26 14:43:43 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.22 2002/10/17 03:31:33 christos Exp $
+# $NetBSD: Makefile.inc,v 1.23 2002/10/26 14:43:44 hubertf Exp $
# Original from FreeBSD, no rcs id.
.include <bsd.own.mk>
@@ -35,7 +35,7 @@
#CPPFLAGS+= -DCHGRP_CMD='"${CHGRP_CMD}"'
DPADD+= ${LIBINSTALL}/libinstall.a
-LDADD+= -L${LIBINSTALL} -linstall
+LDADD+= -L${LIBINSTALL} -linstall -ltermcap
.if exists(${.CURDIR}/../../Makefile.inc)
.include "${.CURDIR}/../../Makefile.inc"
diff -r f985d8247efd -r 0c9448a3ed77 usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c Sat Oct 26 13:50:17 2002 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c Sat Oct 26 14:43:43 2002 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: ftpio.c,v 1.46 2002/10/26 12:37:00 hubertf Exp $ */
+/* $NetBSD: ftpio.c,v 1.47 2002/10/26 14:43:43 hubertf Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.46 2002/10/26 12:37:00 hubertf Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.47 2002/10/26 14:43:43 hubertf Exp $");
#endif
/*
@@ -48,6 +48,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <termcap.h>
#include <unistd.h>
#ifdef EXPECT_DEBUG
#include <vis.h>
@@ -84,6 +85,9 @@
static int ftp_started=0;
static fds ftpio;
static int ftp_pid;
+static char term[1024];
+static char bold_on[1024];
+static char bold_off[1024];
/*
* expect "str" (a regular expression) on file descriptor "fd", storing
@@ -219,11 +223,14 @@
int
ftp_cmd(const char *cmd, const char *expectstr)
{
- int rc=0;
+ int rc=0, verbose_ftp=0;
int len;
if (Verbose)
- fprintf(stderr, "\nftp> %s", cmd);
+ verbose_ftp=1;
+
+ if (verbose_ftp)
+ fprintf(stderr, "\n%sftp> %s%s", bold_on, cmd, bold_off);
fflush(stdout);
len = write(ftpio.command, cmd, strlen(cmd));
@@ -301,7 +308,7 @@
setbuf(stdout, NULL);
if (Verbose)
- fprintf(stderr, "ftp -detv %s\n", base);
+ fprintf(stderr, "%sftp -detv %s%s\n", bold_on, base, bold_off);
rc1 = execlp(FTP_CMD, argv0, "-detv", base, NULL);
warn("setupCoproc: execlp() failed");
exit(1);
@@ -404,12 +411,22 @@
ftp_start(char *base)
{
const char *tmp1, *tmp2;
+ char *p;
int rc;
char newHost[MAXHOSTNAMELEN];
const char *newDir;
const char *currentHost=getenv(PKG_FTPIO_CURRENTHOST);
const char *currentDir=getenv(PKG_FTPIO_CURRENTDIR);
int urllen;
+
+ /* talk to termcap for bold on/off escape sequences */
+ if (tgetent(term, getenv("TERM")) < 0) {
+ bold_on[0] = '\0';
+ bold_off[0] = '\0';
+ } else {
+ p = bold_on; tgetstr("md", &p);
+ p = bold_off; tgetstr("me", &p);
+ }
fileURLHost(base, newHost, sizeof(newHost));
urllen = URLlength(base);
Home |
Main Index |
Thread Index |
Old Index