aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-07-03 13:11:47 +0000
committerRoy Marples <roy@marples.name>2008-07-03 13:11:47 +0000
commita88a177f991527e545e75588013afd16c647e656 (patch)
treef759fbfc83664f9c5f502904c917c3c4ee8d6ca8 /src/rc
parentd61f8318962346b3b2a3f13e7b489d2c0c397b94 (diff)
Add older_than function to complement newer_than function. Also make the userland instance reversed to be compatable with current baselayout, which truely does suck.
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-applets.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c
index cbcbae4d..77790e90 100644
--- a/src/rc/rc-applets.c
+++ b/src/rc/rc-applets.c
@@ -408,7 +408,7 @@ static int do_shell_var(int argc, char **argv)
void run_applets(int argc, char **argv)
{
int i = 2;
- bool match = false;
+ bool (*is_than) (const char *, const char *);
char *p;
pid_t pid = 0;
@@ -437,18 +437,22 @@ void run_applets(int argc, char **argv)
if (strcmp(applet, "shell_var") == 0)
exit(do_shell_var(argc, argv));
+ /* This test is perverted - historically the baselayout function
+ * returns 0 on *failure*, which is plain wrong */
if (strcmp(applet, "is_newer_than") == 0 ||
strcmp(applet, "is_older_than") == 0)
{
if (argc < 3)
exit (EXIT_FAILURE);
if (strcmp(applet, "is_newer_than") == 0)
- match = true;
+ is_than = &rc_older_than;
+ else
+ is_than = &rc_newer_than;
while (i < argc) {
- if (rc_newer_than(argv[1], argv[i++]) != match)
- exit (EXIT_FAILURE);
+ if (!is_than(argv[1], argv[i++]))
+ exit(EXIT_SUCCESS);
}
- exit(EXIT_SUCCESS);
+ exit(EXIT_FAILURE);
};
if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e'))