=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/main.c,v retrieving revision 1.88 retrieving revision 1.89 diff -c -r1.88 -r1.89 *** src/usr.bin/ftp/main.c 2014/07/11 03:31:52 1.88 --- src/usr.bin/ftp/main.c 2014/07/11 18:19:45 1.89 *************** *** 1,4 **** ! /* $OpenBSD: main.c,v 1.88 2014/07/11 03:31:52 lteo Exp $ */ /* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: main.c,v 1.89 2014/07/11 18:19:45 halex Exp $ */ /* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */ /* *************** *** 362,380 **** trace = 1; break; - case 'U': #ifndef SMALL ! if (httpuseragent) ! errx(1, "User-Agent was already defined"); ! /* Ensure that User-Agent value is in a single line. */ if (strcspn(optarg, "\r\n") != strlen(optarg)) errx(1, "Invalid User-Agent: %s.", optarg); if (asprintf(&httpuseragent, "User-Agent: %s", optarg) == -1) errx(1, "Can't allocate memory for HTTP(S) " "User-Agent"); - #endif /* !SMALL */ break; case 'v': verbose = 1; --- 362,378 ---- trace = 1; break; #ifndef SMALL ! case 'U': ! free (httpuseragent); if (strcspn(optarg, "\r\n") != strlen(optarg)) errx(1, "Invalid User-Agent: %s.", optarg); if (asprintf(&httpuseragent, "User-Agent: %s", optarg) == -1) errx(1, "Can't allocate memory for HTTP(S) " "User-Agent"); break; + #endif /* !SMALL */ case 'v': verbose = 1; *************** *** 394,399 **** --- 392,399 ---- #ifndef SMALL cookie_load(); #endif /* !SMALL */ + if (httpuseragent == NULL) + httpuseragent = HTTP_USER_AGENT; cpend = 0; /* no pending replies */ proxy = 0; /* proxy not active */