From aa33cb940bb31c74903fb7dc26e5d2f264064911 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 26 Dec 2024 19:05:07 +0000 Subject: Dev check in. Added tester. --- dload.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) (limited to 'dload.c') diff --git a/dload.c b/dload.c index 82236e0..9431ea3 100644 --- a/dload.c +++ b/dload.c @@ -25,6 +25,8 @@ #include #include +#include "wifi.h" + /* ---------------------------------------- MACROS */ @@ -47,7 +49,7 @@ static const char *dload_usage = "more details.\n" "\n" "usage:\n" -"dload http_url [dest_file]\n"; +".dload http_url [dest_file]\n"; /* ---------------------------------------- TYPES @@ -60,17 +62,59 @@ static const char *dload_usage = /* ---------------------------------------- PRIVATE FUNCTIONS */ +static const char *StatusCode(WifiStatus status) +{ + switch(status) + { + case eWifiNotAvailable: + return "Wifi not available"; + + case eWifiNotConnected: + return "Wifi not connected"; + + case eWifiUnknownHost: + return "Unknown host"; + + case eWifiFailedToWrite: + return "Failed to write to network"; + + case eWifiFailedToReceive: + return "Failed to read from network"; + + case eWifiTimeout: + return "Timeout"; + + case eWifiInvalidURL: + return "Invalid URL"; + + case eWifiOK: + return "OK"; + + default: + return "Error - unknown status code"; + } +} /* ---------------------------------------- MAIN */ int main(int argc, char *argv[]) { - if (!argv[1]) + WifiStatus status; + + if (argc < 2) { fprintf(stderr,"%s\n", dload_usage); - exit(EXIT_FAILURE); + return EXIT_FAILURE; + } + + /* + if ((status = WifiConnect()) != eWifiOK) + { + fprintf(stderr, "%s\n", StatusCode(status)); + return EXIT_FAILURE; } + */ return EXIT_SUCCESS; } -- cgit v1.2.3