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