- lastname = "??";
- ITITERATE(i, dtwalk) {
- if (strncmp(lastname, dtwalk->dd_name,
- sizeof(dtwalk->dd_name)) == 0)
- continue;
- date = (char *)ctime(&dtwalk->dd_ddate);
- date[16] = '\0'; /* blast away seconds and year */
- lastname = dtwalk->dd_name;
- dt = fstabsearch(dtwalk->dd_name);
- dumpme = (dt != NULL &&
- dt->fs_freq != 0 &&
- dtwalk->dd_ddate < tnow - (dt->fs_freq * 86400));
- if (arg != 'w' || dumpme)
- (void) printf(
- "%c %8s\t(%6s) Last dump: Level %c, Date %s\n",
- dumpme && (arg != 'w') ? '>' : ' ',
- dtwalk->dd_name,
- dt ? dt->fs_file : "",
- dtwalk->dd_level,
- date);
+
+ /* For files in dumpdates, get the last dump level and date */
+ if (ddatev != NULL) {
+ struct dumpdates *dtwalk = NULL;
+ int i;
+ char *lastname;
+
+ qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort);
+
+ lastname = "??";
+ ITITERATE(i, dtwalk) {
+ struct mntent *dt;
+ if (strncmp(lastname, dtwalk->dd_name,
+ sizeof(dtwalk->dd_name)) == 0)
+ continue;
+ lastname = dtwalk->dd_name;
+ if ((dt = dtwalk->dd_fstab) != NULL) {
+ /* Overload fs_freq as dump level and
+ * fs_passno as date, because we can't
+ * change struct fstab format.
+ * A positive fs_freq means this
+ * filesystem needs to be dumped.
+ */
+ dt->mnt_passno = dtwalk->dd_ddate;
+ if (dt->mnt_freq > 0 && (dtwalk->dd_ddate <
+ tnow - (dt->mnt_freq * 86400)))
+ dt->mnt_freq = dtwalk->dd_level;
+ else
+ dt->mnt_freq = -dtwalk->dd_level;
+#ifdef FDEBUG
+ printf("%s fs_freq set to %d\n", lastname,
+ dt->mnt_freq);
+#endif
+ }
+ }
+ }
+
+ /* print in /etc/fstab order only those filesystem types we can dump */
+ for (pf = table; pf != NULL; pf = pf->pf_next) {
+ struct mntent *dt = pf->pf_mntent;
+ char **type;
+
+ for (type = fstypes; *type != NULL; type++) {
+ if (strncmp(dt->mnt_type, *type,
+ sizeof(dt->mnt_type)) == 0) {
+ const char *disk = get_device_name(dt->mnt_fsname);
+ print_wmsg(arg, dt->mnt_freq > 0,
+ disk ? disk : dt->mnt_fsname,
+ dt->mnt_freq < 0 ? -dt->mnt_freq :
+ dt->mnt_freq,
+ dt->mnt_dir,
+ dt->mnt_passno);
+ }
+ }
+ }
+
+ /* print in /etc/dumpdates order if not in /etc/fstab */
+ if (ddatev != NULL) {
+ struct dumpdates *dtwalk = NULL;
+ char *lastname;
+ int i;
+
+ lastname = "??";
+ ITITERATE(i, dtwalk) {
+ if (strncmp(lastname, dtwalk->dd_name,
+ sizeof(dtwalk->dd_name)) == 0 ||
+ dtwalk->dd_fstab != NULL)
+ continue;
+ lastname = dtwalk->dd_name;
+ print_wmsg(arg, 0, dtwalk->dd_name,
+ dtwalk->dd_level, NULL, dtwalk->dd_ddate);
+ }