From owner-svn-src-head@FreeBSD.ORG Wed Dec 17 18:00:18 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AD2A1065672; Wed, 17 Dec 2008 18:00:18 +0000 (UTC) (envelope-from murray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55D408FC20; Wed, 17 Dec 2008 18:00:18 +0000 (UTC) (envelope-from murray@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBHI0IBu011055; Wed, 17 Dec 2008 18:00:18 GMT (envelope-from murray@svn.freebsd.org) Received: (from murray@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBHI0I3K011053; Wed, 17 Dec 2008 18:00:18 GMT (envelope-from murray@svn.freebsd.org) Message-Id: <200812171800.mBHI0I3K011053@svn.freebsd.org> From: Murray Stokely Date: Wed, 17 Dec 2008 18:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186241 - in head: lib/libfetch usr.bin/fetch X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2008 18:00:18 -0000 Author: murray Date: Wed Dec 17 18:00:18 2008 New Revision: 186241 URL: http://svn.freebsd.org/changeset/base/186241 Log: 1. Update fetch to consistently return 1 on error, as the man page states, rather than usually returning 1 but in a few instances using a sysexits(3) return value. 2. Remove a few unused variables from libfetch. PR: docs/122470 (1, only) Reviewed by: des > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. M usr.bin/fetch/fetch.c M lib/libfetch/fetch.c Modified: head/lib/libfetch/fetch.c head/usr.bin/fetch/fetch.c Modified: head/lib/libfetch/fetch.c ============================================================================== --- head/lib/libfetch/fetch.c Wed Dec 17 17:43:22 2008 (r186240) +++ head/lib/libfetch/fetch.c Wed Dec 17 18:00:18 2008 (r186241) @@ -74,9 +74,7 @@ static struct fetcherr url_errlist[] = { FILE * fetchXGet(struct url *URL, struct url_stat *us, const char *flags) { - int direct; - direct = CHECK_FLAG('d'); if (us != NULL) { us->size = -1; us->atime = us->mtime = 0; @@ -110,9 +108,7 @@ fetchGet(struct url *URL, const char *fl FILE * fetchPut(struct url *URL, const char *flags) { - int direct; - direct = CHECK_FLAG('d'); if (strcasecmp(URL->scheme, SCHEME_FILE) == 0) return (fetchPutFile(URL, flags)); else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) @@ -132,9 +128,7 @@ fetchPut(struct url *URL, const char *fl int fetchStat(struct url *URL, struct url_stat *us, const char *flags) { - int direct; - direct = CHECK_FLAG('d'); if (us != NULL) { us->size = -1; us->atime = us->mtime = 0; @@ -158,9 +152,7 @@ fetchStat(struct url *URL, struct url_st struct url_ent * fetchList(struct url *URL, const char *flags) { - int direct; - direct = CHECK_FLAG('d'); if (strcasecmp(URL->scheme, SCHEME_FILE) == 0) return (fetchListFile(URL, flags)); else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) Modified: head/usr.bin/fetch/fetch.c ============================================================================== --- head/usr.bin/fetch/fetch.c Wed Dec 17 17:43:22 2008 (r186240) +++ head/usr.bin/fetch/fetch.c Wed Dec 17 18:00:18 2008 (r186241) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -865,7 +864,7 @@ main(int argc, char *argv[]) break; default: usage(); - exit(EX_USAGE); + exit(1); } argc -= optind; @@ -874,7 +873,7 @@ main(int argc, char *argv[]) if (h_hostname || f_filename || c_dirname) { if (!h_hostname || !f_filename || argc) { usage(); - exit(EX_USAGE); + exit(1); } /* XXX this is a hack. */ if (strcspn(h_hostname, "@:/") != strlen(h_hostname)) @@ -887,7 +886,7 @@ main(int argc, char *argv[]) if (!argc) { usage(); - exit(EX_USAGE); + exit(1); } /* allocate buffer */ @@ -928,10 +927,10 @@ main(int argc, char *argv[]) } else if (stat(o_filename, &sb) == -1) { if (errno == ENOENT) { if (argc > 1) - errx(EX_USAGE, "%s is not a directory", + errx(1, "%s is not a directory", o_filename); } else { - err(EX_IOERR, "%s", o_filename); + err(1, "%s", o_filename); } } else { if (sb.st_mode & S_IFDIR)