aboutsummaryrefslogtreecommitdiff
path: root/src/net.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-05-27 23:37:23 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-05-27 23:37:23 +0200
commitdf1df2929646abd77955b80e3ded3574ac005179 (patch)
tree9704901455843d41180a9402ed4c0012a1d67f04 /src/net.c
parent68c20667ca775a4d4a7d1cfc3c9ec5c30f275084 (diff)
downloadpolecat-df1df2929646abd77955b80e3ded3574ac005179.tar.gz
polecat-df1df2929646abd77955b80e3ded3574ac005179.zip
allow flags to exit prematurely, move defines, add no networking flag
Diffstat (limited to 'src/net.c')
-rw-r--r--src/net.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/net.c b/src/net.c
index bf03a07..f58e8fe 100644
--- a/src/net.c
+++ b/src/net.c
@@ -44,6 +44,8 @@ static inline int xferinfo(UNUSED void *p, curl_off_t dltotal, curl_off_t dlnow,
struct MemoryStruct* downloadToRam(const char* URL, int progress)
{
+ if (no_net) return NULL;
+
CURL* curl_handle;
CURLcode res = CURLE_OK;
@@ -138,6 +140,10 @@ struct json_object* fetchJSON(const char* URL)
free(chunk->memory);
free(chunk);
}
+ else if (isatty(STDERR_FILENO))
+ {
+ fprintf(stderr, "Couldn't fetch JSON\n");
+ }
return json;
}