+static void
+stat_on_signal (int signo)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction act;
+ act.sa_handler = sigstat;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (signo, &act, NULL);
+#else
+ signal (signo, sigstat);
+#endif
+}
+
+void
+set_stat_signal (const char *name)
+{
+ static struct sigtab
+ {
+ char *name;
+ int signo;
+ } sigtab[] = {
+ { "SIGUSR1", SIGUSR1 },
+ { "USR1", SIGUSR1 },
+ { "SIGUSR2", SIGUSR2 },
+ { "USR2", SIGUSR2 },
+ { "SIGHUP", SIGHUP },
+ { "HUP", SIGHUP },
+ { "SIGINT", SIGINT },
+ { "INT", SIGINT },
+ { "SIGQUIT", SIGQUIT },
+ { "QUIT", SIGQUIT }
+ };
+ struct sigtab *p;
+
+ for (p = sigtab; p < sigtab + sizeof (sigtab) / sizeof (sigtab[0]); p++)
+ if (strcmp (p->name, name) == 0)
+ {
+ stat_on_signal (p->signo);
+ return;
+ }
+ FATAL_ERROR ((0, 0, _("Unknown signal name: %s"), name));
+}
+
+\f
+struct textual_date
+{
+ struct textual_date *next;
+ struct timespec *ts;
+ const char *option;
+ const char *date;
+};
+
+static void
+get_date_or_file (struct tar_args *args, const char *option,
+ const char *str, struct timespec *ts)
+{
+ if (FILE_SYSTEM_PREFIX_LEN (str) != 0
+ || ISSLASH (*str)
+ || *str == '.')
+ {
+ struct stat st;
+ if (deref_stat (dereference_option, str, &st) != 0)
+ {
+ stat_error (str);
+ USAGE_ERROR ((0, 0, _("Date sample file not found")));
+ }
+ *ts = get_stat_mtime (&st);
+ }
+ else
+ {
+ if (! get_date (ts, str, NULL))
+ {
+ WARN ((0, 0, _("Substituting %s for unknown date format %s"),
+ tartime (*ts, false), quote (str)));
+ ts->tv_nsec = 0;
+ }
+ else
+ {
+ struct textual_date *p = xmalloc (sizeof (*p));
+ p->ts = ts;
+ p->option = option;
+ p->date = str;
+ p->next = args->textual_date;
+ args->textual_date = p;
+ }
+ }
+}
+
+static void
+report_textual_dates (struct tar_args *args)
+{
+ struct textual_date *p;
+ for (p = args->textual_date; p; )
+ {
+ struct textual_date *next = p->next;
+ char const *treated_as = tartime (*p->ts, true);
+ if (strcmp (p->date, treated_as) != 0)
+ WARN ((0, 0, _("Option %s: Treating date `%s' as %s"),
+ p->option, p->date, treated_as));
+ free (p);
+ p = next;
+ }
+}
+
+\f