1 /* built-in troff requests */
8 static int tr_nl
= 1; /* just read a newline */
9 static int tr_bm
= -1; /* blank line macro */
10 static int tr_sm
= -1; /* leading space macro */
11 char c_pc
[GNLEN
] = "%"; /* page number character */
12 int c_ec
= '\\'; /* escape character */
13 int c_cc
= '.'; /* control character */
14 int c_c2
= '\''; /* no-break control character */
16 /* skip everything until the end of line */
17 static void jmp_eol(void)
22 } while (c
>= 0 && c
!= '\n');
25 static void tr_vs(char **args
)
27 int vs
= args
[1] ? eval_re(args
[1], n_v
, 'p') : n_v0
;
32 static void tr_ls(char **args
)
34 int ls
= args
[1] ? eval_re(args
[1], n_L
, 0) : n_L0
;
39 static void tr_pl(char **args
)
41 int n
= eval_re(args
[1] ? args
[1] : "11i", n_p
, 'v');
45 static void tr_nr(char **args
)
51 num_set(id
, eval_re(args
[2], num_get(id
), 'u'));
52 num_setinc(id
, args
[3] ? eval(args
[3], 'u') : 0);
55 static void tr_rr(char **args
)
58 for (i
= 1; i
< NARGS
; i
++)
60 num_del(map(args
[i
]));
63 static void tr_af(char **args
)
66 num_setfmt(map(args
[1]), args
[2]);
69 static void tr_ds(char **args
)
71 str_set(map(args
[1]), args
[2] ? args
[2] : "");
74 static void tr_as(char **args
)
79 s1
= str_get(reg
) ? str_get(reg
) : "";
80 s2
= args
[2] ? args
[2] : "";
81 s
= xmalloc(strlen(s1
) + strlen(s2
) + 1);
88 static void tr_rm(char **args
)
91 for (i
= 1; i
< NARGS
; i
++)
96 static void tr_rn(char **args
)
100 str_rn(map(args
[1]), map(args
[2]));
103 static void tr_po(char **args
)
105 int po
= args
[1] ? eval_re(args
[1], n_o
, 'm') : n_o0
;
110 /* read a string argument of a macro */
111 static char *read_string(void)
118 while ((c
= cp_next()) == ' ')
120 empty
= c
<= 0 || c
== '\n';
123 while (c
> 0 && c
!= '\n') {
135 return sbuf_out(&sbuf
);
138 /* read a space separated macro argument; if two, read at most two characters */
139 static char *read_name(int two
)
145 while (c
== ' ' || c
== '\t' || c
== c_ni
)
147 while (c
> 0 && c
!= ' ' && c
!= '\t' && c
!= '\n' && (!two
|| i
< 2)) {
156 return sbuf_out(&sbuf
);
159 static void macrobody(struct sbuf
*sbuf
, char *end
)
166 while ((c
= cp_next()) >= 0) {
171 if ((c
= cp_next()) != c_cc
) {
175 req
= read_name(n_cp
);
176 if (!strcmp(end
, req
)) {
182 sbuf_add(sbuf
, c_cc
);
183 sbuf_append(sbuf
, req
);
193 static void tr_de(char **args
)
201 if (args
[0][1] == 'a' && args
[0][2] == 'm' && str_get(id
))
202 sbuf_append(&sbuf
, str_get(id
));
203 macrobody(&sbuf
, args
[2] ? args
[2] : ".");
204 str_set(id
, sbuf_buf(&sbuf
));
208 static void tr_ig(char **args
)
210 macrobody(NULL
, args
[1] ? args
[1] : ".");
213 /* read into sbuf until stop; if stop is NULL, stop at whitespace */
214 static int read_until(struct sbuf
*sbuf
, char *stop
,
215 int (*next
)(void), void (*back
)(int))
217 char cs
[GNLEN
], cs2
[GNLEN
];
219 while ((c
= next()) >= 0) {
225 if (!stop
&& (c
== ' ' || c
== '\t'))
227 charnext(cs
, next
, back
);
228 if (stop
&& !strcmp(stop
, cs
))
230 charnext_str(cs2
, cs
);
231 sbuf_append(sbuf
, cs2
);
236 /* evaluate .if strcmp (i.e. 'str'str') */
237 static int if_strcmp(int (*next
)(void), void (*back
)(int))
242 charnext(delim
, next
, back
);
245 read_until(&s1
, delim
, next
, back
);
246 read_until(&s2
, delim
, next
, back
);
248 ret
= !strcmp(sbuf_buf(&s1
), sbuf_buf(&s2
));
254 /* evaluate .if condition letters */
255 static int if_cond(int (*next
)(void), void (*back
)(int))
270 /* evaluate .if condition */
271 static int if_eval(int (*next
)(void), void (*back
)(int))
276 read_until(&sbuf
, NULL
, next
, back
);
277 ret
= eval(sbuf_buf(&sbuf
), '\0') > 0;
282 static int eval_if(int (*next
)(void), void (*back
)(int))
289 } while (c
== ' ' || c
== '\t');
295 if (strchr("oetn", c
)) {
296 ret
= if_cond(next
, back
);
297 } else if (!isdigit(c
) && !strchr("-+*/%<=>&:.|()", c
)) {
298 ret
= if_strcmp(next
, back
);
300 ret
= if_eval(next
, back
);
305 static int ie_cond
[NIES
]; /* .ie condition stack */
308 static void tr_if(char **args
)
310 int c
= eval_if(cp_next
, cp_back
);
311 if (args
[0][1] == 'i' && args
[0][2] == 'e') /* .ie command */
313 ie_cond
[ie_depth
++] = c
;
317 static void tr_el(char **args
)
319 cp_blk(ie_depth
> 0 ? ie_cond
[--ie_depth
] : 1);
322 static void tr_na(char **args
)
327 static int adjmode(int c
, int def
)
345 static void tr_ad(char **args
)
351 if (isdigit((unsigned char) s
[0]))
354 n_j
= s
[0] == 'p' ? AD_P
| adjmode(s
[1], AD_B
) : adjmode(s
[0], n_j
);
357 static void tr_tm(char **args
)
359 fprintf(stderr
, "%s\n", args
[1] ? args
[1] : "");
362 static void tr_so(char **args
)
368 static void tr_nx(char **args
)
373 static void tr_shift(char **args
)
375 int n
= args
[1] ? atoi(args
[1]) : 1;
380 static void tr_ex(char **args
)
385 static void tr_sy(char **args
)
390 static void tr_lt(char **args
)
392 int lt
= args
[1] ? eval_re(args
[1], n_lt
, 'm') : n_t0
;
397 static void tr_pc(char **args
)
400 if (!s
|| charread(&s
, c_pc
) < 0)
404 static void tr_tl(char **args
)
409 } while (c
>= 0 && (c
== ' ' || c
== '\t'));
411 ren_tl(cp_next
, cp_back
);
414 } while (c
>= 0 && c
!= '\n');
417 static void tr_ec(char **args
)
419 c_ec
= args
[1] ? args
[1][0] : '\\';
422 static void tr_cc(char **args
)
424 c_cc
= args
[1] ? args
[1][0] : '.';
427 static void tr_c2(char **args
)
429 c_c2
= args
[1] ? args
[1][0] : '\'';
432 static void tr_eo(char **args
)
437 static void tr_hc(char **args
)
440 if (!s
|| charread(&s
, c_hc
) < 0)
444 /* sentence ending and their transparent characters */
445 static char eos_sent
[NCHARS
][GNLEN
] = { ".", "?", "!", };
446 static int eos_sentcnt
= 3;
447 static char eos_tran
[NCHARS
][GNLEN
] = { "'", "\"", ")", "]", "*", };
448 static int eos_trancnt
= 5;
450 static void tr_eos(char **args
)
456 while (s
&& charread(&s
, eos_sent
[eos_sentcnt
]) >= 0)
457 if (eos_sentcnt
< NCHARS
- 1)
462 while (s
&& charread(&s
, eos_tran
[eos_trancnt
]) >= 0)
463 if (eos_trancnt
< NCHARS
- 1)
468 int c_eossent(char *s
)
471 for (i
= 0; i
< eos_sentcnt
; i
++)
472 if (!strcmp(eos_sent
[i
], s
))
477 int c_eostran(char *s
)
480 for (i
= 0; i
< eos_trancnt
; i
++)
481 if (!strcmp(eos_tran
[i
], s
))
486 /* hyphenation dashes and hyphenation inhibiting character */
487 static char hy_dash
[NCHARS
][GNLEN
] = { "\\:", "-", "em", "en", "\\-", "--", "hy", };
488 static int hy_dashcnt
= 7;
489 static char hy_stop
[NCHARS
][GNLEN
] = { "\\%", };
490 static int hy_stopcnt
= 1;
492 static void tr_nh(char **args
)
497 static void tr_hy(char **args
)
499 n_hy
= args
[1] ? eval_re(args
[1], n_hy
, '\0') : 1;
502 static void tr_hlm(char **args
)
504 n_hlm
= args
[1] ? eval_re(args
[1], n_hlm
, '\0') : 0;
507 static void tr_hycost(char **args
)
509 n_hycost
= args
[1] ? eval_re(args
[1], n_hycost
, '\0') : 0;
510 n_hycost2
= args
[2] ? eval_re(args
[2], n_hycost2
, '\0') : 0;
511 n_hycost3
= args
[3] ? eval_re(args
[3], n_hycost3
, '\0') : 0;
514 static void tr_hydash(char **args
)
519 while (s
&& charread(&s
, hy_dash
[hy_dashcnt
]) >= 0)
520 if (hy_dashcnt
< NCHARS
- 1)
525 static void tr_hystop(char **args
)
530 while (s
&& charread(&s
, hy_stop
[hy_stopcnt
]) >= 0)
531 if (hy_stopcnt
< NCHARS
- 1)
536 int c_hydash(char *s
)
539 for (i
= 0; i
< hy_dashcnt
; i
++)
540 if (!strcmp(hy_dash
[i
], s
))
545 int c_hystop(char *s
)
548 for (i
= 0; i
< hy_stopcnt
; i
++)
549 if (!strcmp(hy_stop
[i
], s
))
554 int c_hymark(char *s
)
556 return !strcmp(c_bp
, s
) || !strcmp(c_hc
, s
);
559 static void tr_pmll(char **args
)
561 n_pmll
= args
[1] ? eval_re(args
[1], n_pmll
, '\0') : 0;
562 n_pmllcost
= args
[2] ? eval_re(args
[2], n_pmllcost
, '\0') : 100;
565 static void tr_lg(char **args
)
568 n_lg
= eval(args
[1], '\0');
571 static void tr_kn(char **args
)
574 n_kn
= eval(args
[1], '\0');
577 static void tr_cp(char **args
)
580 n_cp
= atoi(args
[1]);
583 static void tr_ss(char **args
)
586 n_ss
= eval_re(args
[1], n_ss
, 0);
587 n_sss
= args
[2] ? eval_re(args
[2], n_sss
, 0) : n_ss
;
591 static void tr_ssh(char **args
)
593 n_ssh
= args
[1] ? eval_re(args
[1], n_ssh
, 0) : 0;
596 static void tr_cs(char **args
)
598 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
600 font_setcs(fn
, args
[2] ? eval(args
[2], 0) : 0,
601 args
[3] ? eval(args
[3], 0) : 0);
604 static void tr_fzoom(char **args
)
606 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
608 font_setzoom(fn
, args
[2] ? eval(args
[2], 0) : 0);
611 static void tr_tkf(char **args
)
613 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
615 font_track(fn
, eval(args
[2], 0), eval(args
[3], 0),
616 eval(args
[4], 0), eval(args
[5], 0));
619 static void tr_ff(char **args
)
621 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
623 for (i
= 2; i
< NARGS
; i
++)
624 if (fn
&& args
[i
] && args
[i
][0] && args
[i
][1])
625 font_feat(fn
, args
[i
] + 1, args
[i
][0] == '+');
628 static void tr_ffsc(char **args
)
630 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
632 font_scrp(fn
, args
[2]);
634 font_lang(fn
, args
[3]);
637 static void tr_nm(char **args
)
644 n_ln
= eval_re(args
[1], n_ln
, 0);
646 if (args
[2] && isdigit((unsigned char) args
[2][0]))
647 n_nM
= MAX(1, eval(args
[2], 0));
648 if (args
[3] && isdigit((unsigned char) args
[3][0]))
649 n_nS
= MAX(0, eval(args
[3], 0));
650 if (args
[4] && isdigit((unsigned char) args
[4][0]))
651 n_nI
= MAX(0, eval(args
[4], 0));
654 static void tr_nn(char **args
)
656 n_nn
= args
[1] ? eval(args
[1], 0) : 1;
659 static void tr_bd(char **args
)
661 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
662 if (!args
[1] || !strcmp("S", args
[1]))
665 font_setbd(fn
, args
[2] ? eval(args
[2], 'u') : 0);
668 static void tr_it(char **args
)
672 n_itn
= eval(args
[1], 0);
678 static void tr_mc(char **args
)
681 if (s
&& charread(&s
, c_mc
) >= 0) {
683 n_mcn
= args
[2] ? eval(args
[2], 'm') : SC_EM
;
689 static void tr_tc(char **args
)
692 if (!s
|| charread(&s
, c_tc
) < 0)
696 static void tr_lc(char **args
)
699 if (!s
|| charread(&s
, c_lc
) < 0)
703 static void tr_lf(char **args
)
706 in_lf(args
[2], eval(args
[1], 0));
709 static void tr_chop(char **args
)
716 sbuf_append(&sbuf
, str_get(id
));
717 if (!sbuf_empty(&sbuf
)) {
718 sbuf_cut(&sbuf
, sbuf_len(&sbuf
) - 1);
719 str_set(id
, sbuf_buf(&sbuf
));
725 /* character translation (.tr) */
726 static struct dict
*cmap
; /* character mapping */
727 static char cmap_src
[NCMAPS
][GNLEN
]; /* source character */
728 static char cmap_dst
[NCMAPS
][GNLEN
]; /* character mapping */
729 static int cmap_n
; /* number of translated character */
731 void cmap_add(char *c1
, char *c2
)
733 int i
= dict_get(cmap
, c1
);
735 strcpy(cmap_dst
[i
], c2
);
736 } else if (cmap_n
< NCMAPS
) {
737 strcpy(cmap_src
[cmap_n
], c1
);
738 strcpy(cmap_dst
[cmap_n
], c2
);
739 dict_put(cmap
, cmap_src
[cmap_n
], cmap_n
);
744 char *cmap_map(char *c
)
746 int i
= dict_get(cmap
, c
);
747 return i
>= 0 ? cmap_dst
[i
] : c
;
750 static void tr_tr(char **args
)
753 char c1
[GNLEN
], c2
[GNLEN
];
754 while (s
&& charread(&s
, c1
) >= 0) {
755 if (charread(&s
, c2
) < 0)
761 /* character definition (.char) */
762 static char cdef_src
[NCDEFS
][GNLEN
]; /* source character */
763 static char *cdef_dst
[NCDEFS
]; /* character definition */
764 static int cdef_fn
[NCDEFS
]; /* owning font */
765 static int cdef_n
; /* number of defined characters */
766 static int cdef_expanding
; /* inside cdef_expand() call */
768 static int cdef_find(char *c
, int fn
)
771 for (i
= 0; i
< cdef_n
; i
++)
772 if ((!cdef_fn
[i
] || cdef_fn
[i
] == fn
) && !strcmp(cdef_src
[i
], c
))
777 /* return the definition of the given character */
778 char *cdef_map(char *c
, int fn
)
780 int i
= cdef_find(c
, fn
);
781 return !cdef_expanding
&& i
>= 0 ? cdef_dst
[i
] : NULL
;
784 int cdef_expand(struct wb
*wb
, char *s
, int fn
)
786 char *d
= cdef_map(s
, fn
);
795 static void cdef_remove(char *fn
, char *cs
)
799 int fp
= fn
? dev_pos(fn
) : -1;
800 if (!cs
|| charread(&cs
, c
) < 0)
802 for (i
= 0; i
< cdef_n
; i
++) {
803 if (!strcmp(cdef_src
[i
], c
)) {
804 if (!fn
|| (fp
> 0 && cdef_fn
[i
] == fp
)) {
807 cdef_src
[i
][0] = '\0';
813 static void cdef_add(char *fn
, char *cs
, char *def
)
817 if (!def
|| charread(&cs
, c
) < 0)
819 i
= cdef_find(c
, fn
? dev_pos(fn
) : -1);
821 for (i
= 0; i
< cdef_n
; i
++)
824 if (i
== cdef_n
&& cdef_n
< NCDEFS
)
827 if (i
>= 0 && i
< cdef_n
) {
828 snprintf(cdef_src
[i
], sizeof(cdef_src
[i
]), "%s", c
);
829 cdef_dst
[i
] = xmalloc(strlen(def
) + 1);
830 strcpy(cdef_dst
[i
], def
);
831 cdef_fn
[i
] = fn
? dev_pos(fn
) : 0;
835 static void tr_rchar(char **args
)
838 for (i
= 1; i
< NARGS
; i
++)
840 cdef_remove(NULL
, args
[i
]);
843 static void tr_char(char **args
)
846 cdef_add(NULL
, args
[1], args
[2]);
848 cdef_remove(NULL
, args
[1]);
851 static void tr_ochar(char **args
)
854 cdef_add(args
[1], args
[2], args
[3]);
856 cdef_remove(args
[1], args
[2]);
859 static void tr_fmap(char **args
)
861 struct font
*fn
= args
[1] ? dev_font(dev_pos(args
[1])) : NULL
;
863 font_map(fn
, args
[2], args
[3]);
866 static void tr_blm(char **args
)
868 tr_bm
= args
[1] ? map(args
[1]) : -1;
871 static void tr_lsm(char **args
)
873 tr_sm
= args
[1] ? map(args
[1]) : -1;
876 static void tr_co(char **args
)
879 char *path
= args
[2];
881 if (!reg
|| !reg
[0] || !path
|| !path
[0])
883 if (path
[0] == '>') {
884 FILE *fp
= fopen(path
+ 1, "w");
885 if (fp
&& reg
&& str_get(map(reg
)))
886 fputs(str_get(map(reg
)), fp
);
890 if (path
[0] == '<') {
891 FILE *fp
= fopen(path
+ 1, "r");
894 while (fp
&& fgets(buf
, sizeof(buf
), fp
))
895 sbuf_append(&sb
, buf
);
896 str_set(map(reg
), sbuf_buf(&sb
));
903 /* read a macro argument */
904 static int tr_arg(struct sbuf
*sbuf
, int brk
, int (*next
)(void), void (*back
)(int))
911 if (c
== '\n' || c
== brk
)
913 if (c
< 0 || c
== '\n' || c
== brk
)
919 while (c
>= 0 && c
!= '\n' && (quoted
|| c
!= brk
)) {
920 if (!quoted
&& c
== ' ')
922 if (quoted
&& c
== '"') {
940 /* read macro arguments; free the returned pointer when done */
941 char *tr_args(char **args
, int brk
, int (*next
)(void), void (*back
)(int))
947 while (!tr_arg(&sbuf
, brk
, next
, back
))
950 e
= s
+ sbuf_len(&sbuf
);
951 while (n
< NARGS
&& s
&& s
< e
) {
953 if ((s
= memchr(s
, '\0', e
- s
)))
956 return sbuf_out(&sbuf
);
959 /* split the arguments in sbuf */
960 static int tr_argschop(struct sbuf
*sbuf
, char **args
)
962 char *s
= sbuf_buf(sbuf
);
963 char *e
= s
+ sbuf_len(sbuf
);
965 while (n
< NARGS
&& s
&& s
< e
) {
967 if ((s
= memchr(s
, '\0', e
- s
)))
973 /* read request arguments; trims tabs too */
974 static void mkargs_req(struct sbuf
*sbuf
)
981 while (c
== ' ' || c
== '\t')
983 while (c
>= 0 && c
!= '\n' && c
!= ' ' && c
!= '\t') {
995 if (c
< 0 || c
== '\n')
1001 /* read arguments for .ds and .char */
1002 static void mkargs_ds(struct sbuf
*sbuf
)
1004 char *s
= read_name(n_cp
);
1005 sbuf_append(sbuf
, s
);
1010 sbuf_append(sbuf
, s
);
1017 /* read arguments for .ochar */
1018 static void mkargs_ochar(struct sbuf
*sbuf
)
1020 char *s
= read_name(0);
1021 sbuf_append(sbuf
, s
);
1027 /* read arguments for .nr */
1028 static void mkargs_reg1(struct sbuf
*sbuf
)
1030 char *s
= read_name(n_cp
);
1031 sbuf_append(sbuf
, s
);
1037 /* do not read any arguments; for .if, .ie and .el */
1038 static void mkargs_null(struct sbuf
*sbuf
)
1042 /* read the whole line for .tm */
1043 static void mkargs_eol(struct sbuf
*sbuf
)
1050 while (c
>= 0 && c
!= '\n') {
1060 void (*f
)(char **args
);
1061 void (*args
)(struct sbuf
*sbuf
);
1063 {TR_DIVBEG
, tr_divbeg
},
1064 {TR_DIVEND
, tr_divend
},
1065 {TR_DIVVS
, tr_divvs
},
1066 {TR_POPREN
, tr_popren
},
1069 {"ab", tr_ab
, mkargs_eol
},
1072 {"am", tr_de
, mkargs_reg1
},
1073 {"as", tr_as
, mkargs_ds
},
1082 {"char", tr_char
, mkargs_ds
},
1083 {"chop", tr_chop
, mkargs_reg1
},
1085 {"co", tr_co
, mkargs_ds
},
1089 {"de", tr_de
, mkargs_reg1
},
1091 {"ds", tr_ds
, mkargs_ds
},
1094 {"el", tr_el
, mkargs_null
},
1107 {"fspecial", tr_fspecial
},
1109 {"fzoom", tr_fzoom
},
1111 {"hcode", tr_hcode
},
1116 {"hycost", tr_hycost
},
1117 {"hydash", tr_hydash
},
1118 {"hystop", tr_hystop
},
1120 {"ie", tr_if
, mkargs_null
},
1121 {"if", tr_if
, mkargs_null
},
1142 {"nr", tr_nr
, mkargs_reg1
},
1145 {"ochar", tr_ochar
, mkargs_ochar
},
1153 {"rchar", tr_rchar
},
1159 {"shift", tr_shift
},
1165 {"sy", tr_sy
, mkargs_eol
},
1171 {"tl", tr_tl
, mkargs_null
},
1172 {"tm", tr_tm
, mkargs_eol
},
1173 {"tr", tr_tr
, mkargs_eol
},
1178 static char *dotted(char *name
, int dot
)
1180 char *out
= xmalloc(strlen(name
) + 2);
1182 strcpy(out
+ 1, name
);
1186 /* execute a built-in request */
1187 void tr_req(int reg
, char **args
)
1189 struct cmd
*req
= str_dget(reg
);
1194 /* interpolate a macro for tr_nextreq() */
1195 static void tr_nextreq_exec(char *mac
, char *arg0
, int readargs
)
1197 char *args
[NARGS
+ 3] = {arg0
};
1198 struct cmd
*req
= str_dget(map(mac
));
1207 tr_argschop(&sbuf
, args
+ 1);
1215 buf
= tr_args(args
+ 1, -1, cp_next
, cp_back
);
1219 if (str_get(map(mac
)))
1220 in_push(str_get(map(mac
)), args
);
1225 /* read the next troff request; return zero if a request was executed. */
1226 int tr_nextreq(void)
1234 /* transparent line indicator */
1238 char *args
[NARGS
+ 3] = {"\\!"};
1244 tr_argschop(&sbuf
, args
+ 1);
1245 tr_transparent(args
);
1251 /* not a request, a blank line, or a line with leading spaces */
1252 if (c
< 0 || (c
!= c_cc
&& c
!= c_c2
&&
1253 (c
!= '\n' || tr_bm
< 0) &&
1254 (c
!= ' ' || tr_sm
< 0))) {
1259 if (c
== '\n') { /* blank line macro */
1260 mac
= malloc(strlen(map_name(tr_bm
)) + 1);
1261 strcpy(mac
, map_name(tr_bm
));
1262 arg0
= dotted(mac
, '.');
1263 tr_nextreq_exec(mac
, arg0
, 0);
1264 } else if (c
== ' ') { /* leading space macro */
1266 mac
= malloc(strlen(map_name(tr_sm
)) + 1);
1267 strcpy(mac
, map_name(tr_sm
));
1268 for (i
= 0; c
== ' '; i
++)
1272 arg0
= dotted(mac
, '.');
1273 tr_nextreq_exec(mac
, arg0
, 0);
1275 mac
= read_name(n_cp
);
1276 arg0
= dotted(mac
, c
);
1277 tr_nextreq_exec(mac
, arg0
, 1);
1287 while (!tr_nextreq())
1290 tr_nl
= c
== '\n' || c
< 0;
1297 for (i
= 0; i
< LEN(cmds
); i
++)
1298 str_dset(map(cmds
[i
].id
), &cmds
[i
]);
1299 cmap
= dict_make(-1, 0, 2);
1305 for (i
= 0; i
< cdef_n
; i
++)