diff options
author | Ian C <ianc@noddybox.co.uk> | 2024-12-26 19:05:07 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2024-12-26 19:05:07 +0000 |
commit | aa33cb940bb31c74903fb7dc26e5d2f264064911 (patch) | |
tree | b9c5603ad71080b4f23a6b0473b33160e039f058 /dload.c | |
parent | 80b1b51911e8c4221e918b50039caf7533751e4c (diff) |
Dev check in. Added tester.
Diffstat (limited to 'dload.c')
-rw-r--r-- | dload.c | 50 |
1 files changed, 47 insertions, 3 deletions
@@ -25,6 +25,8 @@ #include <stdlib.h> #include <stdio.h> +#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; } |