X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffld_max.c;h=6c7fe728bd985b935d6ffc3d7cf1ab3cd879534d;hp=f17bcec5a47876b0cbaba031681b556f111d39e0;hb=67ab4b308e932639a3a832052228d445c41c54b4;hpb=0eb88fc5281804773e2a0c7a488a4452463535ce diff --git a/form/fld_max.c b/form/fld_max.c index f17bcec5..6c7fe728 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,12 +27,12 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer 1995,1997 * + * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") +MODULE_ID("$Id: fld_max.c,v 1.13 2013/08/24 22:59:28 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,31 +44,34 @@ MODULE_ID("$Id: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int set_max_field(FIELD *field, int maxgrow) +NCURSES_EXPORT(int) +set_max_field(FIELD *field, int maxgrow) { - if (!field || (maxgrow<0)) + T((T_CALLED("set_max_field(%p,%d)"), (void *)field, maxgrow)); + + if (!field || (maxgrow < 0)) RETURN(E_BAD_ARGUMENT); else { bool single_line_field = Single_Line_Field(field); - if (maxgrow>0) + if (maxgrow > 0) { - if (( single_line_field && (maxgrow < field->dcols)) || + if ((single_line_field && (maxgrow < field->dcols)) || (!single_line_field && (maxgrow < field->drows))) RETURN(E_BAD_ARGUMENT); } field->maxgrow = maxgrow; - field->status &= ~_MAY_GROW; - if (!(field->opts & O_STATIC)) + ClrStatus(field, _MAY_GROW); + if (!((unsigned)field->opts & O_STATIC)) { - if ((maxgrow==0) || - ( single_line_field && (field->dcols < maxgrow)) || + if ((maxgrow == 0) || + (single_line_field && (field->dcols < maxgrow)) || (!single_line_field && (field->drows < maxgrow))) - field->status |= _MAY_GROW; + SetStatus(field, _MAY_GROW); } } RETURN(E_OK); } - + /* fld_max.c ends here */