Menu

[r460]: / wget-1.10.2-alias.patch  Maximize  Restore  History

Download this file

31 lines (29 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- src/host.c.orig 2008-07-24 04:54:29.000000000 +0000
+++ src/host.c 2008-07-24 04:55:01.000000000 +0000
@@ -336,10 +336,27 @@
The function makes sure that when NULL is returned for reasons
other than timeout, errno is reset. */
+int alias(char* old) {
+ int f,i; char tmp[256]; char* new;
+ f=open("/etc/wget-alias",O_RDONLY); // line1 old name, line2 alias name
+ if (f<3) { fprintf(stderr,"/etc/wget-alias not there.\n"); return 0; }
+ else {i=0; while (read(f,&(tmp[i]),1)==1) i++; tmp[i]=0;
+ new=strchr(tmp,'\n');
+ if (new==NULL) return 0;
+ else { *new=0; {char *nl; nl=strchr(new+1,'\n'); if (nl!=NULL) *nl=0; }
+ if (strcmp(old,tmp)==0) {
+ strcpy(old,new+1);
+ fprintf(stderr,"%s => %s\n",tmp,new+1);
+ }
+ }
+ }
+}
+
static struct hostent *
gethostbyname_with_timeout (const char *host_name, double timeout)
{
struct ghbnwt_context ctx;
+ alias(host_name);
ctx.host_name = host_name;
if (run_with_timeout (timeout, gethostbyname_with_timeout_callback, &ctx))
{