2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
4 * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved.
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of U.M. not be used in advertising or
12 * publicity pertaining to distribution of the software without specific,
13 * written prior permission. U.M. makes no representations about the
14 * suitability of this software for any purpose. It is provided "as is"
15 * without express or implied warranty.
17 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
19 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 * Author: James da Silva, Systems Design and Analysis Group
25 * Computer Science Department
26 * University of Maryland at College Park
29 * $Id: amindex.c,v 1.15 2006/05/25 01:47:19 johnfranks Exp $
47 char level_str[NUM_STR_SIZE];
56 while (pc < datebuf + SIZEOF(datebuf)) {
61 } else if (! isdigit (ch)) {
65 datebuf[SIZEOF(datebuf)-1] = '\0';
68 g_snprintf(level_str, SIZEOF(level_str), "%d", level);
71 host = sanitise_filename(host);
73 disk = sanitise_filename(disk);
76 conf_indexdir = config_dir_relative(getconf_str(CNF_INDEXDIR));
78 * Note: vstralloc() will stop at the first NULL, which might be
79 * "disk" or "dc" (datebuf) rather than the full file name.
81 buf = vstralloc(conf_indexdir, "/",
85 level_str, COMPRESS_SUFFIX,
88 amfree(conf_indexdir);
104 char level_str[NUM_STR_SIZE];
105 char datebuf[14 + 1];
113 while (pc < datebuf + sizeof(datebuf)) {
118 } else if (! isdigit (ch)) {
122 datebuf[sizeof(datebuf)-1] = '\0';
125 g_snprintf(level_str, sizeof(level_str), "%d", level);
128 host = sanitise_filename(host);
130 disk = sanitise_filename(disk);
133 conf_indexdir = config_dir_relative(getconf_str(CNF_INDEXDIR));
135 * Note: g_strjoin(NULL, ) will stop at the first NULL, which might be
136 * "disk" or "dc" (datebuf) rather than the full file name.
138 buf = g_strjoin(NULL, conf_indexdir, "/",
142 level_str, ".header",
145 amfree(conf_indexdir);
161 char level_str[NUM_STR_SIZE];
162 char datebuf[14 + 1];
170 while (pc < datebuf + SIZEOF(datebuf)) {
175 } else if (! isdigit (ch)) {
179 datebuf[SIZEOF(datebuf)-1] = '\0';
182 g_snprintf(level_str, SIZEOF(level_str), "%d", level);
185 host = old_sanitise_filename(host);
187 disk = old_sanitise_filename(disk);
190 conf_indexdir = config_dir_relative(getconf_str(CNF_INDEXDIR));
192 * Note: vstralloc() will stop at the first NULL, which might be
193 * "disk" or "dc" (datebuf) rather than the full file name.
195 buf = vstralloc(conf_indexdir, "/",
199 level_str, COMPRESS_SUFFIX,
202 amfree(conf_indexdir);