File:  [MW Coherent from dump] / coherent / d / support / serial_no / unumber.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * Check serial number. If it is correct print in stdout serial number
 * exit status is 0. If serial number is wrong exit status is 1.
 */
#include "unumber.h"

void	unu_usage();

main(argc, argv)
int	argc;
int	*argv[];
{
	int	c, susp, suspen;

	if (argc != 2)
		unu_usage();
	
	sscanf(argv[1], "%1d%3d%5d", &c, &susp, &suspen);
	if ( c < 1 || c > VERSIONS)
		exit(1);

	c--;
	if (((suspen ^ magic3[c]) % magic2[c]) != (susp ^ magic1[c]) ||
	  strlen(argv[1]) > 9)
		exit(1);
	else 
		exit(0);
}

/*
 * Usage of program unumber.
 */
void 
unu_usage()
{
	printf("unumber suspension_number\n");
	exit(1);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.