home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / web2c / fontutil / mft.ch < prev    next >
Text File  |  1996-09-28  |  18KB  |  539 lines

  1. % mft.ch for C compilation with web2c.
  2. % 11/27/89 Karl Berry        version 2.0.
  3. % 01/20/90 Karl            new mft.web (still 2.0, though).
  4. % (more recent changes in ../ChangeLog.W2C)
  5. % From Pierre Mackay's version for pc, which was in turn based on Howard
  6. % Trickey's and Pavel Curtis's change file for weave.
  7.  
  8.  
  9. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  10. % [0] WEAVE: print changes only.
  11. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  12. @x
  13. \pageno=\contentspagenumber \advance\pageno by 1
  14. @y
  15. \pageno=\contentspagenumber \advance\pageno by 1
  16. \let\maybe=\iffalse
  17. \def\title{MFT changes for C}
  18. @z
  19.  
  20. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  21. % [2] Change banner message.
  22. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  23. @x
  24. @d banner=='This is MFT, Version 2.0'
  25. @y
  26. @d banner=='This is MFT, Version 2.0' {more is printed later}
  27. @z
  28.  
  29. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  30. % [3] No need for the final label in C.
  31. % AIX defines `class' in <math.h>, so let's take this opportunity to
  32. % define that away.
  33. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34. @x
  35. @d end_of_MFT = 9999 {go here to wrap it up}
  36. @y
  37. @d class == class_var
  38. @z
  39.  
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. % [3] Main program header, remove external label.
  42. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  43. @x
  44. program MFT(@!mf_file,@!change_file,@!style_file,@!tex_file);
  45. label end_of_MFT; {go here to finish}
  46. const @<Constants in the outer block@>@/
  47. type @<Types in the outer block@>@/
  48. var @<Globals in the outer block@>@/
  49. @<Error handling procedures@>@/
  50. procedure initialize;
  51.   var @<Local variables for initialization@>@/
  52.   begin @<Set initial values@>@/
  53.   end;
  54. @y
  55. program MFT;
  56. const @<Constants in the outer block@>@/
  57. type @<Types in the outer block@>@/
  58. var @<Globals in the outer block@>@/
  59. @<Error handling procedures@>@/
  60. @<|scan_args| procedure@>@/
  61. procedure initialize;
  62.   var @<Local variables for initialization@>@/
  63.   begin @<Set initial values@>@/
  64.   end;
  65. @z
  66.  
  67. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  68. % [4] No compiler directives.
  69. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  70. @x
  71. @{@&$C+,A+,D-@} {range check, catch arithmetic overflow, no debug overhead}
  72. @y
  73. @z
  74.  
  75. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  76. % [13] The text_char type is used as an array index into xord.  The
  77. % default type `char' produces signed integers, which are bad array
  78. % indices in C.
  79. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  80. @x
  81. @d text_char == char {the data type of characters in text files}
  82. @y
  83. @d text_char == ASCII_code {the data type of characters in text files}
  84. @z
  85.  
  86. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  87. % [17] Allow any input character.
  88. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  89. @x
  90. for i:=0 to @'37 do xchr[i]:=' ';
  91. for i:=@'177 to @'377 do xchr[i]:=' ';
  92. @y
  93. for i:=1 to @'37 do xchr[i]:=chr(i);
  94. for i:=@'177 to @'377 do xchr[i]:=chr(i);
  95. @z
  96.  
  97. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  98. % [20] Terminal I/O.
  99. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  100. @x
  101. @d print(#)==write(term_out,#) {`|print|' means write on the terminal}
  102. @y
  103. @d term_out==stdout
  104. @d print(#)==write(term_out,#) {`|print|' means write on the terminal}
  105. @z
  106.  
  107. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  108. % [20] Remove term_out.
  109. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  110. @x
  111. @<Globals...@>=
  112. @!term_out:text_file; {the terminal as an output file}
  113. @y
  114. @z
  115.  
  116. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  117. % [21] Don't initialize the terminal.
  118. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  119. @x
  120. @ Different systems have different ways of specifying that the output on a
  121. certain file will appear on the user's terminal. Here is one way to do this
  122. on the \PASCAL\ system that was used in \.{WEAVE}'s initial development:
  123. @^system dependencies@>
  124.  
  125. @<Set init...@>=
  126. rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
  127. @y
  128. @ Different systems have different ways of specifying that the output on a
  129. certain file will appear on the user's terminal.
  130. @^system dependencies@>
  131.  
  132. @<Set init...@>=
  133. {nothing need be done}
  134. @z
  135.  
  136. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  137. % [22] `break' is `flush'.
  138. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  139. @x
  140. @d update_terminal == break(term_out) {empty the terminal output buffer}
  141. @y
  142. @d update_terminal == flush(term_out) {empty the terminal output buffer}
  143. @z
  144.  
  145. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  146. % [24] Open input files.
  147. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  148. @x
  149. @ The following code opens the input files.  Since these files were listed
  150. in the program header, we assume that the \PASCAL\ runtime system has
  151. already checked that suitable file names have been given; therefore no
  152. additional error checking needs to be done.
  153. @^system dependencies@>
  154.  
  155. @p procedure open_input; {prepare to read the inputs}
  156. begin reset(mf_file); reset(change_file); reset(style_file);
  157. end;
  158. @y
  159. @ The following code opens the input files.  This is called after
  160. |scan_args| has set the file name variables appropriately.
  161. @^system dependencies@>
  162.  
  163. @p procedure open_input; {prepare to read inputs}
  164. begin
  165.   if test_read_access (mf_file_name, MF_INPUT_PATH)
  166.   then reset (mf_file, mf_file_name)
  167.   else begin
  168.     print_pascal_string (mf_file_name);
  169.     print (': Metafont source file not found');
  170.     uexit (1);
  171.   end;
  172.   
  173.   reset (change_file, change_file_name);
  174.  
  175.   if test_read_access (style_file_name, TEX_INPUT_PATH)
  176.   then reset (style_file, style_file_name)
  177.   else begin
  178.     print_pascal_string (style_file_name);
  179.     print (': Style file not found');
  180.     uexit (1);
  181.   end;
  182. end;
  183. @z
  184.  
  185. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  186. % [26] Opening the .tex file.
  187. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  188. @x
  189. @ The following code opens |tex_file|.
  190. Since this file was listed in the program header, we assume that the
  191. \PASCAL\ runtime system has checked that a suitable external file name has
  192. been given.
  193. @^system dependencies@>
  194.  
  195. @<Set init...@>=
  196. rewrite(tex_file);
  197. @y
  198. @ The following code opens |tex_file|.
  199. The |scan_args| procedure is used to set up |tex_file_name| as required.
  200. @^system dependencies@>
  201.  
  202. @<Set init...@>=
  203. scan_args;
  204. rewrite (tex_file,tex_file_name);
  205. @z
  206.  
  207. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  208. % [28] Fix f^.
  209. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  210. @x
  211. if eof(f) then input_ln:=false
  212. else  begin while not eoln(f) do
  213.     begin buffer[limit]:=xord[f^]; get(f);
  214.     incr(limit);
  215.     if buffer[limit-1]<>" " then final_limit:=limit;
  216.     if limit=buf_size then
  217.       begin while not eoln(f) do get(f);
  218. @y
  219. if eof(f) then input_ln:=false
  220. else  begin while not eoln(f) do
  221.     begin buffer[limit]:=xord[getc(f)];
  222.     incr(limit);
  223.     if buffer[limit-1]<>" " then final_limit:=limit;
  224.     if limit=buf_size then
  225.       begin while not eoln(f) do vgetc(f);
  226. @z
  227.  
  228. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  229. % [31] Fix jump_out.
  230. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  231. @x
  232. @ The |jump_out| procedure just cuts across all active procedure levels
  233. and jumps out of the program. This is the only non-local \&{goto} statement
  234. in \.{MFT}. It is used when no recovery from a particular error has
  235. been provided.
  236.  
  237. Some \PASCAL\ compilers do not implement non-local |goto| statements.
  238. @^system dependencies@>
  239. In such cases the code that appears at label |end_of_MFT| should be
  240. copied into the |jump_out| procedure, followed by a call to a system procedure
  241. that terminates the program.
  242.  
  243. @d fatal_error(#)==begin new_line; print(#); error; mark_fatal; jump_out;
  244.   end
  245.  
  246. @<Error handling...@>=
  247. procedure jump_out;
  248. begin goto end_of_MFT;
  249. end;
  250. @y
  251. @ The |jump_out| procedure cleans up, prints appropriate messages,
  252. and exits back to the operating system.
  253.  
  254. @d fatal_error(#)==begin new_line; print(#); error; mark_fatal; jump_out;
  255.     end
  256.  
  257. @<Error handling...@>=
  258. procedure jump_out;
  259. begin
  260. @t\4\4@>{here files should be closed if the operating system requires it}
  261.   @<Print the job |history|@>;
  262.   new_line;
  263.   if (history <> spotless) and (history <> harmless_message) then
  264.     uexit(1)
  265.   else
  266.     uexit(0);
  267. end;
  268. @z
  269.  
  270. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  271. % [112] Print newline at end of run, exit based upon value of history,
  272. % and remove the end_of_MFT label.
  273. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  274. @x
  275. @p begin initialize; {beginning of the main program}
  276. print_ln(banner); {print a ``banner line''}
  277. @y
  278. @p begin initialize; {beginning of the main program}
  279. print (banner); {print a ``banner line''}
  280. print_ln (version_string);
  281. @z
  282.  
  283. @x
  284. end_of_MFT:{here files should be closed if the operating system requires it}
  285. @<Print the job |history|@>;
  286. end.
  287. @y
  288. @<Print the job |history|@>;
  289. new_line;
  290. if (history <> spotless) and (history <> harmless_message)
  291. then uexit (1)
  292. else uexit (0);
  293. end.
  294. @z
  295.  
  296. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  297. % [114] System dependent changes--the scan_args procedure
  298. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  299. @x
  300. @* System-dependent changes.
  301. This module should be replaced, if necessary, by changes to the program
  302. that are necessary to make \.{MFT} work at a particular installation.
  303. It is usually best to design your change file so that all changes to
  304. previous modules preserve the module numbering; then everybody's version
  305. will be consistent with the printed program. More extensive changes,
  306. which introduce new modules, can be inserted here; then only the index
  307. itself will get a new module number.
  308. @^system dependencies@>
  309. @y
  310. @* System-dependent changes.
  311.  
  312. The user calls \.{MFT} with arguments on the command line.  These are
  313. either file names or flags (beginning with `\.-').  The following globals
  314. are for communicating the user's desires to the rest of the program. The
  315. various |file_name| variables contain strings with the full names of
  316. those files, as UNIX knows them.
  317.  
  318. The flags that affect \.{MFT} are \.{-c} and \.{-s}, whose 
  319. statuses is kept in |no_change| and |no_style|, respectively.
  320.  
  321. @<Globals...@>=
  322. @!mf_file_name,@!change_file_name,@!style_file_name,@!tex_file_name:
  323. packed array[1..PATH_MAX] of char;
  324. @!no_change,@!no_style:boolean;
  325.  
  326. @ The |scan_args| procedure looks at the command line arguments and sets
  327. the |file_name| variables accordingly.
  328.  
  329. At least one file name must be present as the first argument: the \.{mf}
  330. file.  It may have an extension, or it may omit it to get |'.mf'| added.
  331. If there is only one file name, the output file name is formed by
  332. replacing the \.{mf} file name extension by |'.tex'|.  Thus, the command
  333. line \.{mf foo} implies the use of the \METAFONT\ input file \.{foo.mf}
  334. and the output file \.{foo.tex}.  If this style of command line, with
  335. only one argument is used, the default style file, |plain.mft|, will be
  336. used to provide basic formatting.
  337.  
  338. An argument beginning with a hyphen is a flag.  Any letters
  339. following the minus sign may cause global flag variables to be set.
  340. Currently, a \.c means that there is a change file, and an \.s means
  341. that there is a style file.  The auxiliary files must of course appear
  342. in the same order as the flags.  For example, the flag \.{-sc} must be
  343. followed by the name of the |style_file| first, and then the name of the
  344. |change_file|.
  345.  
  346. @<|scan_args|...@>=
  347. procedure scan_args;
  348. var @!dot_pos,@!slash_pos,i,a: integer; {indices}
  349. @!which_file_next: char;
  350. @!fname: array[1..PATH_MAX] of char; {temporary argument holder}
  351. @!found_mf,@!found_change,found_style: boolean; {|true| when those 
  352.                                                  file names have been seen}
  353. begin
  354. {get style file path from the environment variable \.{TEXINPUTS}}
  355. set_paths (MF_INPUT_PATH_BIT + TEX_INPUT_PATH_BIT);
  356. found_mf:=false;
  357. @<Set up null change file@>; found_change:=true; {default to no change file}
  358. @<Set up plain style file@>; found_style:=true; {default to plain style file}
  359. for a:=1 to argc-1 do begin
  360.   argv(a,fname); {put argument number |a| into |fname|}
  361.   if fname[1]<>'-' then begin
  362.     if not found_mf then
  363.       @<Get |mf_file_name| from |fname|, and set up |tex_file_name@>
  364.     else 
  365.       if not found_change then begin
  366.         if which_file_next <> 's' then begin
  367.                 @<Get |change_file_name| from |fname|@>;
  368.                 which_file_next := 's'
  369.                 end
  370.         else @<Get |style_file_name| from |fname|@>
  371.         end
  372.       else if not found_style then begin
  373.         if which_file_next = 's' then begin
  374.                 @<Get |style_file_name| from |fname|@>; 
  375.                 which_file_next := 'c'
  376.                 end;
  377.         end
  378.     else  @<Print usage error message and quit@>;
  379.     end
  380.   else @<Handle flag argument in |fname|@>;
  381.   end;
  382. if not found_mf then @<Print usage error message and quit@>;
  383. end;
  384.  
  385. @ Use all of |fname| for the |mf_file_name| if there is a |'.'| in it,
  386. otherwise add |'.mf'|.  The \TeX\ file name comes from adding things
  387. after the dot.  The |argv| procedure will not put more than
  388. |PATH_MAX-5| characters into |fname|, and this leaves enough room in
  389. the |file_name| variables to add the extensions.  We declared |fname| to
  390. be of size |PATH_MAX| instead of |PATH_MAX-5| because the latter
  391. implies |PATH_MAX| must be a numeric constant---and we don't want to
  392. repeat the value from \.{site.h} just to save five bytes of memory.
  393.  
  394. The end of a file name is marked with a |' '|, the convention assumed by 
  395. the |reset| and |rewrite| procedures.
  396.  
  397. @<Get |mf_file_name|...@>=
  398. begin
  399. dot_pos:=-1;
  400. slash_pos:=-1;
  401. i:=1;
  402. while (fname[i]<>' ') and (i<=PATH_MAX-5) do begin
  403.         mf_file_name[i]:=fname[i];
  404.         if fname[i]='.' then dot_pos:=i;
  405.         if fname[i]='/' then slash_pos:=i;
  406.         incr(i);
  407.         end;
  408. if (dot_pos=-1) or (dot_pos < slash_pos) then begin
  409.         dot_pos:=i;
  410.         mf_file_name[dot_pos]:='.';
  411.         mf_file_name[dot_pos+1]:='m';
  412.         mf_file_name[dot_pos+2]:='f';
  413.         mf_file_name[dot_pos+3]:=' ';
  414.         end;
  415. for i:=1 to dot_pos do begin
  416.         tex_file_name[i]:=mf_file_name[i];
  417.         end;
  418. tex_file_name[dot_pos+1]:='t';
  419. tex_file_name[dot_pos+2]:='e';
  420. tex_file_name[dot_pos+3]:='x';
  421. tex_file_name[dot_pos+4]:=' ';
  422. which_file_next := 'z';
  423. found_mf:=true;
  424. end
  425.  
  426. @ Use all of |fname| for the |change_file_name| if there is a |'.'| in it,
  427. otherwise add |'.ch'|.
  428.  
  429. @<Get |change_file_name|...@>=
  430. begin
  431. dot_pos:=-1;
  432. slash_pos:=-1;
  433. i:=1;
  434. while (fname[i]<>' ') and (i<=PATH_MAX-5)
  435. do begin
  436.         change_file_name[i]:=fname[i];
  437.         if fname[i]='.' then dot_pos:=i;
  438.         if fname[i]='/' then slash_pos:=i;
  439.         incr(i);
  440.         end;
  441. if (dot_pos=-1) or (dot_pos < slash_pos) then begin
  442.         dot_pos:=i;
  443.         change_file_name[dot_pos]:='.';
  444.         change_file_name[dot_pos+1]:='c';
  445.         change_file_name[dot_pos+2]:='h';
  446.         change_file_name[dot_pos+3]:=' ';
  447.         end;
  448. which_file_next := 'z';
  449. found_change:=true;
  450. end
  451.  
  452. @ Use all of |fname| for the |style_file_name| if there is a |'.'| in it;
  453. otherwise, add |'.mft'|.
  454.  
  455.  
  456. @<Get |style_file_name|...@>=
  457. begin
  458. dot_pos:=-1;
  459. slash_pos:=-1;
  460. i:=1;
  461. while (fname[i]<>' ') and (i<=PATH_MAX-5)
  462. do begin
  463.         style_file_name[i]:=fname[i];
  464.         if fname[i]='.' then dot_pos:=i;
  465.         if fname[i]='/' then slash_pos:=i;
  466.         incr(i);
  467.         end;
  468. if (dot_pos=-1) or (dot_pos < slash_pos) then begin
  469.         dot_pos:=i;
  470.         style_file_name[dot_pos]:='.';
  471.         style_file_name[dot_pos+1]:='m';
  472.         style_file_name[dot_pos+2]:='f';
  473.         style_file_name[dot_pos+3]:='t';
  474.         style_file_name[dot_pos+4]:=' ';
  475.         end;
  476. which_file_next := 'z';
  477. found_style:=true;
  478. end
  479.  
  480. @
  481.  
  482. @<Set up null change file@>=
  483. begin
  484.         change_file_name[1]:='/';
  485.         change_file_name[2]:='d';
  486.         change_file_name[3]:='e';
  487.         change_file_name[4]:='v';
  488.         change_file_name[5]:='/';
  489.         change_file_name[6]:='n';
  490.         change_file_name[7]:='u';
  491.         change_file_name[8]:='l';
  492.         change_file_name[9]:='l';
  493.         change_file_name[10]:=' ';
  494. end
  495.  
  496. @
  497.  
  498. @<Set up plain style file@>=
  499. begin
  500.         style_file_name[1]:='p';
  501.         style_file_name[2]:='l';
  502.         style_file_name[3]:='a';
  503.         style_file_name[4]:='i';
  504.         style_file_name[5]:='n';
  505.         style_file_name[6]:='.';
  506.         style_file_name[7]:='m';
  507.         style_file_name[8]:='f';
  508.         style_file_name[9]:='t';
  509.         style_file_name[10]:=' ';
  510. end
  511.  
  512. @
  513.  
  514. @<Handle flag...@>=
  515. begin
  516. i:=2;
  517. while (fname[i]<>' ') and (i<=PATH_MAX-5) do begin
  518.         if fname[i]='c' then begin found_change:=false;
  519.                 if which_file_next <> 's' then which_file_next := 'c'
  520.                 end
  521.         else if fname[i]='s' then begin found_style:=false;
  522.                   if which_file_next <> 'c' then which_file_next := 's'
  523.                   end
  524.             else print_nl('Invalid flag ',xchr[xord[fname[i]]], '.');
  525.         incr(i);
  526.         end;
  527. end
  528.  
  529. @
  530.  
  531. @<Print usage error message and quit@>=
  532. begin
  533. print_ln('Usage: mft file[.mf] [-cs] [change[.ch]] [style[.mft]].');
  534. uexit(1);
  535. end
  536. @z
  537.