diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-misc/snarf | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-misc/snarf')
-rw-r--r-- | net-misc/snarf/Manifest | 1 | ||||
-rw-r--r-- | net-misc/snarf/files/snarf-basename-patch.diff | 147 | ||||
-rw-r--r-- | net-misc/snarf/files/snarf-fix-off-by-ones.diff | 45 | ||||
-rw-r--r-- | net-misc/snarf/files/snarf-unlink-empty.diff | 37 | ||||
-rw-r--r-- | net-misc/snarf/metadata.xml | 12 | ||||
-rw-r--r-- | net-misc/snarf/snarf-7.0-r3.ebuild | 35 |
6 files changed, 277 insertions, 0 deletions
diff --git a/net-misc/snarf/Manifest b/net-misc/snarf/Manifest new file mode 100644 index 000000000000..fbb108bd3cea --- /dev/null +++ b/net-misc/snarf/Manifest @@ -0,0 +1 @@ +DIST snarf-7.0.tar.gz 64495 SHA256 85a0846d452b02eaff225bf68fb36e68dfc55be5a58fda38dcb3602dcc300a89 diff --git a/net-misc/snarf/files/snarf-basename-patch.diff b/net-misc/snarf/files/snarf-basename-patch.diff new file mode 100644 index 000000000000..85cafb527d68 --- /dev/null +++ b/net-misc/snarf/files/snarf-basename-patch.diff @@ -0,0 +1,147 @@ +diff -ruN snarf-7.0.orig/http.c snarf-7.0/http.c +--- snarf-7.0.orig/http.c 2000-08-09 01:33:30.000000000 +0100 ++++ snarf-7.0/http.c 2003-07-28 12:19:08.000000000 +0100 +@@ -14,8 +14,6 @@ + #include "util.h" + #include "llist.h" + +-extern int default_opts; +- + int redirect_count = 0; + #define REDIRECT_MAX 10 + +diff -ruN snarf-7.0.orig/options.c snarf-7.0/options.c +--- snarf-7.0.orig/options.c 1999-07-27 20:42:51.000000000 +0100 ++++ snarf-7.0/options.c 2003-07-28 11:59:05.000000000 +0100 +@@ -8,8 +8,8 @@ + int default_opts; + extern int debug_enabled; + +-unsigned char +-set_options(unsigned char opts, char *optstring) ++unsigned int ++set_options(unsigned int opts, char *optstring) + { + int i; + +@@ -78,6 +78,15 @@ + case 'd': + debug_enabled = !debug_enabled; + break; ++ ++ case 'b': ++ opts |= OPT_BASENAME; ++ break; ++ ++ case 'B': ++ default_opts |= OPT_BASENAME; ++ break; ++ + default: + report(WARN, "unknown option `%c', ignoring", optstring[i]); + } +diff -ruN snarf-7.0.orig/options.h snarf-7.0/options.h +--- snarf-7.0.orig/options.h 1999-07-27 20:42:51.000000000 +0100 ++++ snarf-7.0/options.h 2003-07-28 12:20:47.000000000 +0100 +@@ -12,12 +12,13 @@ + #define OPT_PROGRESS (1 << 5) /* for python aka markus fleck */ + #define OPT_BE_MOZILLA (1 << 6) /* To act like Mozilla */ + #define OPT_BE_MSIE (1 << 7) /* To act like MSIE */ ++#define OPT_BASENAME (1 << 8) /* Only show basename() of output */ + + /* Funcs */ + + #ifdef PROTOTYPES + +-unsigned char set_options(unsigned char, char *); ++unsigned int set_options(unsigned int, char *); + + #endif /* PROTOTYPES */ + +diff -ruN snarf-7.0.orig/snarf.1 snarf-7.0/snarf.1 +--- snarf-7.0.orig/snarf.1 2000-01-17 14:26:13.000000000 +0000 ++++ snarf-7.0/snarf.1 2003-07-28 12:45:26.000000000 +0100 +@@ -90,6 +90,9 @@ + .I "\-m" + Send a user-agent string similar to what Microsoft Internet Explorer + uses. ++.TP ++.I "\-b" ++Only print the basename of output file with the progress bars. + .PP + Each option only affects the URL that immediately follows it. To have + an option affect all URLs that follow it, use an uppercase letter for +diff -ruN snarf-7.0.orig/snarf.c snarf-7.0/snarf.c +--- snarf-7.0.orig/snarf.c 2000-08-09 01:34:45.000000000 +0100 ++++ snarf-7.0/snarf.c 2003-07-28 12:43:29.000000000 +0100 +@@ -50,6 +50,7 @@ + " -n Ignore '-r' and transfer file in its entirety\n" + " -m Spoof MSIE user-agent string\n" + " -z Spoof Navigator user-agent string\n" ++ " -b Only print basename of output file\n" + "\n" + "Lowercase option letters only affect the URLs that " + "immediately follow them.\n" +diff -ruN snarf-7.0.orig/url.h snarf-7.0/url.h +--- snarf-7.0.orig/url.h 1999-07-27 20:42:51.000000000 +0100 ++++ snarf-7.0/url.h 2003-07-28 12:00:03.000000000 +0100 +@@ -28,7 +28,7 @@ + char *proxy; + char *proxy_username; + char *proxy_password; +- unsigned char options; ++ unsigned int options; + off_t outfile_size; + off_t outfile_offset; + }; +diff -ruN snarf-7.0.orig/util.c snarf-7.0/util.c +--- snarf-7.0.orig/util.c 2000-08-09 01:12:39.000000000 +0100 ++++ snarf-7.0/util.c 2003-07-28 13:29:46.000000000 +0100 +@@ -32,6 +32,7 @@ + #include <ctype.h> + #include <errno.h> + #include <time.h> ++#include <libgen.h> + #include "url.h" + #include "options.h" + +@@ -292,6 +293,10 @@ + + filename = strdup(rsrc->outfile); + ++ if( rsrc->options & OPT_BASENAME ){ ++ filename = basename(filename); ++ } ++ + if( strlen(filename) > 24 ) + filename[24] = '\0'; + +@@ -312,6 +317,7 @@ + progress_update(Progress * p, + long int increment) + { ++ char *filename = NULL; + unsigned int units; + char *anim = "-\\|/"; + +@@ -320,12 +326,16 @@ + + p->current += increment; + +- if (strlen(p->rsrc->outfile) > 24) { +- p->rsrc->outfile[24] = '\0'; +- } ++ if( p->rsrc->options & OPT_BASENAME ){ ++ filename = basename(strdup(p->rsrc->outfile)); ++ } else ++ filename = strdup(p->rsrc->outfile); + ++ if (strlen(filename) > 24) ++ filename[24] = '\0'; ++ + fprintf(stderr, "\r"); +- fprintf(stderr, "%-25s [", p->rsrc->outfile); ++ fprintf(stderr, "%-25s [", filename); + + + if( p->length ) { diff --git a/net-misc/snarf/files/snarf-fix-off-by-ones.diff b/net-misc/snarf/files/snarf-fix-off-by-ones.diff new file mode 100644 index 000000000000..c0556b3ed851 --- /dev/null +++ b/net-misc/snarf/files/snarf-fix-off-by-ones.diff @@ -0,0 +1,45 @@ +diff -ruNp snarf-7.0.orig/ftp.c snarf-7.0/ftp.c +--- snarf-7.0.orig/ftp.c 2000-08-09 00:27:24.000000000 +0100 ++++ snarf-7.0/ftp.c 2007-03-30 20:47:46.046783664 +0100 +@@ -89,7 +89,7 @@ get_line(UrlResource *rsrc, int control) + char *end; + char buf[BUFSIZE+1]; + +- while( (bytes_read = read(control, buf, BUFSIZE)) ) { ++ while( (bytes_read = read(control, buf, BUFSIZE)) > 0 ) { + if( rsrc->options & OPT_VERBOSE ) + fwrite(buf, 1, bytes_read, stderr); + +diff -ruNp snarf-7.0.orig/http.c snarf-7.0/http.c +--- snarf-7.0.orig/http.c 2007-03-30 20:46:21.176685880 +0100 ++++ snarf-7.0/http.c 2007-03-30 20:47:46.205759496 +0100 +@@ -365,7 +365,7 @@ http_transfer(UrlResource *rsrc) + + bytes_read = read(sock, buf, 8); + +- if( bytes_read == 0 ) { ++ if( bytes_read <= 0 ) { + close(sock); + return 0; + } +diff -ruNp snarf-7.0.orig/url.c snarf-7.0/url.c +--- snarf-7.0.orig/url.c 1998-11-16 01:29:44.000000000 +0000 ++++ snarf-7.0/url.c 2007-03-30 20:47:46.205759496 +0100 +@@ -96,7 +96,7 @@ get_username(char *string, Url *u) + return string; + } + +- username = malloc(i); ++ username = malloc(i+1); + memcpy(username, string, i + 1); + + username[i] = '\0'; +@@ -135,7 +135,7 @@ get_password(char *string, Url *u) + + for(i = 0 ; string[i] != '@'; i++); + +- password = malloc(i); ++ password = malloc(i+1); + + /* and finally, get the password portion */ + memcpy(password, string, i); diff --git a/net-misc/snarf/files/snarf-unlink-empty.diff b/net-misc/snarf/files/snarf-unlink-empty.diff new file mode 100644 index 000000000000..66f3089b0b63 --- /dev/null +++ b/net-misc/snarf/files/snarf-unlink-empty.diff @@ -0,0 +1,37 @@ +diff -urN snarf-7.0.orig/http.c snarf-7.0/http.c +--- snarf-7.0.orig/http.c 2003-08-01 14:46:26.000000000 +0100 ++++ snarf-7.0/http.c 2003-08-01 14:44:02.000000000 +0100 +@@ -447,6 +447,10 @@ + cleanup: + free_http_header(header); + close(sock); fclose(out); ++ if ((rsrc->open_created) && (rsrc->outfile_size == 0) ++ && (retval == 0)) ++ if (unlink(rsrc->outfile)) ++ report(ERR, "unlink %s: %s", rsrc->outfile, strerror(errno)); + return retval; + + } +diff -urN snarf-7.0.orig/url.h snarf-7.0/url.h +--- snarf-7.0.orig/url.h 2003-08-01 14:46:26.000000000 +0100 ++++ snarf-7.0/url.h 2003-08-01 13:27:22.000000000 +0100 +@@ -25,6 +25,7 @@ + struct _UrlResource { + Url *url; + char *outfile; ++ unsigned int open_created; + char *proxy; + char *proxy_username; + char *proxy_password; +diff -urN snarf-7.0.orig/util.h snarf-7.0/util.h +--- snarf-7.0.orig/util.h 2000-08-09 01:12:25.000000000 +0100 ++++ snarf-7.0/util.h 2003-08-01 14:53:54.000000000 +0100 +@@ -53,7 +53,7 @@ + extern int debug_enabled; + + #define open_outfile(x) (((x)->outfile[0] == '-') ? stdout : real_open_outfile(x)) +-#define real_open_outfile(x) (((x)->options & OPT_RESUME && !((x)->options & OPT_NORESUME)) ? (fopen((x)->outfile, "a")) : (fopen((x)->outfile, "w"))) ++#define real_open_outfile(x) (((x)->open_created = (access ((x)->outfile, F_OK)) ? 1 : 0 ),((x)->options & OPT_RESUME && !((x)->options & OPT_NORESUME)) ? (fopen((x)->outfile, "a")) : (fopen((x)->outfile, "w"))) + + #define safe_free(x) if(x) free(x) + #define safe_strdup(x) ( (x) ? strdup(x) : NULL ) diff --git a/net-misc/snarf/metadata.xml b/net-misc/snarf/metadata.xml new file mode 100644 index 000000000000..5b3bf5b24045 --- /dev/null +++ b/net-misc/snarf/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>maintainer-needed@gentoo.org</email> + </maintainer> + <longdescription lang="en"> + snarf is a command line resource grabber. It can transfer files through + the http, gopher, finger, and ftp protocols without user interaction. + It is small and fast. + </longdescription> +</pkgmetadata> diff --git a/net-misc/snarf/snarf-7.0-r3.ebuild b/net-misc/snarf/snarf-7.0-r3.ebuild new file mode 100644 index 000000000000..f3fa8939a8ea --- /dev/null +++ b/net-misc/snarf/snarf-7.0-r3.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +inherit eutils + +IUSE="" +DESCRIPTION="Small and fast CLI resource grabber with support for http, gopher, finger, and ftp protocols" +SRC_URI="http://www.xach.com/snarf/${P}.tar.gz" +HOMEPAGE="http://www.xach.com/snarf/" +KEYWORDS="alpha amd64 ppc sparc x86" +LICENSE="GPL-2" +SLOT="0" + +DEPEND="" + +src_unpack() { + unpack ${A} + epatch "${FILESDIR}"/snarf-basename-patch.diff + epatch "${FILESDIR}"/snarf-unlink-empty.diff + epatch "${FILESDIR}"/snarf-fix-off-by-ones.diff +} + +src_install() { + dobin snarf + doman snarf.1 + dodoc ChangeLog README TODO +} + +pkg_postinst() { + elog 'To use snarf with portage, try these settings in your make.conf' + elog + elog ' FETCHCOMMAND="/usr/bin/snarf -b \${URI} \${DISTDIR}/\${FILE}"' + elog ' RESUMECOMMAND="/usr/bin/snarf -rb \${URI} \${DISTDIR}/\${FILE}"' +} |