version 1.3, 2009/02/23 07:09:13 |
version 1.6, 2009/02/23 15:19:47 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
|
#ifdef __linux__ |
|
#include <time.h> |
|
#endif |
|
|
#include "mmain.h" |
#include "mmain.h" |
#include "term.h" |
#include "term.h" |
|
|
Line 45 static void pword(struct termp *, const char *, siz |
|
Line 49 static void pword(struct termp *, const char *, siz |
|
static void pescape(struct termp *, |
static void pescape(struct termp *, |
const char *, size_t *, size_t); |
const char *, size_t *, size_t); |
static void chara(struct termp *, char); |
static void chara(struct termp *, char); |
|
static void stringa(struct termp *, const char *); |
static void style(struct termp *, enum termstyle); |
static void style(struct termp *, enum termstyle); |
|
|
#ifdef __linux__ |
#ifdef __linux__ |
Line 60 main(int argc, char *argv[]) |
|
Line 65 main(int argc, char *argv[]) |
|
const struct mdoc *mdoc; |
const struct mdoc *mdoc; |
struct termp termp; |
struct termp termp; |
|
|
extern int optreset; |
|
extern int optind; |
|
|
|
p = mmain_alloc(); |
p = mmain_alloc(); |
|
|
if ( ! mmain_getopt(p, argc, argv, NULL, NULL, NULL, NULL)) |
if ( ! mmain_getopt(p, argc, argv, NULL, NULL, NULL, NULL)) |
Line 165 flushln(struct termp *p) |
|
Line 167 flushln(struct termp *p) |
|
for (j = 0; j < p->offset; j++) |
for (j = 0; j < p->offset; j++) |
putchar(' '); |
putchar(' '); |
vis = 0; |
vis = 0; |
} else if (vis + vsz >= maxvis) { |
} else if (vis + vsz >= maxvis) |
/* FIXME */ |
/* FIXME */ |
errx(1, "word breaks right margin"); |
errx(1, "word breaks right margin"); |
} |
|
|
|
/* |
/* |
* Write out the word and a trailing space. Omit the |
* Write out the word and a trailing space. Omit the |
Line 231 vspace(struct termp *p) |
|
Line 232 vspace(struct termp *p) |
|
|
|
|
|
static void |
static void |
|
stringa(struct termp *p, const char *s) |
|
{ |
|
|
|
/* XXX - speed up if not passing to chara. */ |
|
for ( ; *s; s++) |
|
chara(p, *s); |
|
} |
|
|
|
|
|
static void |
chara(struct termp *p, char c) |
chara(struct termp *p, char c) |
{ |
{ |
|
|
Line 284 pescape(struct termp *p, const char *word, size_t *i, |
|
Line 295 pescape(struct termp *p, const char *word, size_t *i, |
|
chara(p, ']'); |
chara(p, ']'); |
else if ('l' == word[*i] && 'B' == word[*i + 1]) |
else if ('l' == word[*i] && 'B' == word[*i + 1]) |
chara(p, '['); |
chara(p, '['); |
|
else if ('<' == word[*i] && '-' == word[*i + 1]) |
|
stringa(p, "<-"); |
|
else if ('-' == word[*i] && '>' == word[*i + 1]) |
|
stringa(p, "->"); |
|
|
(*i)++; |
(*i)++; |
return; |
return; |