* Copyright (c) 1980 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
static char sccsid
[] = "@(#)misc.c 5.2 (Berkeley) %G%";
# define execsh(sh) execl(sh, shell_name[roll(1, num_names)-1], 0)
static char *shell_def
= "/bin/csh",
".I'm really the next process down",
".Singin' in the rain....",
".I am but a Cog in the Wheel of Life",
".Look out!!! Behind you!!!!!",
".Looking for a good time, sailor?",
".I don't get NO respect...",
static int num_names
= sizeof shell_name
/ sizeof (char *);;
* This routine executes a truncated set of commands until a
* "yes or "no" answer is gotten.
if ((com
=getinp(prompt
, yn
)) < 2)
* This routine tells the player if he's out of money.
printf("That leaves you $%d in debt\n", -cur_p
->money
);
else if (cur_p
->money
== 0)
printf("that leaves you broke\n");
else if (fixing
&& !told_em
&& cur_p
->money
> 0) {
printf("-- You are now Solvent ---\n");
* This routine switches to the next player
player
= ++player
% num_play
;
* This routine gets an integer from the keyboard after the
for (sp
= buf
; (*sp
=getchar()) != '\n'; sp
++)
if (*sp
== -1) /* check for interrupted system call */
for (sp
= buf
; isspace(*sp
); sp
++)
for (; isdigit(*sp
); sp
++)
num
= num
* 10 + *sp
- '0';
printf("I can't understand that\n");
* This routine sets the monopoly flag from the list given.
reg
int num
; /* general counter */
reg MON
*orig
; /* remember starting monop ptr */
reg OWN
*op
; /* current owned prop */
OWN
*orig_op
; /* origianl prop before loop */
printf("op [%d] = play[pl [%d] ].own_list;\n", op
, pl
);
printf("op->sqr->type = %d\n", op
->sqr
->type
);
for (num
= 0; op
&& op
->sqr
->type
== UTIL
; op
= op
->next
)
printf("play[pl].num_util = num [%d];\n", num
);
for (num
= 0; op
&& op
->sqr
->type
== RR
; op
= op
->next
) {
printf("iter: %d\n", num
);
printf("op = %d, op->sqr = %d, op->sqr->type = %d\n", op
, op
->sqr
, op
->sqr
->type
);
printf("play[pl].num_rr = num [%d];\n", num
);
printf(" case PRPTY:\n");
orig
= op
->sqr
->desc
->mon_desc
;
while (op
&& op
->sqr
->desc
->mon_desc
== orig
) {
printf("iter: %d\n", num
);
printf("op = op->next ");
printf("panic: bad monopoly descriptor: orig = %d\n", orig
);
printf("player # %d\n", pl
+1);
printf("orig_op = %d\n", orig_op
);
printf("orig_op->sqr->type = %d (PRPTY)\n", op
->sqr
->type
);
printf("orig_op->next = %d\n", op
->next
);
printf("orig_op->sqr->desc = %d\n", op
->sqr
->desc
);
printf("op->sqr->type = %d (PRPTY)\n", op
->sqr
->type
);
printf("op->next = %d\n", op
->next
);
printf("op->sqr->desc = %d\n", op
->sqr
->desc
);
printf("num = %d\n", num
);
printf("orig->num_in = %d\n", orig
->num_in
);
* This routine sets things up as if it is a new monopoly
mp
->num_own
= mp
->num_in
;
for (i
= 0; i
< mp
->num_in
; i
++)
mp
->sq
[i
]->desc
->monop
= TRUE
;
* This routine sets things up as if it is no longer a monopoly
for (i
= 0; i
< mp
->num_in
; i
++)
mp
->sq
[i
]->desc
->monop
= FALSE
;
* This routine gives a list of the current player's routine
* This routine gives a list of a given players holdings
while ((pl
=getinp("Whose holdings do you want to see? ", name_list
)) < num_play
)
* This routine gives the players a chance before it exits.
if (getyn("Do you all really want to quit? ", yn
) == 0)
* This routine copies one structure to another
reg
int *s1
, *s2
, size
; {
* This routine forks off a shell. It uses the users login shell
static char *shell
= NULL
;
* This routine looks up the users login shell
struct passwd
*getpwuid();
if ((sp
= getenv("SHELL")) == NULL
) {
if (pp
->pw_shell
[0] != '\0')
/*return (*(pp->pw_shell) != '\0' ? pp->pw_shell : shell_def);*/
* This routine sets things up to ignore all the signals.
for (i
= 0; i
< NSIG
; i
++)
* This routine sets up things as they were before.
for (i
= 0; i
< NSIG
; i
++)