|
|
1.1 ! root 1: /* verify_speed.c: This is passed a baud rate entered and verifies that ! 2: it is indeed a valid baud rate. If an invalid speed ! 3: is entered, return a -1, otherwise return a 1. ! 4: */ ! 5: ! 6: int valid[7] = {300, 1200, 2400, 4800, 9600, 19200, 38400}; ! 7: ! 8: #include <stdio.h> ! 9: ! 10: validate_speed(speed) ! 11: int speed; /* baud rate passed from calling function */ ! 12: { ! 13: int x; ! 14: for (x = 0 ; x < 7 ; x++){ ! 15: if(speed == valid[x]) ! 16: return(1); ! 17: } ! 18: return(-1); ! 19: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.