home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / utils / indent13.lha / indent-1.3 / amiga.diffs next >
Encoding:
Text File  |  1992-06-05  |  12.7 KB  |  574 lines

  1. Only in dh2:indent-1.3: Makefile.amiga
  2. Only in dh2:indent-1.3: README.Amiga
  3. diff -c -r ram:indent-1.3-orig/args.c dh2:indent-1.3/args.c
  4. *** ram:indent-1.3-orig/args.c    Wed May 06 04:22:40 1992
  5. --- dh2:indent-1.3/args.c    Fri Jun 05 13:50:15 1992
  6. ***************
  7. *** 719,724 ****
  8. --- 719,744 ----
  9.     static char prof[]= INDENT_PROFILE;
  10.     char *homedir;
  11.   
  12. + #ifdef AMIGA
  13. +   if ((f = fopen (prof, "r")) != NULL)
  14. +     {
  15. +       scan_profile (f);
  16. +       (void) fclose (f);
  17. +       fname = xmalloc (sizeof prof);
  18. +       strcpy (fname, prof);
  19. +       return fname;
  20. +     }
  21. +   fname = xmalloc (sizeof prof + 5);
  22. +   sprintf (fname, "S:%s", prof);
  23. +   if ((f = fopen (fname, "r")) != NULL)
  24. +     {
  25. +       scan_profile (f);
  26. +       (void) fclose (f);
  27. +       return fname;
  28. +     }
  29. + #else
  30.     if ((f = fopen (INDENT_PROFILE, "r")) != NULL)
  31.       {
  32.         int len = strlen (INDENT_PROFILE) + 3;
  33. ***************
  34. *** 748,753 ****
  35. --- 768,774 ----
  36.   
  37.         free (fname);
  38.       }
  39. + #endif
  40.   
  41.     return 0;
  42.   }
  43. diff -c -r ram:indent-1.3-orig/backup.c dh2:indent-1.3/backup.c
  44. *** ram:indent-1.3-orig/backup.c    Wed May 06 20:39:24 1992
  45. --- dh2:indent-1.3/backup.c    Fri Jun 05 18:43:48 1992
  46. ***************
  47. *** 75,80 ****
  48. --- 75,83 ----
  49.   #else /* !USG */
  50.   #ifdef SYSDIR
  51.   #include <sys/dir.h>
  52. + #ifdef AMIGA
  53. + #define dirent direct
  54. + #endif
  55.   #endif /* SYSDIR */
  56.   #endif /* !USG */
  57.   #endif /* !DIRENT */
  58. ***************
  59. *** 92,98 ****
  60. --- 95,105 ----
  61.   #endif /* NODIR */
  62.   
  63.   /* Default backup file suffix to use */
  64. + #ifdef AMIGA
  65. + char *simple_backup_suffix = "!";
  66. + #else
  67.   char *simple_backup_suffix = "~";
  68. + #endif
  69.   
  70.   /* What kinds of backup files to make -- see
  71.      table `version_control_values' below. */
  72. ***************
  73. *** 133,139 ****
  74. --- 140,150 ----
  75.       {
  76.         for (p = &direntry[base_length + 2]; ISDIGIT (*p); ++p)
  77.       version = version * 10 + *p - '0';
  78. + #ifdef AMIGA
  79. +       if (p[0] != '!' || p[1])
  80. + #else
  81.         if (p[0] != '~' || p[1])
  82. + #endif
  83.       version = 0;
  84.       }
  85.   
  86. ***************
  87. *** 189,194 ****
  88. --- 200,225 ----
  89.     int version;
  90.   
  91.     p = pathname + pathlen - 1;
  92. + #ifdef AMIGA
  93. +   while (p > pathname && *p != '/' && *p != ':')
  94. +     p--;
  95. +   if (*p == '/')
  96. +     {
  97. +       int dirlen = p - pathname;
  98. +       filename = p + 1;
  99. +       dirname = xmalloc (dirlen + 1);
  100. +       strncpy (dirname, pathname, (dirlen));
  101. +       dirname[dirlen] = '\0';
  102. +     }
  103. +   else if (*p == ':')
  104. +     {
  105. +       int dirlen = p - pathname + 1;
  106. +       filename = p + 1;
  107. +       dirname = xmalloc (dirlen + 1);
  108. +       strncpy (dirname, pathname, (dirlen));
  109. +       dirname[dirlen] = '\0';
  110. +     }
  111. + #else
  112.     while (p > pathname && *p != '/')
  113.       p--;
  114.     if (*p == '/')
  115. ***************
  116. *** 199,207 ****
  117. --- 230,243 ----
  118.         strncpy (dirname, pathname, (dirlen));
  119.         dirname[dirlen] = '\0';
  120.       }
  121. + #endif
  122.     else
  123.       {
  124. + #ifdef AMIGA
  125. +       dirname = "";
  126. + #else
  127.         dirname = ".";
  128. + #endif
  129.         filename = pathname;
  130.       }
  131.   
  132. ***************
  133. *** 239,245 ****
  134. --- 275,285 ----
  135.     if (! backup_name)
  136.       return 0;
  137.   
  138. + #ifdef AMIGA
  139. +   sprintf (backup_name, "%s.!%d!", pathname, last_numbered_version);
  140. + #else
  141.     sprintf (backup_name, "%s.~%d~", pathname, last_numbered_version);
  142. + #endif
  143.     return backup_name;
  144.   }
  145.   #endif /* !NODIR */
  146. ***************
  147. *** 337,340 ****
  148.     close (fd);
  149.     free (backup_filename);
  150.   }
  151. -  
  152. --- 377,379 ----
  153. Only in dh2:indent-1.3: dirent_def.h
  154. diff -c -r ram:indent-1.3-orig/globs.c dh2:indent-1.3/globs.c
  155. *** ram:indent-1.3-orig/globs.c    Wed May 06 20:36:18 1992
  156. --- dh2:indent-1.3/globs.c    Fri Jun 05 15:55:58 1992
  157. ***************
  158. *** 62,67 ****
  159. --- 62,68 ----
  160.      Copy LEN bytes starting at SRCADDR to DESTADDR.  Result undefined
  161.      if the source overlaps with the destination.  */
  162.   
  163. + #ifndef AMIGA
  164.   char *
  165.   mymemcpy (destaddr, srcaddr, len)
  166.        char *destaddr;
  167. ***************
  168. *** 72,74 ****
  169. --- 73,76 ----
  170.       *destaddr++ = *srcaddr++;
  171.     return destaddr;
  172.   }
  173. + #endif
  174. Only in dh2:indent-1.3: indent
  175. diff -c -r ram:indent-1.3-orig/indent.c dh2:indent-1.3/indent.c
  176. *** ram:indent-1.3-orig/indent.c    Wed May 06 08:46:50 1992
  177. --- dh2:indent-1.3/indent.c    Fri Jun 05 18:20:28 1992
  178. ***************
  179. *** 33,38 ****
  180. --- 33,53 ----
  181.   #include "indent.h"
  182.   #include <ctype.h>
  183.   
  184. + #ifdef AMIGA
  185. + #include <exec/types.h>
  186. + #include <dos/dos.h>
  187. + #include <dos/dosextens.h>
  188. + #include <dos/dosasl.h>
  189. + #include <proto/dos.h>
  190. + #define MAXPATH 200
  191. + #define MAXARGS 256
  192. + extern struct DosLibrary *DOSBase;
  193. + int expand_args ();
  194. + #endif
  195.   void
  196.   usage ()
  197.   {
  198. ***************
  199. *** 1524,1529 ****
  200. --- 1539,1547 ----
  201.     struct file_buffer *current_input;
  202.     char *profile_pathname = 0;
  203.     int using_stdin = false;
  204. + #ifdef AMIGA
  205. +   int ex_err;
  206. + #endif
  207.   
  208.   #ifdef DEBUG
  209.     if (debug)
  210. ***************
  211. *** 1530,1535 ****
  212. --- 1548,1578 ----
  213.       debug_init ();
  214.   #endif
  215.   
  216. + #ifdef AMIGA
  217. +   if (DOSBase->dl_lib.lib_Version < 37)
  218. +     {
  219. +       fprintf (stderr, "You must have Kickstart 2.0 (V37) or higher!\n");
  220. +       exit (20);
  221. +     }
  222. +   if (argc == 2 && stricmp (argv[1],"-h") == 0)
  223. +     {
  224. +       usage ();
  225. +       exit (0);
  226. +     }
  227. +   if ((ex_err = expand_args (&argc, &argv)) == 0)
  228. +     {
  229. +       fprintf (stderr, "Couldn't expand wildcards\n");
  230. +       exit (20);
  231. +     }
  232. +   if (ex_err == 2)
  233. +     {
  234. +       fprintf (stderr, "Wildcards didn't match a file\n");
  235. +       exit (5);
  236. +     }
  237. + #endif
  238.     init_parser ();
  239.     initialize_backups ();
  240.   
  241. ***************
  242. *** 1632,1637 ****
  243. --- 1675,1684 ----
  244.       {
  245.         current_input = read_file (in_file_names[i]);
  246.         out_name = in_file_names[i];
  247. + #ifdef AMIGA
  248. +           if (verbose)
  249. +             printf ("\n%s:\n", out_name);
  250. + #endif
  251.         output = fopen (out_name, "w");
  252.         if (output == 0)
  253.           {
  254. ***************
  255. *** 1660,1665 ****
  256. --- 1707,1716 ----
  257.         if (! out_name && ! use_stdout)
  258.           {
  259.             out_name = in_file_names[0];
  260. + #ifdef AMIGA
  261. +               if (verbose)
  262. +                 printf ("\n%s:\n", out_name);
  263. + #endif
  264.             make_backup (current_input);
  265.           }
  266.       }
  267. ***************
  268. *** 1684,1686 ****
  269. --- 1735,1858 ----
  270.   
  271.     exit (0);
  272.   }
  273. + #ifdef AMIGA
  274. + char *expand_next_file (pattern)
  275. +      char *pattern;
  276. + {
  277. +   long err;
  278. +   char *pathname;
  279. +   static struct AnchorPath *an = NULL;
  280. +   pathname = NULL;
  281. +   if (pattern == NULL)
  282. +     err = -1;
  283. +   else
  284. +     do
  285. +       {
  286. +         if (an == NULL)
  287. +           {
  288. +             an = malloc (sizeof (struct AnchorPath) + MAXPATH);
  289. +             memset (an, 0, sizeof (struct AnchorPath) + MAXPATH);
  290. +             an->ap_BreakBits = SIGBREAKF_CTRL_C;
  291. +             an->ap_Strlen = MAXPATH;
  292. +             an->ap_Flags = APF_DOWILD;
  293. +             err = MatchFirst (pattern, an);
  294. +           }
  295. +         else
  296. +           err = MatchNext (an);
  297. +         /* Expand only files */
  298. +         if (an->ap_Info.fib_DirEntryType < 0)
  299. +           pathname = an->ap_Buf;
  300. +       } while (err == 0 && pathname == NULL);
  301. +   if (err)
  302. +     {
  303. +       MatchEnd (an);
  304. +       free (an);
  305. +       an = NULL;
  306. +       return NULL;
  307. +     }
  308. +   else
  309. +     return pathname;
  310. + }
  311. + int
  312. + in_prev_args (arg, argv, argc)
  313. +      char *arg, **argv;
  314. +      int argc;
  315. + {
  316. +   int i, is_in_args;
  317. +   is_in_args = 0;
  318. +   for (i = 1; i < argc - 1; i++)
  319. +     if (strcmp (arg, argv[i]) == 0)
  320. +       is_in_args = 1;
  321. +   return is_in_args;
  322. + }
  323. + int
  324. + expand_args (oargc, oargv)
  325. +      int *oargc;
  326. +      char ***oargv;
  327. + {
  328. +   int i;
  329. +   char *str, **argv, buf[MAXPATH];
  330. +   int argc, no_match_at_all, num_matches, contains_wildcards;
  331. +   no_match_at_all = 1;
  332. +   contains_wildcards = 0;
  333. +   argc = 0;
  334. +   argv = malloc (MAXARGS * sizeof (char *));
  335. +   if (argv == NULL)
  336. +     return 0;
  337. +   argv[argc++] = (*oargv)[0];
  338. +   for (i = 1; i < *oargc; i++)
  339. +     {
  340. +       if (ParsePattern ((*oargv)[i], buf, MAXPATH))
  341. +         {
  342. +           contains_wildcards = 1;
  343. +           num_matches = 0;
  344. +           while (str = expand_next_file ((*oargv)[i]))
  345. +             if (argc >= MAXARGS)
  346. +               {
  347. +                 expand_next_file (NULL);
  348. +                 return 0;
  349. +               }
  350. +             else
  351. +               {
  352. +                 /* Avoid duplicate entries */
  353. +                 if (!in_prev_args (str, argv, argc))
  354. +                   {
  355. +                     argv[argc++] = strdup (str);
  356. +                     num_matches++;
  357. +                   }
  358. +               }
  359. +           if (num_matches != 0)
  360. +             no_match_at_all = 0;
  361. +         }
  362. +       else
  363. +         if (argc >= MAXARGS)
  364. +           return 0;
  365. +         else
  366. +           {
  367. +             if ((*oargv)[i][0] != '-' && (*oargv)[i][0] != '+')
  368. +               /* Found a file with no wildcards */
  369. +               no_match_at_all = 0;
  370. +             if (!in_prev_args ((*oargv)[i], argv, argc))
  371. +               argv[argc++] = (*oargv)[i];
  372. +           }
  373. +     }
  374. +   *oargc = argc;
  375. +   *oargv = argv;
  376. +   if (no_match_at_all && contains_wildcards)
  377. +     return 2;
  378. +   else
  379. +     return 1;
  380. + }
  381. + #endif
  382. Only in dh2:indent-1.3: indent.dvi
  383. diff -c -r ram:indent-1.3-orig/io.c dh2:indent-1.3/io.c
  384. *** ram:indent-1.3-orig/io.c    Sun May 03 11:36:58 1992
  385. --- dh2:indent-1.3/io.c    Fri Jun 05 21:45:50 1992
  386. ***************
  387. *** 29,36 ****
  388. --- 29,43 ----
  389.      <sys/fcntl.h> or <sys/file.h> instead.  */
  390.   #include <fcntl.h>
  391.   
  392. + #ifdef AMIGA
  393. + #include <exec/types.h>
  394. + #include <dos/dos.h>
  395. + #include <proto/dos.h>
  396. + #define bcopy(s,d,l) memcpy(d,s,l)
  397. + #else
  398.   #include <sys/types.h>
  399.   #include <sys/stat.h>
  400. + #endif
  401.   
  402.   /* number of levels a label is placed to left of code */ 
  403.   #define LABEL_OFFSET 2
  404. ***************
  405. *** 422,430 ****
  406. --- 429,462 ----
  407.        char *filename;
  408.   {
  409.     int fd;
  410. + #ifndef AMIGA
  411.     struct stat file_stats;
  412. + #endif
  413.     int namelen = strlen (filename);
  414. + #ifdef AMIGA
  415. +   BPTR in_fh;
  416. +   struct FileInfoBlock __aligned in_fib;
  417. + #endif
  418. + #ifdef AMIGA
  419. +   in_fh = Lock (filename, SHARED_LOCK);
  420. +   if (in_fh == 0)
  421. +     sys_error (filename);
  422. +   if (Examine (in_fh, &in_fib) == 0)
  423. +     sys_error (filename);
  424. +   if (fileptr.data != 0)
  425. +     free (fileptr.data);
  426. +   fileptr.size = in_fib.fib_Size;
  427. +   fileptr.data = (char *) xmalloc (fileptr.size + 3);
  428.   
  429. +   UnLock (in_fh);
  430. +   fd = open (filename, O_RDONLY, 0777);
  431. +   if (fd < 0)
  432. +     sys_error (filename);
  433. + #else
  434.     fd = open (filename, O_RDONLY, 0777);
  435.     if (fd < 0)
  436.       sys_error (filename);
  437. ***************
  438. *** 436,441 ****
  439. --- 468,474 ----
  440.       free (fileptr.data);
  441.     fileptr.size = file_stats.st_size;
  442.     fileptr.data = (char *) xmalloc (file_stats.st_size + 3);
  443. + #endif
  444.   
  445.     if (read (fd, fileptr.data, fileptr.size) < 0)
  446.       sys_error (filename);
  447. ***************
  448. *** 470,479 ****
  449. --- 503,548 ----
  450.     unsigned int size = 15 * BUFSIZ;
  451.     int ch;
  452.     register char *p;
  453. + #ifdef AMIGA
  454. +   char *in_prog;
  455. +   int in_prog_size;
  456. + #endif
  457.   
  458.     if (stdinptr.data != 0)
  459.       free (stdinptr.data);
  460.   
  461. + /* The following code had to be changed, because you can't assume, that
  462. +    xrealloc() always returns the original pointer */
  463. + #ifdef AMIGA
  464. +   in_prog = (char *) xmalloc (size + 3);
  465. +   in_prog_size = 0;
  466. +   do
  467. +     {
  468. +       for (; in_prog_size < size; in_prog_size++)
  469. +     {
  470. +       ch = getc (stdin);
  471. +       if (ch == EOF)
  472. +         break;
  473. +       in_prog[in_prog_size] = ch;
  474. +     }
  475. +       if (ch != EOF)
  476. +     {
  477. +       size += (2 * BUFSIZ);
  478. +       in_prog = xrealloc (in_prog, size);
  479. +     }
  480. +     }
  481. +   while (ch != EOF);
  482. +   stdinptr.data = in_prog;
  483. +   stdinptr.size = in_prog_size;
  484. +   stdinptr.name = "Standard Input";
  485. +   stdinptr.data[stdinptr.size] = ' ';
  486. +   stdinptr.data[stdinptr.size + 1] = '\n';
  487. +   stdinptr.data[stdinptr.size + 2] = '\0';
  488. + #else
  489.     stdinptr.data = (char *) xmalloc (size + 3);
  490.     stdinptr.size = 0;
  491.     p = stdinptr.data;
  492. ***************
  493. *** 502,507 ****
  494. --- 571,577 ----
  495.     stdinptr.data[stdinptr.size] = ' ';
  496.     stdinptr.data[stdinptr.size + 1] = '\n';
  497.     stdinptr.data[stdinptr.size + 2] = '\0';
  498. + #endif
  499.   
  500.     return &stdinptr;
  501.   }
  502. diff -c -r ram:indent-1.3-orig/sys.h dh2:indent-1.3/sys.h
  503. *** ram:indent-1.3-orig/sys.h    Wed May 06 20:38:56 1992
  504. --- dh2:indent-1.3/sys.h    Fri Jun 05 15:54:18 1992
  505. ***************
  506. *** 8,13 ****
  507. --- 8,18 ----
  508.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  */
  509.   
  510.   #include <stdio.h>
  511. + #ifdef AMIGA
  512. + /* For malloc, etc... */
  513. + #include <stdlib.h>
  514. + #include <string.h>
  515. + #endif
  516.   
  517.   #ifdef DEBUG
  518.   extern int debug;
  519. ***************
  520. *** 23,30 ****
  521. --- 28,37 ----
  522.   extern struct file_buffer *read_file (), *read_stdin ();
  523.   
  524.   /* Standard memory allocation routines.  */
  525. + #ifndef AMIGA
  526.   char *malloc ();
  527.   char *realloc ();
  528. + #endif
  529.   
  530.   /* Similar, but abort with an error if out of memory (see globs.c).  */
  531.   char *xmalloc ();
  532. ***************
  533. *** 34,37 ****
  534. --- 41,50 ----
  535.      If your system memcpy is more efficient, you might want to use it by
  536.      uncommenting the following line.  */
  537.   /* #define mymemcpy memcpy */
  538. + #ifdef AMIGA
  539. + #define mymemcpy memcpy
  540. + #endif
  541. + #ifndef AMIGA
  542.   char *mymemcpy ();
  543. + #endif
  544.