diff options
Diffstat (limited to 'src/util/disk.c')
-rw-r--r-- | src/util/disk.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/src/util/disk.c b/src/util/disk.c index 8dc1e35bf..0d24d5a09 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -1928,78 +1928,6 @@ GNUNET_DISK_get_handle_from_native (FILE *fd) | |||
1928 | 1928 | ||
1929 | 1929 | ||
1930 | /** | 1930 | /** |
1931 | * Construct full path to a file inside of the private | ||
1932 | * directory used by GNUnet. Also creates the corresponding | ||
1933 | * directory. If the resulting name is supposed to be | ||
1934 | * a directory, end the last argument in '/' (or pass | ||
1935 | * DIR_SEPARATOR_STR as the last argument before NULL). | ||
1936 | * | ||
1937 | * @param cfg configuration to use (determines HOME) | ||
1938 | * @param service_name name of the service | ||
1939 | * @param ... is NULL-terminated list of | ||
1940 | * path components to append to the | ||
1941 | * private directory name. | ||
1942 | * @return the constructed filename | ||
1943 | */ | ||
1944 | char * | ||
1945 | GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1946 | const char *service_name, ...) | ||
1947 | { | ||
1948 | const char *c; | ||
1949 | char *pfx; | ||
1950 | char *ret; | ||
1951 | va_list ap; | ||
1952 | unsigned int needed; | ||
1953 | |||
1954 | if (GNUNET_OK != | ||
1955 | GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "HOME", &pfx)) | ||
1956 | return NULL; | ||
1957 | if (pfx == NULL) | ||
1958 | { | ||
1959 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1960 | _("No `%s' specified for service `%s' in configuration.\n"), "HOME", | ||
1961 | service_name); | ||
1962 | return NULL; | ||
1963 | } | ||
1964 | needed = strlen (pfx) + 2; | ||
1965 | if ((pfx[strlen (pfx) - 1] != '/') && (pfx[strlen (pfx) - 1] != '\\')) | ||
1966 | needed++; | ||
1967 | va_start (ap, service_name); | ||
1968 | while (1) | ||
1969 | { | ||
1970 | c = va_arg (ap, const char *); | ||
1971 | |||
1972 | if (c == NULL) | ||
1973 | break; | ||
1974 | needed += strlen (c); | ||
1975 | if ((c[strlen (c) - 1] != '/') && (c[strlen (c) - 1] != '\\')) | ||
1976 | needed++; | ||
1977 | } | ||
1978 | va_end (ap); | ||
1979 | ret = GNUNET_malloc (needed); | ||
1980 | strcpy (ret, pfx); | ||
1981 | GNUNET_free (pfx); | ||
1982 | va_start (ap, service_name); | ||
1983 | while (1) | ||
1984 | { | ||
1985 | c = va_arg (ap, const char *); | ||
1986 | |||
1987 | if (c == NULL) | ||
1988 | break; | ||
1989 | if ((c[strlen (c) - 1] != '/') && (c[strlen (c) - 1] != '\\')) | ||
1990 | strcat (ret, DIR_SEPARATOR_STR); | ||
1991 | strcat (ret, c); | ||
1992 | } | ||
1993 | va_end (ap); | ||
1994 | if ((ret[strlen (ret) - 1] != '/') && (ret[strlen (ret) - 1] != '\\')) | ||
1995 | (void) GNUNET_DISK_directory_create_for_file (ret); | ||
1996 | else | ||
1997 | (void) GNUNET_DISK_directory_create (ret); | ||
1998 | return ret; | ||
1999 | } | ||
2000 | |||
2001 | |||
2002 | /** | ||
2003 | * Handle for a memory-mapping operation. | 1931 | * Handle for a memory-mapping operation. |
2004 | */ | 1932 | */ |
2005 | struct GNUNET_DISK_MapHandle | 1933 | struct GNUNET_DISK_MapHandle |