diff options
| author | cf46844 <none@none> | 2006-04-17 10:16:06 -0700 |
|---|---|---|
| committer | cf46844 <none@none> | 2006-04-17 10:16:06 -0700 |
| commit | d61d085d719de73172b264c1169fc0d0dcbc3585 (patch) | |
| tree | c5a35920952b33a1a950a075578c55fcf0e91405 /usr/src/cmd/cron/crontab.c | |
| parent | a1ca9cb81adb8b330e028e66d089a9cd5004052e (diff) | |
| download | illumos-joyent-d61d085d719de73172b264c1169fc0d0dcbc3585.tar.gz | |
PSARC/2005/683 Add /usr/xpg4/bin/crontab and /usr/xpg6/bin/crontab
6344121 `crontab -e` doesn't invoke vi as the default editor
Diffstat (limited to 'usr/src/cmd/cron/crontab.c')
| -rw-r--r-- | usr/src/cmd/cron/crontab.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr/src/cmd/cron/crontab.c b/usr/src/cmd/cron/crontab.c index 221e084fe8..dcf7fe27c5 100644 --- a/usr/src/cmd/cron/crontab.c +++ b/usr/src/cmd/cron/crontab.c @@ -48,6 +48,15 @@ #include <security/pam_appl.h> #include "cron.h" +#if defined(XPG4) +#define VIPATH "/usr/xpg4/bin/vi" +#elif defined(XPG6) +#define VIPATH "/usr/xpg6/bin/vi" +#else +#define _XPG_NOTDEFINED +#define VIPATH "vi" +#endif + #define TMPFILE "_cron" /* prefix for tmp file */ #define CRMODE 0600 /* mode for creating crontabs */ @@ -276,11 +285,16 @@ main(int argc, char **argv) if (stat(edtemp, &stbuf) < 0) crabort("can't stat temporary file"); omodtime = stbuf.st_mtime; +#ifdef _XPG_NOTDEFINED editor = getenv("VISUAL"); - if (editor == NULL) + if (editor == NULL) { +#endif editor = getenv("EDITOR"); - if (editor == NULL) - editor = "ed"; + if (editor == NULL) + editor = VIPATH; +#ifdef _XPG_NOTDEFINED + } +#endif (void) snprintf(buf, sizeof (buf), "%s %s", editor, edtemp); sleep(1); |
