/* Copyright (c) 1981 Regents of the University of California */
static char *sccsid
= "@(#)ex_set.c 7.1 %G%";
register struct option
*op
;
if (cp
< &optname
[ONMSZ
- 2])
} while (isalnum(peekchar()));
if (cp
[0] == 'n' && cp
[1] == 'o') {
/* Implement w300, w1200, and w9600 specially */
ignore(getchar()); /* = */
ignore(getnum()); /* value */
} else if (eq(cp
, "w1200")) {
if (ospeed
< B1200
|| ospeed
>= B2400
)
} else if (eq(cp
, "w9600")) {
for (op
= options
; op
< &options
[NOPTS
]; op
++)
if (eq(op
->oname
, cp
) || op
->oabbrev
&& eq(op
->oabbrev
, cp
))
serror("%s: No such option@- 'set all' gives all option values", cp
);
if (op
->otype
== ONOFF
) {
if (op
== &options
[PROMPT
])
serror("Option %s is not a toggle", op
->oname
);
serror("Missing =@in assignment to option %s", op
->oname
);
if (!isdigit(peekchar()))
error("Digits required@after =");
if (op
== &options
[WINDOW
]) {
if (value(WINDOW
) >= LINES
)
if (cp
>= &optname
[ONMSZ
])
error("String too long@in option assignment");
/* adb change: allow whitepace in strings */
if( (*cp
= getchar()) == '\\')
if (op
->otype
== OTERM
) {
* At first glance it seems like we shouldn't care if the terminal type
* is changed inside visual mode, as long as we assume the screen is
* a mess and redraw it. However, it's a much harder problem than that.
* If you happen to change from 1 crt to another that both have the same
* size screen, it's OK. But if the screen size if different, the stuff
* that gets initialized in vop() will be wrong. This could be overcome
* by redoing the initialization, e.g. making the first 90% of vop into
* a subroutine. However, the most useful case is where you forgot to do
* a setenv before you went into the editor and it thinks you're on a dumb
* terminal. Ex treats this like hardcopy and goes into HARDOPEN mode.
* This loses because the first part of vop calls oop in this case.
* The problem is so hard I gave up. I'm not saying it can't be done,
* but I am saying it probably isn't worth the effort.
error("Can't change type of terminal from within open/visual");
CP(op
->osvalue
, optname
);
return (iswhite(peekchar()) || endcmd(peekchar()));
register int incr
= (NOPTS
+ 2) / 3;
register int rows
= incr
;
register struct option
*op
= options
;
for (; rows
; rows
--, op
++) {
if (&op
[2*incr
] < &options
[NOPTS
]) {
register struct option
*op
;
for (op
= options
; op
< &options
[NOPTS
]; op
++) {
if (op
== &options
[TERM
])
if (op
== &options
[TTYTYPE
])
if (op
->ovalue
== op
->odefault
)
register struct option
*op
;
printf("%s%s", op
->ovalue
? "" : "no", name
);
printf("%s=%d", name
, op
->ovalue
);
printf("%s=%s", name
, op
->osvalue
);