ncurses 5.9 - patch 20131110
[ncurses.git] / form / fld_max.c
index 1ad925c4b870af4a1a53c905f852a6fc31bbb85b..6c7fe728bd985b935d6ffc3d7cf1ab3cd879534d 100644 (file)
@@ -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            *
  ****************************************************************************/
 
 /****************************************************************************
- *   Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1995,1997        *
+ *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_max.c,v 1.2 1998/02/11 12:13:44 tom 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.2 1998/02/11 12:13:44 tom 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 */