From 2b729ee1e0cb266bf50df0ca80f123f93384ac77 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 30 Jan 2020 22:04:43 -0600 Subject: Move TOYBOX_VERSION fallback definition to toys.h. (A git build takes it from "git describe".) --- main.c | 7 ------- toys.h | 7 +++++++ toys/pending/wget.c | 6 ++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index fc1461f6..ded73d99 100644 --- a/main.c +++ b/main.c @@ -5,13 +5,6 @@ #include "toys.h" -#ifndef TOYBOX_VERSION -#ifndef TOYBOX_VENDOR -#define TOYBOX_VENDOR "" -#endif -#define TOYBOX_VERSION "0.8.2"TOYBOX_VENDOR -#endif - // Populate toy_list[]. #undef NEWTOY diff --git a/toys.h b/toys.h index 177918a6..eb9208e4 100644 --- a/toys.h +++ b/toys.h @@ -126,3 +126,10 @@ extern char **environ; #define GLOBALS(...) #define ARRAY_LEN(array) (sizeof(array)/sizeof(*array)) #define TAGGED_ARRAY(X, ...) {__VA_ARGS__} + +#ifndef TOYBOX_VERSION +#ifndef TOYBOX_VENDOR +#define TOYBOX_VENDOR "" +#endif +#define TOYBOX_VERSION "0.8.3"TOYBOX_VENDOR +#endif diff --git a/toys/pending/wget.c b/toys/pending/wget.c index 405ed942..16672a24 100644 --- a/toys/pending/wget.c +++ b/toys/pending/wget.c @@ -135,7 +135,7 @@ void wget_main(void) FILE *fp; ssize_t len, body_len; char *body, *result, *rc, *r_str, *redir_loc = 0; - char ua[18] = "toybox wget", ver[6], hostname[1024], port[6], path[1024]; + char ua[18] = "toybox wget", hostname[1024], port[6], path[1024]; // TODO extract filename to be saved from URL if (!(toys.optflags & FLAG_O)) help_exit("no filename"); @@ -145,9 +145,7 @@ void wget_main(void) get_info(toys.optargs[0], hostname, port, path); -#ifdef TOYBOX_VERSION - strcat(ua, "/"), strncpy(ver, TOYBOX_VERSION, 5), strcat(ua, ver); -#endif + sprintf("/%s", TOYBOX_VERSION); for (;; redirects--) { sock = conn_svr(hostname, port); // compose HTTP request -- cgit v1.2.3