From owner-freebsd-bugs Sat Dec 12 22:50:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA20999 for freebsd-bugs-outgoing; Sat, 12 Dec 1998 22:50:03 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA20986 for ; Sat, 12 Dec 1998 22:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from Unknown UID 563@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id WAA15560; Sat, 12 Dec 1998 22:50:01 -0800 (PST) Received: from genius.cirx.org (r00t.m1.ntu.edu.tw [140.112.240.59]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA20212 for ; Sat, 12 Dec 1998 22:41:58 -0800 (PST) (envelope-from clkao@genius.cirx.org) Received: (from root@localhost) by genius.cirx.org (8.9.1/8.9.1) id OAA20036; Sun, 13 Dec 1998 14:43:54 +0800 (CST) (envelope-from clkao) Message-Id: <199812130643.OAA20036@genius.cirx.org> Date: Sun, 13 Dec 1998 14:43:54 +0800 (CST) From: clkao@CirX.ORG Reply-To: clkao@CirX.ORG To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/9064: [PATCH] propose adding `direct' option in fetch(3) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 9064 >Category: bin >Synopsis: [PATCH] propose adding `direct' option in fetch(3) >Confidential: yes >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Dec 12 22:50:00 PST 1998 >Last-Modified: >Originator: Chia-liang Kao >Organization: CirX >Release: FreeBSD 3.0-CURRENT i386 >Environment: FreeBSD genius.cirx.org 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Mon Dec 7 12:16:11 CST 1998 clkao@genius.cirx.org:/usr/src/sys/compile/GENIUS i386 >Description: When `make fetch', we usually add a very nearby site in MASTER_SITE_BACKUP, and then some of the primary distfile-mirroring sites. The problem is that, I'd like those nearby site being fetched directly, rather than via proxies, while the actually far sites(like ftp.freebsd.org) go through proxies. >How-To-Repeat: >Fix: Here is a patch adding a `-d' option to fetch(3). the `d' stands for `direct' (it's quite hard to find an unused option character in fetch! :p) you can modify your MASTER_SITE_BACKUP like this: MASTER_SITE_BACKUP?= \ "-d ftp://oio/pub/freebsd/distfiles/${DIST_SUBDIR}/" \ "-d ftp://freebsd.ntu.edu.tw/pub/FreeBSD/distfiles/${DIST_SUBDIR}/" \ "-d ftp://bsd.sinica.edu.tw/pub/FreeBSD/distfiles/${DIST_SUBDIR}/" \ ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ cvs diff: Diffing . Index: fetch.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/fetch/fetch.1,v retrieving revision 1.26 diff -u -r1.26 fetch.1 --- fetch.1 1998/12/08 13:00:48 1.26 +++ fetch.1 1998/12/13 06:30:13 @@ -61,6 +61,8 @@ The file to retrieve is in directory .Ar dir on the remote host. +.It Fl d +Directly fetch from the host; skip PROTO_PROXY environment variables. .It Fl f Ar file The file to retrieve is named .Ar file Index: fetch.h =================================================================== RCS file: /home/ncvs/src/usr.bin/fetch/fetch.h,v retrieving revision 1.7 diff -u -r1.7 fetch.h --- fetch.h 1998/12/08 13:00:49 1.7 +++ fetch.h 1998/12/13 06:20:02 @@ -53,6 +53,7 @@ int fs_use_connect; /* -t option */ off_t fs_expectedsize; /* -S option */ int fs_reportsize; /* -s option */ + int fs_skip_proxy; /* -d option */ time_t fs_modtime; void *fs_proto; int (*fs_retrieve)(struct fetch_state *); Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/fetch/main.c,v retrieving revision 1.49 diff -u -r1.49 main.c --- main.c 1998/12/08 13:00:49 1.49 +++ main.c 1998/12/13 06:24:46 @@ -52,7 +52,7 @@ usage() { fprintf(stderr, "%s\n%s\n", - "usage: fetch [-DHILMNPRTVablmnpqrstv] [-o outputfile] [-S bytes]", + "usage: fetch [-DHILMNPRTVabdlmnpqrstv] [-o outputfile] [-S bytes]", " [-f file -h host [-c dir] | URL]"); exit(EX_USAGE); } @@ -68,14 +68,13 @@ int error, rv; unsigned long l; - init_schemes(); fs = clean_fetch_state; fs.fs_verbose = 1; fs.fs_reportsize = 0; fs.fs_expectedsize = -1; change_to_dir = file_to_get = hostname = 0; - while ((c = getopt(argc, argv, "abc:D:f:h:HIlLmMnNo:pPqRrS:stT:vV:")) != -1) { + while ((c = getopt(argc, argv, "abc:dD:f:h:HIlLmMnNo:pPqRrS:stT:vV:")) != -1) { switch (c) { case 'D': case 'H': case 'I': case 'L': case 'N': case 'V': break; /* ncftp compatibility */ @@ -92,6 +91,10 @@ change_to_dir = optarg; break; + case 'd': + fs.fs_skip_proxy = 1; + break; + case 'f': file_to_get = optarg; break; @@ -174,6 +177,8 @@ } clean_fetch_state = fs; /* preserve option settings */ + if(!fs.fs_skip_proxy) + init_schemes(); if (argv[optind] && (hostname || change_to_dir || file_to_get)) { warnx("cannot use -h, -c, or -f with a URI argument"); >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message