+/* Allow the user to select a set of datestamps from those in
+ * holding disks. The result can be passed to
+ * holding_get_files_for_flush. If less than two dates are
+ * available, then no user interaction takes place.
+ *
+ * @returns: a new GSList listing the selected datestamps
+ */
+static GSList *
+pick_datestamp(void)
+{
+ GSList *datestamp_list;
+ GSList *r_datestamp_list = NULL;
+ GSList *ds;
+ char **datestamps = NULL;
+ int i;
+ char *answer = NULL;
+ char *a = NULL;
+ int ch = 0;
+ char max_char = '\0', chupper = '\0';
+
+ datestamp_list = holding_get_all_datestamps();
+
+ if(g_slist_length(datestamp_list) < 2) {
+ return datestamp_list;
+ } else {
+ datestamps = alloc(g_slist_length(datestamp_list) * SIZEOF(char *));
+ for(ds = datestamp_list, i=0; ds != NULL; ds = ds->next,i++) {
+ datestamps[i] = (char *)ds->data; /* borrowing reference */
+ }
+
+ while(1) {
+ puts(_("\nMultiple Amanda runs in holding disks; please pick one by letter:"));
+ for(ds = datestamp_list, max_char = 'A';
+ ds != NULL && max_char <= 'Z';
+ ds = ds->next, max_char++) {
+ g_printf(" %c. %s\n", max_char, (char *)ds->data);
+ }
+ max_char--;
+ g_printf(_("Select datestamps to flush [A..%c or <enter> for all]: "), max_char);
+ fflush(stdout); fflush(stderr);
+ amfree(answer);
+ if ((answer = agets(stdin)) == NULL) {
+ clearerr(stdin);
+ continue;
+ }