File: test.c

package info (click to toggle)
aprx 2.9.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,352 kB
  • sloc: ansic: 15,809; sh: 598; makefile: 160
file content (21 lines) | stat: -rw-r--r-- 350 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

static int aprspass(const char *mycall)
{
	int a = 0, h = 29666, c;

	for (; *mycall; ++mycall) {
		c = 0xFF & *mycall;
		if (!(('0' <= c && c <= '9') || ('A' <= c && c <= 'Z')))
			break;
		h ^= ((0xFF & *mycall) * (a ? 1 : 256));
		a = !a;
	}
	return h;
}

main()
{
	printf("APRSPASS: %d\n", aprspass("OH2MQK-1"));
	return 0;
}