Blob Blame History Raw
diff -ur b/at.c a/at.c
--- b/at.c	2021-04-25 03:31:30.000000000 +0200
+++ a/at.c	2021-05-21 12:51:48.123335137 +0200
@@ -62,11 +62,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef TM_IN_SYS_TIME
 #include <sys/time.h>
-#else
 #include <time.h>
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -245,6 +242,12 @@
     int kill_errno;
     int rc;
     int mailsize = 128;
+    struct timeval tv;
+    struct timezone tz;
+    long int i;
+
+    gettimeofday(&tv, &tz);
+    srandom(getpid()+tv.tv_usec);
 
 /* Install the signal handler for SIGINT; terminate after removing the
  * spool file if necessary
@@ -492,6 +495,9 @@
     fprintf(fp, " || {\n\t echo 'Execution directory "
 	    "inaccessible' >&2\n\t exit 1\n}\n");
 
+    i = random();
+    fprintf(fp, "${SHELL:-/bin/sh} << \'marcinDELIMITER%08lx\'\n", i);
+
     istty = isatty(fileno(stdin));
     if (istty) {
 	runtime = localtime(&runtimer);
@@ -512,7 +518,7 @@
     if (istty) {
 	fprintf(stderr, "<EOT>\n");
     }
-    fprintf(fp, "\n");
+    fprintf(fp, "marcinDELIMITER%08lx\n", i);
     if (ferror(fp))
 	panic("Output error");
     fflush(fp);
Only in a: .vscode