static char sccsid
[] = "@(#)lcmd1.c 3.25 %G%";
struct lcmd_arg arg_window
[] = {
{ "column", 1, ARG_ANY
},
{ "nlines", 2, ARG_NUM
},
register struct value
*v
, *a
;
int col
, row
, ncol
, nrow
, id
, nline
;
char haspty
, hasframe
, mapnl
;
char *argv
[sizeof shell
/ sizeof *shell
];
row
= a
[0].v_type
!= V_NUM
? 1 : a
[0].v_num
;
col
= a
[1].v_type
!= V_NUM
? 0 : a
[1].v_num
;
nrow
= a
[2].v_type
!= V_NUM
? wwnrow
- row
: a
[2].v_num
;
ncol
= a
[3].v_type
!= V_NUM
? wwncol
- col
: a
[3].v_num
;
nline
= a
[4].v_type
== V_ERR
? nbufline
: a
[4].v_num
;
label
= a
[5].v_type
== V_ERR
? 0 : a
[5].v_str
;
if (a
[6].v_type
== V_STR
) {
if (mkargv(a
[6].v_str
, argv
, sizeof argv
/ sizeof *argv
) < 0)
if ((haspty
= vtobool(a
+ 7, 1, -1)) < 0)
if ((hasframe
= vtobool(a
+ 8, 1, -1)) < 0)
if ((mapnl
= vtobool(a
+ 9, !haspty
, -1)) < 0)
if ((w
= openwin(id
, row
, col
, nrow
, ncol
, nline
, label
, haspty
,
hasframe
, shf
, sh
)) == 0)
struct lcmd_arg arg_nline
[] = {
{ "nlines", 1, ARG_NUM
},
register struct value
*v
, *a
;
struct lcmd_arg arg_select
[] = {
{ "window", 1, ARG_NUM
},
register struct value
*v
, *a
;
v
->v_num
= selwin
? selwin
->ww_id
+ 1 : -1;
if ((w
= vtowin(a
)) == 0)
struct lcmd_arg arg_debug
[] = {
register struct value
*v
, *a
;
debug
= vtobool(a
, 1, debug
);
struct lcmd_arg arg_escape
[] = {
{ "escapec", 1, ARG_STR
},
register struct value
*v
, *a
;
if ((v
->v_str
= str_cpy(buf
)) == 0) {
struct lcmd_arg arg_label
[] = {
{ "window", 1, ARG_NUM
},
register struct value
*a
;
if ((w
= vtowin(a
)) == 0)
if ((++a
)->v_type
!= V_ERR
&& setlabel(w
, a
->v_str
) < 0)
struct lcmd_arg arg_foreground
[] = {
{ "window", 1, ARG_NUM
},
register struct value
*v
, *a
;
if ((w
= vtowin(a
)) == 0)
flag
= vtobool(++a
, 1, v
->v_num
);
struct lcmd_arg arg_terse
[] = {
register struct value
*v
, *a
;
setterse(vtobool(a
, 1, terse
));
struct lcmd_arg arg_source
[] = {
{ "filename", 1, ARG_STR
},
register struct value
*v
, *a
;
if (a
->v_type
!= V_ERR
&& dosource(a
->v_str
) < 0) {
error("Can't open %s.", a
->v_str
);
register struct value
*a
;
if ((w
= vtowin(a
++)) == 0)
while (a
->v_type
!= V_ERR
) {
if (a
->v_type
== V_NUM
) {
(void) sprintf(buf
, "%d", a
->v_num
);
(void) write(w
->ww_pty
, buf
, strlen(buf
));
(void) write(w
->ww_pty
, a
->v_str
, strlen(a
->v_str
));
if ((++a
)->v_type
!= V_ERR
)
(void) write(w
->ww_pty
, " ", 1);
register struct value
*a
;
if (a
->v_type
== V_STR
&& str_match(a
->v_str
, "all", 1))
for (; a
->v_type
!= V_ERR
; a
++)
if ((w
= vtowin(a
)) != 0)
struct lcmd_arg arg_cursormodes
[] = {
register struct value
*v
, *a
;
v
->v_num
= wwcursormodes
;
wwsetcursormodes(a
->v_num
);
struct lcmd_arg arg_unset
[] = {
{ "variable", 1, ARG_ANY
},
register struct value
*v
, *a
;
if ((a
->v_str
= str_itoa(a
->v_num
)) == 0) {
v
->v_num
= var_unset(a
->v_str
);
register struct value
*v
;
error("No window specified.");
error("%s: No such window.", v
->v_str
);
if (v
->v_num
< 1 || v
->v_num
> NWINDOW
|| (w
= window
[v
->v_num
- 1]) == 0) {
error("%d: No such window.", v
->v_num
);
register struct value
*v
;
if (str_match(v
->v_str
, "true", 1)
|| str_match(v
->v_str
, "on", 2)
|| str_match(v
->v_str
, "yes", 1))
else if (str_match(v
->v_str
, "false", 1)
|| str_match(v
->v_str
, "off", 2)
|| str_match(v
->v_str
, "no", 1))
error("%s: Illegal boolean value.", v
->v_str
);
for (; *p
&& (*p
== ' ' || *p
== '\t'); p
++)
for (; *p
&& *p
!= ' ' && *p
!= '\t'; p
++)
error("Too many shell arguments.");