aboutsummaryrefslogtreecommitdiff
path: root/common/options_f.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/options_f.c')
-rw-r--r--common/options_f.c212
1 files changed, 101 insertions, 111 deletions
diff --git a/common/options_f.c b/common/options_f.c
index ea3c61160cf5..482a37e39d39 100644
--- a/common/options_f.c
+++ b/common/options_f.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)options_f.c 10.25 (Berkeley) 7/12/96";
+static const char sccsid[] = "$Id: options_f.c,v 10.34 04/07/11 16:06:29 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -32,13 +32,13 @@ static const char sccsid[] = "@(#)options_f.c 10.25 (Berkeley) 7/12/96";
* PUBLIC: int f_altwerase __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_altwerase(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_altwerase(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
- if (!*valp)
+ if (*valp)
O_CLR(sp, O_TTYWERASE);
return (0);
}
@@ -47,11 +47,11 @@ f_altwerase(sp, op, str, valp)
* PUBLIC: int f_columns __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_columns(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_columns(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
/* Validate the number. */
if (*valp < MINIMUM_SCREEN_COLS) {
@@ -81,11 +81,11 @@ f_columns(sp, op, str, valp)
* PUBLIC: int f_lines __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_lines(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_lines(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
/* Validate the number. */
if (*valp < MINIMUM_SCREEN_ROWS) {
@@ -138,11 +138,11 @@ f_lines(sp, op, str, valp)
* PUBLIC: int f_lisp __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_lisp(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_lisp(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
msgq(sp, M_ERR, "044|The lisp option is not implemented");
return (0);
@@ -152,44 +152,37 @@ f_lisp(sp, op, str, valp)
* PUBLIC: int f_msgcat __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_msgcat(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_msgcat(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
(void)msg_open(sp, str);
return (0);
}
/*
- * PUBLIC: int f_paragraph __P((SCR *, OPTION *, char *, u_long *));
- */
-int
-f_paragraph(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
-{
- if (strlen(str) & 1) {
- msgq(sp, M_ERR,
- "048|The paragraph option must be in two character groups");
- return (1);
- }
- return (0);
-}
-
-/*
* PUBLIC: int f_print __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_print(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_print(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
+ int offset = op - sp->opts;
+
+ /* Preset the value, needed for reinitialization of lookup table. */
+ if (offset == O_OCTAL) {
+ if (*valp)
+ O_SET(sp, offset);
+ else
+ O_CLR(sp, offset);
+ } else if (o_set(sp, offset, OS_STRDUP, str, 0))
+ return(1);
+
/* Reinitialize the key fast lookup table. */
v_key_ilookup(sp);
@@ -202,20 +195,20 @@ f_print(sp, op, str, valp)
* PUBLIC: int f_readonly __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_readonly(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_readonly(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
/*
* !!!
* See the comment in exf.c.
*/
if (*valp)
- F_CLR(sp, SC_READONLY);
- else
F_SET(sp, SC_READONLY);
+ else
+ F_CLR(sp, SC_READONLY);
return (0);
}
@@ -223,11 +216,11 @@ f_readonly(sp, op, str, valp)
* PUBLIC: int f_recompile __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_recompile(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_recompile(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
if (F_ISSET(sp, SC_RE_SEARCH)) {
regfree(&sp->re_c);
@@ -244,45 +237,27 @@ f_recompile(sp, op, str, valp)
* PUBLIC: int f_reformat __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_reformat(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_reformat(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
F_SET(sp, SC_SCR_REFORMAT);
return (0);
}
/*
- * PUBLIC: int f_section __P((SCR *, OPTION *, char *, u_long *));
- */
-int
-f_section(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
-{
- if (strlen(str) & 1) {
- msgq(sp, M_ERR,
- "049|The section option must be in two character groups");
- return (1);
- }
- return (0);
-}
-
-/*
* PUBLIC: int f_ttywerase __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_ttywerase(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_ttywerase(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
- if (!*valp)
+ if (*valp)
O_CLR(sp, O_ALTWERASE);
return (0);
}
@@ -291,11 +266,11 @@ f_ttywerase(sp, op, str, valp)
* PUBLIC: int f_w300 __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_w300(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_w300(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
u_long v;
@@ -312,11 +287,11 @@ f_w300(sp, op, str, valp)
* PUBLIC: int f_w1200 __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_w1200(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_w1200(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
u_long v;
@@ -333,11 +308,11 @@ f_w1200(sp, op, str, valp)
* PUBLIC: int f_w9600 __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_w9600(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_w9600(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
u_long v;
@@ -354,14 +329,29 @@ f_w9600(sp, op, str, valp)
* PUBLIC: int f_window __P((SCR *, OPTION *, char *, u_long *));
*/
int
-f_window(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
+f_window(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
{
if (*valp >= O_VAL(sp, O_LINES) - 1 &&
(*valp = O_VAL(sp, O_LINES) - 1) == 0)
*valp = 1;
return (0);
}
+
+/*
+ * PUBLIC: int f_encoding __P((SCR *, OPTION *, char *, u_long *));
+ */
+int
+f_encoding(
+ SCR *sp,
+ OPTION *op,
+ char *str,
+ u_long *valp)
+{
+ int offset = op - sp->opts;
+
+ return conv_enc(sp, offset, str);
+}