1994-05-26 06:35:07 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1980, 1988, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lint
|
1998-06-15 06:58:13 +00:00
|
|
|
#if 0
|
1994-05-26 06:35:07 +00:00
|
|
|
static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94";
|
1998-06-15 06:58:13 +00:00
|
|
|
#endif
|
|
|
|
static const char rcsid[] =
|
1999-08-28 00:22:10 +00:00
|
|
|
"$FreeBSD$";
|
1994-05-26 06:35:07 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
2001-01-29 09:45:51 +00:00
|
|
|
#include <sys/queue.h>
|
1994-05-26 06:35:07 +00:00
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
2002-06-21 06:18:05 +00:00
|
|
|
#include <ufs/ufs/dinode.h>
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <fstab.h>
|
|
|
|
#include <grp.h>
|
2002-09-25 04:06:37 +00:00
|
|
|
#include <limits.h>
|
1994-05-26 06:35:07 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
2002-02-16 20:22:26 +00:00
|
|
|
#include <signal.h>
|
1994-05-26 06:35:07 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "dump.h"
|
|
|
|
#include "pathnames.h"
|
|
|
|
|
2002-03-20 22:49:40 +00:00
|
|
|
void alarmcatch(int);
|
|
|
|
int datesort(const void *, const void *);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Query the operator; This previously-fascist piece of code
|
|
|
|
* no longer requires an exact response.
|
|
|
|
* It is intended to protect dump aborting by inquisitive
|
|
|
|
* people banging on the console terminal to see what is
|
|
|
|
* happening which might cause dump to croak, destroying
|
|
|
|
* a large number of hours of work.
|
|
|
|
*
|
|
|
|
* Every 2 minutes we reprint the message, alerting others
|
|
|
|
* that dump needs attention.
|
|
|
|
*/
|
|
|
|
static int timeout;
|
2002-03-20 22:49:40 +00:00
|
|
|
static const char *attnmessage; /* attention message */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
int
|
2002-03-20 22:49:40 +00:00
|
|
|
query(const char *question)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
|
|
|
char replybuffer[64];
|
|
|
|
int back, errcount;
|
|
|
|
FILE *mytty;
|
|
|
|
|
|
|
|
if ((mytty = fopen(_PATH_TTY, "r")) == NULL)
|
|
|
|
quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
|
|
|
|
attnmessage = question;
|
|
|
|
timeout = 0;
|
2002-03-20 22:49:40 +00:00
|
|
|
alarmcatch(0);
|
1994-05-26 06:35:07 +00:00
|
|
|
back = -1;
|
|
|
|
errcount = 0;
|
|
|
|
do {
|
|
|
|
if (fgets(replybuffer, 63, mytty) == NULL) {
|
|
|
|
clearerr(mytty);
|
|
|
|
if (++errcount > 30) /* XXX ugly */
|
|
|
|
quit("excessive operator query failures\n");
|
|
|
|
} else if (replybuffer[0] == 'y' || replybuffer[0] == 'Y') {
|
|
|
|
back = 1;
|
|
|
|
} else if (replybuffer[0] == 'n' || replybuffer[0] == 'N') {
|
|
|
|
back = 0;
|
|
|
|
} else {
|
|
|
|
(void) fprintf(stderr,
|
|
|
|
" DUMP: \"Yes\" or \"No\"?\n");
|
|
|
|
(void) fprintf(stderr,
|
|
|
|
" DUMP: %s: (\"yes\" or \"no\") ", question);
|
|
|
|
}
|
|
|
|
} while (back < 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Turn off the alarm, and reset the signal to trap out..
|
|
|
|
*/
|
|
|
|
(void) alarm(0);
|
|
|
|
if (signal(SIGALRM, sig) == SIG_IGN)
|
|
|
|
signal(SIGALRM, SIG_IGN);
|
|
|
|
(void) fclose(mytty);
|
|
|
|
return(back);
|
|
|
|
}
|
|
|
|
|
2001-09-05 15:37:01 +00:00
|
|
|
char lastmsg[BUFSIZ];
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Alert the console operator, and enable the alarm clock to
|
|
|
|
* sleep for 2 minutes in case nobody comes to satisfy dump
|
|
|
|
*/
|
|
|
|
void
|
2002-03-20 22:49:40 +00:00
|
|
|
alarmcatch(int sig __unused)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
|
|
|
if (notify == 0) {
|
|
|
|
if (timeout == 0)
|
|
|
|
(void) fprintf(stderr,
|
|
|
|
" DUMP: %s: (\"yes\" or \"no\") ",
|
|
|
|
attnmessage);
|
|
|
|
else
|
2001-01-28 21:21:37 +00:00
|
|
|
msgtail("\a\a");
|
1994-05-26 06:35:07 +00:00
|
|
|
} else {
|
|
|
|
if (timeout) {
|
|
|
|
msgtail("\n");
|
|
|
|
broadcast(""); /* just print last msg */
|
|
|
|
}
|
|
|
|
(void) fprintf(stderr," DUMP: %s: (\"yes\" or \"no\") ",
|
|
|
|
attnmessage);
|
|
|
|
}
|
|
|
|
signal(SIGALRM, alarmcatch);
|
|
|
|
(void) alarm(120);
|
|
|
|
timeout = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Here if an inquisitive operator interrupts the dump program
|
|
|
|
*/
|
|
|
|
void
|
2002-03-20 22:49:40 +00:00
|
|
|
interrupt(int signo __unused)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
|
|
|
msg("Interrupt received.\n");
|
|
|
|
if (query("Do you want to abort dump?"))
|
|
|
|
dumpabort(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-09-05 15:37:01 +00:00
|
|
|
* We now use wall(1) to do the actual broadcasting.
|
1994-05-26 06:35:07 +00:00
|
|
|
*/
|
|
|
|
void
|
2002-03-20 22:49:40 +00:00
|
|
|
broadcast(const char *message)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
2001-09-05 15:37:01 +00:00
|
|
|
FILE *fp;
|
|
|
|
char buf[sizeof(_PATH_WALL) + sizeof(OPGRENT) + 3];
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2001-09-05 15:37:01 +00:00
|
|
|
if (!notify)
|
1994-05-26 06:35:07 +00:00
|
|
|
return;
|
|
|
|
|
2001-09-05 15:37:01 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%s -g %s", _PATH_WALL, OPGRENT);
|
|
|
|
if ((fp = popen(buf, "w")) == NULL)
|
1994-05-26 06:35:07 +00:00
|
|
|
return;
|
|
|
|
|
2001-09-05 15:37:01 +00:00
|
|
|
(void) fputs("\a\a\aMessage from the dump program to all operators\n\nDUMP: NEEDS ATTENTION: ", fp);
|
|
|
|
if (lastmsg[0])
|
|
|
|
(void) fputs(lastmsg, fp);
|
|
|
|
if (message[0])
|
|
|
|
(void) fputs(message, fp);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2001-09-05 15:37:01 +00:00
|
|
|
(void) pclose(fp);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2001-09-05 15:37:01 +00:00
|
|
|
* Print out an estimate of the amount of time left to do the dump
|
1994-05-26 06:35:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
time_t tschedule = 0;
|
|
|
|
|
|
|
|
void
|
2002-03-20 22:49:40 +00:00
|
|
|
timeest(void)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
2002-02-16 21:05:16 +00:00
|
|
|
double percent;
|
2004-05-21 20:13:33 +00:00
|
|
|
time_t tnow, tdone;
|
2002-02-16 21:05:16 +00:00
|
|
|
int deltat, hours, mins;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2004-05-21 20:13:33 +00:00
|
|
|
if (blockswritten > tapesize) {
|
|
|
|
setproctitle("%s: 99.99%% done, finished soon", disk);
|
|
|
|
msg("99.99%% done, finished soon\n");
|
|
|
|
} else {
|
|
|
|
(void) time(&tnow);
|
|
|
|
deltat = (blockswritten == 0) ? 0 : tstart_writing - tnow +
|
|
|
|
(double)(tnow - tstart_writing) / blockswritten * tapesize;
|
|
|
|
tdone = tnow + deltat;
|
|
|
|
percent = (blockswritten * 100.0) / tapesize;
|
|
|
|
hours = deltat / 3600;
|
|
|
|
mins = (deltat % 3600) / 60;
|
|
|
|
|
|
|
|
setproctitle(
|
|
|
|
"%s: pass %d: %3.2f%% done, finished in %d:%02d at %s",
|
|
|
|
disk, passno, percent, hours, mins, ctime(&tdone));
|
|
|
|
if (tnow >= tschedule) {
|
|
|
|
tschedule = tnow + 300;
|
|
|
|
if (blockswritten < 500)
|
|
|
|
return;
|
|
|
|
msg("%3.2f%% done, finished in %d:%02d at %s", percent,
|
|
|
|
hours, mins, ctime(&tdone));
|
|
|
|
}
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-16 20:22:26 +00:00
|
|
|
/*
|
|
|
|
* Schedule a printout of the estimate in the next call to timeest().
|
|
|
|
*/
|
|
|
|
void
|
2002-03-20 22:49:40 +00:00
|
|
|
infosch(int signal __unused)
|
2002-02-16 20:22:26 +00:00
|
|
|
{
|
|
|
|
tschedule = 0;
|
|
|
|
}
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
void
|
|
|
|
msg(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
2003-09-21 22:14:49 +00:00
|
|
|
va_list ap2;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
(void) fprintf(stderr," DUMP: ");
|
|
|
|
#ifdef TDEBUG
|
|
|
|
(void) fprintf(stderr, "pid=%d ", getpid());
|
|
|
|
#endif
|
|
|
|
va_start(ap, fmt);
|
2003-09-21 22:14:49 +00:00
|
|
|
va_copy(ap2, ap);
|
|
|
|
(void) vfprintf(stderr, fmt, ap);
|
1994-05-26 06:35:07 +00:00
|
|
|
(void) fflush(stdout);
|
|
|
|
(void) fflush(stderr);
|
2003-09-21 22:14:49 +00:00
|
|
|
(void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap2);
|
1994-05-26 06:35:07 +00:00
|
|
|
va_end(ap);
|
2003-09-21 22:14:49 +00:00
|
|
|
va_end(ap2);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
msgtail(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
(void) vfprintf(stderr, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
quit(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
(void) fprintf(stderr," DUMP: ");
|
|
|
|
#ifdef TDEBUG
|
|
|
|
(void) fprintf(stderr, "pid=%d ", getpid());
|
|
|
|
#endif
|
|
|
|
va_start(ap, fmt);
|
|
|
|
(void) vfprintf(stderr, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
(void) fflush(stdout);
|
|
|
|
(void) fflush(stderr);
|
|
|
|
dumpabort(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tell the operator what has to be done;
|
|
|
|
* we don't actually do it
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct fstab *
|
2002-03-20 22:49:40 +00:00
|
|
|
allocfsent(const struct fstab *fs)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
2001-11-17 00:06:55 +00:00
|
|
|
struct fstab *new;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
new = (struct fstab *)malloc(sizeof (*fs));
|
|
|
|
if (new == NULL ||
|
|
|
|
(new->fs_file = strdup(fs->fs_file)) == NULL ||
|
|
|
|
(new->fs_type = strdup(fs->fs_type)) == NULL ||
|
|
|
|
(new->fs_spec = strdup(fs->fs_spec)) == NULL)
|
|
|
|
quit("%s\n", strerror(errno));
|
|
|
|
new->fs_passno = fs->fs_passno;
|
|
|
|
new->fs_freq = fs->fs_freq;
|
|
|
|
return (new);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct pfstab {
|
2001-01-29 09:45:51 +00:00
|
|
|
SLIST_ENTRY(pfstab) pf_list;
|
1994-05-26 06:35:07 +00:00
|
|
|
struct fstab *pf_fstab;
|
|
|
|
};
|
|
|
|
|
2001-01-29 09:45:51 +00:00
|
|
|
static SLIST_HEAD(, pfstab) table;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
void
|
2003-04-07 11:34:12 +00:00
|
|
|
dump_getfstab(void)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
2001-11-17 00:06:55 +00:00
|
|
|
struct fstab *fs;
|
|
|
|
struct pfstab *pf;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
if (setfsent() == 0) {
|
|
|
|
msg("Can't open %s for dump table information: %s\n",
|
|
|
|
_PATH_FSTAB, strerror(errno));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
while ((fs = getfsent()) != NULL) {
|
|
|
|
if (strcmp(fs->fs_type, FSTAB_RW) &&
|
|
|
|
strcmp(fs->fs_type, FSTAB_RO) &&
|
|
|
|
strcmp(fs->fs_type, FSTAB_RQ))
|
|
|
|
continue;
|
|
|
|
fs = allocfsent(fs);
|
|
|
|
if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL)
|
|
|
|
quit("%s\n", strerror(errno));
|
|
|
|
pf->pf_fstab = fs;
|
2001-01-29 09:45:51 +00:00
|
|
|
SLIST_INSERT_HEAD(&table, pf, pf_list);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
(void) endfsent();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Search in the fstab for a file name.
|
|
|
|
* This file name can be either the special or the path file name.
|
|
|
|
*
|
|
|
|
* The file name can omit the leading '/'.
|
|
|
|
*/
|
|
|
|
struct fstab *
|
2002-03-20 22:49:40 +00:00
|
|
|
fstabsearch(const char *key)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
2001-11-17 00:06:55 +00:00
|
|
|
struct pfstab *pf;
|
|
|
|
struct fstab *fs;
|
1994-05-26 06:35:07 +00:00
|
|
|
char *rn;
|
|
|
|
|
2001-01-29 09:45:51 +00:00
|
|
|
SLIST_FOREACH(pf, &table, pf_list) {
|
1994-05-26 06:35:07 +00:00
|
|
|
fs = pf->pf_fstab;
|
|
|
|
if (strcmp(fs->fs_file, key) == 0 ||
|
|
|
|
strcmp(fs->fs_spec, key) == 0)
|
|
|
|
return (fs);
|
|
|
|
rn = rawname(fs->fs_spec);
|
|
|
|
if (rn != NULL && strcmp(rn, key) == 0)
|
|
|
|
return (fs);
|
|
|
|
if (key[0] != '/') {
|
|
|
|
if (*fs->fs_spec == '/' &&
|
|
|
|
strcmp(fs->fs_spec + 1, key) == 0)
|
|
|
|
return (fs);
|
|
|
|
if (*fs->fs_file == '/' &&
|
|
|
|
strcmp(fs->fs_file + 1, key) == 0)
|
|
|
|
return (fs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tell the operator what to do
|
|
|
|
*/
|
|
|
|
void
|
2002-03-20 22:49:40 +00:00
|
|
|
lastdump(int arg) /* w ==> just what to do; W ==> most recent dumps */
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
2001-11-17 00:06:55 +00:00
|
|
|
int i;
|
|
|
|
struct fstab *dt;
|
|
|
|
struct dumpdates *dtwalk;
|
1994-05-26 06:35:07 +00:00
|
|
|
char *lastname, *date;
|
|
|
|
int dumpme;
|
1999-07-02 04:44:43 +00:00
|
|
|
time_t tnow;
|
|
|
|
struct tm *tlast;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
(void) time(&tnow);
|
2003-04-07 11:34:12 +00:00
|
|
|
dump_getfstab(); /* /etc/fstab input */
|
1994-05-26 06:35:07 +00:00
|
|
|
initdumptimes(); /* /etc/dumpdates input */
|
|
|
|
qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort);
|
|
|
|
|
|
|
|
if (arg == 'w')
|
2002-08-21 18:11:48 +00:00
|
|
|
(void) printf("Dump these file systems:\n");
|
1994-05-26 06:35:07 +00:00
|
|
|
else
|
2002-08-21 18:11:48 +00:00
|
|
|
(void) printf("Last dump(s) done (Dump '>' file systems):\n");
|
1994-05-26 06:35:07 +00:00
|
|
|
lastname = "??";
|
|
|
|
ITITERATE(i, dtwalk) {
|
|
|
|
if (strncmp(lastname, dtwalk->dd_name,
|
|
|
|
sizeof(dtwalk->dd_name)) == 0)
|
|
|
|
continue;
|
1999-07-02 04:44:43 +00:00
|
|
|
date = (char *)ctime(&dtwalk->dd_ddate);
|
1994-05-26 06:35:07 +00:00
|
|
|
date[16] = '\0'; /* blast away seconds and year */
|
|
|
|
lastname = dtwalk->dd_name;
|
|
|
|
dt = fstabsearch(dtwalk->dd_name);
|
1999-07-02 04:44:43 +00:00
|
|
|
dumpme = (dt != NULL && dt->fs_freq != 0);
|
|
|
|
if (dumpme) {
|
|
|
|
tlast = localtime(&dtwalk->dd_ddate);
|
|
|
|
dumpme = tnow > (dtwalk->dd_ddate - (tlast->tm_hour * 3600)
|
|
|
|
- (tlast->tm_min * 60) - tlast->tm_sec
|
|
|
|
+ (dt->fs_freq * 86400));
|
|
|
|
};
|
1994-05-26 06:35:07 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-03-20 22:49:40 +00:00
|
|
|
datesort(const void *a1, const void *a2)
|
1994-05-26 06:35:07 +00:00
|
|
|
{
|
|
|
|
struct dumpdates *d1 = *(struct dumpdates **)a1;
|
|
|
|
struct dumpdates *d2 = *(struct dumpdates **)a2;
|
|
|
|
int diff;
|
|
|
|
|
|
|
|
diff = strncmp(d1->dd_name, d2->dd_name, sizeof(d1->dd_name));
|
|
|
|
if (diff == 0)
|
|
|
|
return (d2->dd_ddate - d1->dd_ddate);
|
|
|
|
return (diff);
|
|
|
|
}
|