« Ce mariage vous convient-il toujours, madame ?
— Monsieur Fogg, répondit Mrs. Aouda, c'est à moi de vous faire cette question. Vous étiez ruiné, vous voici riche…
— Pardonnez-moi, madame, cette fortune vous appartient. Si vous n'aviez pas eu la pensée de ce mariage, mon domestique ne serait pas allé chez le révérend Samuel Wilson, je n'aurais pas été averti de mon erreur, et…
— Cher monsieur Fogg…, dit la jeune femme.
— Chère Aouda… », répondit Phileas Fogg.
On comprend bien que le mariage se fit quarante-huit heures plus tard, et Passepartout, superbe, resplendissant, éblouissant, y figura comme témoin de la jeune femme. Ne l'avait-il pas sauvée, et ne lui devait-on pas cet honneur ?
Seulement, le lendemain, dès l'aube, Passepartout frappait avec fracas à la porte de son maître.
La porte s'ouvrit, et l'impassible gentleman parut.
« Qu'y a-t-il, Passepartout ?
— Ce qu'il y a, monsieur ! Il y a que je viens d'apprendre à l'instant…
— Quoi donc ?
— Que nous pouvions faire le tour du monde en soixante-dix-huit jours seulement.
— Sans doute, répondit Mr. Fogg, en ne traversant pas l'Inde. Mais si je n'avais pas traversé l'Inde, je n'aurais pas sauvé Mrs. Aouda, elle ne serait pas ma femme, et… »
Et Mr. Fogg ferma tranquillement la porte.
Ainsi donc Phileas Fogg avait gagné son pari. Il avait accompli en quatre-vingts jours ce voyage autour du monde ! Il avait employé pour ce faire tous les moyens de transport, paquebots, railways, voitures, yachts, bâtiments de commerce, traîneaux, éléphant. L'excentrique gentleman avait déployé dans cette affaire ses merveilleuses qualités de sang-froid et d'exactitude. Mais après ? Qu'avait-il gagné à ce déplacement ? Qu'avait-il rapporté de ce voyage ?
Rien, dira-t-on ? Rien, soit, si ce n'est une charmante femme, qui — quelque invraisemblable que cela puisse paraître — le rendit le plus heureux des hommes !
En vérité, ne ferait-on pas, pour moins que cela, le Tour du Monde ?
—————————— TABLE DES MATIÈRES
Chapitres
I. Dans lequel Phileas Fogg et Passepartout s'acceptent réciproquement, l'un comme maître, l'autre comme domestique
II. Où Passepartout est convaincu qu'il a enfin
trouvé son idéal
III. Où s'engage une conversation qui pourra
coûter cher à Phileas Fogg
IV. Dans lequel Phileas Fogg stupéfie
Passepartout, son domestique
V. Dans lequel une nouvelle valeur apparaît sur la
place de Londres
VI. Dans lequel l'agent Fix montre une impatience
bien légitime
VII. Qui témoigne une fois de plus de l'inutilité
des passeports en matière de police
VIII. Dans lequel Passepartout parle un peu plus
peut-être qu'il ne conviendrait
IX. Où la mer Rouge et la mer des Indes se
montrent propices aux desseins de Phileas Fogg
X. Où Passepartout est trop heureux d'en être
quitte en perdant sa chaussure
XI. Où Phileas Fogg achète une monture à un prix
fabuleux
XII. Où Phileas Fogg et ses compagnons s'aventurent à travers les forêts de l'Inde, et ce qui s'ensuit
XIII. Dans lequel Passepartout prouve une fois de plus que la fortune sourit aux audacieux
XIV. Dans lequel Phileas Fogg descend toute l'admirable vallée du Gange sans même songer à la voir
XV. Où le sac aux bank-notes s'allège encore de
quelques milliers de livres
XVI. Où Fix n'a pas l'air de connaître du tout les
choses dont on lui parle
XVII. Où il est question de choses et d'autres
pendant la traversée de Singapore à Hong-Kong
XVIII. Dans lequel Phileas Fogg, Passepartout,
Fix, chacun de son côté, va à ses affaires
XIX. Où Passepartout prend un trop vif intérêt à
son maître, et ce qui s'ensuit
XX. Dans lequel Fix entre directement en relation
avec Phileas Fogg
XXI. Où le patron de la Tankardère risque fort
de perdre une prime de deux cents livres
XXII. Où Passepartout voit bien que, même aux antipodes, il est prudent d'avoir quelque argent dans sa poche
XXIII. Dans lequel le nez de Passepartout
s'allonge démesurément
XXIV. Pendant lequel s'accomplit la traversée de
l'océan Pacifique
XXV. Où l'on donne un léger aperçu de San
Francisco, un jour de meeting
XXVI. Dans lequel on prend le train express du
chemin de fer du Pacifique
XXVII. Dans lequel Passepartout suit, avec une vitesse de vingt milles à l'heure, un cours d'histoire mormone
XXVIII. Dans lequel Passepartout ne put parvenir à faire entendre le langage de la raison
XXIX. Où il sera fait le récit d'incidents divers qui ne se rencontrent que sur les rails-roads de l'Union
XXX. Dans lequel Phileas Fogg fait tout simplement
son devoir
XXXI. Dans lequel l'inspecteur Fix prend très
sérieusement les intérêts de Phileas Fogg
XXXII. Dans lequel Phileas Fogg engage une lutte
directe contre la mauvaise chance
XXXIII. Où Phileas Fogg se montre à la hauteur des
circonstances
XXXIV. Qui procure à Passepartout l'occasion de
faire un jeu de mots atroce, mais peut-être
inédit
XXXV. Dans lequel Passepartout ne se fait pas
répéter deux fois l'ordre que son maître lui a
donné
XXXVI. Dans lequel Phileas Fogg fait de nouveau
prime sur le marché
XXXVII. Dans lequel il est prouvé que Phileas Fogg n'a rien gagné à faire ce tour du monde, si ce n'est le bonheur
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
/*
Encode an ISO 8859/1 Etext into LaTeX or HTML
Rules for writing Etexts compatible with this formatting program
are included in the Etext with which this program is supplied.
Designed and implemented by John Walker (kelvin@fourmilab.ch) in
December of 1996.
This program is in the public domain and may be used and modified
in any manner without restrictions.
Warning: this program and the corresponding specifications for writing Etexts which are both human readable and suitable for machine typesetting are in a state of rapid evolution and can be expected to change as additional Etexts are prepared in this form. Since future versions may or may not be compatible, Etexts which use this program or programs derived from it should *include* the source for the translator program to guarantee compatibility.
*/
#define VERSION "2.0" #define REVDATE "13.12.96"
#include <stdio.h> #include <ctype.h>
#define EOS '\0' #define FormatWidth 70 /* Format width of original text */ #define QuoteIndent 4 /* Indentation for block quotes */ #define SectionSep \ "<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n" #define PUNCTUATION "?!:;»" /* Punctuation set after a space in French text processed with the -f option */
#define abs(x) (((x) < 0) ? (-(x)) : (x))
static int italics = 0, /* Currently in italics mode ? */
quoth = 0, /* Quote parity */
saith = 0, /* In block quotation ? */
inpara = 0, /* In paragraph ? */
inmath = 0, /* Currently in math mode ? */
author = 0, /* Looking for author ? */
firstchap = 0, /* Outputting first chapter break */
chapout = 0, /* Chapter title found */
footcount = 0, /* Footnote number */
infoot = 0, /* In footnote ? */
textstate = 0, /* Text state: 0 = prologue,
1 = text,
2 = appendices. */
nonbreak = 0, /* Use nonbreaking spaces for French punctuation */
html = 0; /* Generate HTML ? */
static FILE *foot = NULL; /* Footnote file */
/* The following table is indexed by ISO codes 161 to 255, and gives
the LaTeX rendering of the ISO character. */
static char *texform[] = {
"!`", "\\makebox{\\rm\\rlap/c}", "\\pounds", "$\\otimes$",
"\\makebox{\\rm\\rlap Y{\\hspace*{0.07em}\\scriptsize =}}", "$|$",
"{\\S}", "\\\"{}", "{\\copyright}", "\\b{a}",
"{$\\ll$}",
"$\\neg$", "$-$",
"{\\ooalign{\\hfil\\raise.07ex\\hbox{\\sc r}\\hfil\\crcr\\mathhexbox20D}}",
"-", "$^{\\circ}$", "$\\pm$", "$^2$", "$^3$", "\\'{}", "$\\mu$",
"{\\P}", "$\\cdot$", "\\c{}", "$^1$", "\\b{o}",
"{$\\gg$}",
"{\\small $1/4$}", "{\\small $1/2$}", "{\\small $3/4$}", "?`",
"\\`{A}", "\\'{A}", "\\^{A}", "\\~{A}", "\\\"{A}", "{\\AA}",
"{\\AE}", "\\c{C}", "\\`{E}", "\\'{E}", "\\^{E}", "\\\"{E}",
"\\`{I}", "\\'{I}", "\\^{I}", "\\\"{I}", "Eth", "\\~{N}",
"\\`{O}", "\\'{O}", "\\^{O}", "\\~{O}", "\\\"{O}", "$\\times$",
"{\\O}", "\\`{U}", "\\'{U}", "\\^{U}", "\\\"{U}", "\\'{Y}",
"Thorn", "{\\ss}", "\\`{a}", "\\'{a}", "\\^{a}", "\\~{a}",
"\\\"{a}", "{\\aa}", "{\\ae}", "\\c{c}", "\\`{e}", "\\'{e}",
"\\^{e}", "\\\"{e}", "\\`{\\i}", "\\'{\\i}", "\\^{\\i}",
"\\\"{\\i}", "eth", "\\~{n}", "\\`{o}", "\\'{o}", "\\^{o}",
"\\~{o}", "\\\"{o}", "$\\div$", "{\\o}", "\\`{u}", "\\'{u}",
"\\^{u}", "\\\"{u}", "\\'{y}", "thorn", "\\\"{y}"
};
/* GIF navigation button images for HTML files. */
static unsigned char d_foot[] = {
71,73,70,56,55,97,15,0,15,0,241,0,0,191,191,191,231,231,231,111,111,111,
0,0,0,44,0,0,0,0,15,0,15,0,0,2,40,132,15,129,139,225,188,156,132,102,
78,118,211,107,251,228,204,41,224,34,148,64,41,64,232,177,34,45,107,26,
175,107,206,36,154,82,114,172,203,80,1,0,59
};
static unsigned char d_next[] = {
71,73,70,56,55,97,32,0,32,0,231,0,0,230,230,250,190,190,190,47,79,79,
255,255,255,112,128,144,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,0,
0,0,32,0,32,0,64,8,222,0,1,4,32,64,176,160,193,131,8,19,18,24,24,0,192,
128,0,16,35,74,44,80,64,162,69,137,4,5,44,116,104,145,162,199,143,32,
43,98,36,160,177,225,195,139,17,41,162,188,152,113,227,128,147,43,99,
90,36,89,146,227,196,144,31,99,182,52,217,17,167,71,157,36,55,66,92,40,
19,168,70,1,53,7,0,88,202,180,169,211,167,77,135,186,44,74,85,106,82,
153,57,101,238,180,153,210,103,214,153,65,121,222,244,170,146,101,88,
174,40,191,174,220,42,176,170,214,157,3,145,42,156,107,16,169,221,134,
110,243,50,124,201,183,175,223,191,125,151,14,189,170,23,101,70,194,43,
69,82,221,10,51,109,217,183,136,33,146,133,60,117,172,215,181,103,27,
7,32,171,214,106,229,174,156,21,71,100,220,115,178,225,204,88,59,131,
141,124,241,103,81,210,49,69,83,110,216,182,240,234,146,82,233,234,62,
44,96,176,221,223,192,131,11,183,27,16,0,59
};
static unsigned char d_next_gr[] = {
71,73,70,56,55,97,32,0,32,0,231,0,0,40,72,72,216,216,216,184,184,184,
224,224,248,255,255,255,112,128,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
0,0,0,0,32,0,32,0,64,8,222,0,7,8,40,64,176,160,193,131,8,19,22,24,40,
96,0,1,1,16,35,74,12,16,64,162,69,137,4,1,44,116,104,145,162,199,143,
32,43,98,44,160,177,225,195,139,17,41,162,188,152,113,35,129,147,43,99,
90,36,89,146,227,196,144,31,99,182,52,217,17,167,71,157,36,55,66,92,40,
19,168,70,0,53,9,12,88,202,180,169,211,167,77,135,186,44,74,85,106,82,
153,57,101,238,180,153,210,103,214,153,65,121,222,244,170,146,101,88,
174,40,191,174,220,42,176,170,214,157,3,145,42,156,107,16,169,221,134,
110,243,50,124,201,183,175,223,191,125,151,14,189,170,23,101,70,194,43,
69,82,221,10,51,109,217,183,136,33,146,133,60,117,172,215,181,103,27,
11,32,171,214,106,229,174,156,21,71,100,220,115,178,225,204,88,59,131,
141,124,241,103,81,210,49,69,83,110,216,182,240,234,146,82,233,234,62,
12,96,176,221,223,192,131,11,183,27,16,0,59
};
static unsigned char d_prev[] = {
71,73,70,56,55,97,32,0,32,0,231,0,0,230,230,250,190,190,190,47,79,79,
255,255,255,112,128,144,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,0,
0,0,32,0,32,0,64,8,223,0,1,4,32,64,176,160,193,131,8,19,18,24,24,0,192,
128,0,16,35,74,132,88,160,192,196,139,4,5,44,116,40,177,162,199,143,32,
45,78,204,184,241,225,197,137,21,79,74,36,217,112,128,73,149,48,71,10,
208,216,82,101,72,144,24,9,208,228,120,242,230,199,156,59,33,46,140,9,
147,228,204,146,0,146,42,93,202,180,233,82,161,37,137,74,133,186,243,
101,79,143,68,89,242,236,232,243,231,72,157,81,81,118,197,250,181,106,
76,175,69,193,54,20,56,53,102,65,154,3,143,42,156,251,118,230,204,134,
109,243,50,116,201,183,175,223,191,125,147,10,53,171,247,100,70,194,68,
69,166,69,108,51,165,91,181,91,47,142,5,26,86,236,228,178,149,41,142,
37,187,18,178,213,0,155,57,71,212,250,89,243,229,206,140,45,59,94,156,
249,170,98,149,164,167,190,54,12,153,109,225,178,112,7,210,221,93,87,
192,96,187,192,131,11,31,110,55,32,0,59
};
static unsigned char d_prev_gr[] = {
71,73,70,56,55,97,32,0,32,0,231,0,0,40,72,72,216,216,216,184,184,184,
224,224,248,255,255,255,112,128,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,
0,0,0,0,32,0,32,0,64,8,223,0,7,8,40,64,176,160,193,131,8,19,22,24,40,
96,0,1,1,16,35,74,132,24,32,192,196,139,4,1,44,116,40,177,162,199,143,
32,45,78,204,184,241,225,197,137,21,79,74,36,217,144,128,73,149,48,71,
2,208,216,82,101,72,144,24,11,208,228,120,242,230,199,156,59,33,46,140,
9,147,228,204,146,3,146,42,93,202,180,233,82,161,37,137,74,133,186,243,
101,79,143,68,89,242,236,232,243,231,72,157,81,81,118,197,250,181,106,
76,175,69,193,54,20,56,53,102,65,154,3,143,42,156,251,118,230,204,134,
109,243,50,116,201,183,175,223,191,125,147,10,53,171,247,100,70,194,68,
69,166,69,108,51,165,91,181,91,47,142,5,26,86,236,228,178,149,41,142,
37,187,18,178,85,1,155,57,71,212,250,89,243,229,206,140,45,59,94,156,
249,170,98,149,164,167,190,54,12,153,109,225,178,112,7,210,221,93,23,
192,96,187,192,131,11,31,110,55,32,0,59
};
static unsigned char d_up[] = {
71,73,70,56,55,97,32,0,32,0,231,0,0,230,230,250,190,190,190,47,79,79,
255,255,255,112,128,144,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,0,
0,0,32,0,32,0,64,8,215,0,1,4,32,64,176,160,193,131,8,19,18,24,24,0,192,
128,0,16,35,74,156,72,81,34,65,1,11,29,78,44,192,177,163,199,143,19,47,
102,124,88,177,164,73,145,13,7,144,52,201,50,34,1,1,24,83,154,252,200,
241,228,203,145,21,105,122,44,137,82,32,195,150,60,111,194,28,9,160,168,
209,163,72,147,30,133,72,80,38,80,160,61,87,150,236,216,50,106,78,157,
84,41,90,133,136,181,107,77,166,55,157,110,236,26,52,102,209,167,85,81,
14,28,170,176,109,65,152,112,27,162,157,203,80,165,221,187,120,243,222,
61,187,22,39,221,138,23,205,74,253,107,49,172,198,150,5,160,26,30,60,
54,107,89,191,20,201,2,94,28,217,235,215,194,130,37,90,166,137,25,178,
102,201,90,41,87,198,250,88,236,103,210,147,51,19,14,109,214,231,106,
151,47,99,130,117,75,59,176,0,166,112,115,235,222,205,59,119,64,0,59
};
/* OUTGIF — Create GIF navigation buttons for HTML trees. */
static void outgif(basename, button, source, length)
char *basename, *button;
unsigned char *source;
int length;
{
char s[256];
FILE *f;
sprintf(s, "%s/%s.gif", basename, button);
f = fopen(s, "wb"); /* "b" is for binary mode on brain-dead
PCs. Shouldn't do any harm on reasonable
UNIX boxes. */
fwrite(source, 1, length, f);
fclose(f);
}
/* TRIM — Trim trailing white space and delete any carriage
return characters which might have crept into the
text. This allows us to process input in a variety
of end of line conventions (Unix, MS-DOS, VMS). */
static void trim(lp)
unsigned char *lp;
{
unsigned char *ap = lp;
while (*ap) {
if (*ap == '\r') {
unsigned char *ep = ap;
do {
*ep = ep[1];
ep++;
} while (*ep);
}
ap++;
}
/* Trim any trailing spaces. */
while (isspace(lp[strlen(lp) - 2])) {
lp[strlen(lp) - 2] = '\n';
lp[strlen(lp) - 1] = EOS;
}
}
/* PROTEXT — Output text with character-level transformations. */
static void protext(lp, tout, basename)
unsigned char *lp;
FILE *tout;
char *basename;
{
if (html) {
#define out (infoot ? foot : tout) int c;
/* Now process the input file character by character and translate each character, if required, emitting the results to the output stream. */
while ((c = *lp++) != EOS) {
/* It's a control character. Emit as ^<letter> unless it is considered as white space (for example, carriage return and line feed), in which case it's sent directly to the output. */
if (c < ' ') {
if (isspace(c)) {
fputc(c, out);
} else {
fputs("<KBD>^", out);
fputc(c + '@', out);
fputs("</KBD>", out);
}
/* ISO graphic character. */
} else if (c > 160) {
fputc(c, out);
if (nonbreak && c == '«' && *lp != 0 && isspace(*lp)) {
fputs(" ", out);
lp++;
}
/* Normal ASCII 7 bit graphic character. */
} if (c >= ' ' && c <= '~') {
/* Italic switch character */
if (!inmath && c == '_') {
italics = !italics;
if (italics) {
fputs("<i>", out);
} else {
fputs("</i>", out);
}
/* Math mode start and end sequences. */
} else if (c == '\\' && (*lp == '(' || *lp == ')')) { fputc(c, out); inmath = *lp == '(';
/* Start footnote */
} else if (!inmath && (c == '[' || (c == ' ' && *lp == '[') ||
(c == ' ' && *lp == ' ' && lp[1] == '['))) {
if (foot == NULL) {
char s[256];
sprintf(s, "%s/%s_foot.html", basename, basename);
foot = fopen(s, "w");
fputs("<HTML>\n<HEAD>\n<TITLE>Footnotes</TITLE>\n</HEAD>\n<BODY>\n<P>\n", foot);
}
fprintf(out, "<A HREF=\"%s_foot.html#F%d\">", basename, ++footcount);
fputs("<IMG ALIGN=MIDDLE SRC=\"foot.gif\" HEIGHT=15 WIDTH=15 ALT=\"¹\"></A>", out);
infoot++;
if (c == ' ') {
if (*lp == ' ') {
lp++;
}
lp++;
}
fprintf(foot, "<A NAME=F%d>", footcount);
/* End footnote */
} else if (!inmath && infoot && c == ']') { int i;
fputs("</A>", foot); fputs("\n<PRE>", foot); for (i = 0; i < 30; i++) { fputs("<P>\n", foot); } fputs("</PRE>\n", foot); infoot—; if (infoot < 0) { infoot = 0; }
/* ASCII characters requiring verbatim handling */
} else if (c == '<') {
fputs("<", out);
} else if (c == '>') {
fputs(">", out);
} else if (c == '&') {
fputs("&", out);
} else if (c == '"') {
fputs(""", out); } else if (c == '<') {
fputs("<", out);
/* Try to convert dumb ASCII quotes to open and close quotes. */
} else if (!inmath && c == '"') { fputs(quoth ? "''" : "``", out); quoth = !quoth;
/* Normal character */
} else {
if (nonbreak && isspace(c) && *lp != 0 &&
strchr(PUNCTUATION, *lp) != NULL) {
fputs(" ", out);
} else {
fputc(c, out);
}
}
}
/* Note that other characters, specifically those in the
range from 127 through 160, get dropped. */
}
#undef out
} else {
#define out tout int c;
/* Now process the input file character by character and translate each character, if required, emitting the results to the output stream. */
while ((c = *lp++) != EOS) {
/* It's a control character. Emit as ^<letter> unless it is considered as white space (for example, carriage return and line feed), in which case it's sent directly to the output. */
if (c < ' ') {
if (isspace(c)) {
putc(c, out);
} else {
fputs("\\verb+^", out);
putc(c + '@', out);
putc('+', out);
}
/* ISO graphic character. */
} else if (c > 160) {
fputs(texform[c - 161], out);
if (nonbreak && c == '«' && *lp != 0 && isspace(*lp)) {
putc('~', out);
lp++;
}
/* Normal ASCII 7 bit graphic character. */
} if (c >= ' ' && c <= '~') {
/* Italic switch character */
if (!inmath && c == '_') {
italics = !italics;
if (italics) {
fputs("{\\it ", out);
} else {
fputs("}", out);
}
/* Math mode start and end sequences. */
} else if (c == '\\' && (*lp == '(' || *lp == ')')) { fputc(c, out); inmath = *lp == '(';
/* Start footnote */
} else if (!inmath && (c == '[' || (c == ' ' && *lp == '[') ||
(c == ' ' && *lp == ' ' && lp[1] == '['))) {
fputs("\\footnote{", out);
if (c == ' ') {
if (*lp == ' ') {
lp++;
}
lp++;
}
/* End footnote */
} else if (!inmath && c == ']') { fputs("}", out);
/* Dash */
} else if (c == '-' && *lp == '-') { /* Turn "—" into "—-" for M-dash. */ fputs("—-", out); lp += 1;
/* Ellipsis */
} else if (c == '.' && *lp == '.' && lp[1] == '.') {
fputs("\\ldots", out);
if (lp[2] == ' ') {
fputs(" ", out);
} else {
fputs("\\ ", out);
}
lp += 2;
/* ASCII characters requiring verbatim handling */
} else if (c == '~') {
fputs("\\verb+", out); fputc(c, out); fputc('+', out);
} else if (!inmath && c == '^') {
fputs("\\verb+", out); fputc(c, out); fputc('+', out);
/* ASCII characters requiring math-mode quoting. */
} else if (!inmath && strchr("|<>", c) != NULL) { fputc('$', out); fputc(c, out); fputc('$', out);
/* Try to convert dumb ASCII quotes to open and close quotes. */
} else if (!inmath && c == '"') { fputs(quoth ? "''" : "``", out); quoth = !quoth;
/* Normal character */
} else {
if (nonbreak && isspace(c) && *lp != 0 &&
strchr(PUNCTUATION, *lp) != NULL) {
putc('~', out);
} else {
/* Characters requiring protection against interpretation
as control sequences. */
if (strchr("$&%#", c) != NULL) {
putc('\\', out);
}
if (!inmath && strchr("{}", c) != NULL) {
putc('\\', out);
}
putc(c, out);
}
}
}
/* Note that other characters, specifically those in the
range from 127 through 160, get dropped. */
}
#undef out
}
}
/* ENDQUOTE — Terminate a block quotation when a non-conforming
line is encountered. */
static void endquote(out)
FILE *out;
{
if (html) {
if (saith) {
fputs("\n</blockquote>\n", out);
saith = 0;
}
} else {
if (saith) {
fputs("\n\\end{quote}\n", out);
saith = 0;
}
}
}
/* NAVAIDS — Create navigation panel buttons. */
static void navaids(basename, chapno, last, out)
char *basename;
int chapno, last;
FILE *out;
{
char s[256];
/* Previous chapter button. */
if (chapno > 1) {
sprintf(s, "<A HREF=\"%s_chap%d.html\">", basename, chapno - 1);
fputs(s, out);
fputs("<IMG ALIGN=MIDDLE SRC=\"prev.gif\" HEIGHT=32 WIDTH=32 ALT=\"Previous\"></A>\n", out);
} else {
fputs("<IMG ALIGN=MIDDLE SRC=\"prev_gr.gif\" HEIGHT=32 WIDTH=32 ALT=\"\">\n", out);
}
/* Up to table of contents button. */
sprintf(s, "<A HREF=\"%s.html\"> <IMG ALIGN=MIDDLE SRC=\"up.gif\" HEIGHT=32 WIDTH=32 ALT=\"Contents\"></A>\n",
basename);
fputs(s, out);
/* Next chapter button. */
if (!last) {
sprintf(s, "<A HREF=\"%s_chap%d.html\">", basename, chapno + 1);
fputs(s, out);
}
sprintf(s, "<IMG ALIGN=MIDDLE SRC=\"next%s.gif\" HEIGHT=32 WIDTH=32 ALT=\"%s\">",
last ? "_gr" : "", last ? "" : "Next");
fputs(s, out);
if (!last) {
fputs("</A>\n", out);
} else {
fputc('\n', out);
}
}
/* ENDCHAP — Standard end of chapter processing. */
static void endchap(basename, chapno, last, out)
char *basename;
int chapno, last;
FILE *out;
{
fputs("<HR>\n", out);
navaids(basename, chapno, last, out);
fputs("</BODY>\n", out);
fputs("</HTML>\n", out);
fclose(out);
}
/* Main program */
int main(argc, argv)
int argc; char *argv[];
{
int i, f = 0, peeked = 0, titling = 1,
chapno = 0, ctl, ttl = 0, atl = 0;
char *cp, opt;
FILE *in = stdin, *out = stdout, *chap = NULL;
unsigned char line[256], peek[256], basename[256], sbuf[256];
unsigned char titre[10][256], auteur[10][256], ctitle[10][256];
#define tstream ((chap == NULL) ? out : chap)
#define ostream ((chap == NULL) ? out : (infoot ? foot : chap))
for (i = 1; i < argc; i++) {
cp = argv[i];
if (*cp == '-') {
opt = *(++cp);
if (islower(opt))
opt = toupper(opt);
switch (opt) {
case 'F':
nonbreak = 1;
break;
case 'H':
if (f > 0) {
fprintf(stderr, "Must specify -h before any file name.\n");
return 2;
}
html = 1;
break;
case '?':
case 'U':
fprintf(stderr,"\nETSET — Typeset ISO 8859 Latin-1 Etext. Call");
fprintf(stderr,
"\n with etset [input [output]]");
fprintf(stderr,"\n");
fprintf(stderr,"\n Options:");
fprintf(stderr,"\n -f Use nonbreaking spaces for French punctuation");
fprintf(stderr,"\n -h Generate HTML");
fprintf(stderr,"\n");
fprintf(stderr,"\n");
return 0;
}
} else {
switch (f) {
case 0:
if ((in = fopen(cp, "r")) == NULL) {
fprintf(stderr, "Cannot open input file %s\n", cp);
return 2;
}
f++;
break;
case 1:
if (html) {
strcpy(basename, cp);
sprintf(line, "%s/%s.html", basename, basename);
if ((out = fopen(line, "w")) == NULL) {
fprintf(stderr, "Cannot open output file %s\n", line);
return 2;
}
} else {
if ((out = fopen(cp, "w")) == NULL) {
fprintf(stderr, "Cannot open output file %s\n", cp);
return 2;
}
}
f++;
break;
default:
fprintf(stderr, "Too many file names specified.\n");
}
}
}
if (html && f < 2) {
fprintf(stderr, "Must specify input and output file names for HTML.\n");
}
/* Output document header. */
if (html) {
outgif(basename, "foot", d_foot, sizeof d_foot);
outgif(basename, "next", d_next, sizeof d_next);
outgif(basename, "prev", d_prev, sizeof d_prev);
outgif(basename, "up", d_up, sizeof d_up);
outgif(basename, "next_gr", d_next_gr, sizeof d_next_gr);
outgif(basename, "prev_gr", d_prev_gr, sizeof d_prev_gr);
fprintf(out, "<!— ETSET version %s — %s. —>\n",
VERSION, REVDATE);
fputs("<HTML>\n", out);
fputs("<HEAD>\n", out);
fputs("<TITLE>\n", out);
} else {
fprintf(out, "%%\n%% ETSET version %s — %s.\n%%\n",
VERSION, REVDATE);
fputs("\\documentclass{report}\n", out);
fputs("\\date{}\n\\title{\n", out);
}
/* Line level file processing. */
for (;;) { unsigned char *lp = line; char *eline = NULL;
if (peeked) {
memcpy(line, peek, sizeof line);
peeked = 0;
} else {
if (fgets((char *) line, (sizeof line) - 1, in) == NULL) {
break;
}
trim(line);
}
/* Reset quote parity on paragraph breaks. */
if (line[0] == '\n' && (!html || textstate == 1)) {
quoth = inpara = 0;
if (html) {
fputs("<P>\n", ostream);
}
}
/* Check for section separator. */
if (strcmp(line, SectionSep) == 0) {
textstate++;
if (textstate == 1) {
continue; /* Ditch section separator */
} else if (textstate > 1) {
break;
}
}
if (textstate < 1) {
continue; /* Ignore prologue text */
}
/* Check for title separator. */
if (titling) { int cheddar = 1, chonk = 0; unsigned char *pp = lp;
/* Check for title separator */
while (*pp != EOS) {
if (!(isspace(*pp) || (*pp == '='))) {
cheddar = 0;
break;
}
if (*pp++ == '=') {
chonk++;
}
}
if (cheddar && chonk > 2) {
titling = 0;
author = 1;
if (html) {
fputs("</TITLE>\n<ADDRESS>\n", out);
} else {
fputs("}\n\\author{\n", out);
}
continue;
}
}
/* Heuristic justification for lines which begin with
white space. */
if (line[0] == ' ') {
int n = strlen(line) - 2, w;
unsigned char *ap = line + 1;
while (isspace(*ap)) {
ap++;
n—;
}
line[strlen(line) - 1] = EOS;
if (abs((w = ((FormatWidth - n) / 2) - (ap - lp))) < 3) {
/* It's centered: check for chapter separators. */
if (fgets((char *) peek, (sizeof peek) - 1, in) != NULL) { unsigned char *pp = peek; int cheddar = 1, chonk = 0;
peeked = 1;
trim(peek);
while (*pp != EOS) {
if (!(isspace(*pp) || (*pp == '-'))) {
cheddar = 0;
break;
}
if (*pp++ == '-') {
chonk++;
}
}
if (cheddar && chonk > 2) {
chapout = 0;
peeked = 0;
if (author) {
author = 0;
if (html) {
int n;
fputs("</ADDRESS>\n</HEAD>\n<BODY>\n", out);
if (ttl > 0) {
fputs("<H1>", out);
for (n = 0; n < ttl; n++) {
protext(titre[n], out, basename);
fputc('\n', out);
}
fputs("</H1>\n", out);
}
if (atl > 0) {
fputs("<H2>", out);
for (n = 0; n < atl; n++) {
protext(auteur[n], out, basename);
fputc('\n', out);
}
fputs("</H2>\n", out);
}
fputs("<UL>\n", out);
} else {
fputs("}\n\\begin{document}\n\\maketitle\n", out);
if (nonbreak) {
fputs("\\frenchspacing\n", out);
}
}
}
while (fgets((char *) peek, (sizeof peek) - 1, in) != NULL) { trim(peek); pp = peek; peek[strlen(peek) - 1] = EOS; while (*pp && isspace(*pp)) { pp++; } if (*pp == EOS) { break; } if (!chapout) { if (html) { if (chap != NULL) { endchap(basename, chapno, 0, chap); chap = NULL; } firstchap = 1; chapout = 1; ctl = 0; sprintf(line, "%s/%s_chap%d.html", basename, basename, ++chapno); chap = fopen(line, "w"); fputs("<HTML>\n<HEAD>\n<TITLE>", ostream); } else { if (!firstchap) { fputs("\\tableofcontents\n", out); } fputs("\\chapter{\n", out); firstchap = 1; chapout = 1; } } if (html) { strcpy(ctitle[ctl++], pp); protext(pp, ostream, basename); fputc('\n', ostream); } else { protext(pp, out, NULL); fputc('\n', out); } } if (firstchap && !chapout) { /* Untitled chapter after one or more titled ones */ if (html) { fputs("<HEAD>\n<TITLE> ", ostream); } else { fputs("\\chapter{", out); } chapout = 1; } if (chapout) { if (html) { int i;
fputs("</TITLE>\n</HEAD>\n<BODY>\n", ostream);
navaids(basename, chapno, 0, ostream);
sprintf(sbuf, "<HR>\n<H1><A NAME=Chapter%d>",
chapno);
fputs(sbuf, ostream);
for (i = 0; i < ctl; i++) {
protext(ctitle[i], ostream, basename);
fputc('\n', ostream);
}
fputs("</A></H1><P>\n", ostream);
/* Now make link to chapter from table of
contents. */
sprintf(sbuf, "<LI> <A HREF=\"%s_chap%d.html\">",
basename, chapno);
fputs(sbuf, out);
for (i = 0; i < ctl; i++) {
protext(ctitle[i], out, basename);
fputc('\n', out);
}
fputs("</A></LI>\n", out);
} else {
fputs("}\n", out);
}
}
continue;
}
}
if (!titling && !author) {
if (html) {
endquote(ostream);
fputs("\n<P ALIGN=CENTER>\n", ostream);
eline = "</P>\n";
} else {
endquote(out);
fputs("\n{\\centering ", out);
eline = "\\\\}\n";
}
}
} else {
int n;
/* Check for a block quote. */
for (n = 1; n < QuoteIndent; n++) {
if (line[n] != ' ') {
n = -1;
break;
}
}
if (n > 1 && !isspace(line[QuoteIndent])) {
if (!saith) {
if (html) {
fputs("<BLOCKQUOTE>\n", ostream);
} else {
fputs("\\begin{quote}\n", out);
}
saith = 1;
}
/* Ragged left or ragged right: determine which and
output appropriate command. */
} else if (!titling && !author) {
if (html) {
endquote(ostream);
} else {
endquote(out);
fputs(w < 0 ? "{\\raggedleft" : "{\\raggedright", out);
eline = "\\\\ }\n\n";
}
}
}
lp = ap - 1;
} else {
if (html) {
endquote(ostream);
} else {
endquote(out);
}
}
if (titling || author) {
unsigned char *ap = line;
int nonbs = 0;
while (*ap != EOS) {
if (!isspace(*ap)) {
nonbs = 1;
break;
}
ap++;
}
if (!nonbs) {
continue;
}
}
if (html) {
if (titling) {
strcpy(titre[ttl++], lp);
}
if (author) {
strcpy(auteur[atl++], lp);
continue;
}
protext(lp, tstream, basename);
if (eline) {
fputs(eline, tstream);
}
} else {
protext(lp, out, NULL);
if (titling || author) {
fputs("\\\\\n", out);
}
if (eline) {
fputs(eline, out);
}
}
}
/* Output document trailer. */
if (html) { fputs("</UL>\n", out); fputs("</BODY>\n", out); fputs("</HTML>\n", out);
if (chap != NULL) {
endchap(basename, chapno, 1, chap);
}
if (foot != NULL) {
fputs("</BODY>\n", foot);
fputs("</HTML>\n", foot);
fclose(foot);
}
} else {
fputs("\\end{document}\n", out);
}
fclose(out);
return 0;
}