home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / wget153.zip / os2 / wget-1.5.3-os2.diff < prev    next >
Text File  |  1998-09-27  |  6KB  |  255 lines

  1. diff -uN wget-1.5.3/src/ftp.c wget-1.5.3-os2/src/ftp.c
  2. --- wget-1.5.3/src/ftp.c    Thu Sep 10 12:21:36 1998
  3. +++ wget-1.5.3-os2/src/ftp.c    Wed Sep 23 01:49:54 1998
  4. @@ -899,6 +899,9 @@
  5.  #ifdef WINDOWS
  6.        ws_changetitle (hurl, 1);
  7.  #endif
  8. +#ifdef __EMX__
  9. +      os2title(0, hurl);
  10. +#endif
  11.        free (hurl);
  12.      }
  13.        /* Send getftp the proper length, if fileinfo was provided.  */
  14. diff -uN wget-1.5.3/src/http.c wget-1.5.3-os2/src/http.c
  15. --- wget-1.5.3/src/http.c    Thu Sep 10 13:14:44 1998
  16. +++ wget-1.5.3-os2/src/http.c    Wed Sep 23 01:49:54 1998
  17. @@ -48,6 +48,10 @@
  18.  # include <winsock.h>
  19.  #endif
  20.  
  21. +#ifdef __EMX__
  22. +# include <os2.h>
  23. +#endif
  24. +
  25.  #include "wget.h"
  26.  #include "utils.h"
  27.  #include "url.h"
  28. @@ -858,7 +862,19 @@
  29.  
  30.    /* Determine the local filename.  */
  31.    if (!u->local)
  32. +#ifndef __EMX__
  33. +    u->local = url_filename (u->proxy ? u->proxy : u);
  34. +#else /* __EMX__ */
  35. +  {
  36. +    /* under os/2 there is a problems with '?' symbol in filenames */
  37.      u->local = url_filename (u->proxy ? u->proxy : u);
  38. +    /* remove '?' from filename under os/2 */
  39. +    URL_OSCOMPAT(u->local);
  40. +#ifdef ENV2
  41. +    replace_percent(u->local);
  42. +#endif /* ENV2 */
  43. +  }
  44. +#endif /* __EMX__ */
  45.  
  46.    if (!opt.output_document)
  47.      locf = u->local;
  48. @@ -925,6 +941,9 @@
  49.  #ifdef WINDOWS
  50.        ws_changetitle (hurl, 1);
  51.  #endif
  52. +#ifdef __EMX__
  53. +      os2title(0, hurl);
  54. +#endif
  55.        free (hurl);
  56.      }
  57.  
  58. @@ -1030,6 +1049,11 @@
  59.            if (tmr == (time_t) (-1))
  60.          logputs (LOG_VERBOSE, _("\
  61.  Last-modified header invalid -- time-stamp ignored.\n"));
  62. +#ifdef __EMX__
  63. +          else
  64. +        /* filetime seconds always even under os/2 :( */
  65. +        tmr = tmr & 0xfffffffeL;
  66. +#endif
  67.          }
  68.      }
  69.  
  70. diff -uN wget-1.5.3/src/init.c wget-1.5.3-os2/src/init.c
  71. --- wget-1.5.3/src/init.c    Fri Sep 11 00:20:22 1998
  72. +++ wget-1.5.3-os2/src/init.c    Wed Sep 23 01:49:56 1998
  73. @@ -224,7 +224,7 @@
  74.  
  75.    if (!home)
  76.      {
  77. -#ifndef WINDOWS
  78. +#if !defined(WINDOWS) && !defined (__EMX__)
  79.        /* If HOME is not defined, try getting it from the password
  80.           file.  */
  81.        struct passwd *pwd = getpwuid (getuid ());
  82. @@ -317,7 +317,11 @@
  83.    ln = 1;
  84.    while ((line = read_whole_line (fp)))
  85.      {
  86. +#ifdef __EMX__ /* shitty emx :( */
  87. +      char *com = NULL, *val = NULL;
  88. +#else
  89.        char *com, *val;
  90. +#endif
  91.        int status;
  92.        int length = strlen (line);
  93.  
  94. diff -uN wget-1.5.3/src/main.c wget-1.5.3-os2/src/main.c
  95. --- wget-1.5.3/src/main.c    Fri Sep 11 01:41:52 1998
  96. +++ wget-1.5.3-os2/src/main.c    Wed Sep 23 01:49:56 1998
  97. @@ -40,6 +40,10 @@
  98.  #endif /* HAVE_LOCALE_H */
  99.  #endif /* HAVE_NLS */
  100.  
  101. +#ifdef __EMX__
  102. +# include "os2.h"
  103. +#endif
  104. +
  105.  #define OPTIONS_DEFINED_HERE    /* for options.h */
  106.  
  107.  #include "wget.h"
  108. @@ -593,7 +597,13 @@
  109.      }
  110.  
  111.    if (opt.background)
  112. +#ifndef __EMX__
  113.      fork_to_background ();
  114. +#else
  115. +    /* spawn new process detached under os/2
  116. +       fork() don't works correctly with emx */
  117. +    spawn_process (argc, argv);
  118. +#endif
  119.  
  120.    /* Allocate basic pointer.  */
  121.    url = ALLOCA_ARRAY (char *, nurl + 1);
  122. @@ -612,6 +622,14 @@
  123.    ws_changetitle (*url, nurl);
  124.  #endif
  125.  
  126. +#ifdef __EMX__
  127. +  signal(SIGINT, os2break);
  128. +  signal(SIGBREAK, os2break);
  129. +  signal(SIGTERM, os2break);
  130. +  os2title(1, NULL);
  131. +  os2title(0, url[0]);
  132. +#endif
  133. +
  134.    /* Initialize logging.  */
  135.    log_init (opt.lfilename, append_to_log);
  136.  
  137. @@ -693,6 +711,9 @@
  138.        convert_all_links ();
  139.      }
  140.    log_close ();
  141. +#ifdef __EMX__
  142. +  os2title(-1, NULL);
  143. +#endif
  144.    cleanup ();
  145.    if (status == RETROK)
  146.      return 0;
  147. diff -uN wget-1.5.3/src/netrc.c wget-1.5.3-os2/src/netrc.c
  148. --- wget-1.5.3/src/netrc.c    Tue Jun 23 21:29:18 1998
  149. +++ wget-1.5.3-os2/src/netrc.c    Wed Sep 23 01:49:56 1998
  150. @@ -46,7 +46,12 @@
  151.  
  152.  #define NETRC_FILE_NAME ".netrc"
  153.  
  154. +#ifndef __EMX__
  155.  acc_t *netrc_list;
  156. +#else
  157. +/* hmm... */
  158. +acc_t *netrc_list = NULL;
  159. +#endif
  160.  
  161.  static acc_t *parse_netrc PARAMS ((const char *));
  162.  
  163. diff -uN wget-1.5.3/src/url.c wget-1.5.3-os2/src/url.c
  164. --- wget-1.5.3/src/url.c    Fri Sep 11 00:23:26 1998
  165. +++ wget-1.5.3-os2/src/url.c    Wed Sep 23 02:32:36 1998
  166. @@ -56,7 +56,11 @@
  167.     encoding, and \033 for safe printing.  */
  168.  
  169.  #ifndef WINDOWS
  170. +#ifndef __EMX__
  171.  # define URL_UNSAFE " <>\"#%{}|\\^~[]`@:\033"
  172. +#else  /* __EMX__ */
  173. +# define URL_UNSAFE " <>\"#%{}|\\^[]`:\033"
  174. +#endif /* __EMX__ */
  175.  #else  /* WINDOWS */
  176.  # define URL_UNSAFE " <>\"%{}|\\^[]`\033"
  177.  #endif /* WINDOWS */
  178. @@ -171,6 +175,14 @@
  179.  int
  180.  contains_unsafe (const char *s)
  181.  {
  182. +#ifdef __EMX__
  183. +  /* when mirroring with '-x -P x:/dir' options
  184. +     do not check 'x:' */
  185. +  /* check if opt.dir_prefix not '.' and contain drive letter */
  186. +  if (!DOTP (opt.dir_prefix) && strlen(opt.dir_prefix) > 1 && 
  187. +      *(opt.dir_prefix + 1) == ':'  && strlen(s) > 1 && *(s+1) == ':')
  188. +    s += 2;
  189. +#endif
  190.    for (; *s; s++)
  191.      if (strchr (URL_UNSAFE, *s))
  192.        return 1;
  193. @@ -217,15 +229,32 @@
  194.    const char *b;
  195.    char *p, *res;
  196.    int i;
  197. +#ifdef __EMX__
  198. +  int drive_here = 0;
  199. +#endif
  200.  
  201.    b = s;
  202.    for (i = 0; *s; s++, i++)
  203.      if (strchr (URL_UNSAFE, *s))
  204.        i += 2; /* Two more characters (hex digits) */
  205. +#ifdef __EMX__
  206. +  /* skip drive letter in opt.dir_prefix */
  207. +  if (!DOTP (opt.dir_prefix) && strlen(opt.dir_prefix) > 1 && 
  208. +      *(opt.dir_prefix + 1) == ':'  && strlen(b) > 1 && *(b+1) == ':') {
  209. +    drive_here = !drive_here;
  210. +    i -= 2;
  211. +  }
  212. +#endif /* __EMX__  */
  213.    res = (char *)xmalloc (i + 1);
  214.    s = b;
  215. +#ifndef __EMX__
  216.    for (p = res; *s; s++)
  217.      if (strchr (URL_UNSAFE, *s))
  218. +#else /* __EMX__  */
  219. +  /* skip ':' after drive letter in unsafe chars conversion */
  220. +  for (p = res, i = 0; *s; s++, i++)
  221. +    if (!(drive_here && i == 1) && strchr (URL_UNSAFE, *s))
  222. +#endif /* __EMX__  */
  223.        {
  224.      const unsigned char c = *s;
  225.      *p++ = '%';
  226. diff -uN wget-1.5.3/src/utils.c wget-1.5.3-os2/src/utils.c
  227. --- wget-1.5.3/src/utils.c    Sat Jun 27 20:49:12 1998
  228. +++ wget-1.5.3-os2/src/utils.c    Wed Sep 23 02:29:08 1998
  229. @@ -510,6 +510,9 @@
  230.  {
  231.    int quit = 0;
  232.    int i;
  233. +#ifdef __EMX__
  234. +  int status;
  235. +#endif
  236.    char *dir;
  237.  
  238.    /* Make a copy of dir, to be able to write to it.  Otherwise, the
  239. @@ -518,7 +521,15 @@
  240.  
  241.    /* If the first character of dir is '/', skip it (and thus enable
  242.       creation of absolute-pathname directories.  */
  243. +#ifdef __EMX__
  244. +  /* there was a problem creating directories under os/2
  245. +     when full directory name (with drive letter) specified. */
  246. +  status =  (strlen(dir) > 1  && *(dir + 1) == ':') ? 2 : 0;
  247. +  status += (*(dir + status) == '/');
  248. +  for (i = status; 1; ++i)
  249. +#else
  250.    for (i = (*dir == '/'); 1; ++i)
  251. +#endif
  252.      {
  253.        for (; dir[i] && dir[i] != '/'; i++)
  254.      ;
  255.