File tree 2 files changed +12
-16
lines changed
2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change 3
3
*
4
4
* Copyright 2000 by PostgreSQL Global Development Group
5
5
*
6
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.25 2000/03/18 22:48:29 petere Exp $
6
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.26 2000/03/27 21:11:37 petere Exp $
7
7
*/
8
8
#include "postgres.h"
9
9
#include "command.h"
@@ -1442,21 +1442,16 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
1442
1442
{
1443
1443
/* read file back in */
1444
1444
char line [1024 ];
1445
- size_t result ;
1446
1445
1447
1446
resetPQExpBuffer (query_buf );
1448
- do
1449
- {
1450
- result = fread (line , 1 , 1024 , stream );
1451
- if (ferror (stream ))
1452
- {
1453
- psql_error ("%s: %s\n" , fname , strerror (errno ));
1454
- error = true;
1455
- break ;
1456
- }
1457
- appendBinaryPQExpBuffer (query_buf , line , result );
1458
- } while (!feof (stream ));
1459
- appendPQExpBufferChar (query_buf , '\0' );
1447
+ while (fgets (line , 1024 , stream ))
1448
+ appendPQExpBufferStr (query_buf , line );
1449
+
1450
+ if (ferror (stream ))
1451
+ {
1452
+ psql_error ("%s: %s\n" , fname , strerror (errno ));
1453
+ error = true;
1454
+ }
1460
1455
1461
1456
fclose (stream );
1462
1457
}
@@ -1471,6 +1466,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
1471
1466
}
1472
1467
}
1473
1468
}
1469
+
1474
1470
return !error ;
1475
1471
}
1476
1472
Original file line number Diff line number Diff line change 3
3
*
4
4
* Copyright 2000 by PostgreSQL Global Development Group
5
5
*
6
- * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.26 2000/03/18 18:03:11 tgl Exp $
6
+ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.27 2000/03/27 21:11:37 petere Exp $
7
7
*/
8
8
#include "postgres.h"
9
9
#include "mainloop.h"
@@ -481,7 +481,7 @@ MainLoop(FILE *source)
481
481
482
482
483
483
/* Put the rest of the line in the query buffer. */
484
- if (line [query_start + strspn (line + query_start , " \t" )] != '\0' )
484
+ if (line [query_start + strspn (line + query_start , " \t\n " )] != '\0' )
485
485
{
486
486
if (query_buf -> len > 0 )
487
487
appendPQExpBufferChar (query_buf , '\n' );
You can’t perform that action at this time.
0 commit comments