C Code for Scoutget with libWWW 2.15
/********************************************************
* scoutget.c
*
* USAGE: scoutget <url>
*
* OUTPUT: file retrieved from Web server
*
* ERROR: alarm call use to terminate after 150 seconds
*
* HISTORY: modified by Rick Wesson
*
********************************************************/
#include <stdio.h>
#include "HTUtils.h"
#include "HTParse.h"
#include "HTAccess.h"
#include "HTAnchor.h"
#include "HTStream.h"
#define REF_MARK "[%d]"
#define END_MARK " [End]"
#define SCREEN_WIDTH 79 /* Default width of the screen */
PUBLIC char * HTAppName = "Lycos"; /* Application name */
PUBLIC char * HTAppVersion = "0.9"; /* Application version */
PUBLIC int HTScreenWidth = SCREEN_WIDTH; /* By default */
PUBLIC int HTScreenHeight = -1; /* Undefined */
PUBLIC BOOL display_anchors = YES; /* anchor will be shown in text? */
PRIVATE BOOL interactive = YES; /* e.g. shows prompts etc */
PRIVATE char * output_file_name = NULL; /* -o xxxx */
PUBLIC HTStream* HTOutputStream;
PUBLIC char * start_reference = NULL; /* Format string for start anchor */
PUBLIC char * end_reference = REF_MARK; /* for end anchor */
PUBLIC char * reference_mark = "[%d] "; /* for reference lists */
PRIVATE char * refhead = NULL; /* Reference list heading */
PUBLIC char * end_mark = END_MARK; /* Format string for [End] */
void main(argc, argv)
int argc;
char **argv;
{
char *ref;
FILE* logfile;
HTParentAnchor *anchor;
HTRequest *req;
if (argc != 2)
{ fprintf (stderr, "Usage: scoutget <url>\n");
exit (1);
}
logfile = fopen("/tmp/test.logfile", "a");
alarm (150);
/* HTFormatInit(); */
HTFileInit();
HTAppName = "Lycos"; /* Application name */
HTAppVersion = "0.9"; /* Application version */
/* HTOutputFormat = WWW_SOURCE; */
HTOutputStream = (HTStream *) HTFWriter_new (stdout);
if ((ref = HTParse(argv[1], "", PARSE_ALL)) &&
(anchor = (HTParentAnchor *) HTAnchor_findAddress(ref)) &&
HTLoadAnchor((HTAnchor *)anchor, (HTRequest *) req))
{ printf ("\n");
exit (0);
}
else
{ exit (1); }
}
----------
X-Sun-Data-Type: c-file
X-Sun-Data-Description: c-file
X-Sun-Data-Name: scout.c
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 77
/********************************************************
* scoutget.c
*
* USAGE: scoutget <url>
*
* OUTPUT: file retrieved from Web server
*
* ERROR: alarm call use to terminate after 150 seconds
*
********************************************************/
#include <stdio.h>
#include "HTUtils.h"
#include "HTParse.h"
#include "HTAccess.h"
#include "HTAnchor.h"
#include "HTStream.h"
#define REF_MARK "[%d]"
#define END_MARK " [End]"
#define SCREEN_WIDTH 79 /* Default width of the screen */
PUBLIC char * HTAppName = "Lycos"; /* Application name */
PUBLIC char * HTAppVersion = "0.9"; /* Application version */
PUBLIC int HTScreenWidth = SCREEN_WIDTH; /* By default */
PUBLIC int HTScreenHeight = -1; /* Undefined */
PUBLIC BOOL display_anchors = YES; /* anchor will be shown in text? */
PRIVATE BOOL interactive = YES; /* e.g. shows prompts etc */
PRIVATE char * output_file_name = NULL; /* -o xxxx */
PUBLIC HTStream* HTOutputStream;
PUBLIC char * start_reference = NULL; /* Format string for start anchor */
PUBLIC char * end_reference = REF_MARK; /* for end anchor */
PUBLIC char * reference_mark = "[%d] "; /* for reference lists */
PRIVATE char * refhead = NULL; /* Reference list heading */
PUBLIC char * end_mark = END_MARK; /* Format string for [End] */
void main(argc, argv)
int argc;
char **argv;
{
char *ref;
FILE* logfile;
HTParentAnchor *anchor;
HTRequest *req;
if (argc != 2)
{ fprintf (stderr, "Usage: scoutget <url>\n");
exit (1);
}
logfile = fopen("/tmp/test.logfile", "a");
alarm (150);
/* HTFormatInit(); */
HTFileInit();
HTAppName = "Lycos"; /* Application name */
HTAppVersion = "0.9"; /* Application version */
/* HTOutputFormat = WWW_SOURCE; */
HTOutputStream = (HTStream *) HTFWriter_new (stdout);
if ((ref = HTParse(argv[1], "", PARSE_ALL)) &&
(anchor = (HTParentAnchor *) HTAnchor_findAddress(ref)) &&
HTLoadAnchor((HTAnchor *)anchor, (HTRequest *) req))
{ printf ("\n");
exit (0);
}
else
{ exit (1); }
}
Last updated 8-Jul-94