xref: /csrg-svn/usr.bin/pascal/libpc/SUCC.c (revision 62096)
140865Sbostic /*-
2*62096Sbostic  * Copyright (c) 1979, 1993
3*62096Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71707Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)SUCC.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111707Smckusick 
123034Smckusic long
SUCC(value,lower,upper)131707Smckusick SUCC(value, lower, upper)
141707Smckusick 
153034Smckusic 	long	value;
163034Smckusic 	long	lower;
173034Smckusic 	long	upper;
181707Smckusick {
193859Smckusic 	if (value == upper) {
203859Smckusic 		ERROR("Cannot take succ of last element of a range\n");
213859Smckusic 	}
221707Smckusick 	value++;
231707Smckusick 	if (value < lower || value > upper) {
243859Smckusic 		ERROR("Value of %D is out of range\n", value);
251707Smckusick 	}
261707Smckusick 	return	value;
271707Smckusick }
28