*** ORIG/diff/diff3.c Tue Apr 24 18:14:52 2001 --- diff/diff3.c Sat Apr 28 20:21:19 2001 *************** *** 1326,1332 **** if (wstatus == 2) diff3_fatal ("subsidiary diff failed"); ! if (-1 == (fd = open (diffout, O_RDONLY))) diff3_fatal ("could not open temporary diff file"); current_chunk_size = 8 * 1024; --- 1326,1332 ---- if (wstatus == 2) diff3_fatal ("subsidiary diff failed"); ! if (-1 == (fd = open (diffout, O_RDONLY, 0))) /* olsen for AMIGA */ diff3_fatal ("could not open temporary diff file"); current_chunk_size = 8 * 1024; *** ORIG/diff/system.h Thu Apr 19 19:45:28 2001 --- diff/system.h Sat Apr 28 20:07:39 2001 *************** *** 270,275 **** --- 270,280 ---- } #endif + + #ifdef AMIGA + #include "amiga.h" + #endif /* AMIGA */ + /* these come from CVS's lib/system.h, but I wasn't sure how to include that * properly or even if I really should */ *** ORIG/lib/getopt.c Wed Feb 28 14:49:39 2001 --- lib/getopt.c Sat Apr 28 20:09:22 2001 *************** *** 66,71 **** --- 66,75 ---- #include #endif /* GNU C library. */ + #ifdef AMIGA + #include + #endif /* AMIGA */ + /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. *** ORIG/lib/getopt.h Thu Apr 19 19:45:30 2001 --- lib/getopt.h Sat Apr 28 20:11:20 2001 *************** *** 97,103 **** --- 97,108 ---- exactly why), and there is no particular need to prototype it. We really shouldn't be trampling on the system's namespace at all by declaring getopt() but that is a bigger issue. */ + + #ifdef AMIGA + extern int getopt (int argc, char * const * argv, const char * optstring); + #else extern int getopt (); + #endif /* AMIGA */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); *** ORIG/lib/regex.h Thu Apr 19 19:45:30 2001 --- lib/regex.h Sat Apr 28 20:37:12 2001 *************** *** 485,493 **** #ifdef _REGEX_RE_COMP /* 4.2 bsd compatibility. */ /* CVS: don't use prototypes: they may conflict with system headers. */ extern char *re_comp _RE_ARGS (()); extern int re_exec _RE_ARGS (()); ! #endif /* POSIX compatibility. */ extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags)); --- 485,497 ---- #ifdef _REGEX_RE_COMP /* 4.2 bsd compatibility. */ /* CVS: don't use prototypes: they may conflict with system headers. */ + #ifdef AMIGA + extern char *re_comp _RE_ARGS ((const char * s)); + extern int re_exec _RE_ARGS ((const char * s)); + #else extern char *re_comp _RE_ARGS (()); extern int re_exec _RE_ARGS (()); ! #endif /* AMIGA */ /* POSIX compatibility. */ extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags)); *** ORIG/lib/system.h Thu Apr 19 19:45:30 2001 --- lib/system.h Sat Apr 28 20:06:36 2001 *************** *** 477,482 **** --- 477,490 ---- #endif /* defined (__CYGWIN32__) || defined (WIN32) */ + #ifdef AMIGA + #include "amiga.h" + + #define FOLD_FN_CHAR(c) amiga_fold_fn_char(c) + #define FILENAMES_CASE_INSENSITIVE 1 + #define ISDIRSEP(c) ((c) == ':' || (c) == '/') + #endif /* AMIGA */ + /* Some file systems are case-insensitive. If FOLD_FN_CHAR is #defined, it maps the character C onto its "canonical" form. In a case-insensitive system, it would map all alphanumeric characters *** ORIG/lib/xtime.h Thu Feb 15 02:53:07 2001 --- lib/xtime.h Sat Apr 28 21:02:31 2001 *************** *** 27,32 **** --- 27,36 ---- # endif /* !HAVE_SYS_TIME_H */ # endif /* !TIME_WITH_SYS_TIME */ + # ifdef timezone + # undef timezone /* needed for sgi */ + # endif /* timezone */ + # ifdef HAVE_SYS_TIMEB_H # include # else /* HAVE_SYS_TIMEB_H */ *************** *** 45,54 **** short dstflag; /* Field not used */ }; # endif /* !HAVE_SYS_TIMEB_H */ - - # ifdef timezone - # undef timezone /* needed for sgi */ - # endif /* timezone */ # if !defined(HAVE_FTIME) && !defined(HAVE_TIMEZONE) extern long timezone; --- 49,54 ---- *** ORIG/src/client.c Tue Apr 24 18:14:53 2001 --- src/client.c Sat Apr 28 21:12:35 2001 *************** *** 5014,5020 **** else fd = CVS_OPEN (file, O_RDONLY | OPEN_BINARY); #else ! fd = CVS_OPEN (file, O_RDONLY | (bin ? OPEN_BINARY : 0)); #endif if (fd < 0) --- 5014,5020 ---- else fd = CVS_OPEN (file, O_RDONLY | OPEN_BINARY); #else ! fd = CVS_OPEN (file, O_RDONLY | (bin ? OPEN_BINARY : 0), 0); /* olsen for AMIGA */ #endif if (fd < 0) *** ORIG/src/filesubr.c Thu Apr 19 19:45:32 2001 --- src/filesubr.c Sun Apr 29 10:04:46 2001 *************** *** 63,69 **** else { /* Not a link or a device... probably a regular file. */ ! if ((fdin = open (from, O_RDONLY)) < 0) error (1, errno, "cannot open %s for copying", from); if (fstat (fdin, &sb) < 0) error (1, errno, "cannot fstat %s", from); --- 63,69 ---- else { /* Not a link or a device... probably a regular file. */ ! if ((fdin = open (from, O_RDONLY, 0)) < 0) /* olsen for AMIGA */ error (1, errno, "cannot open %s for copying", from); if (fstat (fdin, &sb) < 0) error (1, errno, "cannot fstat %s", from); *************** *** 110,115 **** --- 110,119 ---- t.actime = sb.st_atime; t.modtime = sb.st_mtime; (void) utime (to, &t); + + #ifdef AMIGA + (void) chmod (to, sb.st_mode); + #endif /* AMIGA */ } /* FIXME-krp: these functions would benefit from caching the char * & *************** *** 427,432 **** --- 431,437 ---- * removal of all of the files in the directory. Return -1 on error * (in which case errno is set). */ + #ifndef AMIGA int unlink_file_dir (f) const char *f; *************** *** 467,472 **** --- 472,478 ---- return CVS_UNLINK (f); } + #endif /* AMIGA */ /* Remove a directory and everything it contains. Returns 0 for * success, -1 for failure (in which case errno is set). *************** *** 580,586 **** nchars -= nread; } while (nchars != 0); ! return bp - buf; } --- 586,592 ---- nchars -= nread; } while (nchars != 0); ! return (size_t)(bp - buf); /* olsen */ } *************** *** 621,626 **** --- 627,633 ---- return result; } + #ifndef AMIGA /* If FILE1 and FILE2 are devices, they are equal if their device numbers match. */ if (S_ISBLK (sb1.st_mode) || S_ISCHR (sb1.st_mode)) *************** *** 635,644 **** file1, file2); #endif } ! if ((fd1 = open (file1, O_RDONLY)) < 0) error (1, errno, "cannot open file %s for comparing", file1); ! if ((fd2 = open (file2, O_RDONLY)) < 0) error (1, errno, "cannot open file %s for comparing", file2); /* A generic file compare routine might compare st_dev & st_ino here --- 642,652 ---- file1, file2); #endif } + #endif /* AMIGA */ ! if ((fd1 = open (file1, O_RDONLY, 0)) < 0) /* olsen for AMIGA */ error (1, errno, "cannot open file %s for comparing", file1); ! if ((fd2 = open (file2, O_RDONLY, 0)) < 0) /* olsen for AMIGA */ error (1, errno, "cannot open file %s for comparing", file2); /* A generic file compare routine might compare st_dev & st_ino here *************** *** 683,689 **** (void) close (fd2); return (ret); } ! /* Generate a unique temporary filename. Returns a pointer to a newly * malloc'd string containing the name. Returns successfully or not at * all. --- 691,698 ---- (void) close (fd2); return (ret); } ! ! #ifndef AMIGA /* Generate a unique temporary filename. Returns a pointer to a newly * malloc'd string containing the name. Returns successfully or not at * all. *************** *** 707,712 **** --- 716,722 ---- error (0, errno, "Failed to close temporary file %s", fn); return fn; } + #endif /* AMIGA */ /* Generate a unique temporary filename and return an open file stream * to the truncated file by that name *************** *** 846,851 **** --- 856,862 ---- return fp; } + #ifndef AMIGA /* Return non-zero iff FILENAME is absolute. Trivial under Unix, but more complicated under other systems. */ int *************** *** 854,859 **** --- 865,871 ---- { return filename[0] == '/'; } + #endif /* AMIGA */ /* * Return a string (dynamically allocated) with the name of the file to which *************** *** 893,899 **** return tfile; } ! /* Return a pointer into PATH's last component. */ char * last_component (path) --- 905,911 ---- return tfile; } ! #ifndef AMIGA /* Return a pointer into PATH's last component. */ char * last_component (path) *************** *** 906,911 **** --- 918,924 ---- else return path; } + #endif /* AMIGA */ /* Return the home directory. Returns a pointer to storage managed by this function or its callees (currently getenv). *************** *** 955,960 **** --- 968,974 ---- return home; } + #ifndef AMIGA /* See cvs.h for description. On unix this does nothing, because the shell expands the wildcards. */ void *************** *** 970,975 **** --- 984,990 ---- for (i = 0; i < argc; ++i) (*pargv)[i] = xstrdup (argv[i]); } + #endif /* AMIGA */ #ifdef SERVER_SUPPORT /* Case-insensitive string compare. I know that some systems *** ORIG/src/hash.h Thu Apr 19 19:45:32 2001 --- src/hash.h Sat Apr 28 21:06:21 2001 *************** *** 11,16 **** --- 11,20 ---- */ #define HASHSIZE 151 + #ifdef AMIGA + #undef NT_UNKNOWN + #endif /* AMIGA */ + /* * Types of nodes */ *** ORIG/src/history.c Thu Apr 19 19:45:32 2001 --- src/history.c Sat Apr 28 21:15:44 2001 *************** *** 1061,1067 **** int fd; struct stat st_buf; ! if ((fd = CVS_OPEN (fname, O_RDONLY | OPEN_BINARY)) < 0) error (1, errno, "cannot open history file: %s", fname); if (fstat (fd, &st_buf) < 0) --- 1061,1067 ---- int fd; struct stat st_buf; ! if ((fd = CVS_OPEN (fname, O_RDONLY | OPEN_BINARY, 0)) < 0) /* olsen for AMIGA */ error (1, errno, "cannot open history file: %s", fname); if (fstat (fd, &st_buf) < 0) *** ORIG/src/main.c Fri Apr 27 19:57:23 2001 --- src/main.c Sat Apr 28 21:17:50 2001 *************** *** 18,24 **** --- 18,26 ---- #ifdef HAVE_WINSOCK_H #include #else + #ifndef AMIGA extern int gethostname (); + #endif /* AMIGA */ #endif char *program_name; *** ORIG/src/run.c Thu Apr 19 19:45:33 2001 --- src/run.c Sun Apr 29 09:42:10 2001 *************** *** 98,103 **** --- 98,182 ---- const char *sterr; int flags; { + #ifdef AMIGA + int len,total_len,quotes,escape,result,i,j; + char * s; + char * arg; + char * command; + + if (noexec && (flags & RUN_REALLY) == 0) + return (0); + + total_len = 0; + for (i = 0; i < run_argc; i++) + { + arg = run_argv[i]; + len = strlen(arg); + quotes = 0; + + for(j = 0 ; j < len ; j++) + { + if(arg[j] == ' ' && quotes == 0) + quotes = 2; + else if (arg[j] == '\"') + total_len++; + } + + total_len += len + quotes + 1; + } + + command = malloc(total_len+1); + if(command == NULL) + { + errno = ENOMEM; + return(-1); + } + + s = command; + + for (i = 0; i < run_argc; i++) + { + arg = run_argv[i]; + len = strlen(arg); + quotes = escape = 0; + + for(j = 0 ; j < len ; j++) + { + if(arg[j] == ' ') + quotes = 1; + else if (arg[j] == '\"') + escape = 1; + + if(quotes == 1 && escape == 1) + break; + } + + if(quotes) + (*s++) = '\"'; + + for(j = 0 ; j < len ; j++) + { + if(arg[j] == '\"') + (*s++) = '*'; + + (*s++) = arg[j]; + } + + if(quotes) + (*s++) = '\"'; + + if(i < run_argc-1) + (*s++) = ' '; + } + + (*s) = '\0'; + + result = system(command); + free(command); + + return(0); + + #else int shin, shout, sherr; int mode_out, mode_err; int status; *************** *** 345,350 **** --- 424,430 ---- if (rerrno) errno = rerrno; return (rc); + #endif /* AMIGA */ } void *************** *** 403,408 **** --- 483,493 ---- int *fromfdp; { int pid; + + #ifdef AMIGA + pid = amiga_piped_child(command,tofdp,fromfdp); + #else + int to_child_pipe[2]; int from_child_pipe[2]; *************** *** 446,451 **** --- 531,537 ---- *tofdp = to_child_pipe[1]; *fromfdp = from_child_pipe[0]; + #endif /* AMIGA */ return pid; } *************** *** 454,461 **** --- 540,549 ---- close_on_exec (fd) int fd; { + #ifndef AMIGA #ifdef F_SETFD if (fcntl (fd, F_SETFD, 1)) error (1, errno, "can't set close-on-exec flag on %d", fd); + #endif #endif }