aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example.t1
-rw-r--r--fref.lex16
2 files changed, 9 insertions, 8 deletions
diff --git a/example.t b/example.t
index 02f925c..e651a7d 100644
--- a/example.t
+++ b/example.t
@@ -1,5 +1,6 @@
.\" $ export LC_ALL=en_US.UTF-8
.\" $ ./fref <example.t | troff -ms | dpost | ps2pdf - >example.pdf
+.\" % fref
.SH
References
.XP
diff --git a/fref.lex b/fref.lex
index 6155f3a..b52cce5 100644
--- a/fref.lex
+++ b/fref.lex
@@ -57,8 +57,8 @@
/* Fields of current entry. */
struct entry {
- int a; /* Number of authors. */
char au[MAXFIELD][MAXFIELD]; /* Authors. */
+ int a; /* Number of authors. */
#define DO(s,n,m) char n[MAXFIELD];
FOR_FIELDS
#undef DO
@@ -69,13 +69,13 @@
char *name; /* Program name. */
char *lang; /* Main language (-l). */
- int line; /* Line at which entry begins. */
- int lines; /* Total number of lines. */
- int punct; /* Was punctuation printed? */
struct trans *len; /* English strings. */
struct trans *lru; /* Russian strings. */
struct trans *lsv; /* Swedish strings. */
struct trans *tglob; /* Global (default) strings. */
+ unsigned int line; /* Line at which entry begins. */
+ unsigned int lines; /* Total number of lines. */
+ unsigned int punct; /* Was punctuation printed? */
%%
\n lines++; ECHO;
@@ -158,6 +158,8 @@ entry()
int i;
struct trans *t;
+ #define C(a,b) (punct ? b : a)
+
/* Get translation strings. */
t = *e.lc ? gettrans(e.lc) : tglob;
*e.lc = 0;
@@ -186,13 +188,11 @@ entry()
}
/* Print volume. */
- pf(", *%", punct ? t->Vo : t->vo, e.vo);
+ pf(",\n*%", C(t->vo,t->Vo), e.vo);
/* Print pages, converting hyphens to en dashes. */
if(*e.pg){
- pf(", *", strpbrk(e.pg, ",-") ?
- (punct ? t->Pp :t->pp)
- : (punct ? t->P : t->p));
+ pf(",\n*", strpbrk(e.pg, ",-") ? C(t->pp,t->Pp) : C(t->p,t->P));
for(i = 0; i < strlen(e.pg); i++){
if(e.pg[i] == '-') putchar('\\');
putchar(e.pg[i]);