Skip to content

Commit

Permalink
get arguments working
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Mikulka committed Apr 17, 2015
1 parent 8bdc3a2 commit 4fac591
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ fusehello
fusexmp
pa5-encfs
xattr-util
/test

.DS_STORE
23 changes: 22 additions & 1 deletion pa5-encfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#endif

#include <fuse.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
Expand All @@ -22,6 +23,9 @@
#include <sys/xattr.h>
#endif

char mirrorDir[256];
char keyPhrase[256];

static int xmp_getattr(const char *path, struct stat *stbuf)
{
int res;
Expand Down Expand Up @@ -384,8 +388,25 @@ static struct fuse_operations xmp_oper = {
#endif
};

void usage(){
printf("Usage: ./pa5-encfs <key-phrase> <mirror-dir> <mount-point>");
}

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);
}

0 comments on commit 4fac591

Please sign in to comment.