gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4973 - gnunet-fuse


From: gnunet
Subject: [GNUnet-SVN] r4973 - gnunet-fuse
Date: Fri, 8 Jun 2007 23:02:44 -0600 (MDT)

Author: amatus
Date: 2007-06-08 23:02:41 -0600 (Fri, 08 Jun 2007)
New Revision: 4973

Added:
   gnunet-fuse/special_file.c
Log:
Forgot to add a new file

Added: gnunet-fuse/special_file.c
===================================================================
--- gnunet-fuse/special_file.c                          (rev 0)
+++ gnunet-fuse/special_file.c  2007-06-09 05:02:41 UTC (rev 4973)
@@ -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;
+}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]