gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r472 - in GNUnet: po src/applications/fs/ecrs


From: grothoff
Subject: [GNUnet-SVN] r472 - in GNUnet: po src/applications/fs/ecrs
Date: Mon, 21 Mar 2005 08:51:40 -0800 (PST)

Author: grothoff
Date: 2005-03-21 08:51:38 -0800 (Mon, 21 Mar 2005)
New Revision: 472

Modified:
   GNUnet/po/de.po
   GNUnet/src/applications/fs/ecrs/indexinfo.c
Log:
implementing indexinfo

Modified: GNUnet/po/de.po
===================================================================
--- GNUnet/po/de.po     2005-03-21 06:15:49 UTC (rev 471)
+++ GNUnet/po/de.po     2005-03-21 16:51:38 UTC (rev 472)
@@ -4844,7 +4844,7 @@
 
 #: src/transports/udp.c:260
 #, c-format
-msgid "Packet received from %d.%d.%d.%d:%d (UDP) failed format check."
+msgid "Packed received from %d.%d.%d.%d:%d (UDP) failed format check."
 msgstr ""
 
 #: src/transports/udp.c:271
@@ -4873,7 +4873,7 @@
 
 #: src/transports/udp6.c:261
 #, c-format
-msgid "Packet received from %s:%d (UDP6) failed format check."
+msgid "Packed received from %s:%d (UDP6) failed format check."
 msgstr ""
 
 #: src/transports/udp6.c:274

Modified: GNUnet/src/applications/fs/ecrs/indexinfo.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/indexinfo.c 2005-03-21 06:15:49 UTC (rev 
471)
+++ GNUnet/src/applications/fs/ecrs/indexinfo.c 2005-03-21 16:51:38 UTC (rev 
472)
@@ -66,15 +66,44 @@
                     struct iiC * cls) {
   char * fullName;
   char * lnkName;
+  size_t size;
+  int ret;
 
   if (cls->cnt == SYSERR)
     return;
-
-  // FIXME: implement!
+  fullName = MALLOC(strlen(dir) + strlen(fn) + 4);
+  strcpy(fullName, dir);
+  strcat(fullName, DIR_SEPARATOR_STR);
+  strcat(fullName, fn);
+  size = 256;
+  lnkName = MALLOC(size);
+  while (1) {
+    ret = READLINK(fullName,
+                  lnkName,
+                  size - 1);
+    if (ret == -1) {
+      if (errno == ENAMETOOLONG) {
+       GROW(lnkName,
+            size,
+            size * 2);
+       continue;
+      }      
+      if (errno != EINVAL) {
+       LOG_FILE_STRERROR(LOG_WARNING, "readlink", fullName);
+      }
+      FREE(lnkName);
+      FREE(fullName);
+      return; /* error */
+    } else {
+      lnkName[ret] = '\0';
+      break;
+    }
+  }
   cls->cnt++;
   if (OK != cls->iterator(lnkName,
                          cls->closure))
     cls->cnt = SYSERR;
+  FREE(fullName);      
   FREE(lnkName);
 }
 
@@ -92,6 +121,7 @@
  */
 int ECRS_iterateIndexedFiles(ECRS_FileIterator iterator,
                             void * closure) {
+  char * tmp;
   char * indexDirectory;
   GNUNET_TCP_SOCKET * sock;
   struct iiC cls;
@@ -99,10 +129,15 @@
   sock = getClientSocket();
   if (sock == NULL)
     return 0;
-  indexDirectory = getConfigurationOptionValue(sock,
-                                              "FIXME",
-                                              "FIXME");
+  tmp = getConfigurationOptionValue(sock,
+                                   "FS",
+                                   "INDEX-DIRECTORY");
   releaseClientSocket(sock);
+  if (tmp == NULL) {
+    return 0;
+  }
+  indexDirectory = expandFileName(tmp);
+  FREE(tmp);
   cls.iterator = iterator;
   cls.closure = closure;
   cls.cnt = 0;





reply via email to

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