Tue Sep 22 20:39:18 2009 UTC ()
rename getline to get_line as was done in src.
No functional change, no version bump.


(tnn)
diff -r1.8 -r1.9 pkgsrc/net/tnftp/files/src/cmds.c
diff -r1.8 -r1.9 pkgsrc/net/tnftp/files/src/main.c
diff -r1.8 -r1.9 pkgsrc/net/tnftp/files/src/util.c
diff -r1.6 -r1.7 pkgsrc/net/tnftp/files/src/extern.h
diff -r1.7 -r1.8 pkgsrc/net/tnftp/files/src/fetch.c

cvs diff -r1.8 -r1.9 pkgsrc/net/tnftp/files/src/Attic/cmds.c (expand / switch to unified diff)

--- pkgsrc/net/tnftp/files/src/Attic/cmds.c 2008/04/29 05:46:09 1.8
+++ pkgsrc/net/tnftp/files/src/Attic/cmds.c 2009/09/22 20:39:18 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cmds.c,v 1.8 2008/04/29 05:46:09 martin Exp $ */ 1/* $NetBSD: cmds.c,v 1.9 2009/09/22 20:39:18 tnn Exp $ */
2/* from NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp */ 2/* from NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1996-2007 The NetBSD Foundation, Inc. 5 * Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Luke Mewburn. 9 * by Luke Mewburn.
10 * 10 *
11 * This code is derived from software contributed to The NetBSD Foundation 11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 12 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
13 * NASA Ames Research Center. 13 * NASA Ames Research Center.
14 * 14 *
@@ -169,27 +169,27 @@ confirm(const char *cmd, const char *fil @@ -169,27 +169,27 @@ confirm(const char *cmd, const char *fil
169 169
170 if (!interactive || confirmrest) 170 if (!interactive || confirmrest)
171 return (1); 171 return (1);
172 if (file == NULL) { 172 if (file == NULL) {
173 promptleft = "Continue with"; 173 promptleft = "Continue with";
174 promptright = cmd; 174 promptright = cmd;
175 } else { 175 } else {
176 promptleft = cmd; 176 promptleft = cmd;
177 promptright = file; 177 promptright = file;
178 } 178 }
179 while (1) { 179 while (1) {
180 fprintf(ttyout, "%s %s [anpqy?]? ", promptleft, promptright); 180 fprintf(ttyout, "%s %s [anpqy?]? ", promptleft, promptright);
181 (void)fflush(ttyout); 181 (void)fflush(ttyout);
182 if (getline(stdin, line, sizeof(line), &errormsg) < 0) { 182 if (get_line(stdin, line, sizeof(line), &errormsg) < 0) {
183 mflag = 0; 183 mflag = 0;
184 fprintf(ttyout, "%s; %s aborted\n", errormsg, cmd); 184 fprintf(ttyout, "%s; %s aborted\n", errormsg, cmd);
185 return (0); 185 return (0);
186 } 186 }
187 switch (tolower((unsigned char)*line)) { 187 switch (tolower((unsigned char)*line)) {
188 case 'a': 188 case 'a':
189 confirmrest = 1; 189 confirmrest = 1;
190 fprintf(ttyout, 190 fprintf(ttyout,
191 "Prompting off for duration of %s.\n", cmd); 191 "Prompting off for duration of %s.\n", cmd);
192 break; 192 break;
193 case 'p': 193 case 'p':
194 interactive = 0; 194 interactive = 0;
195 fputs("Interactive mode: off.\n", ttyout); 195 fputs("Interactive mode: off.\n", ttyout);
@@ -764,27 +764,27 @@ fget(int argc, char *argv[]) @@ -764,27 +764,27 @@ fget(int argc, char *argv[])
764 return; 764 return;
765 } 765 }
766 766
767 fp = fopen(argv[1], "r"); 767 fp = fopen(argv[1], "r");
768 if (fp == NULL) { 768 if (fp == NULL) {
769 fprintf(ttyout, "Can't open source file %s\n", argv[1]); 769 fprintf(ttyout, "Can't open source file %s\n", argv[1]);
770 code = -1; 770 code = -1;
771 return; 771 return;
772 } 772 }
773 773
774 argv[0] = "get"; 774 argv[0] = "get";
775 mode = restart_point ? "r+" : "w"; 775 mode = restart_point ? "r+" : "w";
776 776
777 while (getline(fp, buf, sizeof(buf), NULL) >= 0) { 777 while (get_line(fp, buf, sizeof(buf), NULL) >= 0) {
778 if (buf[0] == '\0') 778 if (buf[0] == '\0')
779 continue; 779 continue;
780 argv[1] = buf; 780 argv[1] = buf;
781 (void)getit(argc, argv, 0, mode); 781 (void)getit(argc, argv, 0, mode);
782 } 782 }
783 fclose(fp); 783 fclose(fp);
784} 784}
785 785
786const char * 786const char *
787onoff(int truth) 787onoff(int truth)
788{ 788{
789 789
790 return (truth ? "on" : "off"); 790 return (truth ? "on" : "off");

cvs diff -r1.8 -r1.9 pkgsrc/net/tnftp/files/src/Attic/main.c (expand / switch to unified diff)

--- pkgsrc/net/tnftp/files/src/Attic/main.c 2008/04/29 05:46:09 1.8
+++ pkgsrc/net/tnftp/files/src/Attic/main.c 2009/09/22 20:39:18 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.8 2008/04/29 05:46:09 martin Exp $ */ 1/* $NetBSD: main.c,v 1.9 2009/09/22 20:39:18 tnn Exp $ */
2/* from NetBSD: main.c,v 1.105 2007/05/22 05:16:48 lukem Exp */ 2/* from NetBSD: main.c,v 1.105 2007/05/22 05:16:48 lukem Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1996-2005 The NetBSD Foundation, Inc. 5 * Copyright (c) 1996-2005 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Luke Mewburn. 9 * by Luke Mewburn.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -658,27 +658,27 @@ cmdscanner(void) @@ -658,27 +658,27 @@ cmdscanner(void)
658 size_t num; 658 size_t num;
659 659
660 for (;;) { 660 for (;;) {
661#ifndef NO_EDITCOMPLETE 661#ifndef NO_EDITCOMPLETE
662 if (!editing) { 662 if (!editing) {
663#endif /* !NO_EDITCOMPLETE */ 663#endif /* !NO_EDITCOMPLETE */
664 if (fromatty) { 664 if (fromatty) {
665 fputs(prompt(), ttyout); 665 fputs(prompt(), ttyout);
666 p = rprompt(); 666 p = rprompt();
667 if (*p) 667 if (*p)
668 fprintf(ttyout, "%s ", p); 668 fprintf(ttyout, "%s ", p);
669 } 669 }
670 (void)fflush(ttyout); 670 (void)fflush(ttyout);
671 num = getline(stdin, line, sizeof(line), NULL); 671 num = get_line(stdin, line, sizeof(line), NULL);
672 switch (num) { 672 switch (num) {
673 case -1: /* EOF */ 673 case -1: /* EOF */
674 case -2: /* error */ 674 case -2: /* error */
675 if (fromatty) 675 if (fromatty)
676 putc('\n', ttyout); 676 putc('\n', ttyout);
677 quit(0, NULL); 677 quit(0, NULL);
678 /* NOTREACHED */ 678 /* NOTREACHED */
679 case -3: /* too long; try again */ 679 case -3: /* too long; try again */
680 fputs("Sorry, input line is too long.\n", 680 fputs("Sorry, input line is too long.\n",
681 ttyout); 681 ttyout);
682 continue; 682 continue;
683 case 0: /* empty; try again */ 683 case 0: /* empty; try again */
684 continue; 684 continue;

cvs diff -r1.8 -r1.9 pkgsrc/net/tnftp/files/src/Attic/util.c (expand / switch to unified diff)

--- pkgsrc/net/tnftp/files/src/Attic/util.c 2008/04/29 05:46:09 1.8
+++ pkgsrc/net/tnftp/files/src/Attic/util.c 2009/09/22 20:39:18 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: util.c,v 1.8 2008/04/29 05:46:09 martin Exp $ */ 1/* $NetBSD: util.c,v 1.9 2009/09/22 20:39:18 tnn Exp $ */
2/* from NetBSD: util.c,v 1.143 2007/05/24 05:05:19 lukem Exp */ 2/* from NetBSD: util.c,v 1.143 2007/05/24 05:05:19 lukem Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1997-2007 The NetBSD Foundation, Inc. 5 * Copyright (c) 1997-2007 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Luke Mewburn. 9 * by Luke Mewburn.
10 * 10 *
11 * This code is derived from software contributed to The NetBSD Foundation 11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 12 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
13 * NASA Ames Research Center. 13 * NASA Ames Research Center.
14 * 14 *
@@ -405,27 +405,27 @@ ftp_login(const char *host, const char * @@ -405,27 +405,27 @@ ftp_login(const char *host, const char *
405 } 405 }
406 406
407 if (ruserpass(host, &user, &pass, &acct) < 0) { 407 if (ruserpass(host, &user, &pass, &acct) < 0) {
408 code = -1; 408 code = -1;
409 goto cleanup_ftp_login; 409 goto cleanup_ftp_login;
410 } 410 }
411 411
412 while (user == NULL) { 412 while (user == NULL) {
413 if (localname) 413 if (localname)
414 fprintf(ttyout, "Name (%s:%s): ", host, localname); 414 fprintf(ttyout, "Name (%s:%s): ", host, localname);
415 else 415 else
416 fprintf(ttyout, "Name (%s): ", host); 416 fprintf(ttyout, "Name (%s): ", host);
417 errormsg = NULL; 417 errormsg = NULL;
418 nlen = getline(stdin, tmp, sizeof(tmp), &errormsg); 418 nlen = get_line(stdin, tmp, sizeof(tmp), &errormsg);
419 if (nlen < 0) { 419 if (nlen < 0) {
420 fprintf(ttyout, "%s; %s aborted.\n", errormsg, "login"); 420 fprintf(ttyout, "%s; %s aborted.\n", errormsg, "login");
421 code = -1; 421 code = -1;
422 goto cleanup_ftp_login; 422 goto cleanup_ftp_login;
423 } else if (nlen == 0) { 423 } else if (nlen == 0) {
424 user = ftp_strdup(localname); 424 user = ftp_strdup(localname);
425 } else { 425 } else {
426 user = ftp_strdup(tmp); 426 user = ftp_strdup(tmp);
427 } 427 }
428 } 428 }
429 429
430 if (gatemode) { 430 if (gatemode) {
431 char *nuser; 431 char *nuser;
@@ -513,27 +513,27 @@ another(int *pargc, char ***pargv, const @@ -513,27 +513,27 @@ another(int *pargc, char ***pargv, const
513{ 513{
514 const char *errormsg; 514 const char *errormsg;
515 int ret, nlen; 515 int ret, nlen;
516 size_t len; 516 size_t len;
517 517
518 len = strlen(line); 518 len = strlen(line);
519 if (len >= sizeof(line) - 3) { 519 if (len >= sizeof(line) - 3) {
520 fputs("Sorry, arguments too long.\n", ttyout); 520 fputs("Sorry, arguments too long.\n", ttyout);
521 intr(0); 521 intr(0);
522 } 522 }
523 fprintf(ttyout, "(%s) ", prompt); 523 fprintf(ttyout, "(%s) ", prompt);
524 line[len++] = ' '; 524 line[len++] = ' ';
525 errormsg = NULL; 525 errormsg = NULL;
526 nlen = getline(stdin, line + len, sizeof(line)-len, &errormsg); 526 nlen = get_line(stdin, line + len, sizeof(line)-len, &errormsg);
527 if (nlen < 0) { 527 if (nlen < 0) {
528 fprintf(ttyout, "%s; %s aborted.\n", errormsg, "operation"); 528 fprintf(ttyout, "%s; %s aborted.\n", errormsg, "operation");
529 intr(0); 529 intr(0);
530 } 530 }
531 len += nlen; 531 len += nlen;
532 makeargv(); 532 makeargv();
533 ret = margc > *pargc; 533 ret = margc > *pargc;
534 *pargc = margc; 534 *pargc = margc;
535 *pargv = margv; 535 *pargv = margv;
536 return (ret); 536 return (ret);
537} 537}
538 538
539/* 539/*
@@ -1278,27 +1278,27 @@ isipv6addr(const char *addr) @@ -1278,27 +1278,27 @@ isipv6addr(const char *addr)
1278 * If the line has a trailing newline it will be removed. 1278 * If the line has a trailing newline it will be removed.
1279 * If the line is too long, excess characters will be read until 1279 * If the line is too long, excess characters will be read until
1280 * newline/EOF/error. 1280 * newline/EOF/error.
1281 * If EOF/error occurs or a too-long line is encountered and errormsg 1281 * If EOF/error occurs or a too-long line is encountered and errormsg
1282 * isn't NULL, it will be changed to a description of the problem. 1282 * isn't NULL, it will be changed to a description of the problem.
1283 * (The EOF message has a leading \n for cosmetic purposes). 1283 * (The EOF message has a leading \n for cosmetic purposes).
1284 * Returns: 1284 * Returns:
1285 * >=0 length of line (excluding trailing newline) if all ok 1285 * >=0 length of line (excluding trailing newline) if all ok
1286 * -1 error occurred 1286 * -1 error occurred
1287 * -2 EOF encountered 1287 * -2 EOF encountered
1288 * -3 line was too long 1288 * -3 line was too long
1289 */ 1289 */
1290int 1290int
1291getline(FILE *stream, char *buf, size_t buflen, const char **errormsg) 1291get_line(FILE *stream, char *buf, size_t buflen, const char **errormsg)
1292{ 1292{
1293 int rv, ch; 1293 int rv, ch;
1294 size_t len; 1294 size_t len;
1295 1295
1296 if (fgets(buf, buflen, stream) == NULL) { 1296 if (fgets(buf, buflen, stream) == NULL) {
1297 if (feof(stream)) { /* EOF */ 1297 if (feof(stream)) { /* EOF */
1298 rv = -2; 1298 rv = -2;
1299 if (errormsg) 1299 if (errormsg)
1300 *errormsg = "\nEOF received"; 1300 *errormsg = "\nEOF received";
1301 } else { /* error */ 1301 } else { /* error */
1302 rv = -1; 1302 rv = -1;
1303 if (errormsg) 1303 if (errormsg)
1304 *errormsg = "Error encountered"; 1304 *errormsg = "Error encountered";

cvs diff -r1.6 -r1.7 pkgsrc/net/tnftp/files/src/Attic/extern.h (expand / switch to unified diff)

--- pkgsrc/net/tnftp/files/src/Attic/extern.h 2008/04/29 05:46:09 1.6
+++ pkgsrc/net/tnftp/files/src/Attic/extern.h 2009/09/22 20:39:18 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: extern.h,v 1.6 2008/04/29 05:46:09 martin Exp $ */ 1/* $NetBSD: extern.h,v 1.7 2009/09/22 20:39:18 tnn Exp $ */
2/* from NetBSD: extern.h,v 1.72 2007/05/24 05:05:18 lukem Exp */ 2/* from NetBSD: extern.h,v 1.72 2007/05/24 05:05:18 lukem Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1996-2007 The NetBSD Foundation, Inc. 5 * Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Luke Mewburn. 9 * by Luke Mewburn.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -125,27 +125,27 @@ void do_chmod(int, char **); @@ -125,27 +125,27 @@ void do_chmod(int, char **);
125void do_umask(int, char **); 125void do_umask(int, char **);
126void domacro(int, char **); 126void domacro(int, char **);
127void doproxy(int, char **); 127void doproxy(int, char **);
128void feat(int, char **); 128void feat(int, char **);
129void fget(int, char **); 129void fget(int, char **);
130int fileindir(const char *, const char *); 130int fileindir(const char *, const char *);
131int foregroundproc(void); 131int foregroundproc(void);
132void formatbuf(char *, size_t, const char *); 132void formatbuf(char *, size_t, const char *);
133void ftpvis(char *, size_t, const char *, size_t); 133void ftpvis(char *, size_t, const char *, size_t);
134int ftp_login(const char *, const char *, const char *); 134int ftp_login(const char *, const char *, const char *);
135void get(int, char **); 135void get(int, char **);
136struct cmd *getcmd(const char *); 136struct cmd *getcmd(const char *);
137int getit(int, char **, int, const char *); 137int getit(int, char **, int, const char *);
138int getline(FILE *, char *, size_t, const char **); 138int get_line(FILE *, char *, size_t, const char **);
139struct option *getoption(const char *); 139struct option *getoption(const char *);
140char *getoptionvalue(const char *); 140char *getoptionvalue(const char *);
141void getremoteinfo(void); 141void getremoteinfo(void);
142int getreply(int); 142int getreply(int);
143char *globulize(const char *); 143char *globulize(const char *);
144char *gunique(const char *); 144char *gunique(const char *);
145void help(int, char **); 145void help(int, char **);
146char *hookup(char *, char *); 146char *hookup(char *, char *);
147void idlecmd(int, char **); 147void idlecmd(int, char **);
148int initconn(void); 148int initconn(void);
149void intr(int); 149void intr(int);
150int isipv6addr(const char *); 150int isipv6addr(const char *);
151void list_vertical(StringList *); 151void list_vertical(StringList *);

cvs diff -r1.7 -r1.8 pkgsrc/net/tnftp/files/src/Attic/fetch.c (expand / switch to unified diff)

--- pkgsrc/net/tnftp/files/src/Attic/fetch.c 2008/04/29 05:46:09 1.7
+++ pkgsrc/net/tnftp/files/src/Attic/fetch.c 2009/09/22 20:39:18 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fetch.c,v 1.7 2008/04/29 05:46:09 martin Exp $ */ 1/* $NetBSD: fetch.c,v 1.8 2009/09/22 20:39:18 tnn Exp $ */
2/* from NetBSD: fetch.c,v 1.180 2007/06/05 00:31:20 lukem Exp */ 2/* from NetBSD: fetch.c,v 1.180 2007/06/05 00:31:20 lukem Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1997-2007 The NetBSD Foundation, Inc. 5 * Copyright (c) 1997-2007 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Luke Mewburn. 9 * by Luke Mewburn.
10 * 10 *
11 * This code is derived from software contributed to The NetBSD Foundation 11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Scott Aaron Bamford. 12 * by Scott Aaron Bamford.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -182,27 +182,27 @@ auth_url(const char *challenge, char **r @@ -182,27 +182,27 @@ auth_url(const char *challenge, char **r
182 (void)strlcpy(realm, cp, len + 1); 182 (void)strlcpy(realm, cp, len + 1);
183 } else { 183 } else {
184 warnx("Unsupported authentication challenge `%s'", 184 warnx("Unsupported authentication challenge `%s'",
185 challenge); 185 challenge);
186 goto cleanup_auth_url; 186 goto cleanup_auth_url;
187 } 187 }
188 188
189 fprintf(ttyout, "Username for `%s': ", realm); 189 fprintf(ttyout, "Username for `%s': ", realm);
190 if (guser != NULL) { 190 if (guser != NULL) {
191 (void)strlcpy(user, guser, sizeof(user)); 191 (void)strlcpy(user, guser, sizeof(user));
192 fprintf(ttyout, "%s\n", user); 192 fprintf(ttyout, "%s\n", user);
193 } else { 193 } else {
194 (void)fflush(ttyout); 194 (void)fflush(ttyout);
195 if (getline(stdin, user, sizeof(user), &errormsg) < 0) { 195 if (get_line(stdin, user, sizeof(user), &errormsg) < 0) {
196 warnx("%s; can't authenticate", errormsg); 196 warnx("%s; can't authenticate", errormsg);
197 goto cleanup_auth_url; 197 goto cleanup_auth_url;
198 } 198 }
199 } 199 }
200 if (gpass != NULL) 200 if (gpass != NULL)
201 pass = (char *)gpass; 201 pass = (char *)gpass;
202 else { 202 else {
203 pass = getpass("Password: "); 203 pass = getpass("Password: ");
204 if (pass == NULL) { 204 if (pass == NULL) {
205 warnx("Can't read password"); 205 warnx("Can't read password");
206 goto cleanup_auth_url; 206 goto cleanup_auth_url;
207 } 207 }
208 } 208 }
@@ -822,51 +822,51 @@ fetch_url(const char *url, const char *p @@ -822,51 +822,51 @@ fetch_url(const char *url, const char *p
822 hasleading++; 822 hasleading++;
823 } 823 }
824 fprintf(fin, "Proxy-Authorization: %s\r\n", proxyauth); 824 fprintf(fin, "Proxy-Authorization: %s\r\n", proxyauth);
825 } 825 }
826 if (verbose && hasleading) 826 if (verbose && hasleading)
827 fputs(")\n", ttyout); 827 fputs(")\n", ttyout);
828 fprintf(fin, "\r\n"); 828 fprintf(fin, "\r\n");
829 if (fflush(fin) == EOF) { 829 if (fflush(fin) == EOF) {
830 warn("Writing HTTP request"); 830 warn("Writing HTTP request");
831 goto cleanup_fetch_url; 831 goto cleanup_fetch_url;
832 } 832 }
833 833
834 /* Read the response */ 834 /* Read the response */
835 len = getline(fin, buf, sizeof(buf), &errormsg); 835 len = get_line(fin, buf, sizeof(buf), &errormsg);
836 if (len < 0) { 836 if (len < 0) {
837 if (*errormsg == '\n') 837 if (*errormsg == '\n')
838 errormsg++; 838 errormsg++;
839 warnx("Receiving HTTP reply: %s", errormsg); 839 warnx("Receiving HTTP reply: %s", errormsg);
840 goto cleanup_fetch_url; 840 goto cleanup_fetch_url;
841 } 841 }
842 while (len > 0 && (ISLWS(buf[len-1]))) 842 while (len > 0 && (ISLWS(buf[len-1])))
843 buf[--len] = '\0'; 843 buf[--len] = '\0';
844 DPRINTF("received `%s'\n", buf); 844 DPRINTF("received `%s'\n", buf);
845 845
846 /* Determine HTTP response code */ 846 /* Determine HTTP response code */
847 cp = strchr(buf, ' '); 847 cp = strchr(buf, ' ');
848 if (cp == NULL) 848 if (cp == NULL)
849 goto improper; 849 goto improper;
850 else 850 else
851 cp++; 851 cp++;
852 hcode = strtol(cp, &ep, 10); 852 hcode = strtol(cp, &ep, 10);
853 if (*ep != '\0' && !isspace((unsigned char)*ep)) 853 if (*ep != '\0' && !isspace((unsigned char)*ep))
854 goto improper; 854 goto improper;
855 message = ftp_strdup(cp); 855 message = ftp_strdup(cp);
856 856
857 /* Read the rest of the header. */ 857 /* Read the rest of the header. */
858 while (1) { 858 while (1) {
859 len = getline(fin, buf, sizeof(buf), &errormsg); 859 len = get_line(fin, buf, sizeof(buf), &errormsg);
860 if (len < 0) { 860 if (len < 0) {
861 if (*errormsg == '\n') 861 if (*errormsg == '\n')
862 errormsg++; 862 errormsg++;
863 warnx("Receiving HTTP reply: %s", errormsg); 863 warnx("Receiving HTTP reply: %s", errormsg);
864 goto cleanup_fetch_url; 864 goto cleanup_fetch_url;
865 } 865 }
866 while (len > 0 && (ISLWS(buf[len-1]))) 866 while (len > 0 && (ISLWS(buf[len-1])))
867 buf[--len] = '\0'; 867 buf[--len] = '\0';
868 if (len == 0) 868 if (len == 0)
869 break; 869 break;
870 DPRINTF("received `%s'\n", buf); 870 DPRINTF("received `%s'\n", buf);
871 871
872 /* 872 /*
@@ -1050,27 +1050,27 @@ fetch_url(const char *url, const char *p @@ -1050,27 +1050,27 @@ fetch_url(const char *url, const char *p
1050 if (verbose || *authp == NULL || 1050 if (verbose || *authp == NULL ||
1051 auser == NULL || apass == NULL) 1051 auser == NULL || apass == NULL)
1052 fprintf(ttyout, "%s\n", message); 1052 fprintf(ttyout, "%s\n", message);
1053 if (EMPTYSTRING(auth)) { 1053 if (EMPTYSTRING(auth)) {
1054 warnx( 1054 warnx(
1055 "No authentication challenge provided by server"); 1055 "No authentication challenge provided by server");
1056 goto cleanup_fetch_url; 1056 goto cleanup_fetch_url;
1057 } 1057 }
1058 if (*authp != NULL) { 1058 if (*authp != NULL) {
1059 char reply[10]; 1059 char reply[10];
1060 1060
1061 fprintf(ttyout, 1061 fprintf(ttyout,
1062 "Authorization failed. Retry (y/n)? "); 1062 "Authorization failed. Retry (y/n)? ");
1063 if (getline(stdin, reply, sizeof(reply), NULL) 1063 if (get_line(stdin, reply, sizeof(reply), NULL)
1064 < 0) { 1064 < 0) {
1065 goto cleanup_fetch_url; 1065 goto cleanup_fetch_url;
1066 } 1066 }
1067 if (tolower((unsigned char)reply[0]) != 'y') 1067 if (tolower((unsigned char)reply[0]) != 'y')
1068 goto cleanup_fetch_url; 1068 goto cleanup_fetch_url;
1069 auser = NULL; 1069 auser = NULL;
1070 apass = NULL; 1070 apass = NULL;
1071 } 1071 }
1072 if (auth_url(auth, authp, auser, apass) == 0) { 1072 if (auth_url(auth, authp, auser, apass) == 0) {
1073 rval = fetch_url(url, proxyenv, 1073 rval = fetch_url(url, proxyenv,
1074 proxyauth, wwwauth); 1074 proxyauth, wwwauth);
1075 memset(*authp, 0, strlen(*authp)); 1075 memset(*authp, 0, strlen(*authp));
1076 FREEPTR(*authp); 1076 FREEPTR(*authp);