samples: net: big_http_download: Fix POSIX compability
The sample documentation mentions that the sample can be built directly
on Linux, which was no longer the case. This commit fixes it.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <errno.h>
#include "mbedtls/md.h"
#define MAX_URL_LENGTH 256
#endif
+#if defined(CONFIG_SAMPLE_BIG_HTTP_DL_NUM_ITER)
+#define NUM_ITER CONFIG_SAMPLE_BIG_HTTP_DL_NUM_ITER
+#else
+#define NUM_ITER 0
+#endif
+
/* This URL is parsed in-place, so buffer must be non-const. */
static char download_url[MAX_URL_LENGTH] =
#if defined(CONFIG_SAMPLE_BIG_HTTP_DL_URL)
@@ -358,7 +365,7 @@ void main(void)
unsigned int total_bytes = 0U;
int resolve_attempts = 10;
bool is_tls = false;
- unsigned int num_iterations = CONFIG_SAMPLE_BIG_HTTP_DL_NUM_ITER;
+ unsigned int num_iterations = NUM_ITER;
bool redirect = false;
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
