/*
* Base64-encode character string
* oops... isn't something similar in uuencode.c?
- * It would be better to use already existing code
+ * XXX: It would be better to use already existing code
*/
-char *base64enc(unsigned char *p, char *buf, int len) {
+static char *base64enc(unsigned char *p, char *buf, int len) {
char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
"0123456789+/";
/*
* Crack command line.
*/
- bb_opt_complementaly = "\203*";
+ bb_opt_complementally = "\203*";
bb_applet_long_options = wget_long_options;
opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", &fname_out, &headers_llist, &dir_prefix, &proxy_flag);
if (opt & WGET_OPT_CONTINUE) {
/* Guess an output filename */
if (!fname_out) {
- fname_out =
+ // Dirty hack. Needed because bb_get_last_path_component
+ // will destroy trailing / by storing '\0' in last byte!
+ if(target.path[strlen(target.path)-1]!='/') {
+ fname_out =
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
- curfile =
+ curfile =
#endif
- bb_get_last_path_component(target.path);
+ bb_get_last_path_component(target.path);
+ }
if (fname_out==NULL || strlen(fname_out)<1) {
fname_out =
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
{
- char *p;
-
if (s1) {
if (!s2) s2="";
fprintf(fp, "%s%s\r\n", s1, s2);
}
do {
- p = fgets(buf, 510, fp);
- if (!p)
+ char *buf_ptr;
+
+ if (fgets(buf, 510, fp) == NULL) {
bb_perror_msg_and_die("fgets()");
+ }
+ buf_ptr = strstr(buf, "\r\n");
+ if (buf_ptr) {
+ *buf_ptr = '\0';
+ }
} while (! isdigit(buf[0]) || buf[3] != ' ');
return atoi(buf);
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
"%02d:%02d ETA", i / 60, i % 60);
}
- write(fileno(stderr), buf, strlen(buf));
+ write(STDERR_FILENO, buf, strlen(buf));
if (flag == -1) {
struct sigaction sa;
#endif
/* Original copyright notice which applies to the CONFIG_FEATURE_WGET_STATUSBAR stuff,
- * much of which was blatently stolen from openssh. */
+ * much of which was blatantly stolen from openssh. */
/*-
* Copyright (c) 1992, 1993
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.71 2004/03/15 08:28:53 andersen Exp $
+ * $Id: wget.c,v 1.75 2004/10/08 08:27:40 andersen Exp $
*/