home *** CD-ROM | disk | FTP | other *** search
- Only in dh2:indent-1.3: Makefile.amiga
- Only in dh2:indent-1.3: README.Amiga
- diff -c -r ram:indent-1.3-orig/args.c dh2:indent-1.3/args.c
- *** ram:indent-1.3-orig/args.c Wed May 06 04:22:40 1992
- --- dh2:indent-1.3/args.c Fri Jun 05 13:50:15 1992
- ***************
- *** 719,724 ****
- --- 719,744 ----
- static char prof[]= INDENT_PROFILE;
- char *homedir;
-
- + #ifdef AMIGA
- + if ((f = fopen (prof, "r")) != NULL)
- + {
- + scan_profile (f);
- + (void) fclose (f);
- + fname = xmalloc (sizeof prof);
- + strcpy (fname, prof);
- + return fname;
- + }
- +
- + fname = xmalloc (sizeof prof + 5);
- + sprintf (fname, "S:%s", prof);
- +
- + if ((f = fopen (fname, "r")) != NULL)
- + {
- + scan_profile (f);
- + (void) fclose (f);
- + return fname;
- + }
- + #else
- if ((f = fopen (INDENT_PROFILE, "r")) != NULL)
- {
- int len = strlen (INDENT_PROFILE) + 3;
- ***************
- *** 748,753 ****
- --- 768,774 ----
-
- free (fname);
- }
- + #endif
-
- return 0;
- }
- diff -c -r ram:indent-1.3-orig/backup.c dh2:indent-1.3/backup.c
- *** ram:indent-1.3-orig/backup.c Wed May 06 20:39:24 1992
- --- dh2:indent-1.3/backup.c Fri Jun 05 18:43:48 1992
- ***************
- *** 75,80 ****
- --- 75,83 ----
- #else /* !USG */
- #ifdef SYSDIR
- #include <sys/dir.h>
- + #ifdef AMIGA
- + #define dirent direct
- + #endif
- #endif /* SYSDIR */
- #endif /* !USG */
- #endif /* !DIRENT */
- ***************
- *** 92,98 ****
- --- 95,105 ----
- #endif /* NODIR */
-
- /* Default backup file suffix to use */
- + #ifdef AMIGA
- + char *simple_backup_suffix = "!";
- + #else
- char *simple_backup_suffix = "~";
- + #endif
-
- /* What kinds of backup files to make -- see
- table `version_control_values' below. */
- ***************
- *** 133,139 ****
- --- 140,150 ----
- {
- for (p = &direntry[base_length + 2]; ISDIGIT (*p); ++p)
- version = version * 10 + *p - '0';
- + #ifdef AMIGA
- + if (p[0] != '!' || p[1])
- + #else
- if (p[0] != '~' || p[1])
- + #endif
- version = 0;
- }
-
- ***************
- *** 189,194 ****
- --- 200,225 ----
- int version;
-
- p = pathname + pathlen - 1;
- + #ifdef AMIGA
- + while (p > pathname && *p != '/' && *p != ':')
- + p--;
- + if (*p == '/')
- + {
- + int dirlen = p - pathname;
- + filename = p + 1;
- + dirname = xmalloc (dirlen + 1);
- + strncpy (dirname, pathname, (dirlen));
- + dirname[dirlen] = '\0';
- + }
- + else if (*p == ':')
- + {
- + int dirlen = p - pathname + 1;
- + filename = p + 1;
- + dirname = xmalloc (dirlen + 1);
- + strncpy (dirname, pathname, (dirlen));
- + dirname[dirlen] = '\0';
- + }
- + #else
- while (p > pathname && *p != '/')
- p--;
- if (*p == '/')
- ***************
- *** 199,207 ****
- --- 230,243 ----
- strncpy (dirname, pathname, (dirlen));
- dirname[dirlen] = '\0';
- }
- + #endif
- else
- {
- + #ifdef AMIGA
- + dirname = "";
- + #else
- dirname = ".";
- + #endif
- filename = pathname;
- }
-
- ***************
- *** 239,245 ****
- --- 275,285 ----
- if (! backup_name)
- return 0;
-
- + #ifdef AMIGA
- + sprintf (backup_name, "%s.!%d!", pathname, last_numbered_version);
- + #else
- sprintf (backup_name, "%s.~%d~", pathname, last_numbered_version);
- + #endif
- return backup_name;
- }
- #endif /* !NODIR */
- ***************
- *** 337,340 ****
- close (fd);
- free (backup_filename);
- }
- -
- --- 377,379 ----
- Only in dh2:indent-1.3: dirent_def.h
- diff -c -r ram:indent-1.3-orig/globs.c dh2:indent-1.3/globs.c
- *** ram:indent-1.3-orig/globs.c Wed May 06 20:36:18 1992
- --- dh2:indent-1.3/globs.c Fri Jun 05 15:55:58 1992
- ***************
- *** 62,67 ****
- --- 62,68 ----
- Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
- if the source overlaps with the destination. */
-
- + #ifndef AMIGA
- char *
- mymemcpy (destaddr, srcaddr, len)
- char *destaddr;
- ***************
- *** 72,74 ****
- --- 73,76 ----
- *destaddr++ = *srcaddr++;
- return destaddr;
- }
- + #endif
- Only in dh2:indent-1.3: indent
- diff -c -r ram:indent-1.3-orig/indent.c dh2:indent-1.3/indent.c
- *** ram:indent-1.3-orig/indent.c Wed May 06 08:46:50 1992
- --- dh2:indent-1.3/indent.c Fri Jun 05 18:20:28 1992
- ***************
- *** 33,38 ****
- --- 33,53 ----
- #include "indent.h"
- #include <ctype.h>
-
- + #ifdef AMIGA
- + #include <exec/types.h>
- + #include <dos/dos.h>
- + #include <dos/dosextens.h>
- + #include <dos/dosasl.h>
- + #include <proto/dos.h>
- +
- + #define MAXPATH 200
- + #define MAXARGS 256
- +
- + extern struct DosLibrary *DOSBase;
- +
- + int expand_args ();
- + #endif
- +
- void
- usage ()
- {
- ***************
- *** 1524,1529 ****
- --- 1539,1547 ----
- struct file_buffer *current_input;
- char *profile_pathname = 0;
- int using_stdin = false;
- + #ifdef AMIGA
- + int ex_err;
- + #endif
-
- #ifdef DEBUG
- if (debug)
- ***************
- *** 1530,1535 ****
- --- 1548,1578 ----
- debug_init ();
- #endif
-
- + #ifdef AMIGA
- + if (DOSBase->dl_lib.lib_Version < 37)
- + {
- + fprintf (stderr, "You must have Kickstart 2.0 (V37) or higher!\n");
- + exit (20);
- + }
- +
- + if (argc == 2 && stricmp (argv[1],"-h") == 0)
- + {
- + usage ();
- + exit (0);
- + }
- +
- + if ((ex_err = expand_args (&argc, &argv)) == 0)
- + {
- + fprintf (stderr, "Couldn't expand wildcards\n");
- + exit (20);
- + }
- + if (ex_err == 2)
- + {
- + fprintf (stderr, "Wildcards didn't match a file\n");
- + exit (5);
- + }
- + #endif
- +
- init_parser ();
- initialize_backups ();
-
- ***************
- *** 1632,1637 ****
- --- 1675,1684 ----
- {
- current_input = read_file (in_file_names[i]);
- out_name = in_file_names[i];
- + #ifdef AMIGA
- + if (verbose)
- + printf ("\n%s:\n", out_name);
- + #endif
- output = fopen (out_name, "w");
- if (output == 0)
- {
- ***************
- *** 1660,1665 ****
- --- 1707,1716 ----
- if (! out_name && ! use_stdout)
- {
- out_name = in_file_names[0];
- + #ifdef AMIGA
- + if (verbose)
- + printf ("\n%s:\n", out_name);
- + #endif
- make_backup (current_input);
- }
- }
- ***************
- *** 1684,1686 ****
- --- 1735,1858 ----
-
- exit (0);
- }
- +
- +
- + #ifdef AMIGA
- + char *expand_next_file (pattern)
- + char *pattern;
- + {
- + long err;
- + char *pathname;
- + static struct AnchorPath *an = NULL;
- +
- + pathname = NULL;
- + if (pattern == NULL)
- + err = -1;
- + else
- + do
- + {
- + if (an == NULL)
- + {
- + an = malloc (sizeof (struct AnchorPath) + MAXPATH);
- + memset (an, 0, sizeof (struct AnchorPath) + MAXPATH);
- + an->ap_BreakBits = SIGBREAKF_CTRL_C;
- + an->ap_Strlen = MAXPATH;
- + an->ap_Flags = APF_DOWILD;
- + err = MatchFirst (pattern, an);
- + }
- + else
- + err = MatchNext (an);
- +
- + /* Expand only files */
- + if (an->ap_Info.fib_DirEntryType < 0)
- + pathname = an->ap_Buf;
- + } while (err == 0 && pathname == NULL);
- +
- + if (err)
- + {
- + MatchEnd (an);
- + free (an);
- + an = NULL;
- + return NULL;
- + }
- + else
- + return pathname;
- + }
- +
- +
- + int
- + in_prev_args (arg, argv, argc)
- + char *arg, **argv;
- + int argc;
- + {
- + int i, is_in_args;
- +
- + is_in_args = 0;
- + for (i = 1; i < argc - 1; i++)
- + if (strcmp (arg, argv[i]) == 0)
- + is_in_args = 1;
- + return is_in_args;
- + }
- +
- +
- + int
- + expand_args (oargc, oargv)
- + int *oargc;
- + char ***oargv;
- + {
- + int i;
- + char *str, **argv, buf[MAXPATH];
- + int argc, no_match_at_all, num_matches, contains_wildcards;
- +
- + no_match_at_all = 1;
- + contains_wildcards = 0;
- + argc = 0;
- + argv = malloc (MAXARGS * sizeof (char *));
- + if (argv == NULL)
- + return 0;
- +
- + argv[argc++] = (*oargv)[0];
- + for (i = 1; i < *oargc; i++)
- + {
- + if (ParsePattern ((*oargv)[i], buf, MAXPATH))
- + {
- + contains_wildcards = 1;
- + num_matches = 0;
- + while (str = expand_next_file ((*oargv)[i]))
- + if (argc >= MAXARGS)
- + {
- + expand_next_file (NULL);
- + return 0;
- + }
- + else
- + {
- + /* Avoid duplicate entries */
- + if (!in_prev_args (str, argv, argc))
- + {
- + argv[argc++] = strdup (str);
- + num_matches++;
- + }
- + }
- + if (num_matches != 0)
- + no_match_at_all = 0;
- + }
- + else
- + if (argc >= MAXARGS)
- + return 0;
- + else
- + {
- + if ((*oargv)[i][0] != '-' && (*oargv)[i][0] != '+')
- + /* Found a file with no wildcards */
- + no_match_at_all = 0;
- + if (!in_prev_args ((*oargv)[i], argv, argc))
- + argv[argc++] = (*oargv)[i];
- + }
- + }
- + *oargc = argc;
- + *oargv = argv;
- + if (no_match_at_all && contains_wildcards)
- + return 2;
- + else
- + return 1;
- + }
- + #endif
- Only in dh2:indent-1.3: indent.dvi
- diff -c -r ram:indent-1.3-orig/io.c dh2:indent-1.3/io.c
- *** ram:indent-1.3-orig/io.c Sun May 03 11:36:58 1992
- --- dh2:indent-1.3/io.c Fri Jun 05 21:45:50 1992
- ***************
- *** 29,36 ****
- --- 29,43 ----
- <sys/fcntl.h> or <sys/file.h> instead. */
- #include <fcntl.h>
-
- + #ifdef AMIGA
- + #include <exec/types.h>
- + #include <dos/dos.h>
- + #include <proto/dos.h>
- + #define bcopy(s,d,l) memcpy(d,s,l)
- + #else
- #include <sys/types.h>
- #include <sys/stat.h>
- + #endif
-
- /* number of levels a label is placed to left of code */
- #define LABEL_OFFSET 2
- ***************
- *** 422,430 ****
- --- 429,462 ----
- char *filename;
- {
- int fd;
- + #ifndef AMIGA
- struct stat file_stats;
- + #endif
- int namelen = strlen (filename);
- + #ifdef AMIGA
- + BPTR in_fh;
- + struct FileInfoBlock __aligned in_fib;
- + #endif
- +
- + #ifdef AMIGA
- + in_fh = Lock (filename, SHARED_LOCK);
- + if (in_fh == 0)
- + sys_error (filename);
- +
- + if (Examine (in_fh, &in_fib) == 0)
- + sys_error (filename);
- +
- + if (fileptr.data != 0)
- + free (fileptr.data);
- + fileptr.size = in_fib.fib_Size;
- + fileptr.data = (char *) xmalloc (fileptr.size + 3);
-
- + UnLock (in_fh);
- +
- + fd = open (filename, O_RDONLY, 0777);
- + if (fd < 0)
- + sys_error (filename);
- + #else
- fd = open (filename, O_RDONLY, 0777);
- if (fd < 0)
- sys_error (filename);
- ***************
- *** 436,441 ****
- --- 468,474 ----
- free (fileptr.data);
- fileptr.size = file_stats.st_size;
- fileptr.data = (char *) xmalloc (file_stats.st_size + 3);
- + #endif
-
- if (read (fd, fileptr.data, fileptr.size) < 0)
- sys_error (filename);
- ***************
- *** 470,479 ****
- --- 503,548 ----
- unsigned int size = 15 * BUFSIZ;
- int ch;
- register char *p;
- + #ifdef AMIGA
- + char *in_prog;
- + int in_prog_size;
- + #endif
-
- if (stdinptr.data != 0)
- free (stdinptr.data);
-
- + /* The following code had to be changed, because you can't assume, that
- + xrealloc() always returns the original pointer */
- +
- + #ifdef AMIGA
- + in_prog = (char *) xmalloc (size + 3);
- + in_prog_size = 0;
- + do
- + {
- + for (; in_prog_size < size; in_prog_size++)
- + {
- + ch = getc (stdin);
- + if (ch == EOF)
- + break;
- + in_prog[in_prog_size] = ch;
- + }
- +
- + if (ch != EOF)
- + {
- + size += (2 * BUFSIZ);
- + in_prog = xrealloc (in_prog, size);
- + }
- + }
- + while (ch != EOF);
- +
- + stdinptr.data = in_prog;
- + stdinptr.size = in_prog_size;
- + stdinptr.name = "Standard Input";
- +
- + stdinptr.data[stdinptr.size] = ' ';
- + stdinptr.data[stdinptr.size + 1] = '\n';
- + stdinptr.data[stdinptr.size + 2] = '\0';
- + #else
- stdinptr.data = (char *) xmalloc (size + 3);
- stdinptr.size = 0;
- p = stdinptr.data;
- ***************
- *** 502,507 ****
- --- 571,577 ----
- stdinptr.data[stdinptr.size] = ' ';
- stdinptr.data[stdinptr.size + 1] = '\n';
- stdinptr.data[stdinptr.size + 2] = '\0';
- + #endif
-
- return &stdinptr;
- }
- diff -c -r ram:indent-1.3-orig/sys.h dh2:indent-1.3/sys.h
- *** ram:indent-1.3-orig/sys.h Wed May 06 20:38:56 1992
- --- dh2:indent-1.3/sys.h Fri Jun 05 15:54:18 1992
- ***************
- *** 8,13 ****
- --- 8,18 ----
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
-
- #include <stdio.h>
- + #ifdef AMIGA
- + /* For malloc, etc... */
- + #include <stdlib.h>
- + #include <string.h>
- + #endif
-
- #ifdef DEBUG
- extern int debug;
- ***************
- *** 23,30 ****
- --- 28,37 ----
- extern struct file_buffer *read_file (), *read_stdin ();
-
- /* Standard memory allocation routines. */
- + #ifndef AMIGA
- char *malloc ();
- char *realloc ();
- + #endif
-
- /* Similar, but abort with an error if out of memory (see globs.c). */
- char *xmalloc ();
- ***************
- *** 34,37 ****
- --- 41,50 ----
- If your system memcpy is more efficient, you might want to use it by
- uncommenting the following line. */
- /* #define mymemcpy memcpy */
- + #ifdef AMIGA
- + #define mymemcpy memcpy
- + #endif
- +
- + #ifndef AMIGA
- char *mymemcpy ();
- + #endif
-