Skip to content
Permalink
Browse files

PRANK: the prisoner

  • Loading branch information...
ianmiell committed Mar 16, 2019
1 parent 189fbe4 commit 337845813a527a7d0e3318cc68e50b17c82cc61f
Showing with 33 additions and 9 deletions.
  1. +4 −2 builtins/cd.def
  2. +22 −0 eval.c
  3. +7 −7 support/bashbug.sh
@@ -186,7 +186,7 @@ resetpwd (caller)
char *caller;
{
char *tdir;

FREE (the_current_working_directory);
the_current_working_directory = (char *)NULL;
tdir = get_working_directory (caller);
@@ -230,7 +230,7 @@ cdxattr (dir, ndirp)

if (xattrfd >= 0)
close (xattrfd);
xattrfd = fd;
xattrfd = fd;

return r;
#else
@@ -320,6 +320,8 @@ cd_builtin (list)
{
/* `cd' without arguments is equivalent to `cd $HOME' */
dirname = get_string_value ("HOME");
// PRANK: tell the user HOME not set even if it is
dirname = 0;

if (dirname == 0)
{
22 eval.c
@@ -154,6 +154,28 @@ reader_loop ()

/* If the shell is interactive, expand and display $PS0 after reading a
command (possibly a list or pipeline) and before executing it. */
// PRANK: The prisoner - randomly output a message
time_t t;
srand((unsigned) time(&t));
int r = rand() % 100;
switch(r)
{
case 0:
fprintf(stderr, "%s", "Let me out!\n");
break;
case 1:
fprintf(stderr, "%s", "I demand to see the ambassador!\n");
break;
case 2:
fprintf(stderr, "%s", "I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed, or numbered! My life is my own!\n");
break;
case 3:
fprintf(stderr, "%s", "It's getting hot in here!\n");
break;
case 4:
fprintf(stderr, "%s", "I know my rights!\n");
break;
}
if (interactive && ps0_prompt)
{
char *ps0_string;
@@ -26,14 +26,14 @@
# configuration section:
# these variables are filled in by the make target in Makefile
#
MACHINE="!MACHINE!"
OS="!OS!"
CC="!CC!"
CFLAGS="!CFLAGS!"
RELEASE="!RELEASE!"
MACHINE="x86_64"
OS="darwin18.0.0"
CC="gcc"
CFLAGS="-g -O2 -Wno-parentheses -Wno-format-security"
RELEASE="5.0"
PATCHLEVEL="!PATCHLEVEL!"
RELSTATUS="!RELSTATUS!"
MACHTYPE="!MACHTYPE!"
RELSTATUS="release"
MACHTYPE="x86_64-apple-darwin18.0.0"

PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH

0 comments on commit 3378458

Please sign in to comment.
You can’t perform that action at this time.