rebuilding netcat + fcked up code = confusion

Started by
2 comments, last by silverphyre673 18 years, 10 months ago
I'm trying to build netcat and include it in a smallish project that just gets the HTML of a webpage. I tried just building netcat to start with, so I included all the sources in a project and hit ctrl+F11. It gave me copious errors, and looking at the source, I can see why (sources are in C, I am using the hobbit's sources, and its the windows version):

void holler (str, p1, p2, p3, p4, p5, p6)
  char * str;
  char * p1, * p2, * p3, * p4, * p5, * p6;
{
  if (o_verbose) {
    fprintf (stderr, str, p1, p2, p3, p4, p5, p6);
#ifdef WIN32
	if (h_errno)
		fprintf (stderr, ": %s\n",winsockstr(h_errno));
#else
    if (errno) {		/* this gives funny-looking messages, but */
      perror (" ");		/* it's more portable than sys_errlist[]... */
    }				/* xxx: do something better.  */
#endif
	else
      fprintf (stderr, "\n");
    fflush (stderr);
  }
} /* holler */

Huh? Whats this:

void holler (str, p1, p2, p3, p4, p5, p6)
  char * str;
  char * p1, * p2, * p3, * p4, * p5, * p6;
{
...

I have never seen this before. It certainly doesn't compile! can anyone help me out? The main file that has this function and others with similar stuff is the only one that generates compiler errors. Thanks.
my siteGenius is 1% inspiration and 99% perspiration
Advertisement
It's C. Just add the data types to the argument list of the function.
------http://www.livejournal.com/users/rain_is_wet/
Levendis is right, it's pre-ANSI C. This is the way K&R wrote their code back in my young years. I always found this ugly...

Regards,

lovely... so like this:

void holler ( char * str, char * p1, char *p2, char *p3, char *p4, char *p5, char *p6)  char * str;  char * p1, * p2, * p3, * p4, * p5, * p6;{...


or like this:
void holler ( char * str, char * p1, char *p2, char *p3, char *p4, char *p5, char *p6){...


Thanks. yay standards!
my siteGenius is 1% inspiration and 99% perspiration

This topic is closed to new replies.

Advertisement