+ g_snprintf(spindle, SIZEOF(spindle), "%d", dp->spindle);
+ spindlestr = vstralloc(" <spindle>",
+ spindle,
+ "</spindle>\n", NULL);
+ o = xml_optionstr(dp, 0);
+
+ if (strcmp(dp->program,"DUMP") == 0 ||
+ strcmp(dp->program,"GNUTAR") == 0) {
+ l = vstralloc("<dle>\n",
+ " <program>",
+ dp->program,
+ "</program>\n", NULL);
+ } else {
+ l = vstralloc("<dle>\n",
+ " <program>APPLICATION</program>\n",
+ NULL);
+ if (dp->application) {
+ application_t *application;
+ char *xml_app;
+
+ application = lookup_application(dp->application);
+ g_assert(application != NULL);
+ xml_app = xml_application(dp, application,
+ hostp->features);
+ vstrextend(&l, xml_app, NULL);
+ amfree(xml_app);
+ }
+ }
+
+ es = xml_estimate(dp->estimatelist, hostp->features);
+ vstrextend(&l, es, "\n", NULL);
+ amfree(es);
+ vstrextend(&l, " ", b64disk, "\n", NULL);
+ if (dp->device)
+ vstrextend(&l, " ", b64device, "\n", NULL);
+ vstrextend(&l, levelstr, spindlestr, o, "</dle>\n", NULL);
+ strappend(s, l);
+ s_len += strlen(l);
+ amfree(l);
+ amfree(levelstr);
+ amfree(spindlestr);
+ amfree(o);
+ } else if (strcmp(dp->program,"DUMP") != 0 &&
+ strcmp(dp->program,"GNUTAR") != 0) {
+ est(dp)->errstr = newvstrallocf(est(dp)->errstr,
+ _("does not support application-api"));
+ } else {
+ for(i = 0; i < MAX_LEVELS; i++) {
+ char *l;
+ char *exclude1 = "";
+ char *exclude2 = "";
+ char *excludefree = NULL;
+ char *include1 = "";
+ char *include2 = "";
+ char *includefree = NULL;
+ char spindle[NUM_STR_SIZE];
+ char level[NUM_STR_SIZE];
+ int lev = est(dp)->estimate[i].level;
+
+ if(lev == -1) break;
+
+ g_snprintf(level, SIZEOF(level), "%d", lev);
+ g_snprintf(spindle, SIZEOF(spindle), "%d", dp->spindle);
+ if (am_has_feature(hostp->features,
+ fe_sendsize_req_options)){
+ exclude1 = " OPTIONS |";
+ exclude2 = optionstr(dp);
+ if ( exclude2 == NULL ) {
+ error(_("problem with option string, check the dumptype definition.\n"));
+ }
+ excludefree = exclude2;
+ includefree = NULL;
+ } else {
+ if (dp->exclude_file &&
+ dp->exclude_file->nb_element == 1) {
+ exclude1 = " exclude-file=";
+ exclude2 = quote_string(
+ dp->exclude_file->first->name);
+ excludefree = exclude2;
+ }
+ else if (dp->exclude_list &&
+ dp->exclude_list->nb_element == 1) {
+ exclude1 = " exclude-list=";
+ exclude2 = quote_string(
+ dp->exclude_list->first->name);
+ excludefree = exclude2;
+ }
+ if (dp->include_file &&
+ dp->include_file->nb_element == 1) {
+ include1 = " include-file=";
+ include2 = quote_string(
+ dp->include_file->first->name);
+ includefree = include2;
+ }
+ else if (dp->include_list &&
+ dp->include_list->nb_element == 1) {
+ include1 = " include-list=";
+ include2 = quote_string(
+ dp->include_list->first->name);
+ includefree = include2;
+ }
+ }
+
+ if (estimate == ES_CALCSIZE &&
+ !am_has_feature(hostp->features,
+ fe_calcsize_estimate)) {
+ log_add(L_WARNING,
+ _("%s:%s does not support CALCSIZE for estimate, using CLIENT.\n"),
+ hostp->hostname, qname);
+ estimate = ES_CLIENT;
+ }
+ if(estimate == ES_CLIENT)
+ calcsize = "";
+ else
+ calcsize = "CALCSIZE ";
+
+ l = vstralloc(calcsize,
+ dp->program,
+ " ", qname,
+ " ", dp->device ? qdevice : "",
+ " ", level,
+ " ", est(dp)->estimate[i].dumpdate,
+ " ", spindle,
+ " ", exclude1, exclude2,
+ ((includefree != NULL) ? " " : ""),
+ include1, include2,
+ "\n",
+ NULL);
+ strappend(s, l);
+ s_len += strlen(l);
+ amfree(l);
+ amfree(includefree);
+ amfree(excludefree);