src/swclock: make the reference file a required argument

This commit is contained in:
William Hubbs 2022-12-08 09:56:50 -06:00
parent 839083bb52
commit 02b064a591

View File

@ -34,7 +34,6 @@
#include "misc.h" #include "misc.h"
#include "_usage.h" #include "_usage.h"
#define RC_SHUTDOWNTIME RC_SVCDIR "/shutdowntime"
const char *applet = NULL; const char *applet = NULL;
const char *extraopts = "file"; const char *extraopts = "file";
@ -54,7 +53,7 @@ const char *usagestring = NULL;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int opt, sflag = 0, wflag = 0; int opt, sflag = 0, wflag = 0;
const char *file = RC_SHUTDOWNTIME; const char *file = NULL;
struct stat sb; struct stat sb;
struct timeval tv; struct timeval tv;
@ -75,6 +74,8 @@ int main(int argc, char **argv)
if (optind < argc) if (optind < argc)
file = argv[optind++]; file = argv[optind++];
else
eerrorx("swclock: Reference file was not specified");
if (sflag) { if (sflag) {
if (stat(file, &sb) == -1) { if (stat(file, &sb) == -1) {