diff options
author | Roy Marples <roy@marples.name> | 2008-01-14 08:12:37 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-01-14 08:12:37 +0000 |
commit | d6954071142c7c16d070621e247d8ef9f20a7c90 (patch) | |
tree | b1a655319960c4d7ee7b5886c378e97bfcf6fb80 /src/rc | |
parent | e49e5b147c7a670b9e3df69ef2cfaf787bbbe3ee (diff) |
Add support for is_newer_than and is_older_than. is_older_than currently doesn't work as expected, but is_newer_than works fine.
Diffstat (limited to 'src/rc')
-rw-r--r-- | src/rc/Makefile | 2 | ||||
-rw-r--r-- | src/rc/rc.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/rc/Makefile b/src/rc/Makefile index 1168b3f2..587d60d7 100644 --- a/src/rc/Makefile +++ b/src/rc/Makefile @@ -23,7 +23,7 @@ RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \ service_coldplugged service_started_daemon \ checkpath fstabinfo mountinfo rc-depend \ service_get_value service_set_value get_options save_options \ - shell_var + shell_var is_newer_than is_older_than RC_SBINLINKS= mark_service_starting mark_service_started \ mark_service_stopping mark_service_stopped \ mark_service_inactive mark_service_wasinactive \ diff --git a/src/rc/rc.c b/src/rc/rc.c index 567da725..93be82d4 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -913,6 +913,21 @@ int main (int argc, char **argv) if (strncmp (applet, "mark_service_", strlen ("mark_service_")) == 0) exit (do_mark_service (argc, argv)); + if (strcmp (applet, "is_newer_than") == 0 || + strcmp (applet, "is_older_than") == 0) + { + bool match = false; + if (argc < 2) + exit (EXIT_FAILURE); + if (strcmp (applet, "is_newer_than") == 0) + match = true; + while (optind < argc) { + if (rc_newer_than (argv[0], argv[optind++]) != match) + exit (EXIT_FAILURE); + } + exit (EXIT_SUCCESS); + }; + if (strcmp (applet, "is_runlevel_start") == 0) exit (rc_runlevel_starting () ? 0 : 1); else if (strcmp (applet, "is_runlevel_stop") == 0) |