summaryrefslogtreecommitdiff
path: root/testing.c
diff options
context:
space:
mode:
authorkaa <kaa@disroot.org>2023-11-19 00:56:10 -0800
committerkaa <kaa@disroot.org>2023-11-19 00:56:10 -0800
commitc11b26e1f75b643997787b76f5181731058a28f9 (patch)
treed186d74acbe892e17b323a884e49868ed25532fd /testing.c
parent5a30f14c78f7f82c41680b983bea4ce2fa938226 (diff)
Basis for directory listing and file download.
Diffstat (limited to 'testing.c')
-rw-r--r--testing.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/testing.c b/testing.c
new file mode 100644
index 0000000..f50a0a7
--- /dev/null
+++ b/testing.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+enum {
+ cmdsize = 4096,
+};
+
+char *upload_key;
+char *base = "https://sdccd.instructure.com/api/v1/";
+
+int
+main(int argc, char **argv)
+{
+ if (argc < 2) {
+ fputs("Provide an API argument.\n", stderr);
+ return 1;
+ }
+ upload_key = getenv("CANKEY");
+ if (upload_key == NULL) {
+ return -1;
+ }
+ char *cmd = calloc(cmdsize, sizeof(char));
+ snprintf(cmd, cmdsize, "curl -X GET '%s%s' -H 'Authorization: Bearer %s'",
+ base, argv[1], upload_key);
+ puts(cmd);
+ system(cmd);
+ return 0;
+}