source: golgotha/src/test/web_crawl/database.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.6 KB
RevLine 
[80]1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9
10#include "isllist.hh"
11
12
13url::~url()
14{
15  if (full_name)
16    i4_free(full_name);
17}
18
19
20split_url::split_url(char *url_name)
21{
22  port=80;
23  type=HTTP;
24 
25  server[0]=0;
26  page[0]=0;
27  extension[0]=0;
28
29  int read_server=1;
30 
31  if (fb_strneq(url_name,"file://",7))
32    type=FILE;
33  else if (fb_strneq(url_name,"http://",7))
34    type=HTTP;
35  else read_server=0;
36
37  if (read_server)
38  {
39    // read the server name
40    while (url_name[0] && (url_name[0]!='/' || url_name[1]!='/')) url_name++;
41    if (*url_name) url_name+=2;
42 
43
44    char *s=server;
45    while (*url_name && *url_name!='/' && *url_name!=':')
46      *(s++)=*(url_name++);
47    *s=0;
48
49
50    // read the port number if there is one
51    if (*url_name==':')
52    {
53      url_name++;
54      char num_buf[50],*c, count=0;
55      for (c=num_buf; *url && *url!='/' && count<48; count++)
56        *(c++)=*(url_name++);
57      *c=0;
58
59      sscanf(num_buf,"%d",&port);
60    }
61
62 
63    // skip final /
64    if (*url_name) url_name++;
65  }
66 
67  // read off the page name
68  while (*url)
69    *(page++)=*(url++);
70  *page=0;
71
72}
73
Note: See TracBrowser for help on using the repository browser.