gnunet-fuse

GNUnet file-sharing directory mounting via FUSE
Log | Files | Refs | Submodules | README | LICENSE

commit 475ed1ce3a0579a3ec8aac8ea71482af6fe54b88
parent 49b0ca7160af463278e07a461b1084d579069c23
Author: David Barksdale <amatus.amongus@gmail.com>
Date:   Sat,  9 Jun 2007 05:02:41 +0000

Forgot to add a new file

Diffstat:
Aspecial_file.c | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+), 0 deletions(-)

diff --git a/special_file.c b/special_file.c @@ -0,0 +1,52 @@ +/* + * special_file.c - special file support (like .uri) + * + * This file is part of gnunet-fuse. + * Copyright (C) 2007 David Barksdale + * + * gnunet-fuse is free software; you can redistribute it and/or + * modify if under the terms of version 2 of the GNU General Public License + * as published by the Free Software Foundation. + * + * gnunet-fuse is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <string.h> +#include <GNUnet/gnunet_util_string.h> +#include <GNUnet/gnunet_ecrs_lib.h> +#include "gnfs.h" + +char *gn_get_special_file(const char *path) +{ + struct dirent *de; + char *parent, *buf = NULL; + int len; + + len = strlen(path); + if(len >= URI_LEN && strcmp(&path[len - URI_LEN], URI_FILE) == 0) + { + char *uri; + + parent = STRDUP(path); + parent[len - URI_LEN - 1] = '\0'; + de = gn_dirent_find(parent); + FREE(parent); + if(de == NULL) + return NULL; + uri = ECRS_uriToString(de->de_uri); + gn_dirent_put(de); + buf = MALLOC(strlen(uri) + 1); + strcpy(buf, uri); + FREE(uri); + strcat(buf, "\n"); + } + /* else if next case */ + return buf; +}