-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
48 lines (40 loc) · 857 Bytes
/
main.cpp
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
#include <stdio.h>
#include "filesys.h"
struct hinode hinode[NHINO];
struct dir dir;
struct file sys_ofile[SYSOPENFILE];
struct filsys filsys;
struct pwd pwd[PWDNUM];
struct user user[USERNUM];
struct inode* cur_path_inode;
int user_id;
char disk[(DINODEBLK+FILEBLK+2)*BLOCKSIZ];
char str[100];
int main(){
int username;
char password[16];
char wd[2048];
user_id = -1;
format();
install();
printf("Welcome to mini filesystem!\n");
while(user_id == -1){
printf("Login:");
scanf("%d",&username);
printf("Password:");
scanf("%s",password);
int c;
while ((c = getchar()) != '\n' && c != EOF);
user_id = login(username,password);
}
do{
_pwd(wd);
printf("%s", wd);
printf("> ");
fflush(stdin);
gets_s(str, 99);//100-1 cuz '\0'
}while(shell(user_id,str));
logout(user_id);
halt();
return 0;
}