summaryrefslogtreecommitdiff
path: root/testing.c
blob: a557450a05d514d02b528e39413a4acb3a8d31eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}