前些天在看getopt源码, 一种前所未见的函数定义方法
1 int 2 getopt(nargc, nargv, ostr) 3 int nargc; 4 char * const nargv[]; 5 const char *ostr; 6 { 7 static char *__progname = 0; 8 static char *place = EMSG; /* option letter processing */ 9 char *oli; /* option letter list index */ 10 __progname = __progname?__progname:_progname(*nargv); 11 12 _DIAGASSERT(nargv != NULL); 13 _DIAGASSERT(ostr != NULL); 14 15 if (optreset || !*place) { /* update scanning pointer */ 16 optreset = 0; 17 if (optind >= nargc || *(place = nargv[optind]) != '-') { 18 place = EMSG; 19 return (-1); 20 } 21 if (place[1] && *++place == '-' /* found "--" */ 22 && place[1] == '