4 * Copyright (C) 2012-2014 Ali Gholami Rudi <ali at rudi dot ir>
6 * This program is released under the Modified BSD license.
14 void errmsg(char *fmt
, ...)
18 vfprintf(stderr
, fmt
, ap
);
22 void errdie(char *msg
)
29 "Usage: neatroff [options] input\n\n"
31 " -mx \tinclude macro x\n"
32 " -C \tenable compatibility mode\n"
33 " -Tdev \tset output device\n"
34 " -Fdir \tset font directory (" TROFFFDIR
")\n"
35 " -Mdir \tset macro directory (" TROFFMDIR
")\n";
37 int main(int argc
, char **argv
)
39 char fontdir
[PATHLEN
] = TROFFFDIR
;
40 char macrodir
[PATHLEN
] = TROFFMDIR
;
41 char dev
[PATHLEN
] = "utf";
45 for (i
= 1; i
< argc
; i
++) {
46 if (argv
[i
][0] != '-' || !argv
[i
][1])
53 sprintf(path
, "%s/tmac.%s", macrodir
, argv
[i
] + 2);
57 strcpy(fontdir
, argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
60 strcpy(macrodir
, argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
63 strcpy(dev
, argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
70 if (dev_open(fontdir
, dev
)) {
71 fprintf(stderr
, "neatroff: cannot open device %s\n", dev
);
77 in_queue(NULL
); /* reading from standard input */
79 in_queue(!strcmp("-", argv
[i
]) ? NULL
: argv
[i
]);
80 str_set(map(".P"), macrodir
);