home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / tex / texsrc2 / Src / fontutil / mft / old-ch < prev    next >
Encoding:
Text File  |  1993-02-21  |  17.0 KB  |  536 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. rewrite (tex_file,tex_file_name);
  202. @z
  203.  
  204. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  205. % [28] Fix f^.
  206. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  207. @x
  208. if eof(f) then input_ln:=false
  209. else  begin while not eoln(f) do
  210.     begin buffer[limit]:=xord[f^]; get(f);
  211.     incr(limit);
  212.     if buffer[limit-1]<>" " then final_limit:=limit;
  213.     if limit=buf_size then
  214.       begin while not eoln(f) do get(f);
  215. @y
  216. if eof(f) then input_ln:=false
  217. else  begin while not eoln(f) do
  218.     begin buffer[limit]:=xord[getc(f)];
  219.     incr(limit);
  220.     if buffer[limit-1]<>" " then final_limit:=limit;
  221.     if limit=buf_size then
  222.       begin while not eoln(f) do vgetc(f);
  223. @z
  224.  
  225. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  226. % [31] Fix jump_out.
  227. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  228. @x
  229. @ The |jump_out| procedure just cuts across all active procedure levels
  230. and jumps out of the program. This is the only non-local \&{goto} statement
  231. in \.{MFT}. It is used when no recovery from a particular error has
  232. been provided.
  233.  
  234. Some \PASCAL\ compilers do not implement non-local |goto| statements.
  235. @^system dependencies@>
  236. In such cases the code that appears at label |end_of_MFT| should be
  237. copied into the |jump_out| procedure, followed by a call to a system procedure
  238. that terminates the program.
  239.  
  240. @d fatal_error(#)==begin new_line; print(#); error; mark_fatal; jump_out;
  241.   end
  242.  
  243. @<Error handling...@>=
  244. procedure jump_out;
  245. begin goto end_of_MFT;
  246. end;
  247. @y
  248. @ The |jump_out| procedure cleans up, prints appropriate messages,
  249. and exits back to the operating system.
  250.  
  251. @d fatal_error(#)==begin new_line; print(#); error; mark_fatal; jump_out;
  252.     end
  253.  
  254. @<Error handling...@>=
  255. procedure jump_out;
  256. begin
  257. @t\4\4@>{here files should be closed if the operating system requires it}
  258.   @<Print the job |history|@>;
  259.   new_line;
  260.   if (history <> spotless) and (history <> harmless_message) then
  261.     uexit(1)
  262.   else
  263.     uexit(0);
  264. end;
  265. @z
  266.  
  267. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  268. % [112] Print newline at end of run, exit based upon value of history,
  269. % and remove the end_of_MFT label.
  270. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  271. @x
  272. @p begin initialize; {beginning of the main program}
  273. print_ln(banner); {print a ``banner line''}
  274. @y
  275. @p begin initialize; {beginning of the main program}
  276. print (banner); {print a ``banner line''}
  277. print_ln (version_string);
  278. @z
  279.  
  280. @x
  281. end_of_MFT:{here files should be closed if the operating system requires it}
  282. @<Print the job |history|@>;
  283. end.
  284. @y
  285. @<Print the job |history|@>;
  286. new_line;
  287. if (history <> spotless) and (history <> harmless_message)
  288. then uexit (1)
  289. else uexit (0);
  290. end.
  291. @z
  292.  
  293. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  294. % [114] System dependent changes--the scan_args procedure
  295. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  296. @x
  297. @* System-dependent changes.
  298. This module should be replaced, if necessary, by changes to the program
  299. that are necessary to make \.{MFT} work at a particular installation.
  300. It is usually best to design your change file so that all changes to
  301. previous modules preserve the module numbering; then everybody's version
  302. will be consistent with the printed program. More extensive changes,
  303. which introduce new modules, can be inserted here; then only the index
  304. itself will get a new module number.
  305. @^system dependencies@>
  306. @y
  307. @* System-dependent changes.
  308.  
  309. The user calls \.{MFT} with arguments on the command line.  These are
  310. either file names or flags (beginning with `\.-').  The following globals
  311. are for communicating the user's desires to the rest of the program. The
  312. various |file_name| variables contain strings with the full names of
  313. those files, as UNIX knows them.
  314.  
  315. The flags that affect \.{MFT} are \.{-c} and \.{-s}, whose 
  316. statuses is kept in |no_change| and |no_style|, respectively.
  317.  
  318. @<Globals...@>=
  319. @!mf_file_name,@!change_file_name,@!style_file_name,@!tex_file_name:
  320. packed array[1..PATH_MAX] of char;
  321. @!no_change,@!no_style:boolean;
  322.  
  323. @ The |scan_args| procedure looks at the command line arguments and sets
  324. the |file_name| variables accordingly.
  325.  
  326. At least one file name must be present as the first argument: the \.{mf}
  327. file.  It may have an extension, or it may omit it to get |'.mf'| added.
  328. If there is only one file name, the output file name is formed by
  329. replacing the \.{mf} file name extension by |'.tex'|.  Thus, the command
  330. line \.{mf foo} implies the use of the \METAFONT\ input file \.{foo.mf}
  331. and the output file \.{foo.tex}.  If this style of command line, with
  332. only one argument is used, the default style file, |plain.mft|, will be
  333. used to provide basic formatting.
  334.  
  335. An argument beginning with a hyphen is a flag.  Any letters
  336. following the minus sign may cause global flag variables to be set.
  337. Currently, a \.c means that there is a change file, and an \.s means
  338. that there is a style file.  The auxiliary files must of course appear
  339. in the same order as the flags.  For example, the flag \.{-sc} must be
  340. followed by the name of the |style_file| first, and then the name of the
  341. |change_file|.
  342.  
  343. @<|scan_args|...@>=
  344. procedure scan_args;
  345. var @!dot_pos,@!slash_pos,i,a: integer; {indices}
  346. @!which_file_next: char;
  347. @!fname: array[1..PATH_MAX] of char; {temporary argument holder}
  348. @!found_mf,@!found_change,found_style: boolean; {|true| when those 
  349.                                                  file names have been seen}
  350. begin
  351. {get style file path from the environment variable \.{TEXINPUTS}}
  352. set_paths (MF_INPUT_PATH_BIT + TEX_INPUT_PATH_BIT);
  353. found_mf:=false;
  354. @<Set up null change file@>; found_change:=true; {default to no change file}
  355. @<Set up plain style file@>; found_style:=true; {default to plain style file}
  356. for a:=1 to argc-1 do begin
  357.   argv(a,fname); {put argument number |a| into |fname|}
  358.   if fname[1]<>'-' then begin
  359.     if not found_mf then
  360.       @<Get |mf_file_name| from |fname|, and set up |tex_file_name@>
  361.     else 
  362.       if not found_change then begin
  363.         if which_file_next <> 's' then begin
  364.                 @<Get |change_file_name| from |fname|@>;
  365.                 which_file_next := 's'
  366.                 end
  367.         else @<Get |style_file_name| from |fname|@>
  368.         end
  369.       else if not found_style then begin
  370.         if which_file_next = 's' then begin
  371.                 @<Get |style_file_name| from |fname|@>; 
  372.                 which_file_next := 'c'
  373.                 end;
  374.         end
  375.     else  @<Print usage error message and quit@>;
  376.     end
  377.   else @<Handle flag argument in |fname|@>;
  378.   end;
  379. if not found_mf then @<Print usage error message and quit@>;
  380. end;
  381.  
  382. @ Use all of |fname| for the |mf_file_name| if there is a |'.'| in it,
  383. otherwise add |'.mf'|.  The \TeX\ file name comes from adding things
  384. after the dot.  The |argv| procedure will not put more than
  385. |PATH_MAX-5| characters into |fname|, and this leaves enough room in
  386. the |file_name| variables to add the extensions.  We declared |fname| to
  387. be of size |PATH_MAX| instead of |PATH_MAX-5| because the latter
  388. implies |PATH_MAX| must be a numeric constant---and we don't want to
  389. repeat the value from \.{site.h} just to save five bytes of memory.
  390.  
  391. The end of a file name is marked with a |' '|, the convention assumed by 
  392. the |reset| and |rewrite| procedures.
  393.  
  394. @<Get |mf_file_name|...@>=
  395. begin
  396. dot_pos:=-1;
  397. slash_pos:=-1;
  398. i:=1;
  399. while (fname[i]<>' ') and (i<=PATH_MAX-5) do begin
  400.         mf_file_name[i]:=fname[i];
  401.         if fname[i]='.' then dot_pos:=i;
  402.         if fname[i]='/' then slash_pos:=i;
  403.         incr(i);
  404.         end;
  405. if (dot_pos=-1) or (dot_pos < slash_pos) then begin
  406.         dot_pos:=i;
  407.         mf_file_name[dot_pos]:='.';
  408.         mf_file_name[dot_pos+1]:='m';
  409.         mf_file_name[dot_pos+2]:='f';
  410.         mf_file_name[dot_pos+3]:=' ';
  411.         end;
  412. for i:=1 to dot_pos do begin
  413.         tex_file_name[i]:=mf_file_name[i];
  414.         end;
  415. tex_file_name[dot_pos+1]:='t';
  416. tex_file_name[dot_pos+2]:='e';
  417. tex_file_name[dot_pos+3]:='x';
  418. tex_file_name[dot_pos+4]:=' ';
  419. which_file_next := 'z';
  420. found_mf:=true;
  421. end
  422.  
  423. @ Use all of |fname| for the |change_file_name| if there is a |'.'| in it,
  424. otherwise add |'.ch'|.
  425.  
  426. @<Get |change_file_name|...@>=
  427. begin
  428. dot_pos:=-1;
  429. slash_pos:=-1;
  430. i:=1;
  431. while (fname[i]<>' ') and (i<=PATH_MAX-5)
  432. do begin
  433.         change_file_name[i]:=fname[i];
  434.         if fname[i]='.' then dot_pos:=i;
  435.         if fname[i]='/' then slash_pos:=i;
  436.         incr(i);
  437.         end;
  438. if (dot_pos=-1) or (dot_pos < slash_pos) then begin
  439.         dot_pos:=i;
  440.         change_file_name[dot_pos]:='.';
  441.         change_file_name[dot_pos+1]:='c';
  442.         change_file_name[dot_pos+2]:='h';
  443.         change_file_name[dot_pos+3]:=' ';
  444.         end;
  445. which_file_next := 'z';
  446. found_change:=true;
  447. end
  448.  
  449. @ Use all of |fname| for the |style_file_name| if there is a |'.'| in it;
  450. otherwise, add |'.mft'|.
  451.  
  452.  
  453. @<Get |style_file_name|...@>=
  454. begin
  455. dot_pos:=-1;
  456. slash_pos:=-1;
  457. i:=1;
  458. while (fname[i]<>' ') and (i<=PATH_MAX-5)
  459. do begin
  460.         style_file_name[i]:=fname[i];
  461.         if fname[i]='.' then dot_pos:=i;
  462.         if fname[i]='/' then slash_pos:=i;
  463.         incr(i);
  464.         end;
  465. if (dot_pos=-1) or (dot_pos < slash_pos) then begin
  466.         dot_pos:=i;
  467.         style_file_name[dot_pos]:='.';
  468.         style_file_name[dot_pos+1]:='m';
  469.         style_file_name[dot_pos+2]:='f';
  470.         style_file_name[dot_pos+3]:='t';
  471.         style_file_name[dot_pos+4]:=' ';
  472.         end;
  473. which_file_next := 'z';
  474. found_style:=true;
  475. end
  476.  
  477. @
  478.  
  479. @<Set up null change file@>=
  480. begin
  481.         change_file_name[1]:='/';
  482.         change_file_name[2]:='d';
  483.         change_file_name[3]:='e';
  484.         change_file_name[4]:='v';
  485.         change_file_name[5]:='/';
  486.         change_file_name[6]:='n';
  487.         change_file_name[7]:='u';
  488.         change_file_name[8]:='l';
  489.         change_file_name[9]:='l';
  490.         change_file_name[10]:=' ';
  491. end
  492.  
  493. @
  494.  
  495. @<Set up plain style file@>=
  496. begin
  497.         style_file_name[1]:='p';
  498.         style_file_name[2]:='l';
  499.         style_file_name[3]:='a';
  500.         style_file_name[4]:='i';
  501.         style_file_name[5]:='n';
  502.         style_file_name[6]:='.';
  503.         style_file_name[7]:='m';
  504.         style_file_name[8]:='f';
  505.         style_file_name[9]:='t';
  506.         style_file_name[10]:=' ';
  507. end
  508.  
  509. @
  510.  
  511. @<Handle flag...@>=
  512. begin
  513. i:=2;
  514. while (fname[i]<>' ') and (i<=PATH_MAX-5) do begin
  515.         if fname[i]='c' then begin found_change:=false;
  516.                 if which_file_next <> 's' then which_file_next := 'c'
  517.                 end
  518.         else if fname[i]='s' then begin found_style:=false;
  519.                   if which_file_next <> 'c' then which_file_next := 's'
  520.                   end
  521.             else print_nl('Invalid flag ',xchr[xord[fname[i]]], '.');
  522.         incr(i);
  523.         end;
  524. end
  525.  
  526. @
  527.  
  528. @<Print usage error message and quit@>=
  529. begin
  530. print_ln('Usage: mft file[.mf] [-cs] [change[.ch]] [style[.mft]].');
  531. uexit(1);
  532. end
  533. @z
  534.