* Copyright (c) 1980 Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
static char sccsid
[] = "@(#)misc.c 5.5 (Berkeley) 2/28/91";
# 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
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
++)