Date: Mon, 26 Feb 2001 00:10:34 +0300 (MSK) From: "Aleksandr A.Babaylov" <babolo@links.ru> To: des@ofug.org (Dag-Erling Smorgrav) Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/24977: fetch: noice in quiet mode (fix) Message-ID: <200102252110.AAA08675@aaz.links.ru> In-Reply-To: <xzphf1zsq23.fsf@flood.ping.uio.no> from "Dag-Erling Smorgrav" at "Feb 12, 1 07:40:20 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
--ELM983135434-8384-0_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Dag-Erling Smorgrav writes: > "Aleksandr A.Babaylov" <babolo@links.ru> writes: > > Is it accessible if flag -qq delays such a message? > > If so I'll send a patch. > > Yes, that would be a good compromise. > > DES > -- > Dag-Erling Smorgrav - des@ofug.org See patch in attach -- @BABOLO http://links.ru/ --ELM983135434-8384-0_ Content-Type: text/plain; charset=KOI8-R Content-Disposition: attachment; filename=fetch.patch Content-Description: /tmp/babolo/fetch.patch Content-Transfer-Encoding: 7bit --- fetch.c.orig Wed Dec 27 19:42:09 2000 +++ fetch.c Sun Feb 25 22:40:50 2001 @@ -45,6 +45,7 @@ #include <fetch.h> #define MINBUFSIZE 4096 +#define V_NORM 2 /* Option flags */ int A_flag; /* -A: do not follow 302 redirects */ @@ -72,7 +73,7 @@ int s_flag; /* -s: show size, don't fetch */ off_t S_size; /* -S: require size to match */ int t_flag; /*! -t: workaround TCP bug */ -int v_level = 1; /* -v: verbosity level */ +int v_level = V_NORM;/* -v: verbosity level */ int v_tty; /* stdout is a tty */ u_int w_secs; /* -w: retry delay */ int family = PF_UNSPEC; /* -[46]: address family to use */ @@ -113,7 +114,7 @@ { struct timeval now; - if (!v_tty || !v_level) + if (!v_tty || v_level < V_NORM) return; gettimeofday(&now, NULL); @@ -155,7 +156,7 @@ double delta; double bps; - if (!v_level) + if (v_level < V_NORM) return; gettimeofday(&xs->end, NULL); @@ -212,7 +213,7 @@ count = 0; /* common flags */ - if (v_level > 1) + if (v_level > V_NORM) strcat(flags, "v"); switch (family) { case PF_INET: @@ -305,9 +306,9 @@ goto success; } - if (us.size == -1) + if (us.size == -1 && v_level) warnx("%s: size of remote file is not known", path); - if (v_level > 1) { + if (v_level > V_NORM) { if (sb.st_size != -1) fprintf(stderr, "local size / mtime: %lld / %ld\n", sb.st_size, sb.st_mtime); @@ -327,8 +328,9 @@ fclose(f); /* if precious, warn the user and give up */ if (R_flag) { - warnx("%s: local modification time does not match remote", - path); + if (v_level) + warnx("%s: local modification time does not match remote", + path); goto failure_keep; } url->offset = 0; @@ -416,19 +418,19 @@ tv[0].tv_sec = (long)(us.atime ? us.atime : us.mtime); tv[1].tv_sec = (long)us.mtime; tv[0].tv_usec = tv[1].tv_usec = 0; - if (utimes(path, tv)) + if (utimes(path, tv) && v_level) warn("%s: utimes()", path); } /* timed out or interrupted? */ signal: - if (sigalrm) + if (sigalrm && v_level) warnx("transfer timed out"); if (sigint) { warnx("transfer interrupted"); goto failure; } - + if (!sigalrm) { /* check the status of our files */ if (ferror(f)) @@ -441,8 +443,8 @@ /* did the transfer complete normally? */ if (us.size != -1 && count < us.size) { - warnx("%s appears to be truncated: %lld/%lld bytes", - path, count, us.size); + if (v_level) warnx("%s appears to be truncated: %lld/%lld bytes", + path, count, us.size); goto failure_keep; } @@ -451,7 +453,7 @@ * expect, assume the worst (i.e. we didn't get all of it) */ if (sigalrm && us.size == -1) { - warnx("%s may be truncated", path); + if (v_level) warnx("%s may be truncated", path); goto failure_keep; } @@ -577,7 +579,7 @@ p_flag = 1; break; case 'q': - v_level = 0; + if (v_level) v_level--; break; case 'R': R_flag = 1; @@ -727,7 +729,7 @@ && fetchLastErrCode != FETCH_RESOLV && fetchLastErrCode != FETCH_UNKNOWN)) { if (w_secs) { - if (v_level) + if (v_level >= V_NORM) fprintf(stderr, "Waiting %d seconds before retrying\n", w_secs); sleep(w_secs); --ELM983135434-8384-0_-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102252110.AAA08675>