|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)getcodi.c 5.1 (Berkeley) 5/30/85"; ! 9: #endif not lint ! 10: ! 11: # include "getpar.h" ! 12: ! 13: /* ! 14: ** get course and distance ! 15: ** ! 16: ** The user is asked for a course and distance. This is used by ! 17: ** move, impulse, and some of the computer functions. ! 18: ** ! 19: ** The return value is zero for success, one for an invalid input ! 20: ** (meaning to drop the request). ! 21: */ ! 22: ! 23: getcodi(co, di) ! 24: int *co; ! 25: double *di; ! 26: { ! 27: ! 28: *co = getintpar("Course"); ! 29: ! 30: /* course must be in the interval [0, 360] */ ! 31: if (*co < 0 || *co > 360) ! 32: return (1); ! 33: *di = getfltpar("Distance"); ! 34: ! 35: /* distance must be in the interval [0, 15] */ ! 36: if (*di <= 0.0 || *di > 15.0) ! 37: return (1); ! 38: ! 39: /* good return */ ! 40: return (0); ! 41: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.