home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / GNUISH / INDENT11.ZIP / PATCHES < prev    next >
Text File  |  1990-09-23  |  52KB  |  1,833 lines

  1. diff -cBdNp e:/gnu/indent/gnu/args.c ./args.c
  2. *** e:/gnu/indent/gnu/args.c    Mon Jul 02 20:39:16 1990
  3. --- ./args.c    Mon Jul 02 20:39:26 1990
  4. ***************
  5. *** 18,23 ****
  6. --- 18,40 ----
  7.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  8.    */
  9.   
  10. + /*
  11. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  12. +  *
  13. +  * To this port, the same copying conditions apply as to the
  14. +  * original release.
  15. +  *
  16. +  * IMPORTANT:
  17. +  * This file is not identical to the original GNU release!
  18. +  * You should have received this code as patch to the official
  19. +  * GNU release.
  20. +  *
  21. +  * MORE IMPORTANT:
  22. +  * This port comes with ABSOLUTELY NO WARRANTY.
  23. +  *
  24. +  * $Header: e:/gnu/indent/RCS/args.c'v 1.1.0.2 90/07/02 10:32:18 tho Exp $
  25. +  */
  26.   #ifndef lint
  27.   static char sccsid[] = "@(#)args.c    5.8 (Berkeley) 5/15/89";
  28.   #endif /* not lint */
  29. *************** struct pro {
  30. *** 157,166 ****
  31. --- 174,190 ----
  32.   struct pro pro[] = {
  33.   
  34.       {"T", PRO_KEY, 0, ONOFF_NA, 0, &exp_T},
  35. + #ifdef MSDOS
  36. +     {"bacc", PRO_BOOL, false, ON,
  37. +       &blanklines_around_cond_comp, &exp_bacc},
  38. +     {"badp", PRO_BOOL, false, ON,
  39. +        &blanklin_after_decl_proctop, &exp_badp},
  40. + #else
  41.       {"bacc", PRO_BOOL, false, ON,
  42.         &blanklines_around_conditional_compilation, &exp_bacc},
  43.       {"badp", PRO_BOOL, false, ON,
  44.          &blanklines_after_declarations_at_proctop, &exp_badp},
  45. + #endif /* MSDOS */
  46.       {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations, &exp_bad},
  47.       {"bap", PRO_BOOL, false, ON, &blanklines_after_procs, &exp_bap},
  48.       {"bbb", PRO_BOOL, false, ON, &blanklines_before_blockcomments, &exp_bbb},
  49. *************** struct pro pro[] = {
  50. *** 203,212 ****
  51. --- 227,243 ----
  52.       {"lc", PRO_INT, 0, ONOFF_NA, &block_comment_max_col, &exp_lc},
  53.       {"lp", PRO_BOOL, true, ON, &lineup_to_parens, &exp_lp},
  54.       {"l", PRO_INT, 78, ONOFF_NA, &max_col, &exp_l},
  55. + #ifdef MSDOS
  56.       {"nbacc", PRO_BOOL, false, OFF,
  57. +        &blanklines_around_cond_comp, &exp_bacc},
  58. +     {"nbadp", PRO_BOOL, false, OFF,
  59. +        &blanklin_after_decl_proctop, &exp_badp},
  60. + #else
  61. +     {"nbacc", PRO_BOOL, false, OFF,
  62.          &blanklines_around_conditional_compilation, &exp_bacc},
  63.       {"nbadp", PRO_BOOL, false, OFF,
  64.          &blanklines_after_declarations_at_proctop, &exp_badp},
  65. + #endif /* MSDOS */
  66.       {"nbad", PRO_BOOL, false, OFF, &blanklines_after_declarations, &exp_bad},
  67.       {"nbap", PRO_BOOL, false, OFF, &blanklines_after_procs, &exp_bap},
  68.       {"nbbb", PRO_BOOL, false, OFF, &blanklines_before_blockcomments, &exp_bbb},
  69. *************** struct pro pro[] = {
  70. *** 249,257 ****
  71. --- 280,300 ----
  72.    * set_profile reads $HOME/.indent.pro and ./.indent.pro and handles arguments
  73.    * given in these files.
  74.    */
  75. + void
  76.   set_profile()
  77.   {
  78.       register FILE *f;
  79. + #ifdef MSDOS
  80. +     static char prof[] = "indent.pro";
  81. +     char fname[_MAX_PATH],
  82. +      device[_MAX_DRIVE],
  83. +      homedir[_MAX_DIR],
  84. +      filename[_MAX_FNAME],
  85. +      ext[_MAX_EXT];
  86. +                     /* look for profile in indent's dir */
  87. +     _splitpath( my_name, device, homedir, filename, ext);
  88. +     _makepath( fname, device, homedir, prof, "");
  89. + #else
  90.       char *fname;
  91.       static char prof[] = ".indent.pro";
  92.       char *homedir;
  93. *************** set_profile()
  94. *** 259,264 ****
  95. --- 302,309 ----
  96.       homedir = getenv("HOME");
  97.       fname = xmalloc(strlen(homedir) + 10 + sizeof prof);
  98.       sprintf(fname, "%s/%s", homedir, prof);
  99. + #endif
  100.       if ((f = fopen(option_source = fname, "r")) != NULL) {
  101.       scan_profile(f);
  102.       (void) fclose(f);
  103. *************** set_profile()
  104. *** 271,276 ****
  105. --- 316,322 ----
  106.       free (fname);
  107.   }
  108.   
  109. + void
  110.   scan_profile(f)
  111.       register FILE *f;
  112.   {
  113. *************** scan_profile(f)
  114. *** 279,285 ****
  115.       char        buf[BUFSIZ];
  116.   
  117.       while (1) {
  118. !     for (p = buf; (i = getc(f)) != EOF && (*p = i) > ' '; ++p);
  119.       if (p != buf) {
  120.           *p++ = 0;
  121.           if (verbose)
  122. --- 325,331 ----
  123.       char        buf[BUFSIZ];
  124.   
  125.       while (1) {
  126. !     for (p = buf; (i = getc(f)) != EOF && (*p = (char) i) > ' '; ++p);
  127.       if (p != buf) {
  128.           *p++ = 0;
  129.           if (verbose)
  130. *************** eqin(s1, s2, start_param)
  131. *** 311,316 ****
  132. --- 357,363 ----
  133.   /*
  134.    * Set the defaults.
  135.    */
  136. + void
  137.   set_defaults()
  138.   {
  139.       register struct pro *p;
  140. *************** set_defaults()
  141. *** 325,330 ****
  142. --- 372,378 ----
  143.      specified (as opposed to being taken from a PRO_SETTINGS group of
  144.      settings).  */
  145.   
  146. + void
  147.   set_option (arg, explicit)
  148.        char *arg;
  149.        int explicit;
  150. diff -cBdNp e:/gnu/indent/gnu/globs.c ./globs.c
  151. *** e:/gnu/indent/gnu/globs.c    Mon Jul 02 20:39:18 1990
  152. --- ./globs.c    Mon Jul 02 20:39:26 1990
  153. ***************
  154. *** 15,24 ****
  155. --- 15,53 ----
  156.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  157.    */
  158.   
  159. + /*
  160. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  161. +  *
  162. +  * To this port, the same copying conditions apply as to the
  163. +  * original release.
  164. +  *
  165. +  * IMPORTANT:
  166. +  * This file is not identical to the original GNU release!
  167. +  * You should have received this code as patch to the official
  168. +  * GNU release.
  169. +  *
  170. +  * MORE IMPORTANT:
  171. +  * This port comes with ABSOLUTELY NO WARRANTY.
  172. +  *
  173. +  * $Header: e:/gnu/indent/RCS/globs.c'v 1.1.0.4 90/07/02 20:25:09 tho Exp $
  174. +  */
  175.   #include "indent_globs.h"
  176.   
  177.   /* Like malloc but get error if no storage available.  */
  178.   
  179. + #ifdef MSDOS
  180. + void *xmalloc (size_t size)        /* cleaner anyway ... */
  181. + {
  182. +   register void *val = malloc (size);
  183. +   if (!val)
  184. +     {
  185. +       fprintf (stderr,"indent: Virtual memory exhausted.\n");
  186. +       exit (1);
  187. +     }
  188. +   return val;
  189. + }
  190. + #else /* not MSDOS */
  191.   char *
  192.   xmalloc (size)
  193.        long size;
  194. *************** xmalloc (size)
  195. *** 31,39 ****
  196. --- 60,81 ----
  197.       }
  198.     return val;
  199.   }
  200. + #endif /* not MSDOS */
  201.   
  202.   /* Like realloc but get error if no storage available.  */
  203.   
  204. + #ifdef MSDOS
  205. + void *xrealloc (void *ptr, size_t size)    /* cleaner anyway ... */
  206. + {
  207. +   register void *val = realloc (ptr, size);
  208. +   if (!val)
  209. +     {
  210. +       fprintf (stderr,"indent: Virtual memory exhausted.\n");
  211. +       exit (1);
  212. +     }
  213. +   return val;
  214. + }
  215. + #else /* not MSDOS */
  216.   char *
  217.   xrealloc (ptr, size)
  218.        char *ptr;
  219. *************** xrealloc (ptr, size)
  220. *** 47,52 ****
  221. --- 89,95 ----
  222.       }
  223.     return val;
  224.   }
  225. + #endif /* not MSDOS */
  226.   
  227.   /* Some systems lack memcpy so this does the same thing.
  228.      If your system-supplied memcpy is more efficient, you might want
  229. *************** xrealloc (ptr, size)
  230. *** 54,59 ****
  231. --- 97,103 ----
  232.   
  233.      Copy LEN bytes starting at SRCADDR to DESTADDR.  Result undefined
  234.      if the source overlaps with the destination.  */
  235. + #ifndef MSDOS
  236.   char *
  237.   mymemcpy (destaddr, srcaddr, len)
  238.        char *destaddr;
  239. *************** mymemcpy (destaddr, srcaddr, len)
  240. *** 64,66 ****
  241. --- 108,229 ----
  242.       *destaddr++ = *srcaddr++;
  243.     return destaddr;
  244.   }
  245. + #endif /* not MSDOS */
  246. + /* malloc a block of memory, with fatal error message if we can't do it. */
  247. + #ifdef M_I86HM
  248. + #include <dos.h>
  249. + void huge *
  250. + xhalloc (long size)
  251. + {
  252. +   void huge *value = (void huge *) halloc (size, (size_t)1 );
  253. +   if (!value)
  254. +     {
  255. +       fprintf (stderr, "indent: Virtual memory exhausted.\n");
  256. +       exit (1);
  257. +     }
  258. +   return value;
  259. + }
  260. + /* Here we do a huge "realloc" by allocating a new block and
  261. +    moving the old block afterwards.  This is *slow*, but should
  262. +    be reliable.  */
  263. + void huge *
  264. + xhrealloc (void huge *ptr, long new_size, long old_size)
  265. + {
  266. +   void huge *value = (void huge *) halloc (new_size, (size_t)1 );
  267. +   if (!value)
  268. +     {
  269. +       fprintf (stderr,"indent: Virtual memory exhausted.\n");
  270. +       exit (1);
  271. +     }
  272. +   else
  273. +     {
  274. +       char huge *dest = value;
  275. +       char huge *src = ptr;
  276. +       while (old_size > 0L)
  277. +     {
  278. +       unsigned int bytes = (unsigned int) min (0x8000L, old_size);
  279. +       memcpy (dest, src, bytes);
  280. +       old_size -= (long) bytes;
  281. +       dest += (long) bytes;
  282. +       src += (long) bytes;
  283. +     }
  284. +     }
  285. +   hfree (ptr);
  286. +   return value;
  287. + }
  288. + long        /* doesn't belong here, but is also a 'huge' pointer kludge */
  289. + hread (int fd, void huge *buffer, long bytes)
  290. + {
  291. +   long bytes_read = 0L;
  292. +   while (1)
  293. +     {
  294. +       int n = read (fd, buffer, (unsigned int) min (0x4000L, bytes));
  295. +       if (n > 0)
  296. +     {
  297. +       bytes_read += (long) n;
  298. +       bytes -= (long) n;
  299. +       /* we can't say buffer += n here, because we have to make
  300. +          sure that the offset of BUFFER doesn't overflow during
  301. +          the read() system call.  Therefore we add what we read
  302. +          to the segment of BUFFER.  */
  303. +       FP_SEG(buffer) += (n >> 4);
  304. +       FP_OFF(buffer) += (n & 0x0F);
  305. +     }
  306. +       else if (n == 0)
  307. +     return bytes_read;    /* done */
  308. +       else
  309. +     {
  310. +       perror ("indent: Error while reading input");
  311. +       exit (1);
  312. +     }
  313. +     }
  314. + }
  315. + long
  316. + hwrite (int fd, void huge *buffer, long bytes)
  317. + {
  318. +   long bytes_written = 0L;
  319. +   while (1)
  320. +     {
  321. +       unsigned int n = (unsigned int) min (0x4000L, bytes);
  322. +       unsigned int m = write (fd, buffer, n);
  323. +       if (m == n)
  324. +     {
  325. +       bytes_written += (long) m;
  326. +       bytes -= (long) m;
  327. +       if (bytes <= 0)
  328. +         return bytes_written;
  329. +       /* we can't say buffer += n here, because we have to make
  330. +          sure that the offset of BUFFER doesn't overflow during
  331. +          the read() system call.  Therefore we add what we read
  332. +          to the segment of BUFFER.  */
  333. +       FP_SEG(buffer) += (m >> 4);
  334. +       FP_OFF(buffer) += (m & 0x0F);
  335. +     }
  336. +       else
  337. +     {
  338. +       perror ("indent: Error while reading input");
  339. +       exit (1);
  340. +     }
  341. +     }
  342. + }
  343. + #endif /* M_I86HM */
  344. diff -cBdNp e:/gnu/indent/gnu/indent.c ./indent.c
  345. *** e:/gnu/indent/gnu/indent.c    Mon Jul 02 20:39:20 1990
  346. --- ./indent.c    Mon Jul 02 20:39:34 1990
  347. ***************
  348. *** 18,23 ****
  349. --- 18,40 ----
  350.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  351.    */
  352.   
  353. + /*
  354. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  355. +  *
  356. +  * To this port, the same copying conditions apply as to the
  357. +  * original release.
  358. +  *
  359. +  * IMPORTANT:
  360. +  * This file is not identical to the original GNU release!
  361. +  * You should have received this code as patch to the official
  362. +  * GNU release.
  363. +  *
  364. +  * MORE IMPORTANT:
  365. +  * This port comes with ABSOLUTELY NO WARRANTY.
  366. +  *
  367. +  * $Header: e:/gnu/indent/RCS/indent.c'v 1.1.0.3 90/07/02 20:25:11 tho Exp $
  368. +  */
  369.   #ifndef lint
  370.   char copyright[] =
  371.   "@(#) Copyright (c) 1985 Sun Microsystems, Inc.\n\
  372. *************** char       *out_name = 0;    /* will always
  373. *** 41,46 ****
  374. --- 58,64 ----
  375.   /* The following variables are documented in indent_globs.h.  */
  376.   int else_or_endif = false;
  377.   
  378. + void
  379.   main(argc, argv)
  380.       int         argc;
  381.       char      **argv;
  382. *************** main(argc, argv)
  383. *** 54,60 ****
  384.       int *di_stack;
  385.       /* Currently allocated size of di_stack.  */
  386.       int di_stack_alloc;
  387. !     
  388.       int         flushed_nl;    /* used when buffering up comments to remember
  389.                    * that a newline was passed over */
  390.       int         force_nl;    /* when true, code must be broken */
  391. --- 72,78 ----
  392.       int *di_stack;
  393.       /* Currently allocated size of di_stack.  */
  394.       int di_stack_alloc;
  395.       int         flushed_nl;    /* used when buffering up comments to remember
  396.                    * that a newline was passed over */
  397.       int         force_nl;    /* when true, code must be broken */
  398. *************** main(argc, argv)
  399. *** 72,78 ****
  400.          decremented at the beginning of the loop, so it will reach zero
  401.          when the second token after the ')' is read.  */
  402.       int last_token_ends_sp = 0;
  403. !     
  404.       int         squest;        /* when this is positive, we have seen a ?
  405.                    * without the matching : in a <c>?<s>:<s>
  406.                    * construct */
  407. --- 90,96 ----
  408.          decremented at the beginning of the loop, so it will reach zero
  409.          when the second token after the ')' is read.  */
  410.       int last_token_ends_sp = 0;
  411.       int         squest;        /* when this is positive, we have seen a ?
  412.                    * without the matching : in a <c>?<s>:<s>
  413.                    * construct */
  414. *************** main(argc, argv)
  415. *** 86,93 ****
  416. --- 104,121 ----
  417.       |              INITIALIZATION              |
  418.       \*-----------------------------------------------*/
  419.   
  420. + #ifdef MSDOS
  421. +     my_name = xmalloc( strlen(argv[0]) + 1 );        /* who am I?      */
  422. +     strcpy( my_name, argv[0] );
  423. + #endif /* MSDOS */
  424.       parser_state_tos = (struct parser_state *)
  425.         xmalloc(sizeof(struct parser_state));
  426. + #ifdef MSDOS
  427. +     memset(parser_state_tos,'\0',sizeof(struct parser_state));    /* tidy      */
  428. + #endif /* MSDOS */
  429.       parser_state_tos->next = 0;
  430.       /* Allocate initial stacks for the parser.  */
  431.       parser_state_tos->p_stack_size = INITIAL_STACK_SIZE;
  432. *************** main(argc, argv)
  433. *** 101,107 ****
  434.       parser_state_tos->paren_indents_size = 1;
  435.       parser_state_tos->paren_indents = (short *) xmalloc
  436.         (parser_state_tos->paren_indents_size * sizeof (short));
  437. !     
  438.       parser_state_tos->p_stack[0] = stmt;    /* this is the parser's stack */
  439.       parser_state_tos->last_nl = true;        /* this is true if the last thing scanned was
  440.                    * a newline */
  441. --- 129,135 ----
  442.       parser_state_tos->paren_indents_size = 1;
  443.       parser_state_tos->paren_indents = (short *) xmalloc
  444.         (parser_state_tos->paren_indents_size * sizeof (short));
  445.       parser_state_tos->p_stack[0] = stmt;    /* this is the parser's stack */
  446.       parser_state_tos->last_nl = true;        /* this is true if the last thing scanned was
  447.                    * a newline */
  448. *************** main(argc, argv)
  449. *** 127,138 ****
  450.       sp_sw = force_nl = false;
  451.       parser_state_tos->in_or_st = false;
  452.       parser_state_tos->bl_line = true;
  453. !     
  454.       dec_ind = 0;
  455.       di_stack_alloc = 2;
  456.       di_stack = (int *)xmalloc (di_stack_alloc * sizeof (*di_stack));
  457.       di_stack[parser_state_tos->dec_nest = 0] = 0;
  458. !     
  459.       parser_state_tos->want_blank = parser_state_tos->in_stmt = parser_state_tos->ind_stmt = false;
  460.       parser_state_tos->procname = parser_state_tos->procname_end = "\0";
  461.   
  462. --- 155,166 ----
  463.       sp_sw = force_nl = false;
  464.       parser_state_tos->in_or_st = false;
  465.       parser_state_tos->bl_line = true;
  466.       dec_ind = 0;
  467.       di_stack_alloc = 2;
  468.       di_stack = (int *)xmalloc (di_stack_alloc * sizeof (*di_stack));
  469.       di_stack[parser_state_tos->dec_nest = 0] = 0;
  470.       parser_state_tos->want_blank = parser_state_tos->in_stmt = parser_state_tos->ind_stmt = false;
  471.       parser_state_tos->procname = parser_state_tos->procname_end = "\0";
  472.   
  473. *************** main(argc, argv)
  474. *** 296,302 ****
  475.                  necessary to keep track of the text between the if() and
  476.              the start of the statement which follows.  Use save_com
  477.              to do so.  */
  478. !         
  479.           switch (type_code) {
  480.           case newline:
  481.           ++line_no;
  482. --- 324,330 ----
  483.                  necessary to keep track of the text between the if() and
  484.              the start of the statement which follows.  Use save_com
  485.              to do so.  */
  486.           switch (type_code) {
  487.           case newline:
  488.           ++line_no;
  489. *************** main(argc, argv)
  490. *** 318,324 ****
  491.              if (foo) {
  492.                / * comment here * /
  493.             */
  494. !           
  495.             save_com.ptr[0] = '{';
  496.   
  497.           else
  498. --- 346,352 ----
  499.              if (foo) {
  500.                / * comment here * /
  501.             */
  502.             save_com.ptr[0] = '{';
  503.   
  504.           else
  505. *************** check_type:
  506. *** 543,549 ****
  507.           /* Do not put a space before the '{'.  */
  508.           parser_state_tos->want_blank = false;
  509.             }
  510. !         
  511.           /* Count parens so we know how deep we are.  */
  512.           if (++parser_state_tos->p_l_follow
  513.           >= parser_state_tos->paren_indents_size)
  514. --- 571,577 ----
  515.           /* Do not put a space before the '{'.  */
  516.           parser_state_tos->want_blank = false;
  517.             }
  518.           /* Count parens so we know how deep we are.  */
  519.           if (++parser_state_tos->p_l_follow
  520.           >= parser_state_tos->paren_indents_size)
  521. *************** check_type:
  522. *** 891,897 ****
  523. --- 919,929 ----
  524.                            * a declaration, so dont do
  525.                            * special indentation of
  526.                            * comments */
  527. + #ifdef MSDOS
  528. +         if (blanklin_after_decl_proctop
  529. + #else
  530.           if (blanklines_after_declarations_at_proctop
  531. + #endif /* MSDOS */
  532.               && parser_state_tos->in_parameter_declaration)
  533.               postfix_blankline_requested = 1;
  534.           parser_state_tos->in_parameter_declaration = 0;
  535. *************** check_type:
  536. *** 902,908 ****
  537.              Needed so that the '=' in "enum bar {a = 1" does not
  538.              get interpreted as the start of an initializer.  */
  539.           parser_state_tos->in_or_st = false;
  540. !            
  541.           parse(lbrace);    /* let parser know about this */
  542.           if (parser_state_tos->want_blank)    /* put a blank before '{' if '{' is not at
  543.                    * start of line */
  544. --- 934,940 ----
  545.              Needed so that the '=' in "enum bar {a = 1" does not
  546.              get interpreted as the start of an initializer.  */
  547.           parser_state_tos->in_or_st = false;
  548.           parse(lbrace);    /* let parser know about this */
  549.           if (parser_state_tos->want_blank)    /* put a blank before '{' if '{' is not at
  550.                    * start of line */
  551. *************** check_type:
  552. *** 1103,1109 ****
  553.                 check_code_size;
  554.                 *e_code++ = *t_ptr;
  555.               }
  556. !         }    
  557.           parser_state_tos->want_blank = true;
  558.   
  559.           /* If the token is va_dcl, it appears without a semicolon,
  560. --- 1135,1141 ----
  561.                 check_code_size;
  562.                 *e_code++ = *t_ptr;
  563.               }
  564. !         }
  565.           parser_state_tos->want_blank = true;
  566.   
  567.           /* If the token is va_dcl, it appears without a semicolon,
  568. *************** check_type:
  569. *** 1245,1251 ****
  570. --- 1277,1287 ----
  571.           }
  572.   
  573.           if (strncmp(s_lab + 1, "if", 2) == 0) {
  574. + #ifdef MSDOS
  575. +         if (blanklines_around_cond_comp) {
  576. + #else
  577.           if (blanklines_around_conditional_compilation) {
  578. + #endif /* MSDOS */
  579.               register    c;
  580.               prefix_blankline_requested++;
  581.               while ((c = *in_prog_pos++) == '\n');
  582. *************** check_type:
  583. *** 1286,1292 ****
  584.               (parser_state_tos->paren_indents_size * sizeof (short));
  585.             mymemcpy (new->paren_indents, parser_state_tos->paren_indents,
  586.                 parser_state_tos->paren_indents_size * sizeof (short));
  587. !           
  588.             new->next = parser_state_tos;
  589.             parser_state_tos = new;
  590.           }
  591. --- 1322,1328 ----
  592.               (parser_state_tos->paren_indents_size * sizeof (short));
  593.             mymemcpy (new->paren_indents, parser_state_tos->paren_indents,
  594.                 parser_state_tos->paren_indents_size * sizeof (short));
  595.             new->next = parser_state_tos;
  596.             parser_state_tos = new;
  597.           }
  598. *************** check_type:
  599. *** 1316,1322 ****
  600.               mymemcpy (parser_state_tos, second,
  601.                   sizeof(struct parser_state));
  602.               parser_state_tos->next = second;
  603. !             
  604.               /* Now copy the arrays from the second to top of
  605.                  stack to the top of stack.  */
  606.               /* Since the p_stack, etc. arrays only grow, never
  607. --- 1352,1358 ----
  608.               mymemcpy (parser_state_tos, second,
  609.                   sizeof(struct parser_state));
  610.               parser_state_tos->next = second;
  611.               /* Now copy the arrays from the second to top of
  612.                  stack to the top of stack.  */
  613.               /* Since the p_stack, etc. arrays only grow, never
  614. *************** check_type:
  615. *** 1369,1375 ****
  616. --- 1405,1415 ----
  617.             }
  618.           else
  619.               diag(1, "Unmatched #endif");
  620. + #ifdef MSDOS
  621. +         if (blanklines_around_cond_comp) {
  622. + #else
  623.           if (blanklines_around_conditional_compilation) {
  624. + #endif /* MSDOS */
  625.               postfix_blankline_requested++;
  626.               n_real_blanklines = 0;
  627.           }
  628. *************** check_type:
  629. *** 1403,1408 ****
  630. --- 1443,1449 ----
  631.    * backup file will be "file.BAK" then make the backup file the input and
  632.    * original input file the output
  633.    */
  634. + void
  635.   bakcopy()
  636.   {
  637.       /* file descriptor for the output file */
  638. *************** bakcopy()
  639. *** 1410,1433 ****
  640.   
  641.       /* Used to walk around file names */
  642.       register char *p;
  643.   
  644.       /* Buffer for error message.  */
  645.       char *errbuf;
  646.       /* Backup file name.  */
  647.       char *bakfile;
  648. !     
  649.       /* construct name of backup file */
  650.       for (p = in_name; *p; p++);    /* skip to end of string */
  651.       while (p > in_name && *p != '/')    /* find last '/' */
  652.       p--;
  653.       if (*p == '/')
  654.       p++;
  655.       bakfile = xmalloc(40 + strlen(p));
  656.       sprintf(bakfile, "%s.BAK", p);
  657.       errbuf = xmalloc(80 + strlen(p));
  658.   
  659.       sprintf(errbuf,"indent: %s",bakfile);
  660. !       
  661.       /* copy in_name to backup file */
  662.       /* permissions 0666 means rw-rw-rw- (modified by umask).  */
  663.       bakchn = creat(bakfile, 0666);
  664. --- 1451,1495 ----
  665.   
  666.       /* Used to walk around file names */
  667.       register char *p;
  668. + #ifdef MSDOS
  669. +     char *p_no_ext,
  670. +      *p_ext;
  671. + #endif /* MSDOS */
  672.   
  673.       /* Buffer for error message.  */
  674.       char *errbuf;
  675.       /* Backup file name.  */
  676.       char *bakfile;
  677.       /* construct name of backup file */
  678.       for (p = in_name; *p; p++);    /* skip to end of string */
  679. + #ifdef MSDOS
  680. +     while (p > in_name && *p != '/' && *p != '\\' )
  681. +     p--;
  682. +     if (*p == '/' || *p == '\\' )
  683. +     p++;
  684. + #else
  685.       while (p > in_name && *p != '/')    /* find last '/' */
  686.       p--;
  687.       if (*p == '/')
  688.       p++;
  689. + #endif /* MSDOS */
  690.       bakfile = xmalloc(40 + strlen(p));
  691. + #ifdef MSDOS                /* strip extension! */
  692. +     p_no_ext = xmalloc(strlen(p)+1);
  693. +     strcpy(p_no_ext,p);
  694. +     if( p_ext = strrchr(p_no_ext,'.'))
  695. +     *p_ext = '\0';
  696. +     sprintf(bakfile, "%s.BAK", p_no_ext);
  697. +     free(p_no_ext);
  698. + #else
  699.       sprintf(bakfile, "%s.BAK", p);
  700. + #endif /* MSDOS */
  701.       errbuf = xmalloc(80 + strlen(p));
  702.   
  703.       sprintf(errbuf,"indent: %s",bakfile);
  704.       /* copy in_name to backup file */
  705.       /* permissions 0666 means rw-rw-rw- (modified by umask).  */
  706.       bakchn = creat(bakfile, 0666);
  707. *************** bakcopy()
  708. *** 1437,1443 ****
  709. --- 1499,1509 ----
  710.       exit(1);
  711.         }
  712.   
  713. + #ifdef M_I86HM
  714. +     if (hwrite(bakchn, in_prog, in_prog_size) != in_prog_size)
  715. + #else
  716.       if (write(bakchn, in_prog, in_prog_size) != in_prog_size)
  717. + #endif
  718.         {
  719.       perror(errbuf);
  720.       exit(1);
  721. *************** bakcopy()
  722. *** 1444,1450 ****
  723.         }
  724.   
  725.       close(bakchn);
  726. !     
  727.       /* now the original input file will be the output */
  728.       output = fopen(in_name, "w");
  729.       if (output == 0) {
  730. --- 1510,1516 ----
  731.         }
  732.   
  733.       close(bakchn);
  734.       /* now the original input file will be the output */
  735.       output = fopen(in_name, "w");
  736.       if (output == 0) {
  737. diff -cBdNp e:/gnu/indent/gnu/indent_g.h ./indent_g.h
  738. *** e:/gnu/indent/gnu/indent_g.h    Mon Jul 02 20:39:20 1990
  739. --- ./indent_g.h    Mon Jul 02 20:39:38 1990
  740. ***************
  741. *** 20,26 ****
  742. --- 20,64 ----
  743.    *    @(#)indent_globs.h    5.7 (Berkeley) 9/15/88
  744.    */
  745.   
  746. + /*
  747. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  748. +  *
  749. +  * To this port, the same copying conditions apply as to the
  750. +  * original release.
  751. +  *
  752. +  * IMPORTANT:
  753. +  * This file is not identical to the original GNU release!
  754. +  * You should have received this code as patch to the official
  755. +  * GNU release.
  756. +  *
  757. +  * MORE IMPORTANT:
  758. +  * This port comes with ABSOLUTELY NO WARRANTY.
  759. +  *
  760. +  * $Header: e:/gnu/indent/RCS/indent_g.h'v 1.1.0.4 90/07/02 20:25:28 tho Exp $
  761. +  */
  762.   #include <stdio.h>
  763. + #ifdef MSDOS
  764. + #include <stdlib.h>
  765. + #include <string.h>
  766. + #include <malloc.h>
  767. + #include <io.h>
  768. + #define mymemcpy memcpy
  769. + #ifdef M_I86HM
  770. + /* This symbol is predefined by the Microsoft C Compiler,
  771. +    when it is creating "huge memory model" code.
  772. +    In that case we need long offsets and buffer lengths.  */
  773. + #define LONG long
  774. + #else
  775. + #define LONG unsigned int
  776. + #endif
  777. + #else /* not MSDOS */
  778.   #include <strings.h>
  779.   
  780.   /* Standard memory allocation routines.  */
  781. *************** char *realloc ();
  782. *** 31,41 ****
  783.   char *xmalloc ();
  784.   char *xrealloc ();
  785.   
  786.   /* Because some systems lack memcpy, I have provided one, called
  787.      mymemcpy.  If you system memcpy is more efficient, you might
  788.      want to use it by uncommenting the following line.  */
  789.   /* #define mymemcpy memcpy */
  790. ! char *mymemcpy ();
  791.   
  792.   #define BACKSLASH '\\'
  793.   #define label_offset 2        /* number of levels a label is placed to left
  794. --- 69,83 ----
  795.   char *xmalloc ();
  796.   char *xrealloc ();
  797.   
  798. + #define LONG unsigned int
  799. + #endif /* not MSDOS */
  800.   /* Because some systems lack memcpy, I have provided one, called
  801.      mymemcpy.  If you system memcpy is more efficient, you might
  802.      want to use it by uncommenting the following line.  */
  803.   /* #define mymemcpy memcpy */
  804. ! /* char *mymemcpy ();        see below, [tho] Mon Nov 13 01:12:02 1989 */
  805.   
  806.   #define BACKSLASH '\\'
  807.   #define label_offset 2        /* number of levels a label is placed to left
  808. *************** enum codes {code_eof = 0,  /* end of fil
  809. *** 61,70 ****
  810.             sp_nparen, ifstmt, whilestmt,
  811.             forstmt, stmt, stmtl, elselit, dolit, dohead, ifhead,
  812.             elsehead, period };
  813. !           
  814.   #define false 0
  815.   #define true  1
  816.   
  817.   /* Name of input file.  */
  818.   extern char *in_name;
  819.   
  820. --- 103,116 ----
  821.             sp_nparen, ifstmt, whilestmt,
  822.             forstmt, stmt, stmtl, elselit, dolit, dohead, ifhead,
  823.             elsehead, period };
  824.   #define false 0
  825.   #define true  1
  826.   
  827. + #ifdef MSDOS
  828. + char *my_name;                /* argv[0] */
  829. + #endif /* MSDOS */
  830.   /* Name of input file.  */
  831.   extern char *in_name;
  832.   
  833. *************** char *in_prog_pos;
  834. *** 78,84 ****
  835.   char *cur_line;
  836.   
  837.   /* Size of the input program, not including the ' \n\0' we add at the end */
  838. ! int in_prog_size;
  839.   
  840.   FILE       *output;        /* the output file */
  841.   
  842. --- 124,131 ----
  843.   char *cur_line;
  844.   
  845.   /* Size of the input program, not including the ' \n\0' we add at the end */
  846. ! LONG in_prog_size;
  847.   
  848.   FILE       *output;        /* the output file */
  849.   
  850. *************** int         pointer_as_binop;
  851. *** 177,183 ****
  852. --- 224,234 ----
  853.   int         blanklines_after_declarations;
  854.   int         blanklines_before_blockcomments;
  855.   extern int blanklines_after_procs;
  856. + #ifdef MSDOS
  857. + int         blanklines_around_cond_comp;
  858. + #else /* not MSDOS */
  859.   int         blanklines_around_conditional_compilation;
  860. + #endif /* not MSDOS */
  861.   int         swallow_optional_blanklines;
  862.   int         n_real_blanklines;
  863.   int         prefix_blankline_requested;
  864. *************** extern int paren_target;
  865. *** 241,247 ****
  866.   
  867.   int         Bill_Shannon;    /* true iff a blank should always be inserted
  868.                    * after sizeof */
  869. ! int         blanklines_after_declarations_at_proctop;    /* This is vaguely
  870.                                * similar to
  871.                                * blanklines_after_decla
  872.                                * rations except that
  873. --- 292,303 ----
  874.   
  875.   int         Bill_Shannon;    /* true iff a blank should always be inserted
  876.                    * after sizeof */
  877. ! #ifdef MSDOS
  878. ! int         blanklin_after_decl_proctop;
  879. ! #else /* not MSDOS */
  880. ! int         blanklines_after_declarations_at_proctop;
  881. ! #endif /* not MSDOS */
  882. !                             /* This is vaguely
  883.                                * similar to
  884.                                * blanklines_after_decla
  885.                                * rations except that
  886. *************** extern int         use_stdinout;
  887. *** 294,299 ****
  888. --- 350,358 ----
  889.   struct fstate {
  890.       char        font[4];
  891.       char        size;
  892. + #ifdef MSDOS
  893. +     unsigned
  894. + #endif /* MSDOS */
  895.       int         allcaps:1;
  896.   };
  897.   char       *chfont();
  898. *************** extern struct parser_state *parser_state
  899. *** 415,417 ****
  900. --- 474,516 ----
  901.   /* The column in which comments to the right of #else and #endif should
  902.      start.  */
  903.   extern int else_endif_col;
  904. + #ifdef MSDOS
  905. + char *chfont (struct fstate *, struct fstate *, char *);
  906. + enum codes lexi (void);
  907. + int compute_code_target (void);
  908. + int compute_label_target (void);
  909. + int count_spaces (int, char *);
  910. + int eqin (char *, char *, char * *);
  911. + void fill_buffer (void);
  912. + int pad_output (int, int);
  913. + struct templ *is_reserved (char *, int);
  914. + void *mymemcpy (void *, const void *, size_t);
  915. + void *xmalloc (size_t);
  916. + void *xrealloc (void *, size_t);
  917. + void addkey (char *, enum rwcodes);
  918. + void bakcopy (void);
  919. + void diag (int, char *,...);
  920. + void dump_line (void);
  921. + void fill_buffer (void);
  922. + void main (int, char * *);
  923. + void parse (enum codes);
  924. + void parsefont (struct fstate *, char *);
  925. + void pr_comment (void);
  926. + void read_file (char *);
  927. + void read_stdin (void);
  928. + void reduce (void);
  929. + void scan_profile (FILE *);
  930. + void set_defaults (void);
  931. + void set_option (char *, int);
  932. + void set_profile (void);
  933. + void writefdef (struct fstate *, int);
  934. + #ifdef M_I86HM
  935. + void huge *xhalloc (long size);
  936. + void huge *xhrealloc (void huge *ptr, long new_size, long old_size);
  937. + long hread (int fd, void huge *buffer, long bytes);
  938. + long hwrite (int fd, void huge *buffer, long bytes);
  939. + #endif /* M_I86HM */
  940. + #endif /* MSDOS */
  941. diff -cBdNp e:/gnu/indent/gnu/io.c ./io.c
  942. *** e:/gnu/indent/gnu/io.c    Mon Jul 02 20:39:22 1990
  943. --- ./io.c    Mon Jul 02 20:39:42 1990
  944. ***************
  945. *** 18,23 ****
  946. --- 18,40 ----
  947.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  948.    */
  949.   
  950. + /*
  951. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  952. +  *
  953. +  * To this port, the same copying conditions apply as to the
  954. +  * original release.
  955. +  *
  956. +  * IMPORTANT:
  957. +  * This file is not identical to the original GNU release!
  958. +  * You should have received this code as patch to the official
  959. +  * GNU release.
  960. +  *
  961. +  * MORE IMPORTANT:
  962. +  * This port comes with ABSOLUTELY NO WARRANTY.
  963. +  *
  964. +  * $Header: e:/gnu/indent/RCS/io.c'v 1.1.0.5 90/07/02 20:28:47 tho Exp $
  965. +  */
  966.   #ifndef lint
  967.   static char sccsid[] = "@(#)io.c    5.10 (Berkeley) 9/15/88";
  968.   #endif /* not lint */
  969. *************** int paren_target;
  970. *** 39,44 ****
  971. --- 56,62 ----
  972.   /* true if INDENT OFF is in effect */
  973.   static int inhibit_formatting;
  974.   
  975. + void
  976.   dump_line()
  977.   {                /* dump_line is the routine that actually
  978.                    * effects the printing of the new source. It
  979. *************** dump_line()
  980. *** 142,148 ****
  981.           fprintf(output, ".*/\n");
  982.           }
  983.           target_col = compute_code_target();
  984. !         /* If a line ends in an lparen character, the following 
  985.              line should not line up with the parenthesis, but
  986.              should be indented by the usual amount.  */
  987.           if (parser_state_tos->last_token == lparen)
  988. --- 160,166 ----
  989.           fprintf(output, ".*/\n");
  990.           }
  991.           target_col = compute_code_target();
  992. !         /* If a line ends in an lparen character, the following
  993.              line should not line up with the parenthesis, but
  994.              should be indented by the usual amount.  */
  995.           if (parser_state_tos->last_token == lparen)
  996. *************** dump_line()
  997. *** 225,231 ****
  998. --- 243,253 ----
  999.           }
  1000.           }
  1001.           else {        /* print comment, if any */
  1002. + #ifdef MSDOS
  1003. +         register int target = parser_state_tos->com_col;
  1004. + #else
  1005.           register    target = parser_state_tos->com_col;
  1006. + #endif
  1007.           register char *com_st = s_com;
  1008.   
  1009.           target += parser_state_tos->comment_delta;
  1010. *************** inhibit_newline:
  1011. *** 301,314 ****
  1012. --- 323,345 ----
  1013.   int
  1014.   compute_code_target()
  1015.   {
  1016. + #ifdef MSDOS
  1017. +     register int target_col = parser_state_tos->ind_level + 1;
  1018. + #else
  1019.       register    target_col = parser_state_tos->ind_level + 1;
  1020. + #endif /* MSDOS */
  1021.   
  1022.       if (parser_state_tos->paren_level)
  1023.       if (!lineup_to_parens)
  1024.           target_col += continuation_indent * parser_state_tos->paren_level;
  1025.       else {
  1026. + #ifdef MSDOS
  1027. +         register int w;
  1028. +         register int t = paren_target;
  1029. + #else
  1030.           register    w;
  1031.           register    t = paren_target;
  1032. + #endif /* MSDOS */
  1033.   
  1034.           if ((w = count_spaces(t, s_code) - max_col) > 0
  1035.               && count_spaces(target_col, s_code) <= max_col) {
  1036. *************** compute_label_target()
  1037. *** 333,340 ****
  1038.       : parser_state_tos->ind_level - label_offset + 1;
  1039.   }
  1040.   
  1041. ! /* Allocate space for FILENAME, read in the file, and set in_prog and 
  1042. !    in_prog_pos to point to the buffer.  If any errors occur, report an 
  1043.      error message and abort.  */
  1044.   void
  1045.   read_file(filename)
  1046. --- 364,371 ----
  1047.       : parser_state_tos->ind_level - label_offset + 1;
  1048.   }
  1049.   
  1050. ! /* Allocate space for FILENAME, read in the file, and set in_prog and
  1051. !    in_prog_pos to point to the buffer.  If any errors occur, report an
  1052.      error message and abort.  */
  1053.   void
  1054.   read_file(filename)
  1055. *************** read_file(filename)
  1056. *** 345,350 ****
  1057. --- 376,382 ----
  1058.   
  1059.     /* File status for the input file */
  1060.     struct stat in_stat;
  1061. +   LONG bytes_read;
  1062.   
  1063.     /* buffer used for error messages */
  1064.     char *errbuf;
  1065. *************** read_file(filename)
  1066. *** 364,378 ****
  1067.         perror(errbuf);
  1068.         exit(1);
  1069.       }
  1070.     in_prog_size = in_stat.st_size;
  1071.     in_prog = xmalloc(in_prog_size + 3); /* 3 for ' ','\n','\0' */
  1072.   
  1073. !   if (read(in_fd,in_prog,in_prog_size) < 0)
  1074.       {
  1075.         perror(errbuf);
  1076.         exit(1);
  1077.       }
  1078.   
  1079.     if (close(in_fd) < 0)
  1080.       {
  1081.         perror(errbuf);
  1082. --- 396,448 ----
  1083.         perror(errbuf);
  1084.         exit(1);
  1085.       }
  1086. + #ifdef MSDOS
  1087. + #ifdef M_I86HM
  1088.     in_prog_size = in_stat.st_size;
  1089. +   in_prog = xhalloc(in_prog_size + 3); /* 3 for ' ','\n','\0' */
  1090. +   if ( (bytes_read=hread(in_fd,in_prog,in_prog_size)) < 0)
  1091. +     {
  1092. +       perror(errbuf);
  1093. +       exit(1);
  1094. +     }
  1095. + #else /* not M_I86HM */
  1096. +   if (in_stat.st_size >= 0xfff0)
  1097. +     {
  1098. +       fprintf (stderr,  "Can't handle large files (> 64k) under MS-DOS, "
  1099. +            "if not compiled with huge pointers.\nSorry.\n");
  1100. +       exit (1);
  1101. +     }
  1102. +   in_prog_size = (unsigned int) in_stat.st_size;
  1103.     in_prog = xmalloc(in_prog_size + 3); /* 3 for ' ','\n','\0' */
  1104.   
  1105. !   if ( (bytes_read=read(in_fd,in_prog,in_prog_size)) < 0)
  1106. !     {
  1107. !       perror(errbuf);
  1108. !       exit(1);
  1109. !     }
  1110. ! #endif /* not M_I86HM */
  1111. !   if (close(in_fd) < 0)
  1112.       {
  1113.         perror(errbuf);
  1114.         exit(1);
  1115.       }
  1116.   
  1117. +   in_prog_size = bytes_read;        /* the crlf story ... */
  1118. + #else /* not MSDOS */
  1119. +   in_prog_size = in_stat.st_size;
  1120. +   in_prog = xmalloc(in_prog_size + 3); /* 3 for ' ','\n','\0' */
  1121. +   if ( (bytes_read=read(in_fd,in_prog,in_prog_size)) < 0)
  1122. +     {
  1123. +       perror(errbuf);
  1124. +       exit(1);
  1125. +     }
  1126.     if (close(in_fd) < 0)
  1127.       {
  1128.         perror(errbuf);
  1129. *************** read_file(filename)
  1130. *** 379,387 ****
  1131.         exit(1);
  1132.       }
  1133.   
  1134.     in_prog[in_prog_size] = ' ';
  1135.     in_prog[in_prog_size+1] = '\n';
  1136. !   in_prog[in_prog_size+2] = 0;
  1137.     in_prog_pos = in_prog;
  1138.   
  1139.     free (errbuf);
  1140. --- 449,459 ----
  1141.         exit(1);
  1142.       }
  1143.   
  1144. + #endif /* not MSDOS */
  1145.     in_prog[in_prog_size] = ' ';
  1146.     in_prog[in_prog_size+1] = '\n';
  1147. !   in_prog[in_prog_size+2] = '\0';
  1148.     in_prog_pos = in_prog;
  1149.   
  1150.     free (errbuf);
  1151. *************** read_file(filename)
  1152. *** 391,396 ****
  1153. --- 464,523 ----
  1154.   void
  1155.   read_stdin()
  1156.   {
  1157. + #ifdef MSDOS
  1158. +   LONG alloc_size = 10000;
  1159. +   int ch;
  1160. +   in_prog_pos = in_prog
  1161. + #ifdef M_I86HM
  1162. +     = xhalloc (alloc_size);
  1163. + #else /* not M_I86HM */
  1164. +     = xmalloc (alloc_size);
  1165. + #endif /* not M_I86HM */
  1166. +   in_prog_size = 0;
  1167. +   do
  1168. +     {
  1169. +       /* Copy up until 3 bytes before the end of the buffer,
  1170. +      (the 3 is for ' \n\0')...  */
  1171. +       for (; in_prog_size < alloc_size - 3; in_prog_size++)
  1172. +     {
  1173. +       ch = getc(stdin);
  1174. +       if (ch == EOF)
  1175. +           break;
  1176. +       in_prog[in_prog_size] = (char) ch;
  1177. +     }
  1178. +       /* ...and if that's not enough allocate more.  */
  1179. +       if (ch != EOF) {
  1180. + #ifdef M_I86HM
  1181. +     LONG old_alloc_size = alloc_size;
  1182. +     alloc_size *= 2;
  1183. +     in_prog = xhrealloc (in_prog, alloc_size, old_alloc_size);
  1184. + #else /* not M_I86HM */
  1185. +     if (alloc_size >= 0xFFE0)
  1186. +       {
  1187. +         fprintf (stderr,  "Can't handle large files (> 64k) under MS-DOS, "
  1188. +              "if not compiled with huge pointers.\nSorry.\n");
  1189. +         exit (1);
  1190. +       }
  1191. +     else if (alloc_size >= 0x7FF0)
  1192. +       alloc_size = 0xFFE0;
  1193. +     else
  1194. +       alloc_size *= 2;
  1195. +     in_prog = xrealloc(in_prog,alloc_size);
  1196. + #endif /* not M_I86HM */
  1197. +       }
  1198. +     }
  1199. +   while (ch != EOF);
  1200. + #else /* not MSDOS */
  1201.     unsigned int alloc_size = 10000;
  1202.     int ch;
  1203.   
  1204. *************** read_stdin()
  1205. *** 405,411 ****
  1206.         ch = getc(stdin);
  1207.         if (ch == EOF)
  1208.             break;
  1209. !       in_prog[in_prog_size] = ch;
  1210.       }
  1211.         /* ...and if that's not enough allocate more.  */
  1212.         if (ch != EOF) {
  1213. --- 532,538 ----
  1214.         ch = getc(stdin);
  1215.         if (ch == EOF)
  1216.             break;
  1217. !       in_prog[in_prog_size] = (char) ch;
  1218.       }
  1219.         /* ...and if that's not enough allocate more.  */
  1220.         if (ch != EOF) {
  1221. *************** read_stdin()
  1222. *** 414,432 ****
  1223.         }
  1224.       }
  1225.     while (ch != EOF);
  1226. !   
  1227.     in_prog[in_prog_size] = ' ';
  1228.     in_prog[in_prog_size+1] = '\n';
  1229.     in_prog[in_prog_size+2] = 0;
  1230. !   in_prog_pos = in_prog;  
  1231.   }
  1232.   
  1233. ! /* Advance buf_ptr so that it points to the next line of input.  Skip 
  1234.      over indent errors (comments beginning with *INDENT**), ignoring
  1235.      them.  Process INDENT ON and INDENT OFF. (Note: the name of this
  1236.      function is a historical artifact from before the time that indent
  1237.      kept the whole source file in memory). */
  1238.   
  1239.   fill_buffer()
  1240.   {
  1241.     /* Point various places in the buffer.  */
  1242. --- 541,562 ----
  1243.         }
  1244.       }
  1245.     while (ch != EOF);
  1246. ! #endif /* not MSDOS */
  1247.     in_prog[in_prog_size] = ' ';
  1248.     in_prog[in_prog_size+1] = '\n';
  1249.     in_prog[in_prog_size+2] = 0;
  1250. !   in_prog_pos = in_prog;
  1251.   }
  1252.   
  1253. ! /* Advance buf_ptr so that it points to the next line of input.  Skip
  1254.      over indent errors (comments beginning with *INDENT**), ignoring
  1255.      them.  Process INDENT ON and INDENT OFF. (Note: the name of this
  1256.      function is a historical artifact from before the time that indent
  1257.      kept the whole source file in memory). */
  1258.   
  1259. + void
  1260.   fill_buffer()
  1261.   {
  1262.     /* Point various places in the buffer.  */
  1263. *************** fill_buffer()
  1264. *** 434,440 ****
  1265.   
  1266.     /* Have we found INDENT ON or INDENT OFF ? */
  1267.     enum {None,Indent_on,Indent_off} com;
  1268. !   
  1269.     if (bp_save != 0)
  1270.       {        /* there is a partly filled input buffer left */
  1271.       buf_ptr = bp_save;    /* dont read anything, just switch buffers */
  1272. --- 564,570 ----
  1273.   
  1274.     /* Have we found INDENT ON or INDENT OFF ? */
  1275.     enum {None,Indent_on,Indent_off} com;
  1276.     if (bp_save != 0)
  1277.       {        /* there is a partly filled input buffer left */
  1278.       buf_ptr = bp_save;    /* dont read anything, just switch buffers */
  1279. *************** fill_buffer()
  1280. *** 451,457 ****
  1281.     buf_ptr = in_prog_pos;
  1282.     for (p = buf_ptr; *p && *p++ != '\n';)
  1283.       ;
  1284. !   
  1285.     buf_end = p;
  1286.     if (!*p)
  1287.       had_eof = true;
  1288. --- 581,587 ----
  1289.     buf_ptr = in_prog_pos;
  1290.     for (p = buf_ptr; *p && *p++ != '\n';)
  1291.       ;
  1292.     buf_end = p;
  1293.     if (!*p)
  1294.       had_eof = true;
  1295. *************** fill_buffer()
  1296. *** 458,464 ****
  1297.   
  1298.     p = buf_ptr;
  1299.     in_prog_pos = buf_end;
  1300. !   
  1301.     while (*p == ' ' || *p == '\t')
  1302.       p++;
  1303.     if (*p == '/' && p[1] == '*')
  1304. --- 588,594 ----
  1305.   
  1306.     p = buf_ptr;
  1307.     in_prog_pos = buf_end;
  1308.     while (*p == ' ' || *p == '\t')
  1309.       p++;
  1310.     if (*p == '/' && p[1] == '*')
  1311. *************** fill_buffer()
  1312. *** 502,539 ****
  1313.       putc(*p,output);
  1314.         while (*p++ != '\n');
  1315.       }
  1316. !       
  1317.   }
  1318. !   
  1319. !       
  1320. !   
  1321.   /*
  1322.    * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
  1323. !  * 
  1324.    * All rights reserved
  1325. !  * 
  1326. !  * 
  1327.    * NAME: pad_output
  1328. !  * 
  1329.    * FUNCTION: Writes tabs and spaces to move the current column up to the desired
  1330.    * position.
  1331. !  * 
  1332.    * ALGORITHM: Put tabs and/or blanks into pobuf, then write pobuf.
  1333. !  * 
  1334.    * PARAMETERS: current        integer        The current column target
  1335.    * nteger        The desired column
  1336. !  * 
  1337.    * RETURNS: Integer value of the new column.  (If current >= target, no action is
  1338.    * taken, and current is returned.
  1339. !  * 
  1340.    * GLOBALS: None
  1341. !  * 
  1342.    * CALLS: write (sys)
  1343. !  * 
  1344.    * CALLED BY: dump_line
  1345. !  * 
  1346.    * HISTORY: initial coding     November 1976    D A Willcox of CAC
  1347. !  * 
  1348.    */
  1349.   pad_output(current, target)    /* writes tabs and blanks (if necessary) to
  1350.                    * get the current output position up to the
  1351. --- 633,670 ----
  1352.       putc(*p,output);
  1353.         while (*p++ != '\n');
  1354.       }
  1355.   }
  1356.   /*
  1357.    * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
  1358. !  *
  1359.    * All rights reserved
  1360. !  *
  1361. !  *
  1362.    * NAME: pad_output
  1363. !  *
  1364.    * FUNCTION: Writes tabs and spaces to move the current column up to the desired
  1365.    * position.
  1366. !  *
  1367.    * ALGORITHM: Put tabs and/or blanks into pobuf, then write pobuf.
  1368. !  *
  1369.    * PARAMETERS: current        integer        The current column target
  1370.    * nteger        The desired column
  1371. !  *
  1372.    * RETURNS: Integer value of the new column.  (If current >= target, no action is
  1373.    * taken, and current is returned.
  1374. !  *
  1375.    * GLOBALS: None
  1376. !  *
  1377.    * CALLS: write (sys)
  1378. !  *
  1379.    * CALLED BY: dump_line
  1380. !  *
  1381.    * HISTORY: initial coding     November 1976    D A Willcox of CAC
  1382. !  *
  1383.    */
  1384.   pad_output(current, target)    /* writes tabs and blanks (if necessary) to
  1385.                    * get the current output position up to the
  1386. *************** pad_output(current, target)    /* writes ta
  1387. *** 562,584 ****
  1388.   
  1389.   /*
  1390.    * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
  1391. !  * 
  1392.    * All rights reserved
  1393. !  * 
  1394. !  * 
  1395.    * NAME: count_spaces
  1396. !  * 
  1397.    * FUNCTION: Find out where printing of a given string will leave the current
  1398.    * character position on output.
  1399. !  * 
  1400.    * ALGORITHM: Run thru input string and add appropriate values to current
  1401.    * position.
  1402. !  * 
  1403.    * RETURNS: Integer value of position after printing "buffer" starting in column
  1404.    * "current".
  1405. !  * 
  1406.    * HISTORY: initial coding     November 1976    D A Willcox of CAC
  1407. !  * 
  1408.    */
  1409.   int
  1410.   count_spaces(current, buffer)
  1411. --- 693,715 ----
  1412.   
  1413.   /*
  1414.    * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
  1415. !  *
  1416.    * All rights reserved
  1417. !  *
  1418. !  *
  1419.    * NAME: count_spaces
  1420. !  *
  1421.    * FUNCTION: Find out where printing of a given string will leave the current
  1422.    * character position on output.
  1423. !  *
  1424.    * ALGORITHM: Run thru input string and add appropriate values to current
  1425.    * position.
  1426. !  *
  1427.    * RETURNS: Integer value of position after printing "buffer" starting in column
  1428.    * "current".
  1429. !  *
  1430.    * HISTORY: initial coding     November 1976    D A Willcox of CAC
  1431. !  *
  1432.    */
  1433.   int
  1434.   count_spaces(current, buffer)
  1435. *************** count_spaces(current, buffer)
  1436. *** 621,630 ****
  1437.   /* Nonzero if we have found an error (not a warning).  */
  1438.   int    found_err;
  1439.   
  1440. ! /* Signal an error.  LEVEL is nonzero if it is an error (as opposed to 
  1441. !    a warning.  MSG is a printf-style format string.  Additional 
  1442.      arguments are additional arguments for printf.  */
  1443.   /* VARARGS2 */
  1444.   diag(level, msg, a, b)
  1445.        char *msg;
  1446.   {
  1447. --- 752,762 ----
  1448.   /* Nonzero if we have found an error (not a warning).  */
  1449.   int    found_err;
  1450.   
  1451. ! /* Signal an error.  LEVEL is nonzero if it is an error (as opposed to
  1452. !    a warning.  MSG is a printf-style format string.  Additional
  1453.      arguments are additional arguments for printf.  */
  1454.   /* VARARGS2 */
  1455. + void
  1456.   diag(level, msg, a, b)
  1457.        char *msg;
  1458.   {
  1459. *************** diag(level, msg, a, b)
  1460. *** 642,647 ****
  1461. --- 774,780 ----
  1462.       }
  1463.   }
  1464.   
  1465. + void
  1466.   writefdef(f, nm)
  1467.       register struct fstate *f;
  1468.   {
  1469. *************** chfont(of, nf, s)
  1470. *** 685,691 ****
  1471.       return s;
  1472.   }
  1473.   
  1474.   parsefont(f, s0)
  1475.       register struct fstate *f;
  1476.       char       *s0;
  1477. --- 818,824 ----
  1478.       return s;
  1479.   }
  1480.   
  1481. ! void
  1482.   parsefont(f, s0)
  1483.       register struct fstate *f;
  1484.       char       *s0;
  1485. *************** parsefont(f, s0)
  1486. *** 693,704 ****
  1487.       register char *s = s0;
  1488.       int         sizedelta = 0;
  1489.       int i;
  1490. !     
  1491.       f->size = 0;
  1492.       f->allcaps = 1;
  1493.       for (i = 0; i < 4; i++)
  1494.         f->font[i] = 0;
  1495. !     
  1496.       while (*s) {
  1497.       if (isdigit(*s))
  1498.           f->size = f->size * 10 + *s - '0';
  1499. --- 826,837 ----
  1500.       register char *s = s0;
  1501.       int         sizedelta = 0;
  1502.       int i;
  1503.       f->size = 0;
  1504.       f->allcaps = 1;
  1505.       for (i = 0; i < 4; i++)
  1506.         f->font[i] = 0;
  1507.       while (*s) {
  1508.       if (isdigit(*s))
  1509.           f->size = f->size * 10 + *s - '0';
  1510. diff -cBdNp e:/gnu/indent/gnu/lexi.c ./lexi.c
  1511. *** e:/gnu/indent/gnu/lexi.c    Mon Jul 02 20:39:22 1990
  1512. --- ./lexi.c    Mon Jul 02 20:39:44 1990
  1513. ***************
  1514. *** 18,23 ****
  1515. --- 18,40 ----
  1516.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1517.    */
  1518.   
  1519. + /*
  1520. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  1521. +  *
  1522. +  * To this port, the same copying conditions apply as to the
  1523. +  * original release.
  1524. +  *
  1525. +  * IMPORTANT:
  1526. +  * This file is not identical to the original GNU release!
  1527. +  * You should have received this code as patch to the official
  1528. +  * GNU release.
  1529. +  *
  1530. +  * MORE IMPORTANT:
  1531. +  * This port comes with ABSOLUTELY NO WARRANTY.
  1532. +  *
  1533. +  * $Header: e:/gnu/indent/RCS/lexi.c'v 1.1.0.1 90/07/02 10:32:29 tho Exp $
  1534. +  */
  1535.   #ifndef lint
  1536.   static char sccsid[] = "@(#)lexi.c    5.11 (Berkeley) 9/15/88";
  1537.   #endif /* not lint */
  1538. *************** static char sccsid[] = "@(#)lexi.c    5.11 
  1539. *** 31,36 ****
  1540. --- 48,57 ----
  1541.   #include "indent_globs.h"
  1542.   #include <ctype.h>
  1543.   
  1544. + #ifdef MSDOS
  1545. + static int hash (char *, int);
  1546. + #endif
  1547.   #define alphanum 1
  1548.   #define opchar 3
  1549.   
  1550. *************** lexi()
  1551. *** 582,587 ****
  1552. --- 603,609 ----
  1553.   /*
  1554.    * Add the given keyword to the keyword table, using val as the keyword type
  1555.    */
  1556. + void
  1557.   addkey(key, val)
  1558.       char       *key;
  1559.        enum rwcodes val;
  1560. diff -cBdNp e:/gnu/indent/gnu/makefile ./makefile
  1561. *** e:/gnu/indent/gnu/makefile    Mon Jul 02 20:40:01 1990
  1562. --- ./makefile    Mon Jul 02 20:39:48 1990
  1563. ***************
  1564. *** 0 ****
  1565. --- 1,62 ----
  1566. + # Copyright (c) 1987 Regents of the University of California.
  1567. + # All rights reserved.
  1568. + #
  1569. + # Redistribution and use in source and binary forms are permitted
  1570. + # provided that the above copyright notice and this paragraph are
  1571. + # duplicated in all such forms and that any documentation,
  1572. + # advertising materials, and other materials related to such
  1573. + # distribution and use acknowledge that the software was developed
  1574. + # by the University of California, Berkeley.  The name of the
  1575. + # University may not be used to endorse or promote products derived
  1576. + # from this software without specific prior written permission.
  1577. + # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1578. + # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1579. + # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1580. + #
  1581. + #    @(#)Makefile    5.9 (Berkeley) 9/15/88
  1582. + #
  1583. + # $Header: e:/gnu/indent/RCS/makefile.'v 1.1.0.3 90/07/02 20:22:49 tho Exp $
  1584. + #
  1585. + BINDIR    = c:/bin
  1586. + # MSC 5.1 bombs with -Oailt -Gs, we have not yet taken pains to spot
  1587. + # the faulty module.
  1588. + # Floating point makes no sense, pretending to use the alternate library
  1589. + # prevents the dumb linker from loading to much floating point code.
  1590. + CFLAGS    = -AH -FPa -Oilt -Gs -W3
  1591. + LDFLAGS    = /e/st:0x2000
  1592. + SRCS    = indent.c io.c lexi.c parse.c pr_comment.c args.c globs.c
  1593. + OBJS    = indent.obj io.obj lexi.obj parse.obj pr_comment.obj \
  1594. +       args.obj globs.obj
  1595. + HEADERS    = indent_g.h version.h
  1596. + all: indent.exe
  1597. + indent.exe: $(OBJS)
  1598. +     $(LINK) $(LDFLAGS) $(OBJS), $@;
  1599. + zip:
  1600. +     pkzip -f indent'v
  1601. + disk:
  1602. +     cp indent'v.zip b:/indent'v.zip
  1603. +     pkunzip -t b:/indent'v | grep -vw OK
  1604. + $(OBJS): indent_globs.h
  1605. + args.obj: version.h
  1606. + install:
  1607. +     cp indent.exe $(BINDIR)
  1608. + clean:
  1609. +     rm -f *.exe *.obj errs tags
  1610. +     rcsclean *.c *.h
  1611. + tags: $(SRCS) $(HEADERS)
  1612. +     etags -t *.h *.c
  1613. diff -cBdNp e:/gnu/indent/gnu/parse.c ./parse.c
  1614. *** e:/gnu/indent/gnu/parse.c    Mon Jul 02 20:39:22 1990
  1615. --- ./parse.c    Mon Jul 02 20:39:46 1990
  1616. ***************
  1617. *** 18,23 ****
  1618. --- 18,40 ----
  1619.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1620.    */
  1621.   
  1622. + /*
  1623. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  1624. +  *
  1625. +  * To this port, the same copying conditions apply as to the
  1626. +  * original release.
  1627. +  *
  1628. +  * IMPORTANT:
  1629. +  * This file is not identical to the original GNU release!
  1630. +  * You should have received this code as patch to the official
  1631. +  * GNU release.
  1632. +  *
  1633. +  * MORE IMPORTANT:
  1634. +  * This port comes with ABSOLUTELY NO WARRANTY.
  1635. +  *
  1636. +  * $Header: e:/gnu/indent/RCS/parse.c'v 1.1.0.1 90/07/02 10:32:31 tho Exp $
  1637. +  */
  1638.   #ifndef lint
  1639.   static char sccsid[] = "@(#)parse.c    5.8 (Berkeley) 9/15/88";
  1640.   #endif /* not lint */
  1641. *************** static char sccsid[] = "@(#)parse.c    5.8 
  1642. *** 24,29 ****
  1643. --- 41,50 ----
  1644.   
  1645.   #include "indent_globs.h"
  1646.   
  1647. + #ifdef MSDOS
  1648. + static int inc_pstack (void);
  1649. + #endif
  1650.   struct parser_state *parser_state_tos;
  1651.   
  1652.   /* like ++parser_state_tos->tos but checks for stack overflow and extends
  1653. *************** parse(tk)
  1654. *** 280,285 ****
  1655. --- 301,307 ----
  1656.   /*----------------------------------------------*\
  1657.   |   REDUCTION PHASE                    |
  1658.   \*----------------------------------------------*/
  1659. + void
  1660.   reduce()
  1661.   {
  1662.   
  1663. diff -cBdNp e:/gnu/indent/gnu/pr_comme.c ./pr_comme.c
  1664. *** e:/gnu/indent/gnu/pr_comme.c    Mon Jul 02 20:39:24 1990
  1665. --- ./pr_comme.c    Mon Jul 02 20:39:46 1990
  1666. ***************
  1667. *** 18,23 ****
  1668. --- 18,40 ----
  1669.    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1670.    */
  1671.   
  1672. + /*
  1673. +  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  1674. +  *
  1675. +  * To this port, the same copying conditions apply as to the
  1676. +  * original release.
  1677. +  *
  1678. +  * IMPORTANT:
  1679. +  * This file is not identical to the original GNU release!
  1680. +  * You should have received this code as patch to the official
  1681. +  * GNU release.
  1682. +  *
  1683. +  * MORE IMPORTANT:
  1684. +  * This port comes with ABSOLUTELY NO WARRANTY.
  1685. +  *
  1686. +  * $Header: e:/gnu/indent/RCS/pr_comme.c'v 1.1.0.1 90/07/02 10:32:33 tho Exp $
  1687. +  */
  1688.   #ifndef lint
  1689.   static char sccsid[] = "@(#)pr_comment.c    5.9 (Berkeley) 9/15/88";
  1690.   #endif /* not lint */
  1691. *************** static char sccsid[] = "@(#)pr_comment.c
  1692. *** 56,62 ****
  1693.   
  1694.   #include "indent_globs.h"
  1695.   
  1696.   pr_comment()
  1697.   {
  1698.       int         now_col;    /* column we are in now */
  1699. --- 73,79 ----
  1700.   
  1701.   #include "indent_globs.h"
  1702.   
  1703. ! void
  1704.   pr_comment()
  1705.   {
  1706.       int         now_col;    /* column we are in now */
  1707. diff -cBdNp e:/gnu/indent/gnu/version.h ./version.h
  1708. *** e:/gnu/indent/gnu/version.h    Mon Jul 02 20:39:24 1990
  1709. --- ./version.h    Mon Jul 02 20:39:48 1990
  1710. ***************
  1711. *** 1,5 ****
  1712.   #define VERSION_STRING \
  1713. ! "GNU indent 1.1.  Based on Berkeley indent 5.11 (9/15/88)."
  1714.   
  1715.   /* Not strictly true, because I've merged in a bunch of changes
  1716.      from the BSD version of Sep 89, but it wouldn't really be correct
  1717. --- 1,6 ----
  1718.   #define VERSION_STRING \
  1719. ! "GNU indent 1.1.  Based on Berkeley indent 5.11 (9/15/88).\n"\
  1720. ! "$Header: e:/gnu/indent/RCS/version.h'v 1.1.0.1 90/01/16 22:09:21 tho Exp $"
  1721.   
  1722.   /* Not strictly true, because I've merged in a bunch of changes
  1723.      from the BSD version of Sep 89, but it wouldn't really be correct
  1724.