Reference

linleech(1)

selectively download usenet articles

NAME

linleech - selectively download usenet articles

SYNOPSIS

linleech [script]

DESCRIPTION

linleech is a small utility that will search through all the articles in a given USENET group and match the subject line against a given set of words. If it is matched, the article will be retrieved. This is useful for automating the download of different articles, perhaps binary articles or specific articles (like searching for certain HOWTO's in a Linux group).

USAGE

linleech uses small scripts written by you to automate the process of receiving articles. The name of the script file can be passed as a command line option or the script can be read from stdin. Scripts are based on S-Lang, an embeddable C-like language.

FUNCTIONS

auth_connect (char *Server, int *port, char *User, char *Password);

Connects to a news server using username/password authentication. ONLY USE THIS IF YOUR SERVER REQUIRES IT! This function is found in the /usr/lib/linleech/auth directory. Before calling auth_connect(), you must include the function:

evalfile("/usr/lib/linleech/auth/auth.sl");

Example:

auth_connect ("your-host.com", 119, "user", "password");

connect (char *Host, int *Port);

Connects to the USENET server Host and port Port. Generally, Port should be set to 119 as this is the standard NNTP port.

Example:

connect ("your-host.com", 119);

delete_match_list (void);

Clears any dynamically allocated match lists created with new_match_list(); You should always at least call this function at the end of the script to destroy the list in use.

Example:

delete_match_list();

disable_match_all (void);

Disables the option to save all articles, as set by enable_match_list(); By default, linleech will not match all articles.

Example:

disable_match_all();

disable_resume (void);

Disables the option to attempt to resume at the last article examined, as set by enable_resume(); By default, linleech does not attempt to resume.

Example:

disable_resume();

disconnect (void);

Disconnects from the current NNTP server.

Example:

disconnect();

enable_match_all (void);

Enables the option to save all articles, regardless of whether or not your criteria is matched. By default, linleech does not do this.

Example:

enable_match_all();

enable_resume (void);

Enables the option to attempt to resume at the last article examined. By default, linleech does not do this. In high traffic newgroups this function may be futile, as by the time you actually attempt to resume, the article may not exist anymore!

Example:

enable_resume();

evalfile (char *File);

Interprets the file File. Used to include external S-Lang files in your script.

Example:

evalfile("/usr/lib/linleech/auth/auth.sl");

filter (char *Program, int *Output);

Sets up an article filter with which to run articles through after download (usually uudecode). The Program parameter is the command line to run, with %s replaced with the filename. The Output parameter can be 0 (don't show filter output -- default) or 1 (show filter output).

Example:

filter ("uudecode %s", 1);

group (char *Group);

Joins the group Group and searches it for the criteria specified in the match functions.

Example:

group ("comp.os.linux.advocacy");

hide_subjects (void);

Disables the option to display article subjects as headers are downloaded. This reverses the effects of show_subjects(); By default, linleech will hide subjects.

Example:

hide_subjects();

match (char *Str, int *Case);

Looks for Str with case sensitivity set as Case. A value of 1 for Case will enable case sensitive matching; a value of 0 will enable case insensitive matching.

Example:

match ("linux 2.2.0", 0);

match_regexp (char *Str);

Performs matching using regular expressions. See the file /usr/doc/linleech/regex/regex.info for more information.

Example:

match_regexp ("PICTURE[1-9].*");

new_match_list (int *Size);

This is used in conjunction with delete_match_list(); to manage the creation and destruction of match lists. This must be called before any match functions, with Size being the number of match functions being called.

Example:

new_match_list(10);

remove_filter (void);

Removes the current article filter, set by the filter(); function.

Example:

remove_filter();

saveto (char *Path);

Sets linleech to save all articles to the path Path. The trailing forward slash must be included in Path.

Example:

saveto("articles/");

saveto_def (void);

Sets linleech to save all articles to the current directory.

Example:

saveto_def();

set_trigger (char *Trigger, char *Find);

Used to limit a match using a specific line in the article's headers. Trigger specifies the header to search in for the regexp Find. See RFC 850 for the types of lines in an article header. The example shows how to limit the date of articles downloaded to the month of November, 1998. Please note that set_trigger(); will use a space on the match list.

Example:

set_trigger ("Date:", ".. Nov 98");

show_subjects (void);

Sets the option to show article subjects as the headers are downloaded. By default, linleech will not display the article subjects.

Example:

show_subjects();

EXAMPLE

The following example will download binary posts of pictures from alt.binaries.picutures that were posted between November 12-19.

show_subjects();

new_match_list (5);

match (".gif", 0);

match (".jpg", 0);

match_regexp ("(./.)");

match_regexp ("[./.]");

set_trigger ("Date:", "1[2-9] Nov 98");

connect ("your-host.com", 119);

group (alt.binaries.pictures");

disconnect();

delete_match_list();

The idea behind this script is that most binary posts contain the filename (hence searching for popular file extensions -- GIF and JPEG) and, in the case of multi-part posts, the current part (ie, "(3/6)" or "[2/3]"). This is matched by the first four match functions. The set_trigger function will limit the matches to articles with the shown regex in the 'Date' header.

FILES

/usr/lib/linleech/auth/auth.sl

Location of the S-Lang script used on news servers requiring authorization. This file is called from your program using the evalfile(); function.

AUTHORS

Curtiss Howard

BUGS

There has been a report that the enable_resume(); function can crash the program.

SEE ALSO

For more information on linleech, including more examples, a short regexp tutorial, and how to expand the capabilities of linleech using extended functions, please see the /usr/doc/linleech/ directory.