user-0 提问: 求助一个netcat代码问题

回复:
user: user-1
content: C Function Definitions A function definition specifies the name of the function, the types and number of parameters it expects to receive, and its return type. A function definition also includes a function body with the declarations of its local variables, and the statements that determine what the function does.   Syntax  translation-unit :  external-declaration translation-unit external-declaration  external-declaration : /* Allowed only at external (file) scope */  function-definition declaration  function-definition : /* Declarator here is the function declarator */  declaration-specifiersopt attribute-seqopt declarator declaration-listopt compound-statement  /* attribute-seq is Microsoft Specific */  Prototype parameters are:  declaration-specifiers :  storage-class-specifier declaration-specifiers opt  type-specifier declaration-specifiers opt type-qualifier declaration-specifiers opt  declaration-list :  declaration declaration-list declaration  declarator :  pointeropt direct-declarator  direct-declarator : /* A function declarator */   direct-declarator ( parameter-type-list ) /* New-style declarator */ direct-declarator ( identifier-list opt ) /* Obsolete-style declarator */  The parameter list in a definition uses this syntax:   parameter-type-list : /* The parameter list */  parameter-list parameter-list , ...  parameter-list :  parameter-declaration parameter-list , parameter-declaration  parameter-declaration :  declaration-specifiers declarator declaration-specifiers abstract-declarator opt  The parameter list in an old-style function definition uses this syntax:  identifier-list : /* Used in obsolete-style function definitions and declarations */  identifier identifier-list , identifier  The syntax for the function body is:  compound-statement : /* The function body */   { declaration-list opt statement-list opt }  The only storage-class specifiers that can modify a function declaration are extern and static. The extern specifier signifies that the function can be referenced from other files; that is, the function name is exported to the linker. The static specifier signifies that the function cannot be referenced from other files; that is, the name is not exported by the linker. If no storage class appears in a function definition, extern is assumed. In any case, the function is always visible from the definition point to the end of the file.   The optional declaration-specifiers and mandatory declarator together specify the function’s return type and name. The declarator is a combination of the identifier that names the function and the parentheses following the function name. The optional attribute-seq nonterminal is a Microsoft-specific feature defined in Function Attributes.   The direct-declarator (in the declarator syntax) specifies the name of the function being defined and the identifiers of its parameters. If the direct-declarator includes a parameter-type-list, the list specifies the types of all the parameters. Such a declarator also serves as a function prototype for later calls to the function.   A declaration in the declaration-list in function definitions cannot contain a storage-class-specifier other than register. The type-specifier in the declaration-specifiers syntax can be omitted only if the register storage class is specified for a value of int type.   The compound-statement is the function body containing local variable declarations, references to externally declared items, and statements.   The sections Function Attributes, Storage Class, Return Type, Parameters, and Function Body describe the components of the function definition in detail.

user: user-2
content: 引用 2 楼 jianwen0529 的回复:[quote=引用 1 楼 cfjtaishan 的回复:] void bail (str, p1, p2, p3, p4, p5, p6)   char * str;   char * p1, * p2, * p3, * p4, * p5, * p6; {   o_verbose = 1;   holler (str, p1, p2, p3, p4, p5, p6); #ifdef WIN32   shutdown(netfd, 0x02);  /* Kirby */   closesocket (netfd); #else   close (netfd); #endif   sleep (1);   exit (1); } /* bail */  这是C语言吗？ 语法看着怪怪的，  K&R C标准的写法[/quote] so old~,与时俱进吧，建议用现代写法～ 当下标准C，指的是ANSI C，ISO C，C89，C90

user: user-3
content: 引用 1 楼 cfjtaishan 的回复:void bail (str, p1, p2, p3, p4, p5, p6)   char * str;   char * p1, * p2, * p3, * p4, * p5, * p6; {   o_verbose = 1;   holler (str, p1, p2, p3, p4, p5, p6); #ifdef WIN32   shutdown(netfd, 0x02);  /* Kirby */   closesocket (netfd); #else   close (netfd); #endif   sleep (1);   exit (1); } /* bail */  这是C语言吗？ 语法看着怪怪的，  K&R C标准的写法

user: user-2
content: void bail (str, p1, p2, p3, p4, p5, p6)   char * str;   char * p1, * p2, * p3, * p4, * p5, * p6; {   o_verbose = 1;   holler (str, p1, p2, p3, p4, p5, p6); #ifdef WIN32   shutdown(netfd, 0x02);  /* Kirby */   closesocket (netfd); #else   close (netfd); #endif   sleep (1);   exit (1); } /* bail */  这是C语言吗？ 语法看着怪怪的，