# HG changeset patch # User masneyb # Date 1055600041 0 # Node ID 8d933999bba6d60ea2572f6450276e5df06d22ff # Parent 8beb7bfca92bf9061476cda788eecd9c218c473c 2003-6-14 Brian Masney * lib/cache.c (gftp_delete_cache_entry) - fix for restoring newlines * lib/gftp.h lib/protocols.c - added EOF flag for gftp_get_line() * lib/gftp.h lib/pty.c - added get_pty_impl() function for each PTY type * src/text/gftp-text.c - after removing files, clear the cache for that directory diff -r 8beb7bfca92b -r 8d933999bba6 ChangeLog --- a/ChangeLog Wed Jun 11 22:02:26 2003 +0000 +++ b/ChangeLog Sat Jun 14 14:14:01 2003 +0000 @@ -1,3 +1,14 @@ +2003-6-14 Brian Masney + * lib/cache.c (gftp_delete_cache_entry) - fix for restoring newlines + + * lib/gftp.h lib/protocols.c - added EOF flag for gftp_get_line() + + * lib/gftp.h lib/pty.c - added get_pty_impl() function for each PTY + type + + * src/text/gftp-text.c - after removing files, clear the cache for + that directory + 2003-6-11 Brian Masney * lib/configure.in lib/gftp.h - portability fix for openpty(). (from Nathan Robertson , which he took from @@ -957,7 +968,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.87 2003/06/11 22:02:25 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.88 2003/06/14 14:13:59 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r 8beb7bfca92b -r 8d933999bba6 lib/cache.c --- a/lib/cache.c Wed Jun 11 22:02:26 2003 +0000 +++ b/lib/cache.c Sat Jun 14 14:14:01 2003 +0000 @@ -324,15 +324,15 @@ unlink (centry.file); else { - /* Make sure when we call gftp_get_line() that we pass the read size - as sizeof(buf) - 1 so that we'll have room to put the newline */ - buf[strlen (buf)] = '\n'; - /* Make sure we put the tabs back in the line. I do it this way so that I don't have to allocate memory again for each line as we read it */ gftp_restore_cache_line (¢ry, buf); + /* Make sure when we call gftp_get_line() that we pass the read size + as sizeof(buf) - 1 so that we'll have room to put the newline */ + buf[strlen (buf)] = '\n'; + if (gftp_fd_write (NULL, buf, strlen (buf), newfd) < 0) break; } diff -r 8beb7bfca92b -r 8d933999bba6 lib/gftp.h --- a/lib/gftp.h Wed Jun 11 22:02:26 2003 +0000 +++ b/lib/gftp.h Sat Jun 14 14:14:01 2003 +0000 @@ -538,6 +538,7 @@ *curpos; size_t max_bufsize, cur_bufsize; + unsigned int eof : 1; } gftp_getline_buffer; @@ -875,6 +876,8 @@ ssize_t num_read ); /* pty.c */ +char * get_pty_impl ( void ); + int open_ptys ( gftp_request * request, int *fdm, int *fds ); diff -r 8beb7bfca92b -r 8d933999bba6 lib/protocols.c --- a/lib/protocols.c Wed Jun 11 22:02:26 2003 +0000 +++ b/lib/protocols.c Sat Jun 14 14:14:01 2003 +0000 @@ -1875,6 +1875,7 @@ char *pos, *nextpos; ssize_t (*read_function) (gftp_request * request, void *ptr, size_t size, int fd); + int end_of_buffer; if (request == NULL || request->read_function == NULL) read_function = gftp_fd_read; @@ -1893,7 +1894,6 @@ gftp_free_getline_buffer (rbuf); return (ret); } - (*rbuf)->buffer[ret] = '\0'; (*rbuf)->cur_bufsize = ret; (*rbuf)->curpos = (*rbuf)->buffer; @@ -1902,10 +1902,11 @@ retval = GFTP_ERETRYABLE; do { - if ((*rbuf)->cur_bufsize > 0 && - ((pos = strchr ((*rbuf)->curpos, '\n')) != NULL || - ((*rbuf)->curpos == (*rbuf)->buffer && - (*rbuf)->max_bufsize == (*rbuf)->cur_bufsize))) + pos = strchr ((*rbuf)->curpos, '\n'); + end_of_buffer = (*rbuf)->curpos == (*rbuf)->buffer && + ((*rbuf)->max_bufsize == (*rbuf)->cur_bufsize || (*rbuf)->eof); + + if ((*rbuf)->cur_bufsize > 0 && (pos != NULL || end_of_buffer)) { if (pos != NULL) retval = pos - (*rbuf)->curpos + 1; @@ -1952,10 +1953,15 @@ gftp_free_getline_buffer (rbuf); return (ret); } - else if (ret == 0 && (*rbuf)->cur_bufsize == 0) + else if (ret == 0) { - gftp_free_getline_buffer (rbuf); - return (ret); + if ((*rbuf)->cur_bufsize == 0) + { + gftp_free_getline_buffer (rbuf); + return (ret); + } + + (*rbuf)->eof = 1; } (*rbuf)->buffer[ret + (*rbuf)->cur_bufsize] = '\0'; diff -r 8beb7bfca92b -r 8d933999bba6 lib/pty.c --- a/lib/pty.c Wed Jun 11 22:02:26 2003 +0000 +++ b/lib/pty.c Sat Jun 14 14:14:01 2003 +0000 @@ -21,8 +21,14 @@ #include "gftp.h" +#ifdef __sgi -#ifdef __sgi +char * +get_pty_impl (void) +{ + return ("sgi"); +} + int open_ptys (gftp_request * request, int *fdm, int *fds) @@ -43,6 +49,13 @@ #elif HAVE_GRANTPT +char * +get_pty_impl (void) +{ + return ("unix98"); +} + + int open_ptys (gftp_request * request, int *fdm, int *fds) { @@ -75,16 +88,25 @@ return (GFTP_ERETRYABLE); } +#ifdef SYSV /* I intentionally ignore these errors */ ioctl (*fds, I_PUSH, "ptem"); ioctl (*fds, I_PUSH, "ldterm"); ioctl (*fds, I_PUSH, "ttcompat"); +#endif return (0); } #elif HAVE_OPENPTY +char * +get_pty_impl (void) +{ + return ("openpty"); +} + + int open_ptys (gftp_request * request, int *fdm, int *fds) { @@ -102,6 +124,13 @@ /* Fall back to *BSD... */ +char * +get_pty_impl (void) +{ + return ("bsd"); +} + + int open_ptys (gftp_request * request, int *fdm, int *fds) { diff -r 8beb7bfca92b -r 8d933999bba6 src/text/gftp-text.c --- a/src/text/gftp-text.c Wed Jun 11 22:02:26 2003 +0000 +++ b/src/text/gftp-text.c Sat Jun 14 14:14:01 2003 +0000 @@ -501,7 +501,8 @@ } else { - gftp_remove_file (request, command); + if (gftp_remove_file (request, command) == 0) + gftp_delete_cache_entry (request, 0); } return (1); }