xref: /csrg-svn/usr.bin/pascal/libpc/MAX.c (revision 40865)
1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
71664Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)MAX.c	1.6 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111664Smckusick 
121664Smckusick #include "h00vars.h"
131664Smckusick 
143011Smckusic long
151664Smckusick MAX(width, reduce, min)
161664Smckusick 
173011Smckusic 	register long	width;		/* requested width */
183011Smckusic 	long		reduce;		/* amount of extra space required */
193011Smckusic 	long		min;		/* minimum amount of space needed */
201664Smckusick {
213177Smckusic 	if (width <= 0) {
223867Smckusic 		ERROR("Non-positive format width: %D\n", width);
231664Smckusick 	}
241664Smckusick 	if ((width -= reduce) >= min)
251664Smckusick 		return width;
261664Smckusick 	return min;
271664Smckusick }
28