--- 1.1.1.2.1.1	1991/12/29 16:09:12
+++ arscan.c	1992/01/24 20:00:48
@@ -25,7 +25,11 @@
 #define PORTAR 1
 #endif
 
+#ifdef atarist
+#include <gnu-ar.h>
+#else
 #include <ar.h>
+#endif
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
--- 1.1.1.2.1.1	1991/12/29 16:09:12
+++ commands.c	1992/01/24 20:00:48
@@ -342,6 +342,7 @@
      int sig;
 {
   signal (sig, SIG_DFL);
+#ifndef atarist
 #ifndef USG
   (void) sigsetmask (0);
 #endif
@@ -387,6 +388,7 @@
     wait_for_children (0, 1);
 
   /* Delete any non-precious intermediate files that were made.  */
+#endif /* atarist */
 
   remove_intermediates (1);
 
--- 1.3.1.1	1991/12/29 16:09:12
+++ default.c	1992/01/24 20:00:48
@@ -28,9 +28,14 @@
    `.s' must come last, so that a `.o' file will be made from
    a `.c' or `.p' or ... file rather than from a .s file.  */
 
+#ifdef atarist
 static char default_suffixes[]
+  = ".out .a .o .c .cc .y .l .s .S .h .info .dvi .tex .texinfo .sh .elc .el";
+#else
+static char default_suffixes[]
   = ".out .a .ln .o .c .cc .C .p .f .F .r .y .l .s .S \
 .mod .sym .def .h .info .dvi .tex .texinfo .texi .cweb .web .sh .elc .el";
+#endif
 
 static struct pspec default_pattern_rules[] =
   {
@@ -48,6 +53,13 @@
 
 static struct pspec default_terminal_rules[] =
   {
+#ifdef atarist
+    /* RCS.  */
+    "%", "RCS/%",		/* This is for RCS 5.6 */
+    "test -f $@ || $(CO) $(COFLAGS) $< $@",
+    "%", "RCS/%,v",
+    "test -f $@ || $(CO) $(COFLAGS) $< $@",
+#else
     /* RCS.  */
     "%", "%,v",
     "test -f $@ || $(CO) $(COFLAGS) $< $@",
@@ -59,6 +71,7 @@
     "$(GET) $(GFLAGS) $<",
     "%", "SCCS/s.%",
     "$(GET) $(GFLAGS) $<",
+#endif
 
     0, 0, 0
   };
--- 1.1.1.3	1991/12/29 16:09:12
+++ dir.c	1992/06/10 20:54:58
@@ -50,6 +50,12 @@
 #define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
 #endif /* POSIX */
 
+#ifdef atarist
+#define HASH_LIMIT 8	/* only consider this many characters of file names */
+static short _limit = 0;
+#endif
+
+
 /* Hash table of directories.  */
 
 struct directory
@@ -97,12 +103,20 @@
   register char *p;
   register struct directory *dir;
 
+#ifdef atarist
+  for (p = name, _limit = HASH_LIMIT; *p != '\0' && _limit-- > 0; ++p)
+#else
   for (p = name; *p != '\0'; ++p)
+#endif
     HASH (hash, *p);
   hash %= DIRECTORY_BUCKETS;
 
   for (dir = directories[hash]; dir != 0; dir = dir->next)
+#ifdef atarist
+    if (DOS_streq (dir->name, name))
+#else
     if (streq (dir->name, name))
+#endif
       break;
 
   if (dir == 0)
@@ -164,7 +178,11 @@
 	/* Checking if the directory exists.  */
 	return 1;
 
+#ifdef atarist
+      for (p = filename,_limit = HASH_LIMIT; *p != '\0' && _limit-- > 0; ++p)
+#else
       for (p = filename; *p != '\0'; ++p)
+#endif
 	HASH (hash, *p);
       hash %= DIRFILE_BUCKETS;
 
@@ -171,7 +189,11 @@
       /* Search the list of hashed files.  */
 
       for (df = dir->files[hash]; df != 0; df = df->next)
+#ifdef atarist
+	if (DOS_streq (df->name, filename))
+#else
 	if (streq (df->name, filename))
+#endif
 	  return !df->impossible;
     }
 
@@ -191,10 +213,13 @@
       if (!REAL_DIR_ENTRY (d))
 	continue;
 
+#ifdef atarist
+      for (i = 0, _limit = HASH_LIMIT; i < D_NAMLEN(d) && _limit-- > 0; ++i)
+#else
       for (i = 0; i < D_NAMLEN(d); ++i)
+#endif
 	HASH (newhash, d->d_name[i]);
       newhash %= DIRFILE_BUCKETS;
-
       df = (struct dirfile *) xmalloc (sizeof (struct dirfile));
       df->next = dir->files[newhash];
       dir->files[newhash] = df;
@@ -202,8 +227,13 @@
       df->impossible = 0;
 
       /* Check if the name matches the one we're searching for.  */
-      if (filename != 0
-	  && newhash == hash && streq (d->d_name, filename))
+      if (filename != 0 && newhash == hash 
+#ifdef atarist
+	  && DOS_streq (d->d_name, filename)
+#else
+	  && streq (d->d_name, filename)
+#endif
+					)
 	return 1;
     }
 
@@ -269,7 +299,12 @@
       filename = p = dirend + 1;
     }
 
+#ifdef atarist
+  _limit = HASH_LIMIT;
+  for (hash = 0; *p != '\0' && _limit-- > 0; ++p)
+#else
   for (hash = 0; *p != '\0'; ++p)
+#endif
     HASH (hash, *p);
   hash %= DIRFILE_BUCKETS;
 
@@ -318,12 +353,21 @@
     /* There are no files entered for this directory.  */
     return 0;
 
+#ifdef atarist
+  _limit = HASH_LIMIT;
+  for (hash = 0; *p != '\0' && _limit-- > 0; ++p)
+#else
   for (hash = 0; *p != '\0'; ++p)
+#endif
     HASH (hash, *p);
   hash %= DIRFILE_BUCKETS;
 
   for (next = dir->files[hash]; next != 0; next = next->next)
+#ifdef atarist
+    if (DOS_streq (filename, next->name))
+#else
     if (streq (filename, next->name))
+#endif
       return next->impossible;
 
   return 0;
@@ -399,3 +443,44 @@
     printf ("%u", impossible);
   printf (" impossibilities in %u directories.\n", dirs);
 }
+
+#ifdef atarist
+/* checks to see if two names refer to the same file */
+int DOS_streq(name1, name2)
+char *name1, *name2;
+{
+	static char _name1[64], _name2[64];
+	char *lastslash;
+	extern char *rindex();
+	int i;
+
+	if (!strcmp(name1, name2)) return 1;
+
+	unx2dos(name1, _name1);
+	unx2dos(name2, _name2);
+
+	name1 = rindex(_name1, '\\'); if (!name1) name1 = _name1;
+	name2 = rindex(_name2, '\\'); if (!name2) name2 = _name2;
+	for(i = 8; i>0; i--) {
+		if (*name1 != *name2) return 0;
+		if (*name1 == 0)
+			return 1;
+		if (*name1 == '.')
+			goto doext;
+		name1++; name2++;
+	}
+
+/* now look for extension */
+	while (*name1 && *name1 != '.') name1++;
+	while (*name2 && *name2 != '.') name2++;
+	if (*name1 != *name2) return 0;
+doext:
+	name1++; name2++;
+	for (i = 3; i > 0; i--) {
+		if (*name1 != *name2) return 0;
+		if (!*name1) return 1;
+		name1++; name2++;
+	}
+	return 1;
+}
+#endif /* atarist */
--- 1.1.1.1.1.1	1991/12/29 16:09:12
+++ function.c	1992/01/24 20:00:50
@@ -351,6 +351,9 @@
 	else
 	  error_prefix = "";
 
+#ifdef atarist
+	perror_with_name (error_prefix, "function not allowed under TOS");
+#else
 	if (pipe (pipedes) < 0)
 	  {
 	    perror_with_name (error_prefix, "pipe");
@@ -444,6 +447,7 @@
 
 	pop_signals_blocked_p ();
 
+#endif /* atarist */
 	free (text);
 	break;
       }
--- 1.1.1.2.1.1	1991/12/29 16:09:12
+++ job.c	1992/01/25 18:06:16
@@ -24,7 +24,11 @@
 #include <errno.h>
 
 /* Default path to search for executables.  */
+#ifdef atarist
+static char default_path[] = ";/bin";
+#else
 static char default_path[] = ":/bin:/usr/bin";
+#endif
 
 /* Default shell to use.  */
 char default_shell[] = "/bin/sh";
@@ -87,10 +91,20 @@
 
 #else	/* WTERMSIG not defined and have <sys/wait.h> or not USG.  */
 
+#ifdef atarist
+#  define WAIT_T int
+#  define WTERMSIG(x) 0
+#  define WCOREDUMP(x) 0
+#  define WEXITSTATUS(x)  x
+#  define WIFSIGNALED(x) (WTERMSIG (x) != 0)
+#  define WIFEXITED(x) (WTERMSIG (x) == 0)
+#  undef WAIT_NOHANG
+#else
 #define WAIT_T union wait
 #define WTERMSIG(x)	((x).w_termsig)
 #define WCOREDUMP(x)	((x).w_coredump)
 #define WEXITSTATUS(x)	((x).w_retcode)
+#endif /* atarist */
 #ifndef	WIFSIGNALED
 #define	WIFSIGNALED(x)	(WTERMSIG(x) != 0)
 #endif
@@ -205,7 +219,9 @@
 #else	/* Not USG.  */
 
   /* Block the signals.  */
+#ifndef atarist
   (void) sigblock (fatal_signal_mask | sigmask (SIGCHLD));
+#endif /* atarist */
 
 #endif
 
@@ -226,7 +242,9 @@
 #else	/* Not USG.  */
 
   /* Unblock the signals.  */
+#ifndef atarist
   (void) sigsetmask (sigblock (0) & ~(fatal_signal_mask | sigmask (SIGCHLD)));
+#endif
 
 #endif
 
@@ -654,6 +672,7 @@
   
   /* Set up a bad standard input that reads from a broken pipe.  */
 
+#ifndef atarist
   if (bad_stdin == -1)
     {
       /* Make a file descriptor that is the read end of a broken pipe.
@@ -667,6 +686,7 @@
 	  bad_stdin = pd[0];
 	}
     }
+#endif
 
   /* Decide whether to give this child the `good' standard input
      (one that points to the terminal or whatever), or the `bad' one
@@ -827,6 +847,7 @@
   if (stdout_fd != 1)
     (void) dup2 (stdout_fd, 1);
 
+#ifndef atarist
   /* Free up file descriptors.  */
   {
     register int d;
@@ -834,6 +855,7 @@
     for (d = 3; d < max; ++d)
       (void) close (d);
   }
+#endif /* atarist */
 
   /* Don't block signals for the new process.  */
   unblock_signals ();
@@ -850,6 +872,60 @@
 search_path (file, path, program)
      char *file, *path, *program;
 {
+#ifdef atarist
+  static char **_extensions = 0, *suff;
+  char *p, *q;
+  int i;
+      
+  if (path == 0 || path[0] == '\0')
+    path = default_path;
+  
+  if ((index (file, '/') != 0) || (index (file, '\\') != 0))
+    {
+      strcpy (program, file);
+      return 1;
+    }
+  else
+  {
+    if (_extensions == 0)
+      {
+	if ((p == (char *) getenv ("SUFF")) != 0 && *p)
+	  {
+	    suff = (char *) xmalloc (strlen (p) + 1);
+	    strcpy (suff, p);
+	    for (i = 1, q = suff; *q; q++)
+	      if (*q == ',' || *q == ';')
+		i++;
+	    _extensions = (char **) xmalloc (i * sizeof (char *));
+	    _extensions[0] = suff;
+	    for (i = 0, q = suff;  *q; q++)
+	      if (*q == ',' || *q == ';')
+		{
+		  *q = '\0';
+		  _extensions[++i] = q + 1;
+		}
+	    _extensions[++i] = 0;
+	  }
+	else
+          {
+	    _extensions = (char **) xmalloc (5 * sizeof (char *));
+	    _extensions[0] = "ttp";
+	    _extensions[1] = "tos";
+	    _extensions[2] = "prg";
+	    _extensions[3] = "app";
+	    _extensions[4] = 0;
+	  }
+      }
+    p = (char *) findfile (file, path, _extensions);
+    if (p == NULL)
+      return 0;
+    else
+      {
+	strcpy (program, p);
+	return 1;
+      }
+  }
+#else
   if (path == 0 || path[0] == '\0')
     path = default_path;
 
@@ -933,6 +1009,7 @@
     }
 
   return 0;
+#endif /* atarist */
 }
 
 /* Replace the current process with one running the command in ARGV,
@@ -1001,7 +1078,6 @@
 		  new_argv[1 + argc] = argv[argc];
 		  --argc;
 		}
-
 	      execve (shell_path, new_argv, envp);
 	      perror_with_name ("execve: ", shell_path);
 	    }
@@ -1030,7 +1106,11 @@
      char *line, **restp;
      char *shell, *ifs;
 {
+#ifdef atarist
+  static char sh_chars[] = "#;\"*?[]&|<>(){}$`";
+#else
   static char sh_chars[] = "#;\"*?[]&|<>(){}=$`";
+#endif
   static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login",
 			     "logout", "set", "umask", "wait", "while", "for",
 			     "case", "if", ":", ".", "break", "continue",
@@ -1079,6 +1159,7 @@
 	    instring = 0;
 	  else
 	    *ap++ = *p;
+	    /* Backslash-newline combinations are eaten.  */
 	}
       else if (index (sh_chars, *p) != 0)
 	/* Not inside a string, but it's a special char.  */
@@ -1087,8 +1168,11 @@
 	/* Not a special char.  */
 	switch (*p)
 	  {
+#ifdef atarist
+	  case '@':
+#else
 	  case '\\':
-	    /* Backslash-newline combinations are eaten.  */
+#endif
 	    if (p[1] != '\0' && p[1] != '\n')
 	      /* Copy and skip the following char.  */
 	      *ap++ = *++p;
@@ -1202,7 +1286,11 @@
 	  if (*p == '\\' || *p == '\''
 	      || isspace (*p)
 	      || index (sh_chars, *p) != 0)
+#ifdef atarist
+	    *ap++ = '@';
+#else
 	    *ap++ = '\\';
+#endif
 	  *ap++ = *p;
 	}
       *ap = '\0';
--- 1.1.1.2.1.1	1991/12/29 16:09:12
+++ main.c	1992/01/24 20:00:50
@@ -291,6 +291,10 @@
   struct dep *read_makefiles;
   PATH_VAR (current_directory);
 
+#ifdef atarist
+  _binmode( 0 );
+#endif /* atarist */
+
   default_goal_file = 0;
   reading_filename = 0;
   reading_lineno_ptr = 0;
--- 1.1.1.2.1.1	1991/12/29 16:09:12
+++ misc.c	1992/01/24 20:00:50
@@ -498,6 +498,7 @@
 static void
 init_access ()
 {
+#ifndef atarist
   user_uid = getuid ();
   user_gid = getgid ();
 
@@ -507,6 +508,7 @@
   /* Do these ever fail?  */
   if (user_uid == -1 || user_gid == -1 || make_uid == -1 || make_gid == -1)
     pfatal_with_name ("get{e}[gu]id");
+#endif /* atarist */
 
   current_access = make;
 }
@@ -513,9 +515,16 @@
 
 /* Give the process appropriate permissions for access to
    user data (i.e., to stat files, or to spawn a child process).  */
+#ifdef atarist
 void
 user_access ()
 {
+  current_access = user;
+}
+#else
+void
+user_access ()
+{
   if (!access_inited)
     init_access ();
 
@@ -554,6 +563,7 @@
 
   current_access = user;
 }
+#endif /* atarist */
 
 /* Give the process appropriate permissions for access to
    make data (i.e., the load average).  */
@@ -560,6 +570,7 @@
 void
 make_access ()
 {
+#ifndef atarist
   if (!access_inited)
     init_access ();
 
@@ -579,6 +590,7 @@
   if (setregid (user_gid, make_gid) < 0)
     pfatal_with_name ("setregid");
 #endif
+#endif /* atarist */
 
   current_access = make;
 }
@@ -591,8 +603,10 @@
   /* Set both the real and effective UID and GID to the user's.
      They cannot be changed back to make's.  */
 
+#ifndef atarist
   if (setuid (user_uid) < 0)
     pfatal_with_name ("setuid");
   if (setgid (user_gid) < 0)
     pfatal_with_name ("setgid");
+#endif
 }
--- 1.4	1991/12/29 16:09:12
+++ version.c	1992/01/24 20:00:52
@@ -1,4 +1,4 @@
-char *version_string = "3.62";
+char *version_string = "3.62 atariST";
 
 /*
   Local variables:
--- 1.1.1.3	1991/12/29 16:09:12
+++ make.h	1992/01/24 20:00:50
@@ -219,8 +219,13 @@
 #else
 
 #ifndef	USG
+#ifdef __MINT__
+extern long sigsetmask ();
+extern long sigblock ();
+#else
 extern int sigsetmask ();
 extern int sigblock ();
+#endif
 #endif
 extern int kill ();
 extern void abort (), exit ();
