xref: /csrg-svn/usr.bin/pascal/libpc/SUCC.c (revision 3859)
11707Smckusick /* Copyright (c) 1979 Regents of the University of California */
21707Smckusick 
3*3859Smckusic static char sccsid[] = "@(#)SUCC.c 1.3 06/08/81";
41707Smckusick 
51707Smckusick #include "h01errs.h"
61707Smckusick 
73034Smckusic long
81707Smckusick SUCC(value, lower, upper)
91707Smckusick 
103034Smckusic 	long	value;
113034Smckusic 	long	lower;
123034Smckusic 	long	upper;
131707Smckusick {
14*3859Smckusic 	if (value == upper) {
15*3859Smckusic 		ERROR("Cannot take succ of last element of a range\n");
16*3859Smckusic 		return;
17*3859Smckusic 	}
181707Smckusick 	value++;
191707Smckusick 	if (value < lower || value > upper) {
20*3859Smckusic 		ERROR("Value of %D is out of range\n", value);
211707Smckusick 		return;
221707Smckusick 	}
231707Smckusick 	return	value;
241707Smckusick }
25