File: main.c

package info (click to toggle)
etw 3.6%2Bsvn162-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 18,692 kB
  • sloc: ansic: 31,633; objc: 244; sh: 97; makefile: 61
file content (42 lines) | stat: -rwxr-xr-x 808 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "highsocket.h"
#include "server.h"


int config_length = 0;
char config_buffer[4000];

int main(int argc,char *argv[])
{
	if(argc!=2)
		printf("Usage: %s portnum\n",argv[0]);
	else 
	{
		int port=atoi(argv[1]);
		FILE *f;

		if(!(f=fopen("etw.cfg","rb"))) {
			printf("Unable to load server default config!\n");
			exit(0);
		}

		config_length=fread(config_buffer+sizeof(simplemsg),1,sizeof(config_buffer)-sizeof(simplemsg),f);
		fclose(f);

		printf("Config file read (%d bytes)\n", config_length);
		
		if(port>32767 || port<4000)
			printf("Port number should be between 4000 and 32767\n");
		else
		{
			printf("Winsock initialization...\n");
			SocketSystemBoot();
			atexit(my_close_all);
			start_server(port);
		}
	}
	return 0;
}