From 4fac5916dff238ec8812ffca04e26fafe9c72eec Mon Sep 17 00:00:00 2001 From: Brandon Mikulka Date: Fri, 17 Apr 2015 11:33:15 -0600 Subject: [PATCH] get arguments working --- .gitignore | 1 + pa5-encfs.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2e61324..b9932a5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,6 @@ fusehello fusexmp pa5-encfs xattr-util +/test .DS_STORE diff --git a/pa5-encfs.c b/pa5-encfs.c index 2a45172..079e25c 100644 --- a/pa5-encfs.c +++ b/pa5-encfs.c @@ -11,6 +11,7 @@ #endif #include +#include #include #include #include @@ -22,6 +23,9 @@ #include #endif +char mirrorDir[256]; +char keyPhrase[256]; + static int xmp_getattr(const char *path, struct stat *stbuf) { int res; @@ -384,8 +388,25 @@ static struct fuse_operations xmp_oper = { #endif }; +void usage(){ + printf("Usage: ./pa5-encfs "); +} + int main(int argc, char *argv[]) { + if(argc < 3){ + usage(); + exit(EXIT_FAILURE); + } + + strncpy(keyPhrase, argv[1], sizeof(keyPhrase)); + strncpy(mirrorDir, argv[2], sizeof(mirrorDir)); + + printf("Key Phrase: %s \n", keyPhrase); + printf("Mirror Directory: %s \n", mirrorDir); + + char *fuseArgs[] = {argv[0], argv[3], "-d"}; + umask(0); - return fuse_main(argc, argv, &xmp_oper, NULL); + return fuse_main(2, fuseArgs, &xmp_oper, NULL); }