Embedded --- common template functions (usage instructions and parameter resolution functions)
Main Content: Embedded common template functions (usage instructions and parameter resolution functions)
/* Display the parameter list */void usage () {printf ("usage: server [-p: x] [-I: IP] [-o] \ n "); printf ("-p: x Port number to listen on \ n "); printf ("-I: str Interface to listen on \ n "); printf ("-o Don't echo the data back \ n "); ExitProcess (1 );} /* Verification parameter */void ValidateArgs (int argc, char ** argv) {int I; for (I = 1; I <argc; I ++) {if (argv [I] [0] = '-') | (argv [I] [0] = '/')) {switch (tolower (argv [I] [1]) {/* specify the port */case 'p': iPort = atoi (& argv [I] [3]); break;/* specify IP */case 'I': bInterface = TRUE; if (strlen (argv [I])> 3) strcpy (szAddress, & argv [I] [3]); break;/* only receives messages and does not respond */case 'O': bRecvOnly = TRUE; break;/* the parameter is invalid, display the parameter list */default: usage (); break ;}}}}