summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cron/funcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/cron/funcs.c')
-rw-r--r--usr/src/cmd/cron/funcs.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/usr/src/cmd/cron/funcs.c b/usr/src/cmd/cron/funcs.c
index 84ffbdc07f..0a5e78476a 100644
--- a/usr/src/cmd/cron/funcs.c
+++ b/usr/src/cmd/cron/funcs.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
@@ -203,3 +201,33 @@ xcalloc(size_t nElements, size_t size)
}
return (p);
}
+
+int
+isvalid_shell(const char *shell)
+{
+ char *t;
+ int ret = 0;
+
+ while ((t = getusershell()) != NULL) {
+ if (strcmp(t, shell) == 0) {
+ ret = 1;
+ break;
+ }
+ }
+ endusershell();
+ return (ret);
+}
+
+int
+isvalid_dir(const char *dir)
+{
+ char *cwd = getcwd(NULL, 0);
+
+ if (dir[0] != '/' || chdir(dir) == -1) {
+ return (0);
+ }
+ if (cwd != NULL) {
+ (void) chdir(cwd);
+ }
+ return (1);
+}