.
0 0
../
0 0

transact-sql


 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "burg.h"

creds user_creds;

void memset(void *ptr, uint8_t byte, uint32_t len){
	uint32_t i = 0;
	while (i < len){
		((uint8_t *) ptr)[i] = byte;
		i++;
	}
}

uint8_t strncmp(char *a, char *b, uint32_t mlen){
	uint32_t i = 0;
	while (a[i] == b[i] && i < mlen){
		i++;
	}
	return (a[i] - b[i]);
}

int main() {
	// reading from floppy
	sinit();
	sprint("BURG loading.\n");
	sprint("Welcome to BURG!\n");
	memset(&user_creds, 0,  sizeof(creds));

	sprint("username >> ");
	sgets(user_creds.username, 32);
	sprint("password >> ");
	sgets(user_creds.password, 32);
	if (strncmp(user_creds.username, "burg_admin", sizeof("burg_admin")) != 0){
		sprint("Get off grub enjoyer\n");
		return (0);
	}
	if (strncmp(user_creds.password, PASS, sizeof(PASS)) != 0){
		sprint("Yeah you might wanna contact burg_admin\n");
		return (0);
	}
	sprint("error: no such partition.\n");
	sprint("Entering rescue mode...\n");
	sprint("burg rescue> ");

	return 0;
}