diff --git a/lib/libform/Makefile b/lib/libform/Makefile index dceffccf333e..58927199c68d 100644 --- a/lib/libform/Makefile +++ b/lib/libform/Makefile @@ -1,8 +1,11 @@ -# $NetBSD: Makefile,v 1.1 2000/12/17 12:04:30 blymn Exp $ +# $NetBSD: Makefile,v 1.2 2001/01/16 01:02:47 blymn Exp $ # -DBG=-g -CPPFLAGS+=-I${.CURDIR} #-DDEBUG +CPPFLAGS+=-I${.CURDIR} +.if defined(DEBUG_FORMS) +CFLAGS+=-g +CPPFLAGS+=-DDEBUG +.endif LIB= form SRCS= driver.c field_types.c internals.c field.c form.c post.c type_alnum.c \ type_alpha.c type_integer.c type_numeric.c type_enum.c type_regex.c \ diff --git a/lib/libform/driver.c b/lib/libform/driver.c index 8bf7316b0628..f0d8bf321326 100644 --- a/lib/libform/driver.c +++ b/lib/libform/driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: driver.c,v 1.1 2000/12/17 12:04:30 blymn Exp $ */ +/* $NetBSD: driver.c,v 1.2 2001/01/16 01:02:47 blymn Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -123,6 +123,10 @@ form_driver(FORM *form, int c) pos = fieldp->start_char + fieldp->cursor_xpos + fieldp->hscroll; + /* check if we are allowed to edit this field */ + if ((fieldp->opts & O_EDIT) != O_EDIT) + return E_REQUEST_DENIED; + /* * Need to check here if we want to autoskip. * we call the form driver recursively to pos diff --git a/lib/libform/field.c b/lib/libform/field.c index f4ee6ca2ba31..a76ee144342b 100644 --- a/lib/libform/field.c +++ b/lib/libform/field.c @@ -1,4 +1,4 @@ -/* $NetBSD: field.c,v 1.2 2001/01/04 12:30:37 blymn Exp $ */ +/* $NetBSD: field.c,v 1.3 2001/01/16 01:02:47 blymn Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn * (blymn@baea.com.au, brett_lymn@yahoo.com.au) @@ -58,7 +58,7 @@ FIELD _formi_default_field = { 0, /* start of a new page on the form if 1 */ 0, /* number of the page this field is on */ A_NORMAL, /* character attributes for the foreground */ - A_REVERSE, /* character attributes for the background */ + A_NORMAL, /* character attributes for the background */ ' ', /* padding character */ DEFAULT_FORM_OPTS, /* options for the field */ NULL, /* the form this field is bound to, if any */ diff --git a/lib/libform/form.c b/lib/libform/form.c index 7ca368e4fa60..26a21d716649 100644 --- a/lib/libform/form.c +++ b/lib/libform/form.c @@ -1,4 +1,4 @@ -/* $NetBSD: form.c,v 1.2 2001/01/04 12:30:37 blymn Exp $ */ +/* $NetBSD: form.c,v 1.3 2001/01/16 01:02:47 blymn Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -40,6 +40,7 @@ extern FIELD _formi_default_field; FORM _formi_default_form = { FALSE, /* true if performing a init or term function */ FALSE, /* the form is posted */ + FALSE, /* make field list circular if true */ NULL, /* window for the form */ NULL, /* subwindow for the form */ NULL, /* user defined pointer */ diff --git a/lib/libform/form.h b/lib/libform/form.h index b839bd75b7d2..c41106749f9f 100644 --- a/lib/libform/form.h +++ b/lib/libform/form.h @@ -1,4 +1,4 @@ -/* $NetBSD: form.h,v 1.2 2001/01/04 12:30:37 blymn Exp $ */ +/* $NetBSD: form.h,v 1.3 2001/01/16 01:02:47 blymn Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -221,6 +221,7 @@ struct _form_fieldtype { struct _form_struct { int in_init; /* true if performing a init or term function */ int posted; /* the form is posted */ + int wrap; /* wrap from last field to first field if true */ WINDOW *win; /* window for the form */ WINDOW *subwin; /* subwindow for the form */ void *userptr; /* user defined pointer */ diff --git a/lib/libform/internals.c b/lib/libform/internals.c index b9cb2614f5c3..7220bc260319 100644 --- a/lib/libform/internals.c +++ b/lib/libform/internals.c @@ -1,4 +1,4 @@ -/* $NetBSD: internals.c,v 1.2 2001/01/04 12:30:37 blymn Exp $ */ +/* $NetBSD: internals.c,v 1.3 2001/01/16 01:02:47 blymn Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -736,9 +736,10 @@ _formi_redraw_field(FORM *form, int field) if (cur->start_char > 0) offset += cur->start_char - 1; - if (flen > cur->hscroll + 1) - flen -= cur->hscroll + 1; - else + if (flen > cur->hscroll + 1) { + if (flen > slen) + flen -= cur->hscroll + 1; + } else flen = 0; #ifdef DEBUG @@ -1492,6 +1493,7 @@ field_sort_compare(const void *one, const void *two) const FIELD *a, *b; int tl; + /* LINTED const castaway; we don't modify these! */ a = (const FIELD *) *((const FIELD **) one); b = (const FIELD *) *((const FIELD **) two); diff --git a/lib/libform/post.c b/lib/libform/post.c index edc2cc8686e5..06bcb89999c9 100644 --- a/lib/libform/post.c +++ b/lib/libform/post.c @@ -1,4 +1,4 @@ -/* $NetBSD: post.c,v 1.2 2001/01/04 12:30:37 blymn Exp $ */ +/* $NetBSD: post.c,v 1.3 2001/01/16 01:02:47 blymn Exp $ */ /*- * Copyright (c) 1998-2000 Brett Lymn @@ -86,6 +86,7 @@ post_form(FORM *form) form->field_init(form); form->in_init = 0; + _formi_pos_first_field(form); if ((status = _formi_draw_page(form)) != E_OK) return status; diff --git a/lib/libform/shlib_version b/lib/libform/shlib_version index 9a58da70f622..790edb198811 100644 --- a/lib/libform/shlib_version +++ b/lib/libform/shlib_version @@ -1,5 +1,5 @@ -# $NetBSD: shlib_version,v 1.4 2001/01/07 13:15:11 jdc Exp $ +# $NetBSD: shlib_version,v 1.5 2001/01/16 01:02:47 blymn Exp $ # Remember to update distrib/sets/lists/base/shl.* when changing # major=1 -minor=0 +minor=1