|
|
1.1 root 1: /*
2: * Check serial number. If it is correct print in stdout serial number
3: * exit status is 0. If serial number is wrong exit status is 1.
4: */
5: #include "unumber.h"
6:
7: void unu_usage();
8:
9: main(argc, argv)
10: int argc;
11: int *argv[];
12: {
13: int c, susp, suspen;
14:
15: if (argc != 2)
16: unu_usage();
17:
18: sscanf(argv[1], "%1d%3d%5d", &c, &susp, &suspen);
19: if ( c < 1 || c > VERSIONS)
20: exit(1);
21:
22: c--;
23: if (((suspen ^ magic3[c]) % magic2[c]) != (susp ^ magic1[c]) ||
24: strlen(argv[1]) > 9)
25: exit(1);
26: else
27: exit(0);
28: }
29:
30: /*
31: * Usage of program unumber.
32: */
33: void
34: unu_usage()
35: {
36: printf("unumber suspension_number\n");
37: exit(1);
38: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.