I'm sure there's lots of errors, so be gentle. :) It does work though,
so that's a plus.
Doug
--
This .signature sanitized for your protection
Index: savecore.8
===================================================================
RCS file: /usr/local/ncvs/src/sbin/savecore/savecore.8,v
retrieving revision 1.19
diff -u -r1.19 savecore.8
--- savecore.8 21 Aug 2002 18:11:42 -0000 1.19
+++ savecore.8 2 Sep 2003 10:11:04 -0000
@@ -42,6 +42,10 @@
.Nm
.Fl c
.Nm
+.Fl C
+.Op Fl v
+.Op Ar directory device
+.Nm
.Op Fl fkvz
.Op Ar directory Op Ar device ...
.Sh DESCRIPTION
@@ -58,6 +62,14 @@
.Pp
The options are as follows:
.Bl -tag -width indent
+.It Fl C
+Check to see if a dump exists,
+and display a brief message to indicate the status.
+An exit status of 0 indicates that a dump is there,
+1 indicates that none exists.
+This option is compatible only with the
+.Op Fl v
+option.
.It Fl c
Clear the dump, so that future invocations of
.Nm
Index: savecore.c
===================================================================
RCS file: /usr/local/ncvs/src/sbin/savecore/savecore.c,v
retrieving revision 1.63
diff -u -r1.63 savecore.c
--- savecore.c 1 Jan 2003 18:48:46 -0000 1.63
+++ savecore.c 2 Sep 2003 10:17:07 -0000
@@ -88,7 +88,7 @@
/* The size of the buffer used for I/O. */
#define BUFFERSIZE (1024*1024)
-int compress, clear, force, keep, verbose; /* flags */
+int checkfor, compress, clear, force, keep, verbose; /* flags */
int nfound, nsaved, nerr; /* statistics */
extern FILE *zopen(const char *, const char *);
@@ -321,6 +321,12 @@
goto closefd;
}
+ if (checkfor) {
+ printf("A dump exists on %s\n", device);
+ close(fd);
+ exit(0);
+ }
+
if (kdhl.panicstring[0])
syslog(LOG_ALERT, "reboot after panic: %s", kdhl.panicstring);
else
@@ -478,7 +484,7 @@
static void
usage(void)
{
- fprintf(stderr, "usage: savecore [-cfkv] [directory [device...]]\n");
+ fprintf(stderr, "usage: savecore [-Cv|-cfkv] [directory [device...]]\n");
exit (1);
}
@@ -496,8 +502,11 @@
syslog(LOG_ERR, "Cannot allocate memory");
exit(1);
}
- while ((ch = getopt(argc, argv, "cdfkN:vz")) != -1)
+ while ((ch = getopt(argc, argv, "CcdfkN:vz")) != -1)
switch(ch) {
+ case 'C':
+ checkfor = 1;
+ break;
case 'c':
clear = 1;
break;
@@ -519,6 +528,8 @@
default:
usage();
}
+ if (checkfor && (clear || force || keep))
+ usage();
argc -= optind;
argv += optind;
if (argc >= 1) {
@@ -547,8 +558,13 @@
}
/* Emit minimal output. */
- if (nfound == 0)
+ if (nfound == 0) {
+ if (checkfor) {
+ printf("No dump exists\n");
+ exit(1);
+ }
syslog(LOG_WARNING, "no dumps found");
+ }
else if (nsaved == 0) {
if (nerr != 0)
syslog(LOG_WARNING, "unsaved dumps found but not saved");
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"