OSDN Git Service

chr_cmd().
[putex/putex.git] / src / texsourc / yandytex.c
1 /* Copyright 1992 Karl Berry
2    Copyright 2007 TeX Users Group
3    Copyright 2014 Clerk Ma
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301 USA.  */
19
20 #define EXTERN
21
22 #include "texd.h"
23
24 #define dump_ext_length     4
25 #define edit_value          tex_edit_value
26
27 extern char * replacement[];
28 static char * program_name = NULL;
29 int    gargc;   /* number of args - set to zero after initialization */
30 char **gargv;
31
32 /* The entry point: set up for reading the command line, which will
33    happen in `t_open_in', then call the main body.  */
34
35 int jump_used = 0;
36
37 jmp_buf jumpbuffer;
38
39 int main (int ac, char *av[])
40 {
41   int flag = 0, ret = 0;
42
43   gargc = ac;
44   gargv = av;
45
46   if (main_init(gargc, gargv))
47     return -1; // failure
48
49   TEX_format_default = " plain.fmt";
50   format_default_length = strlen(TEX_format_default + 1);
51
52   jump_used = 0;
53
54   ret = setjmp(jumpbuffer);
55
56   if (ret == 0)
57   {
58     flag = main_program();
59
60     if (trace_flag)
61       printf("EXITING at %s: flag = %d, ret = %d, jump_used = %d\n", "main", flag, ret, jump_used);
62   }
63   else
64   {
65     if (trace_flag)
66       printf("EXITING at %s: flag = %d, ret = %d, jump_used =  %d\n", "jump_out", flag, ret, jump_used);
67   }
68
69   if (endit(flag) != 0)
70     flag = 1; /* do final clean up in local.c */
71
72   if (flag == 0)
73     return 0;
74   else
75     exit (flag);
76 }
77
78 /* texk/web2c/lib/texmfmp.c */
79 void t_open_in (void)
80 {
81   int i;
82
83   buffer[first] = 0;  /* In case there are no arguments.  */
84
85 #ifdef MSDOS
86   if (gargc > optind && optind > 0)
87   {
88     for (i = optind; i < gargc; i++)
89 #else
90   if (gargc > 1)
91   {
92     for (i = 1; i < gargc; i++)
93 #endif
94     {
95       if (allow_quoted_names && strchr(gargv[i], ' ') != NULL)
96       {
97         (void) strcat ((char *) &buffer[first], "\"");
98         (void) strcat ((char *) &buffer[first], gargv[i]);
99         (void) strcat ((char *) &buffer[first], "\"");
100       }
101       else
102         (void) strcat ((char *) &buffer[first], gargv[i]);
103
104       (void) strcat ((char *) &buffer[first], " ");
105     }
106     
107     gargc = 0;
108   }
109
110   /* Find the end of the buffer.  */
111   for (last = first; buffer[last]; ++last)
112     ;
113
114   for (--last; last >= first && ISBLANK (buffer[last]) && buffer[last] != '\r'; --last)
115     ;
116
117   last++;
118
119 /* One more time, this time converting to TeX's internal character
120    representation.  */ /* for command line input in this case */
121   if (non_ascii)
122   {
123     for (i = first; i < last; i++)
124       buffer[i] = xord[buffer[i]];
125   }
126 }
127
128 static void catch_interrupt(int err)
129 {
130   (void) signal(SIGINT, SIG_IGN);
131
132   if (interrupt++ >= 3)
133     exit(1);
134
135   (void) signal(SIGINT, catch_interrupt);
136 }
137
138 void fix_date_and_time (void)
139 {
140   time_t clock;
141   struct tm *tmptr;
142
143   (void) time(&clock);
144
145   if (trace_flag)
146     printf("The time is %u\n", clock);
147
148   if (clock < 0)
149     puts("Time not available!\n");
150
151   tmptr = localtime (&clock);
152
153   if (tmptr == NULL)
154   {
155     printf("Cannot convert time (%0ld)!\n", clock);
156     year     = 2038;
157     month    = 1;
158     day      = 18;
159     tex_time = 22 * 60 + 14;
160   }
161   else
162   {
163     tex_time = tmptr->tm_hour * 60 + tmptr->tm_min;
164     day      = tmptr->tm_mday;
165     month    = tmptr->tm_mon + 1;
166     year     = tmptr->tm_year + 1900;
167
168     if (trace_flag)
169       printf("%d-%d-%d %d:%d\n",
170         tmptr->tm_year + 1900,
171         tmptr->tm_mon + 1,
172         tmptr->tm_mday,
173         tmptr->tm_hour,
174         tmptr->tm_min);
175   }
176
177   {
178 #ifdef MSDOS
179     if (!no_interrupts)
180     {
181       if (signal(SIGINT, catch_interrupt) == SIG_ERR)
182       {
183         puts(" CTRL-C handler not installed\n");
184 #ifndef _WINDOWS
185         uexit(EXIT_FAILURE);  /* do we care when run as DLL ? */
186 #endif
187       }
188     }
189 #else
190     void (*old_handler)();
191
192     if ((old_handler = signal (SIGINT, catch_interrupt)) != SIG_DFL)
193       (void) signal (SIGINT, old_handler);
194 #endif
195   }
196 }
197
198 /* I/O for TeX and Metafont.  */
199 void complain_line (FILE *output)
200 {
201   show_line("\n", 0);
202
203 #ifdef ALLOCATEBUFFER
204   sprintf(log_line, "! Unable to read an entire line---buf_size=%d.\n", current_buf_size);
205 #else
206   sprintf(log_line, "! Unable to read an entire line---buf_size=%d.\n", buf_size);
207 #endif
208
209   fputs(log_line, output);
210   puts("  (File may have a line termination problem.)");
211 }
212
213 void show_bad_line (FILE *output, int first, int last)
214 {
215   int i, c, d, ch;
216   char *s = log_line;
217
218   for (i = first; i <= last; i++)
219   {
220     ch = buffer[i];
221
222     if ((show_in_hex && ch > 127))
223     {
224       c = ch >> 4;
225       d = ch & 15; 
226       if (c > 9)
227         c = c + 'a' - 10;
228       else
229         c = c + '0';
230       if (d > 9)
231         d = d + 'a' - 10;
232       else
233         d = d + '0';
234 /* putc('^', output); putc('^', output); */
235       *s++ = '^';
236       *s++ = '^';
237 /* putc (c, output); putc (d, output); */
238       *s++ = (char) c;
239       *s++ = (char) d;
240     }
241     else
242       if (ch < 32)
243       {
244 /* putc('^', output); putc('^', output); */
245         *s++ = '^';
246         *s++ = '^';
247 /* putc (ch + 64, output); */
248         *s++ = (char) (ch + 64);
249       }
250       else
251         if (ch == 127)
252         {
253 /* putc('^', output); putc('^', output); */
254           *s++ = '^';
255           *s++ = '^';
256 /* putc (ch - 64, output); */
257           *s++ = (char) (ch - 64);
258         }
259         else
260         {
261 /* putc(ch, output); */
262           *s++ = (char) ch;
263         }
264   }
265 //  putc(' ', output);    /*  putc('\n', output); */
266   *s++ = ' ';
267   *s++ = '\0';
268
269   fputs(log_line, output);   // log_file
270 }
271
272 // split off for convenience and use in ConsoleInput
273 boolean input_line_finish (void)
274 {
275   int i = '\0';
276   int ch, flag;
277   
278 /*  if last line in file does not end with \n - never happens ? */
279 /*  if (i == EOF && buffer[last] != '\n') buffer[last++] = '\n'; */
280
281   buffer[last] = ' ';           /* space terminate */
282
283   if (last >= max_buf_stack)
284     max_buf_stack = last; /* remember longest line */
285
286 /* Trim trailing whitespace.  */ 
287 /* #define isblank(c) ((c) == ' ' || (c) == '\t') */
288 /* What about \n ?  Can't get in here ?- bkph */
289 /* What about control-Z that gets read in binary mode ? - bkph */
290 // #ifdef MYDEBUG
291 /*  while (last > first && buffer[last - 1] <= ' ')  --last; */
292   while (last > first)
293   {
294     i = buffer[last - 1];
295
296     if (i == ' ' || i == '\t')
297       --last;
298     else
299       break;
300   }
301
302 /* following added to check source file integrity ASCII 32 - 127 */
303 /* allow space, tab, new-page - also allow return, newline ? */
304   if (restrict_to_ascii)
305   {
306     flag = 0;
307     for (i = first; i <= last; i++)
308     {
309       ch = buffer[i];
310 /*      if (ch > 127 || (ch < ' ' && ch != '\t' && ch != '\f')) */
311 /*      1 -- 8, 11, 14 -- 31 are not good ASCII characters */
312       if (ch > 126 ||  (ch < ' ' && ch != '\t' && ch != '\f' && ch != '\r' && ch != '\n'))
313       {
314         sprintf(log_line, "\n! non ASCII char (%d) in line: ", ch);
315         show_line(log_line, 1);
316         if (log_opened)
317           fprintf(log_file, "\n! non ASCII char (%d) in line: ", ch);
318 /*        buffer[i]= 127; */ /* not defined - invalid char */
319         flag = 1;
320         break;
321       }
322     }
323     if (flag)
324     {
325       show_bad_line(errout, first, last);
326       if (log_opened)
327         show_bad_line(log_file, first, last);
328     }
329   }
330 /* Don't bother using xord if we don't need to. */ /* for input line */
331 /* #ifdef NONASCII */ /* has been turned into command line flag - bkph */
332   if (non_ascii)
333   {
334     for (i = first; i <= last; i++)
335       buffer[i] = xord[buffer[i]];
336   }
337 /* #endif */
338   return true;
339 }
340
341 /* Read a line of input into buffer as efficiently as possible (ha ha)
342    while still looking like Pascal.
343    We set `last' to `first' and return `false' if we get to eof.
344    Otherwise, we return `true' and set last = first +
345    length(line except trailing whitespace).  */
346 /* texmfmp.c */
347
348 boolean input_line (FILE *f)
349 {
350 //  int ch, flag;         /* for restrict_to_ascii case 94/Jan/21 */
351   char *u;            /* 1994/July/3 for key_replace */
352   int i = '\0';
353
354 /*  and here is the long way of doing this */
355   last = first;
356 /*  following is new version with tab expansion and key replacement */
357 /*  may want to expand out separately for speed 1994/July/3 */
358 /*  different versions depending on return_flag / tabexpand / key_replace */
359 /*  while (last < buf_size && (i = getc (f)) != EOF)  */
360 #ifdef ALLOCATEBUFFER
361   for ( ; ; ) 
362 #else
363   while (last < buf_size) 
364 #endif
365   {
366     i = getc(f);
367
368     if (i < ' ')
369     {
370       if (i == EOF || i == '\n' || (i == '\r' && return_flag))
371         break;
372       else if (i == '\t' && tab_step != 0)
373       {
374         buffer[last++] = (ASCII_code) ' ';
375
376 #ifdef ALLOCATEBUFFER
377         if (last >= current_buf_size)
378         {
379           buffer = realloc_buffer(increment_buf_size);  
380
381           if (last >= current_buf_size)
382             break;
383         }
384 #endif
385
386 #ifdef ALLOCATEBUFFER
387         while ((last - first) % tab_step != 0) 
388 #else
389         while (last < buf_size && (last - first) % tab_step != 0)
390 #endif
391         {
392
393           buffer[last++] = (ASCII_code) ' ';
394
395 #ifdef ALLOCATEBUFFER
396           if (last >= current_buf_size)
397           {
398             buffer = realloc_buffer(increment_buf_size);
399
400             if (last >= current_buf_size)
401               break;
402           }
403 #endif
404         }
405
406         continue;
407       }
408     }
409
410     if (key_replace && (u = replacement[i]) != NULL)
411     {
412 #ifdef ALLOCATEBUFFER
413       while (*u != '\0') 
414 #else
415       while (last < buf_size && *u != '\0')  
416 #endif
417       {
418         buffer[last++] = (ASCII_code) *u++;
419 #ifdef ALLOCATEBUFFER
420         if (last >= current_buf_size)
421         {
422           buffer = realloc_buffer(increment_buf_size);
423
424           if (last >= current_buf_size)
425             break;
426         }
427 #endif
428       }
429     }
430     else       /* normal case */
431     {
432       buffer[last++] = (ASCII_code) i;
433
434 #ifdef ALLOCATEBUFFER
435       if (last >= current_buf_size)
436       {
437         buffer = realloc_buffer(increment_buf_size);
438
439         if (last >= current_buf_size)
440           break;
441       }
442 #endif
443     }
444   }
445
446   if (return_flag)    /* let return terminate line as well as newline */
447   {
448     if (i == '\r')      /* see whether return followed by newline */
449     {
450       i = getc (f);       /* in which case throw away the newline */
451
452       if (i != '\n')
453       {
454         ungetc (i, f);
455         i = '\r';
456       }
457 /*      else  buffer[last-1] = (ASCII_code) i; */
458     }
459   }
460
461   //  Turn Ctrl-Z at end of file into newline 2000 June 22
462   if (i == EOF && trimeof && buffer[last - 1] == 26)
463   {
464     last--;
465   }
466
467   if (i == EOF && last == first)
468     return false;
469
470 /*  Didn't get the whole line because buffer was too small?  */
471 /*  This shouldn't happen anymore 99/Jan/23 */
472   if (i != EOF && i != '\n' && i != '\r')
473   {
474     complain_line(errout);
475
476     if (log_opened)
477       complain_line(log_file);
478
479     /* This may no longer be needed ... now that we grow it */
480     if (truncate_long_lines)
481     {
482       while (i != EOF && i != '\n' && i != '\r')
483       {
484         i = getc (f);     // discard rest of line
485       }
486
487       last--;       /* just in case */
488     }
489     else
490       uexit(EXIT_FAILURE);      /* line too long */
491   }
492
493   return input_line_finish();
494 }
495
496 /* This string specifies what the `e' option does in response to an
497    error message.  */
498
499 static char *edit_value = "c:\\yandy\\WinEdt\\WinEdt.exe [Open('%s');SelLine(%d,7)]";
500
501 /* This procedure is due to sjc@s1-c.  TeX (or Metafont) calls it when
502    the user types `e' in response to an error, invoking a text editor on
503    the erroneous source file.  FNSTART is how far into STRINGPOOL the
504    actual filename starts; FNLENGTH is how long the filename is.
505    
506    See ../site.h for how to set the default, and how to override it.  */
507
508 /* called from close_files_and_terminate in  tex9.c */
509
510 void call_edit (ASCII_code *stringpool, pool_pointer fnstart, integer fnlength, integer linenumber)
511 {
512   char *command, *s, *t, *u;
513   char c;
514   int sdone, ddone, ldone;
515   int i, n;
516   unsigned int commandlen;
517   ASCII_code *texfilename;
518   ASCII_code *log_file_name;
519   pool_pointer lgstart;
520   integer lglength;
521
522   if (log_opened)
523   {
524     lgstart = str_start[texmf_log_name];
525     lglength = length(texmf_log_name);
526     log_file_name = stringpool + lgstart;
527   }
528   else
529   {
530     lglength = 0;
531     log_file_name = (unsigned char *) "";
532   }
533
534   sdone = ddone = ldone = 0;
535   texfilename = stringpool + fnstart;
536
537   for (i = 1; i <= in_open; i++)
538     (void) fclose (input_file[i]);
539
540   n = fcloseall();
541
542   if (n > 0 && verbose_flag)
543   {
544     sprintf(log_line, "Closed %d streams\n", n);
545     show_line(log_line, 0);
546   }
547
548   s = kpse_var_value(edit_value);  
549
550   if (s != NULL)
551     edit_value = s;
552
553   commandlen = strlen (edit_value) + fnlength + lglength + 10 + 1 + 2;
554   command = (string) xmalloc (commandlen); 
555
556   s = command;
557
558   u = edit_value;
559
560   while ((c = *u++) != 0)
561   {
562     if (c == '%')
563     {
564       switch (c = *u++)
565       {
566         case 'd':
567           if (ddone)
568           {
569 #ifdef _WIN32
570             sprintf(log_line, "! bad command syntax (%c).\n", 'd');
571             show_line(log_line, 1);
572 #else
573             sprintf(log_line, "! `%%d' cannot appear twice in editor command.\n");
574             show_line(log_line, 1);
575 #endif
576             uexit(EXIT_FAILURE); 
577           }
578
579           (void) sprintf (s, "%d", linenumber);
580
581           while (*s != '\0')
582             s++;
583
584           ddone = 1;
585           break;
586
587         case 's':
588           if (sdone)
589           {
590 #ifdef __WIN32
591             sprintf(log_line, "! bad command syntax (%c).\n", 's'); 
592             show_line(log_line, 1);
593 #else
594             sprintf(log_line, "! `%%s' cannot appear twice in editor command.\n");
595             show_line(log_line, 1);
596 #endif
597             uexit(EXIT_FAILURE); 
598           }
599
600           t = (char *) texfilename;
601           n = fnlength;
602
603           if (non_ascii)
604             for (i = 0; i < n; i++)
605               *s++ = xchr [*t++];
606           else
607             for (i = 0; i < n; i++)
608               *s++ = (char) *t++;
609
610           sdone = 1;
611           break;
612
613         case 'l':
614           if (ldone)
615           {
616 #ifdef __WIN32
617             sprintf(log_line, "! bad command syntax (%c).\n", 'l'); 
618             show_line(log_line, 1);
619 #else
620             sprintf(log_line, "! `%%l' cannot appear twice in editor command.\n");
621             show_line(log_line, 1);
622 #endif
623             uexit(EXIT_FAILURE); 
624           }
625
626           t = (char *) log_file_name;
627           n = lglength;
628
629           if (non_ascii)
630             for (i = 0; i < n; i++)
631               *s++ = xchr [*t++];
632           else
633             for (i = 0; i < n; i++)
634               *s++ = (char) *t++;
635
636           ldone = 1;
637           break;
638
639         case '\0':
640           *s++ = '%'; 
641           u--;
642           break;
643
644         default:
645           *s++ = '%';
646           *s++ = c;
647           break;
648       }
649     }
650     else
651       *s++ = c;
652   }
653
654   *s = 0; /* terminate the command string */
655
656   if (strlen(command) + 1 >= commandlen)
657   {
658     sprintf(log_line, "Command too long (%d > %d)\n", strlen(command) + 1, commandlen);
659     show_line(log_line, 1);
660     uexit(EXIT_FAILURE);
661   }
662
663   //flushall();
664   fflush(NULL);
665
666   if (system (command) != 0)
667   {
668     show_line("\n", 0);
669     sprintf(log_line, "! Error in call: %s\n", command);
670     show_line(log_line, 1);
671
672 #ifdef __WIN32
673     if (errno != 0)
674       perrormod("! DOS says");
675 #endif
676
677     sprintf(log_line, "  (TEXEDIT=%s)\n", edit_value);
678     show_line(log_line, 0);
679     puts("  (Editor specified may be missing or path may be wrong)\n");
680     puts("  (or there may be missing -- or extraneous -- quotation signs)\n");
681   }
682
683   uexit(EXIT_FAILURE);
684 }
685
686 /* Read and write format (for TeX) or base (for Metafont) files.  In
687    tex.web, these files are architecture dependent; specifically,
688    BigEndian and LittleEndian architectures produce different files.
689    These routines always output BigEndian files.  This still does not
690    make the dump files architecture-independent, because it is possible
691    to make a format file that dumps a glue ratio, i.e., a floating-point
692    number.  Fortunately, none of the standard formats do that.  */
693
694 #if !defined (WORDS_BIGENDIAN) && !defined (NO_FMTBASE_SWAP) /* this fn */
695
696 /* We don't REALLY care what `endian' the machine is after all ! */
697 /* But we do care about speed - so check exe file for following - bkph */
698
699 // #ifdef MYDEBUG
700 // char swapmarkerstring="ERROR: SWAPPING - NOT BigEndian AND NOT NoFmtBaseSwap";
701 // #endif
702
703 /* This macro is always invoked as a statement.  It assumes a variable
704    `temp'.  */
705    
706 #define SWAP(x, y) temp = (x); (x) = (y); (y) = temp;
707
708
709 /* Make the NITEMS items pointed at by P, each of size SIZE, be the
710    opposite-endianness of whatever they are now.  */
711
712 static int swap_items (char *p, int nitems, int size)
713 {
714   char temp;
715
716   /* Since `size' does not change, we can write a while loop for each
717      case, and avoid testing `size' for each time.  */
718   switch (size)
719   {
720     case 8:
721       while (nitems--)
722       {
723         SWAP (p[0], p[7]);
724         SWAP (p[1], p[6]);
725         SWAP (p[2], p[5]);
726         SWAP (p[3], p[4]);
727         p += size;
728       }
729       break;
730
731     case 4:
732       while (nitems--)
733       {
734         SWAP (p[0], p[3]);
735         SWAP (p[1], p[2]);
736         p += size;
737       }
738       break;
739
740     case 2:
741       while (nitems--)
742       {
743         SWAP (p[0], p[1]);
744         p += size;
745       }
746       break;
747
748     case 1:
749     /* Nothing to do.  */
750       break;
751
752     default:
753       show_line("\n", 0);
754       sprintf(log_line, "! I can't (un)dump a %d byte item.\n", size);
755       show_line(log_line, 1);
756       uexit(EXIT_FAILURE);
757   }
758   return 0;
759 }
760 #endif /* not WORDS_BIGENDIAN and not NO_FMTBASE_SWAP */
761
762 #ifdef COMPACTFORMAT
763 int do_dump(char *p, int item_size, int nitems, gzFile out_file)
764 #else
765 int do_dump(char *p, int item_size, int nitems, FILE *out_file)
766 #endif
767 {
768 #if !defined (WORDS_BIGENDIAN) && !defined (NO_FMTBASE_SWAP)
769   swap_items (p, nitems, item_size);
770 #endif
771
772 #ifdef COMPACTFORMAT
773   if (gzwrite(out_file, p, (item_size * nitems)) != (item_size * nitems))
774 #else
775   if ((int) fwrite(p, item_size, nitems, out_file) != nitems)
776 #endif
777   {
778     show_line("\n", 0);
779     sprintf(log_line, "! Could not write %d %d-byte item%s.\n",
780                nitems, item_size, (nitems > 1) ? "s" : "");
781     show_line(log_line, 1);
782     uexit(EXIT_FAILURE);
783   }
784
785 /* Have to restore the old contents of memory, since some of it might get used again.  */
786 #if !defined (WORDS_BIGENDIAN) && !defined (NO_FMTBASE_SWAP)
787   swap_items (p, nitems, item_size);
788 #endif
789
790   return 0;
791 }
792
793 #ifdef COMPACTFORMAT
794 int do_undump(char *p, int item_size, int nitems, gzFile in_file)
795 #else
796 int do_undump(char *p, int item_size, int nitems, FILE *in_file)
797 #endif
798 {
799 #ifdef COMPACTFORMAT
800   if (gzread(in_file, (void *) p, (unsigned int) (item_size * nitems)) <= 0)
801 #else
802   if ((int) fread((void *) p, item_size, nitems, in_file) != nitems)
803 #endif
804   {
805     show_line("\n", 0);
806     sprintf(log_line, "! Could not read %d %d-byte item%s.\n",
807                nitems, item_size, (nitems > 1) ? "s" : "");
808     show_line(log_line, 1);
809     uexit(EXIT_FAILURE);
810   }
811
812 #if !defined (WORDS_BIGENDIAN) && !defined (NO_FMTBASE_SWAP)
813   swap_items (p, nitems, item_size);
814 #endif
815
816   return 0;
817 }
818
819 #ifdef FUNNY_CORE_DUMP
820 /* This procedure is due to chris@mimsy.umd.edu.  It makes a core dump
821    without any sort of error status (abort(2) does return an error status,
822    so we don't want to use that).  It is used only when making a preloaded
823    TeX from virtex, and is triggered by a magic file name requested as
824    input (see `open_input', above).  */
825
826 void funny_core_dump (void)
827 {
828   int pid, w;
829   union wait status;
830
831   switch (pid = vfork ())
832   {
833     case -1:
834       perrormod ("vfork");
835       exit (-1);
836
837     case 0:
838        (void) signal (SIGQUIT, SIG_DFL);
839        (void) kill (getpid (), SIGQUIT);
840        (void) write (2, "how did we get here?\n", 21);
841        exit (1);
842
843     default:
844       while ((w = wait (&status)) != pid && w != -1)
845         ;
846
847       if (status.w_coredump)
848         exit (0);
849
850       (void) write (2, "attempt to dump core failed\n", 28);
851       exit (1);
852   }
853 }
854 #endif /* FUNNY_CORE_DUMP */
855 /*
856 #include <tex0.c>
857 #include <tex1.c>
858 #include <tex2.c>
859 #include <tex3.c>
860 #include <tex4.c>
861 #include <tex5.c>
862 #include <tex6.c>
863 #include <tex7.c>
864 #include <tex8.c>
865 #include <tex9.c>
866 */