Can someone please provide some insight on this:

int get_smtp_line( void )
   char ch = '.';
   char in_data [255];
   char * index;
   int retval = 0;

   index = in_data;

   while (ch != '\n')
      if ( (retval = gensock_getchar (SMTPSock, 0, &ch) ) )
         gensock_error ("gensock_getchar", retval);
         return -1;
         *index = ch;

   return atoi(in_data);

I'm working on an e-mail issue in AIX, and am getting this:

Segmentation fault in get_smtp_line() at line 254 in file ""

I don't understand what's going on here at all though - was hoping someone here might be able to give an "assumption" of what it might be used for. Thanks in advance.

I don't see you terminating your string with '\0'. That's required by atoi or you'll walk right off the end.

Thanks for replying - while debugging it looks like the value never changes from '\0'. I'm not sure what the point of this method is - it looks like it sets 'ch' to '.' and then ... no clue. What's the point in doing ch='.' and then while(ch != '\n')?

I guess I should be more descriptive:

When I step through the while() loop, and do 'print ch' and 'print *index', the values never seem to change from '\0'. I don't understand how they became '\0'.

Also, is it possible we should be checking for '\0' instead of '\n'? This code works fine in Windows but is crashing in AIX.