-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproj1_server.h
49 lines (46 loc) · 1.27 KB
/
proj1_server.h
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
43
44
45
46
47
48
49
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
#include <string.h>
#include <iostream>
using std::cerr;
using std::cout;
using std::endl;
/*********************************
* Name: help_message
* Purpose: display to the users how to run this program
* also show users the available parameters
* Recieve: none
* Return: none
*********************************/
void help_message()
{
cerr << "[ERR] Usage ./lab1_server [options]" << endl;
cout << "[ERR] The following option is available:" << endl;
cout << " -h Display help message." << endl;
}
/*********************************
* Name: parse_argv
* Purpose: parse the parameters
* Recieve: argv and argc
* Return: none
* NOTE: In fact we do not need this. I leave it here, so that
* it can capture invalid parameters.
*********************************/
void parse_argv(int argc, char *argv[])
{
for(int i = 1; i < argc; i++)
{
if((!strncmp(argv[i], "-h", 2)) ||
(!strncmp(argv[i], "-H", 2)))
{
help_message();
exit(1);
} else {
cerr << "[ERR] Invalid parameter:" << argv[i] << endl;
help_message();
exit(1);
}
}
}