X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Ftapefile.c;h=9a9cf3d5f4498b9ec0f0d53c5ebee516d680e1e5;hb=fb2bd066c2f8b34addafe48d62550e3033a59431;hp=ce120d06647ed2e0ae3016d93aea93a23b0d0b89;hpb=a6127998ee6dcab6bb034f6ca985b07804a86f9a;p=debian%2Famanda diff --git a/server-src/tapefile.c b/server-src/tapefile.c index ce120d0..9a9cf3d 100644 --- a/server-src/tapefile.c +++ b/server-src/tapefile.c @@ -443,3 +443,49 @@ stamp2time( return mktime(tm); } + +void +print_new_tapes( + FILE *output, + int nb) +{ + tape_t *lasttp, *iter; + + /* Find latest reusable new tape */ + lasttp = lookup_tapepos(lookup_nb_tape()); + while (lasttp && lasttp->reuse == 0) + lasttp = lasttp->prev; + + if(lasttp && nb > 0 && strcmp(lasttp->datestamp,"0") == 0) { + int c = 0; + iter = lasttp; + /* count the number of tapes we *actually* used */ + while(iter && nb > 0 && strcmp(iter->datestamp,"0") == 0) { + if (iter->reuse) { + c++; + nb--; + } + iter = iter->prev; + } + + if(c == 1) { + g_fprintf(output, + _("The next new tape already labelled is: %s.\n"), + lasttp->label); + } else { + g_fprintf(output, + _("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) { + g_fprintf(output, ", %s", iter->label); + c--; + } + iter = iter->prev; + } + g_fprintf(output, ".\n"); + } + } +}