projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 3.1.0
[debian/amanda]
/
server-src
/
tapefile.c
diff --git
a/server-src/tapefile.c
b/server-src/tapefile.c
index 52ece52ee4fba44a0f21f616dc28af4d512cbe42..d3afe12bbfd42bb467554ad395c48578e3f1b581 100644
(file)
--- a/
server-src/tapefile.c
+++ b/
server-src/tapefile.c
@@
-29,6
+29,7
@@
* routines to read and write the amanda active tape list
*/
#include "amanda.h"
* routines to read and write the amanda active tape list
*/
#include "amanda.h"
+#include "match.h"
#include "tapefile.h"
#include "conffile.h"
#include "tapefile.h"
#include "conffile.h"
@@
-133,7
+134,7
@@
clear_tapelist(void)
tape_t *
lookup_tapelabel(
tape_t *
lookup_tapelabel(
- char *label)
+ c
onst c
har *label)
{
tape_t *tp;
{
tape_t *tp;
@@
-182,6
+183,15
@@
lookup_nb_tape(void)
return pos;
}
return pos;
}
+
+char *
+get_last_reusable_tape_label(
+ int skip)
+{
+ tape_t *tp = lookup_last_reusable_tape(skip);
+ return (tp != NULL) ? tp->label : NULL;
+}
+
tape_t *
lookup_last_reusable_tape(
int skip)
tape_t *
lookup_last_reusable_tape(
int skip)
@@
-470,12
+480,12
@@
stamp2time(
return mktime(tm);
}
return mktime(tm);
}
-void
-print_new_tapes(
- FILE *output,
- int nb)
+char *
+list_new_tapes(
+ int nb)
{
tape_t *lasttp, *iter;
{
tape_t *lasttp, *iter;
+ char *result = NULL;
/* Find latest reusable new tape */
lasttp = lookup_tapepos(lookup_nb_tape());
/* Find latest reusable new tape */
lasttp = lookup_tapepos(lookup_nb_tape());
@@
-495,23
+505,36
@@
print_new_tapes(
}
if(c == 1) {
}
if(c == 1) {
- g_fprintf(output,
-
_("The next new tape already labelled is: %s.\n
"),
- lasttp->label);
+ result = g_strdup_printf(
+
_("The next new tape already labelled is: %s.
"),
+
lasttp->label);
} else {
} else {
- g_fprintf(output,
- _("The next %d new tapes already labelled are: %s"),
- c, lasttp->label);
+ result = g_strdup_printf(
+
_("The next %d new tapes already labelled are: %s"),
+
c, lasttp->label);
iter = lasttp->prev;
c--;
while(iter && c > 0 && strcmp(iter->datestamp,"0") == 0) {
if (iter->reuse) {
iter = lasttp->prev;
c--;
while(iter && c > 0 && strcmp(iter->datestamp,"0") == 0) {
if (iter->reuse) {
-
g_fprintf(output, ", %s", iter->label
);
+
result = vstrextend(&result, ", ", iter->label, NULL
);
c--;
}
iter = iter->prev;
}
c--;
}
iter = iter->prev;
}
- g_fprintf(output, ".\n");
}
}
}
}
+ return result;
+}
+
+void
+print_new_tapes(
+ FILE *output,
+ int nb)
+{
+ char *result = list_new_tapes(nb);
+
+ if (result) {
+ g_fprintf(output,"%s\n", result);
+ amfree(result);
+ }
}
}