Skip to content

Commit

Permalink
Extern argument added
Browse files Browse the repository at this point in the history
  • Loading branch information
taralesca committed Jan 13, 2019
1 parent 34c35be commit 6f134b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion sifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
#include <fuse.h>

extern int fd, fdd;
extern char* argument;
int fd, fdd;
char *argument;
/*
* Command line options
*
Expand Down Expand Up @@ -98,7 +100,7 @@ int populate_tree_directory(int fd, struct node *dir) {
free(auxTar);
break;
}

// Creating node
//auxNode = malloc(sizeof(struct node));
auxNode = calloc(1, sizeof(struct node));
Expand Down Expand Up @@ -284,6 +286,9 @@ int main(int argc, char **argv) {
else {
logger(DEBUG, "[main] Opened file2: %s\n", "testy.tar");
}

argument = malloc(strlen(argv[argc-1]));
strcpy(argument, argv[argc-1]);
// Moving reading head to beginning of file
lseek(fd, 0, SEEK_SET);

Expand Down
5 changes: 4 additions & 1 deletion src/destroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
int fd; /* gets value from sifs.c */
int fdd;
int enfd;

char * argument;
void print_tree2(struct node *n) {
//~ logger(DEBUG, "\t%s%d\n", n->header->name, strtoul(n->header->size, NULL, 8));
if(strcmp(n->header->name, "./") != 0){
Expand Down Expand Up @@ -58,6 +58,7 @@ void print_tree2(struct node *n) {
}

void sifs_destroy(void* private_data) {

lseek(fd, 0, SEEK_SET); /* move to the beginning of file */
//~ printf("FAILED!!!");
//~ }
Expand All @@ -66,6 +67,8 @@ void sifs_destroy(void* private_data) {
//parent = get_node_from_path(private_data,"/");
print_tree2((struct node*)private_data);



/*
lseek(fdd, 0, SEEK_END);
for (int i = 0; i < 18*512 - 10; i++){
Expand Down

0 comments on commit 6f134b8

Please sign in to comment.