summaryrefslogtreecommitdiff
path: root/dload.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2024-12-26 19:05:07 +0000
committerIan C <ianc@noddybox.co.uk>2024-12-26 19:05:07 +0000
commitaa33cb940bb31c74903fb7dc26e5d2f264064911 (patch)
treeb9c5603ad71080b4f23a6b0473b33160e039f058 /dload.c
parent80b1b51911e8c4221e918b50039caf7533751e4c (diff)
Dev check in. Added tester.
Diffstat (limited to 'dload.c')
-rw-r--r--dload.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/dload.c b/dload.c
index 82236e0..9431ea3 100644
--- a/dload.c
+++ b/dload.c
@@ -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;
}