Code

some cleanups
authorLennart Poettering <lennart@poettering.net>
Mon, 29 Mar 2004 18:23:21 +0000 (18:23 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 29 Mar 2004 18:23:21 +0000 (18:23 +0000)
git-svn-id: file:///home/lennart/svn/public/fusedav/trunk@4 e35a362c-bbd6-0310-a59f-a4efcb1729c4

src/Makefile
src/fusedav.c

index bea2a08f33d5abcfca1618161bd0ce97c2132852..e0dca3b1f83c0dff97eda10cdd955a6d99065382 100644 (file)
@@ -1,16 +1,13 @@
 CC=gcc
-CFLAGS=-g -Wall -pipe -O0 -I/usr/include/neon
+CFLAGS=-g -Wall -pipe -O0 -I/usr/include/neon -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -ansi
 LIBS=/usr/lib/libfuse.a -lpthread -lneon
 
-all: fusexmp fusedav
-
-fusexmp: fusexmp.o
-       $(CC) -o $@ $^ $(LIBS)
+all: fusedav
 
 fusedav: fusedav.o statcache.o filecache.o session.o openssl-thread.o
        $(CC) -o $@ $^ $(LIBS)
 
 clean:
-       rm -f *.o fusexmp fusedav
+       rm -f *.o fusedav
 
 .PHONY: clean all
index 17f1001738be8184abd8a050c66e8fbcab168a47..355feae2e8e6f7606e7499ff97913949cf6c4baf 100644 (file)
@@ -111,7 +111,9 @@ static void fill_stat(struct stat* st, const ne_prop_result_set *results, int is
     st->st_mtime = glm ? ne_rfc1123_parse(glm) : 0;
     st->st_ctime = cd ? ne_iso8601_parse(cd) : 0;
 
-    //fprintf(stderr, "a: %u; m: %u; c: %u\n", st->st_atime, st->st_mtime, st->st_ctime);
+
+    st->st_blocks = (st->st_size+511)/512;
+    /*fprintf(stderr, "a: %u; m: %u; c: %u\n", st->st_atime, st->st_mtime, st->st_ctime);*/
 
     st->st_mode &= ~mask;
     
@@ -612,7 +614,7 @@ static void usage(char *argv0) {
 }
 
 static void exit_handler(int s) {
-    static const char m[] = "Signal caught\n";
+    static const char m[] = "*** Caught signal ***\n";
     write(2, m, strlen(m));
     if(fuse != NULL)
         fuse_exit(fuse);
@@ -648,6 +650,8 @@ int main(int argc, char *argv[]) {
     char *u=NULL, *p = NULL;
     int fuse_fd = -1;
     int ret = 1;
+    char mountpoint[PATH_MAX];
+    static const char *mount_args[] = { "-n",  NULL, "-l", "-c", NULL };
 
     if (ne_sock_init()) {
         fprintf(stderr, "Failed to initialize libneon.\n");
@@ -696,7 +700,17 @@ int main(int argc, char *argv[]) {
         goto finish;
     }
 
-    if ((fuse_fd = fuse_mount(argv[optind+1], NULL)) < 0) {
+    if (argv[optind+1][0] == '/')
+        snprintf(mountpoint, sizeof(mountpoint), "%s", argv[optind+1]);
+    else {
+        char *pwd = get_current_dir_name();
+        snprintf(mountpoint, sizeof(mountpoint), "%s/%s", pwd, argv[optind+1]);
+        free(pwd);
+    }
+
+    mount_args[1] = argv[optind];
+    
+    if ((fuse_fd = fuse_mount(mountpoint, mount_args)) < 0) {
         fprintf(stderr, "Failed to mount FUSE file system.\n");
         goto finish;
     }
@@ -716,7 +730,7 @@ finish:
         fuse_destroy(fuse);
     
     if (fuse_fd >= 0)
-        fuse_unmount(argv[optind]);
+        fuse_unmount(mountpoint);
     
     file_cache_close_all();
     cache_free();