X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/a68924a6e07d69bc4b8d6106b3af0ac5a7490905..7bbfca116a81abb60bfcb48c939dc599ccf380dc:/usr/src/cmd/at.c diff --git a/usr/src/cmd/at.c b/usr/src/cmd/at.c index bc5e60fefc..a94f701868 100644 --- a/usr/src/cmd/at.c +++ b/usr/src/cmd/at.c @@ -53,6 +53,7 @@ FILE *file; FILE *ifile; char **environ; char *prefix(); +char *getenv(); FILE *popen(); main(argc, argv) @@ -63,6 +64,7 @@ char **argv; char pwbuf[100]; FILE *pwfil; int larg; + char *tmp; /* argv[1] is the user's time: e.g., 3AM */ /* argv[2] is a month name or day of week */ @@ -93,6 +95,7 @@ char **argv; signal(SIGINT, onintr); file = fopen(fname, "a"); chmod(fname, 0644); + chown(fname,getuid(),getgid()); if (file == NULL) { fprintf(stderr, "at: cannot open memo file\n"); exit(1); @@ -107,11 +110,23 @@ char **argv; if (environ) { char **ep = environ; while(*ep) - fprintf(file, "%s\n", *ep++); + { + fprintf(file, "%s\nexport ", *ep); + for(tmp = *ep ; *tmp != '=' ; tmp++) putc(*tmp,file); + putc('\n',file); + ep++; + } } + /* see if the SHELL variable in the current enviroment is /bin/csh + * and in that case, use the csh as the shell + */ + if(strcmp(getenv("SHELL"), "/bin/csh") == 0) + fprintf(file, "%s\n", "csh << 'xxFUNNYxx'"); while((c = getc(ifile)) != EOF) { putc(c, file); } + if(strcmp(getenv("SHELL"), "/bin/csh") == 0) + fprintf(file, "%s\n", "xxFUNNYxx"); exit(0); }