home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Programming / CVS / source / amiga.diffs next >
Encoding:
Text File  |  2001-04-30  |  13.1 KB  |  544 lines

  1. *** ORIG/diff/diff3.c    Tue Apr 24 18:14:52 2001
  2. --- diff/diff3.c    Sat Apr 28 20:21:19 2001
  3. ***************
  4. *** 1326,1332 ****
  5.     if (wstatus == 2)
  6.       diff3_fatal ("subsidiary diff failed");
  7.   
  8. !   if (-1 == (fd = open (diffout, O_RDONLY)))
  9.       diff3_fatal ("could not open temporary diff file");
  10.   
  11.     current_chunk_size = 8 * 1024;
  12. --- 1326,1332 ----
  13.     if (wstatus == 2)
  14.       diff3_fatal ("subsidiary diff failed");
  15.   
  16. !   if (-1 == (fd = open (diffout, O_RDONLY, 0))) /* olsen for AMIGA */
  17.       diff3_fatal ("could not open temporary diff file");
  18.   
  19.     current_chunk_size = 8 * 1024;
  20. *** ORIG/diff/system.h    Thu Apr 19 19:45:28 2001
  21. --- diff/system.h    Sat Apr 28 20:07:39 2001
  22. ***************
  23. *** 270,275 ****
  24. --- 270,280 ----
  25.     }
  26.   #endif
  27.   
  28. + #ifdef AMIGA
  29. + #include "amiga.h"
  30. + #endif /* AMIGA */
  31.   /* these come from CVS's lib/system.h, but I wasn't sure how to include that
  32.    * properly or even if I really should
  33.    */
  34. *** ORIG/lib/getopt.c    Wed Feb 28 14:49:39 2001
  35. --- lib/getopt.c    Sat Apr 28 20:09:22 2001
  36. ***************
  37. *** 66,71 ****
  38. --- 66,75 ----
  39.   #include <stdlib.h>
  40.   #endif    /* GNU C library.  */
  41.   
  42. + #ifdef AMIGA
  43. + #include <stdlib.h>
  44. + #endif /* AMIGA */
  45.   /* This version of `getopt' appears to the caller like standard Unix `getopt'
  46.      but it behaves differently for the user, since it allows the user
  47.      to intersperse the options with the other arguments.
  48. *** ORIG/lib/getopt.h    Thu Apr 19 19:45:30 2001
  49. --- lib/getopt.h    Sat Apr 28 20:11:20 2001
  50. ***************
  51. *** 97,103 ****
  52. --- 97,108 ----
  53.      exactly why), and there is no particular need to prototype it.
  54.      We really shouldn't be trampling on the system's namespace at all by
  55.      declaring getopt() but that is a bigger issue.  */
  56. + #ifdef AMIGA
  57. + extern int getopt (int argc, char * const * argv, const char * optstring);
  58. + #else
  59.   extern int getopt ();
  60. + #endif /* AMIGA */
  61.   
  62.   extern int getopt_long (int argc, char *const *argv, const char *shortopts,
  63.                   const struct option *longopts, int *longind);
  64. *** ORIG/lib/regex.h    Thu Apr 19 19:45:30 2001
  65. --- lib/regex.h    Sat Apr 28 20:37:12 2001
  66. ***************
  67. *** 485,493 ****
  68.   #ifdef _REGEX_RE_COMP
  69.   /* 4.2 bsd compatibility.  */
  70.   /* CVS: don't use prototypes: they may conflict with system headers.  */
  71.   extern char *re_comp _RE_ARGS (());
  72.   extern int re_exec _RE_ARGS (());
  73. ! #endif
  74.   
  75.   /* POSIX compatibility.  */
  76.   extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
  77. --- 485,497 ----
  78.   #ifdef _REGEX_RE_COMP
  79.   /* 4.2 bsd compatibility.  */
  80.   /* CVS: don't use prototypes: they may conflict with system headers.  */
  81. + #ifdef AMIGA
  82. + extern char *re_comp _RE_ARGS ((const char * s));
  83. + extern int re_exec _RE_ARGS ((const char * s));
  84. + #else
  85.   extern char *re_comp _RE_ARGS (());
  86.   extern int re_exec _RE_ARGS (());
  87. ! #endif /* AMIGA */
  88.   
  89.   /* POSIX compatibility.  */
  90.   extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
  91. *** ORIG/lib/system.h    Thu Apr 19 19:45:30 2001
  92. --- lib/system.h    Sat Apr 28 20:06:36 2001
  93. ***************
  94. *** 477,482 ****
  95. --- 477,490 ----
  96.   
  97.   #endif /* defined (__CYGWIN32__) || defined (WIN32) */
  98.   
  99. + #ifdef AMIGA
  100. + #include "amiga.h"
  101. + #define FOLD_FN_CHAR(c) amiga_fold_fn_char(c)
  102. + #define FILENAMES_CASE_INSENSITIVE 1
  103. + #define ISDIRSEP(c) ((c) == ':' || (c) == '/')
  104. + #endif /* AMIGA */
  105.   /* Some file systems are case-insensitive.  If FOLD_FN_CHAR is
  106.      #defined, it maps the character C onto its "canonical" form.  In a
  107.      case-insensitive system, it would map all alphanumeric characters
  108. *** ORIG/lib/xtime.h    Thu Feb 15 02:53:07 2001
  109. --- lib/xtime.h    Sat Apr 28 21:02:31 2001
  110. ***************
  111. *** 27,32 ****
  112. --- 27,36 ----
  113.   #   endif /* !HAVE_SYS_TIME_H */
  114.   # endif /* !TIME_WITH_SYS_TIME */
  115.   
  116. + # ifdef timezone
  117. + #   undef timezone /* needed for sgi */
  118. + # endif /* timezone */
  119.   # ifdef HAVE_SYS_TIMEB_H
  120.   #   include <sys/timeb.h>
  121.   # else /* HAVE_SYS_TIMEB_H */
  122. ***************
  123. *** 45,54 ****
  124.       short        dstflag;    /* Field not used        */
  125.   };
  126.   # endif /* !HAVE_SYS_TIMEB_H */
  127. - # ifdef timezone
  128. - #   undef timezone /* needed for sgi */
  129. - # endif /* timezone */
  130.   
  131.   # if !defined(HAVE_FTIME) && !defined(HAVE_TIMEZONE)
  132.   extern long timezone;
  133. --- 49,54 ----
  134. *** ORIG/src/client.c    Tue Apr 24 18:14:53 2001
  135. --- src/client.c    Sat Apr 28 21:12:35 2001
  136. ***************
  137. *** 5014,5020 ****
  138.       else
  139.       fd = CVS_OPEN (file, O_RDONLY | OPEN_BINARY);
  140.   #else
  141. !     fd = CVS_OPEN (file, O_RDONLY | (bin ? OPEN_BINARY : 0));
  142.   #endif
  143.   
  144.       if (fd < 0)
  145. --- 5014,5020 ----
  146.       else
  147.       fd = CVS_OPEN (file, O_RDONLY | OPEN_BINARY);
  148.   #else
  149. !     fd = CVS_OPEN (file, O_RDONLY | (bin ? OPEN_BINARY : 0), 0); /* olsen for AMIGA */
  150.   #endif
  151.   
  152.       if (fd < 0)
  153. *** ORIG/src/filesubr.c    Thu Apr 19 19:45:32 2001
  154. --- src/filesubr.c    Sun Apr 29 10:04:46 2001
  155. ***************
  156. *** 63,69 ****
  157.       else
  158.       {
  159.       /* Not a link or a device... probably a regular file. */
  160. !     if ((fdin = open (from, O_RDONLY)) < 0)
  161.           error (1, errno, "cannot open %s for copying", from);
  162.       if (fstat (fdin, &sb) < 0)
  163.           error (1, errno, "cannot fstat %s", from);
  164. --- 63,69 ----
  165.       else
  166.       {
  167.       /* Not a link or a device... probably a regular file. */
  168. !     if ((fdin = open (from, O_RDONLY, 0)) < 0)  /* olsen for AMIGA */
  169.           error (1, errno, "cannot open %s for copying", from);
  170.       if (fstat (fdin, &sb) < 0)
  171.           error (1, errno, "cannot fstat %s", from);
  172. ***************
  173. *** 110,115 ****
  174. --- 110,119 ----
  175.       t.actime = sb.st_atime;
  176.       t.modtime = sb.st_mtime;
  177.       (void) utime (to, &t);
  178. +     #ifdef AMIGA
  179. +     (void) chmod (to, sb.st_mode);
  180. +     #endif /* AMIGA */
  181.   }
  182.   
  183.   /* FIXME-krp: these functions would benefit from caching the char * &
  184. ***************
  185. *** 427,432 ****
  186. --- 431,437 ----
  187.    * removal of all of the files in the directory.  Return -1 on error
  188.    * (in which case errno is set).
  189.    */
  190. + #ifndef AMIGA
  191.   int
  192.   unlink_file_dir (f)
  193.       const char *f;
  194. ***************
  195. *** 467,472 ****
  196. --- 472,478 ----
  197.   
  198.       return CVS_UNLINK (f);
  199.   }
  200. + #endif /* AMIGA */
  201.   
  202.   /* Remove a directory and everything it contains.  Returns 0 for
  203.    * success, -1 for failure (in which case errno is set).
  204. ***************
  205. *** 580,586 ****
  206.       nchars -= nread;
  207.       } while (nchars != 0);
  208.   
  209. !     return bp - buf;
  210.   } 
  211.   
  212.       
  213. --- 586,592 ----
  214.       nchars -= nread;
  215.       } while (nchars != 0);
  216.   
  217. !     return (size_t)(bp - buf); /* olsen */
  218.   } 
  219.   
  220.       
  221. ***************
  222. *** 621,626 ****
  223. --- 627,633 ----
  224.       return result;
  225.       }
  226.   
  227. + #ifndef AMIGA
  228.       /* If FILE1 and FILE2 are devices, they are equal if their device
  229.          numbers match. */
  230.       if (S_ISBLK (sb1.st_mode) || S_ISCHR (sb1.st_mode))
  231. ***************
  232. *** 635,644 ****
  233.              file1, file2);
  234.   #endif
  235.       }
  236.   
  237. !     if ((fd1 = open (file1, O_RDONLY)) < 0)
  238.       error (1, errno, "cannot open file %s for comparing", file1);
  239. !     if ((fd2 = open (file2, O_RDONLY)) < 0)
  240.       error (1, errno, "cannot open file %s for comparing", file2);
  241.   
  242.       /* A generic file compare routine might compare st_dev & st_ino here 
  243. --- 642,652 ----
  244.              file1, file2);
  245.   #endif
  246.       }
  247. + #endif /* AMIGA */
  248.   
  249. !     if ((fd1 = open (file1, O_RDONLY, 0)) < 0) /* olsen for AMIGA */
  250.       error (1, errno, "cannot open file %s for comparing", file1);
  251. !     if ((fd2 = open (file2, O_RDONLY, 0)) < 0) /* olsen for AMIGA */
  252.       error (1, errno, "cannot open file %s for comparing", file2);
  253.   
  254.       /* A generic file compare routine might compare st_dev & st_ino here 
  255. ***************
  256. *** 683,689 ****
  257.       (void) close (fd2);
  258.       return (ret);
  259.   }
  260.   /* Generate a unique temporary filename.  Returns a pointer to a newly
  261.    * malloc'd string containing the name.  Returns successfully or not at
  262.    * all.
  263. --- 691,698 ----
  264.       (void) close (fd2);
  265.       return (ret);
  266.   }
  267. ! #ifndef AMIGA
  268.   /* Generate a unique temporary filename.  Returns a pointer to a newly
  269.    * malloc'd string containing the name.  Returns successfully or not at
  270.    * all.
  271. ***************
  272. *** 707,712 ****
  273. --- 716,722 ----
  274.       error (0, errno, "Failed to close temporary file %s", fn);
  275.       return fn;
  276.   }
  277. + #endif /* AMIGA */
  278.   
  279.   /* Generate a unique temporary filename and return an open file stream
  280.    * to the truncated file by that name
  281. ***************
  282. *** 846,851 ****
  283. --- 856,862 ----
  284.       return fp;
  285.   }
  286.   
  287. + #ifndef AMIGA
  288.   /* Return non-zero iff FILENAME is absolute.
  289.      Trivial under Unix, but more complicated under other systems.  */
  290.   int
  291. ***************
  292. *** 854,859 ****
  293. --- 865,871 ----
  294.   {
  295.       return filename[0] == '/';
  296.   }
  297. + #endif /* AMIGA */
  298.   
  299.   /*
  300.    * Return a string (dynamically allocated) with the name of the file to which
  301. ***************
  302. *** 893,899 ****
  303.       return tfile;
  304.   }
  305.   
  306.   /* Return a pointer into PATH's last component.  */
  307.   char *
  308.   last_component (path)
  309. --- 905,911 ----
  310.       return tfile;
  311.   }
  312.   
  313. ! #ifndef AMIGA
  314.   /* Return a pointer into PATH's last component.  */
  315.   char *
  316.   last_component (path)
  317. ***************
  318. *** 906,911 ****
  319. --- 918,924 ----
  320.       else
  321.           return path;
  322.   }
  323. + #endif /* AMIGA */
  324.   
  325.   /* Return the home directory.  Returns a pointer to storage
  326.      managed by this function or its callees (currently getenv).
  327. ***************
  328. *** 955,960 ****
  329. --- 968,974 ----
  330.       return home;
  331.   }
  332.   
  333. + #ifndef AMIGA
  334.   /* See cvs.h for description.  On unix this does nothing, because the
  335.      shell expands the wildcards.  */
  336.   void
  337. ***************
  338. *** 970,975 ****
  339. --- 984,990 ----
  340.       for (i = 0; i < argc; ++i)
  341.       (*pargv)[i] = xstrdup (argv[i]);
  342.   }
  343. + #endif /* AMIGA */
  344.   
  345.   #ifdef SERVER_SUPPORT
  346.   /* Case-insensitive string compare.  I know that some systems
  347. *** ORIG/src/hash.h    Thu Apr 19 19:45:32 2001
  348. --- src/hash.h    Sat Apr 28 21:06:21 2001
  349. ***************
  350. *** 11,16 ****
  351. --- 11,20 ----
  352.    */
  353.   #define HASHSIZE    151
  354.   
  355. + #ifdef AMIGA
  356. + #undef NT_UNKNOWN
  357. + #endif /* AMIGA */
  358.   /*
  359.    * Types of nodes
  360.    */
  361. *** ORIG/src/history.c    Thu Apr 19 19:45:32 2001
  362. --- src/history.c    Sat Apr 28 21:15:44 2001
  363. ***************
  364. *** 1061,1067 ****
  365.       int fd;
  366.       struct stat st_buf;
  367.   
  368. !     if ((fd = CVS_OPEN (fname, O_RDONLY | OPEN_BINARY)) < 0)
  369.       error (1, errno, "cannot open history file: %s", fname);
  370.   
  371.       if (fstat (fd, &st_buf) < 0)
  372. --- 1061,1067 ----
  373.       int fd;
  374.       struct stat st_buf;
  375.   
  376. !     if ((fd = CVS_OPEN (fname, O_RDONLY | OPEN_BINARY, 0)) < 0) /* olsen for AMIGA */
  377.       error (1, errno, "cannot open history file: %s", fname);
  378.   
  379.       if (fstat (fd, &st_buf) < 0)
  380. *** ORIG/src/main.c    Fri Apr 27 19:57:23 2001
  381. --- src/main.c    Sat Apr 28 21:17:50 2001
  382. ***************
  383. *** 18,24 ****
  384. --- 18,26 ----
  385.   #ifdef HAVE_WINSOCK_H
  386.   #include <winsock.h>
  387.   #else
  388. + #ifndef AMIGA
  389.   extern int gethostname ();
  390. + #endif /* AMIGA */
  391.   #endif
  392.   
  393.   char *program_name;
  394. *** ORIG/src/run.c    Thu Apr 19 19:45:33 2001
  395. --- src/run.c    Sun Apr 29 09:42:10 2001
  396. ***************
  397. *** 98,103 ****
  398. --- 98,182 ----
  399.       const char *sterr;
  400.       int flags;
  401.   {
  402. + #ifdef AMIGA
  403. +     int len,total_len,quotes,escape,result,i,j;
  404. +     char * s;
  405. +     char * arg;
  406. +     char * command;
  407. +     if (noexec && (flags & RUN_REALLY) == 0)
  408. +     return (0);
  409. +     total_len = 0;
  410. +     for (i = 0; i < run_argc; i++)
  411. +     {
  412. +         arg = run_argv[i];
  413. +         len = strlen(arg);
  414. +         quotes = 0;
  415. +         for(j = 0 ; j < len ; j++)
  416. +         {
  417. +            if(arg[j] == ' ' && quotes == 0)
  418. +                quotes = 2;
  419. +            else if (arg[j] == '\"')
  420. +                total_len++;
  421. +         }
  422. +         total_len += len + quotes + 1;
  423. +     }
  424. +     command = malloc(total_len+1);
  425. +     if(command == NULL)
  426. +     {
  427. +         errno = ENOMEM;
  428. +         return(-1);
  429. +     }
  430. +     s = command;
  431. +     for (i = 0; i < run_argc; i++)
  432. +     {
  433. +         arg = run_argv[i];
  434. +         len = strlen(arg);
  435. +         quotes = escape = 0;
  436. +         for(j = 0 ; j < len ; j++)
  437. +         {
  438. +            if(arg[j] == ' ')
  439. +                quotes = 1;
  440. +            else if (arg[j] == '\"')
  441. +                escape = 1;
  442. +            if(quotes == 1 && escape == 1)
  443. +                break;
  444. +         }
  445. +         if(quotes)
  446. +             (*s++) = '\"';
  447. +         for(j = 0 ; j < len ; j++)
  448. +         {
  449. +             if(arg[j] == '\"')
  450. +                 (*s++) = '*';
  451. +             (*s++) = arg[j];
  452. +         }
  453. +         if(quotes)
  454. +             (*s++) = '\"';
  455. +         if(i < run_argc-1)
  456. +           (*s++) = ' ';
  457. +     }
  458. +     (*s) = '\0';
  459. +     result = system(command);
  460. +     free(command);
  461. +     return(0);
  462. + #else
  463.       int shin, shout, sherr;
  464.       int mode_out, mode_err;
  465.       int status;
  466. ***************
  467. *** 345,350 ****
  468. --- 424,430 ----
  469.       if (rerrno)
  470.       errno = rerrno;
  471.       return (rc);
  472. + #endif /* AMIGA */
  473.   }
  474.   
  475.   void
  476. ***************
  477. *** 403,408 ****
  478. --- 483,493 ----
  479.        int *fromfdp;
  480.   {
  481.       int pid;
  482. + #ifdef AMIGA
  483. +     pid = amiga_piped_child(command,tofdp,fromfdp);
  484. + #else
  485.       int to_child_pipe[2];
  486.       int from_child_pipe[2];
  487.   
  488. ***************
  489. *** 446,451 ****
  490. --- 531,537 ----
  491.   
  492.       *tofdp = to_child_pipe[1];
  493.       *fromfdp = from_child_pipe[0];
  494. + #endif /* AMIGA */
  495.       return pid;
  496.   }
  497.   
  498. ***************
  499. *** 454,461 ****
  500. --- 540,549 ----
  501.   close_on_exec (fd)
  502.        int fd;
  503.   {
  504. + #ifndef AMIGA
  505.   #ifdef F_SETFD
  506.       if (fcntl (fd, F_SETFD, 1))
  507.       error (1, errno, "can't set close-on-exec flag on %d", fd);
  508. + #endif
  509.   #endif
  510.   }
  511.