77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.180 1999/05/26 20:08:06 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.181 1999/05/30 15:32:45 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -3118,7 +3118,7 @@ handleCopyIn(PGconn *conn, const bool mustprompt, FILE *copystream)
31183118char copybuf [COPYBUFSIZ ];
31193119char * s ;
31203120int buflen ;
3121- int c ;
3121+ int c = 0 ;
31223122
31233123if (mustprompt )
31243124{
@@ -3138,18 +3138,23 @@ handleCopyIn(PGconn *conn, const bool mustprompt, FILE *copystream)
31383138while (!linedone )
31393139{/* for each buffer ... */
31403140s = copybuf ;
3141- buflen = COPYBUFSIZ ;
3142- for (;buflen > 1 &&
3143- !(linedone = (c = getc (copystream ))== '\n' || c == EOF );
3144- -- buflen )
3141+ for (buflen = COPYBUFSIZ ;buflen > 1 ;buflen -- )
3142+ {
3143+ c = getc (copystream );
3144+ if (c == '\n' || c == EOF )
3145+ {
3146+ linedone = true;
3147+ break ;
3148+ }
31453149* s ++ = c ;
3150+ }
3151+ * s = '\0' ;
31463152if (c == EOF )
31473153{
31483154PQputline (conn ,"\\." );
31493155copydone = true;
31503156break ;
31513157}
3152- * s = '\0' ;
31533158PQputline (conn ,copybuf );
31543159if (firstload )
31553160{