;; IPv6 patch for fetch-20000508 ;; May 13, 2000 by Hajimu UMEMOTO ;; Index: fetch/fetch.1 diff -u fetch/fetch.1.orig fetch/fetch.1 --- fetch/fetch.1.orig Mon May 8 16:39:35 2000 +++ fetch/fetch.1 Sat May 13 02:50:40 2000 @@ -35,7 +35,7 @@ .Nd retrieve a file by Uniform Resource Locator .Sh SYNOPSIS .Nm -.Op Fl AHMPRalmnpqrsv +.Op Fl 46AHMPRalmnpqrsv .Op Fl B Ar bytes .Op Fl S Ar bytes .Op Fl T Ar seconds @@ -52,6 +52,14 @@ .Pp The following options are available: .Bl -tag -width Fl +.It Fl 4 +Forces +.Nm +to use IPv4 addresses only. +.It Fl 6 +Forces +.Nm +to use IPv6 addresses only. .It Fl a Automatically retry the transfer upon soft failures. .It Fl B Ar bytes Index: fetch/fetch.c diff -u fetch/fetch.c.orig fetch/fetch.c --- fetch/fetch.c.orig Mon May 8 16:28:00 2000 +++ fetch/fetch.c Sat May 13 02:01:27 2000 @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -70,6 +71,7 @@ int v_level = 1; /* -v: verbosity level */ int v_tty; /* stdout is a tty */ int w_secs; /* -w: retry delay */ +int family = PF_UNSPEC; /* -[46]: address family to use */ int ftp_timeout; /* default timeout for FTP transfers */ @@ -104,6 +106,14 @@ if (v_level > 2) strcat(flags, "v"); + switch (family) { + case PF_INET: + strcat(flags, "4"); + break; + case PF_INET6: + strcat(flags, "6"); + break; + } /* FTP specific flags */ if (strcmp(url->scheme, "ftp") == 0) { @@ -355,8 +365,15 @@ char *p, *q, *s; int c, e, r; - while ((c = getopt(argc, argv, "AaB:bdf:h:lHMmnPpo:qRrS:sT:tvw:")) != EOF) + while ((c = getopt(argc, argv, + "46AaB:bdf:h:lHMmnPpo:qRrS:sT:tvw:")) != EOF) switch (c) { + case '4': + family = PF_INET; + break; + case '6': + family = PF_INET6; + break; case 'A': warnx("warning: the -A option is currently unimplemented"); A_flag = 1;