FILE *ifile;
char **environ;
char *prefix();
+char *getenv();
FILE *popen();
main(argc, 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 */
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);
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);
}