Embedded --- common template functions (usage instructions and parameter resolution functions)

Source: Internet
Author: User

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 ;}}}}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.