]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - phantasia/main.c
1 /* $NetBSD: main.c,v 1.24 2019/02/03 03:19:25 mrg Exp $ */
4 * Phantasia 3.3.2 -- Interterminal fantasy game
12 * This game is distributed for free as is. It is not guaranteed to work
13 * in every conceivable environment. It is not even guaranteed to work
16 * This game is distributed without notice of copyright, therefore it
17 * may be used in any manner the recipient sees fit. However, the
18 * author assumes no responsibility for maintaining or revising this
19 * game, in its original form, or any derivitives thereof.
21 * The author shall not be responsible for any loss, cost, or damage,
22 * including consequential damage, caused by reliance on this material.
24 * The author makes no warranties, express or implied, including warranties
25 * of merchantability or fitness for a particular purpose or use.
27 * AT&T is in no way connected with this game.
30 #include <sys/types.h>
42 #include "phantdefs.h"
43 #include "phantstruct.h"
44 #include "phantglobs.h"
45 #include "pathnames.h"
51 * The program allocates as much file space as it needs to store characters,
52 * so the possibility exists for the character file to grow without bound.
53 * The file is purged upon normal entry to try to avoid that problem.
54 * A similar problem exists for energy voids. To alleviate the problem here,
55 * the void file is cleared with every new king, and a limit is placed
56 * on the size of the energy void file.
60 * Put one line of text into the file 'motd' for announcements, etc.
64 * The scoreboard file is updated when someone dies, and keeps track
65 * of the highest character to date for that login.
66 * Being purged from the character file does not cause the scoreboard
72 * main.c Main routines for Phantasia
75 static void genchar(int);
76 static void initialstate(void);
77 static void neatstuff(void);
78 static void playinit(void);
79 static void procmain(void);
80 static long recallplayer(void);
81 static long rollnewplayer(void);
82 static void titlelist(void);
84 int main(int, char **);
87 main(int argc
, char **argv
)
89 bool noheader
= FALSE
; /* set if don't want header */
90 bool headeronly
= FALSE
; /* set if only want header */
91 bool examine
= FALSE
; /* set if examine a character */
92 time_t seconds
; /* for time of day */
93 double dtemp
; /* for temporary calculations */
95 initialstate(); /* init globals */
97 /* process arguments */
98 while (--argc
&& (*++argv
)[0] == '-')
100 case 's': /* short */
104 case 'H': /* Header */
108 case 'a': /* all users */
114 case 'p': /* purge old players */
120 case 'S': /* set 'Wizard' */
124 case 'x': /* examine */
128 case 'm': /* monsters */
134 case 'b': /* scoreboard */
141 if (!isatty(0)) /* don't let non-tty's play */
145 playinit(); /* set up to catch signals, init curses */
155 purgeoldplayers(); /* clean up old characters */
164 /* get the player structure filled */
168 mvaddstr(22, 17, "Do you have a character to run [Q = Quit] ? ");
170 switch (getanswer("NYQ", FALSE
)) {
172 Fileloc
= recallplayer();
181 Fileloc
= rollnewplayer();
186 while (Fileloc
< 0L);
188 if (Player
.p_level
> 5.0)
189 /* low level players have long timeout */
192 /* update some important player statistics */
193 strlcpy(Player
.p_login
, Login
, sizeof(Player
.p_login
));
195 Player
.p_lastused
= localtime(&seconds
)->tm_yday
;
196 Player
.p_status
= S_PLAYING
;
197 writerecord(&Player
, Fileloc
);
199 Statptr
= &Stattable
[Player
.p_type
]; /* initialize pointer */
201 /* catch interrupts */
203 sigset(SIGINT
, interrupt
);
206 signal(SIGINT
, interrupt
);
209 signal(SIGINT
, interrupt
);
212 signal(SIGINT
, interrupt
);
215 altercoordinates(Player
.p_x
, Player
.p_y
, A_FORCED
); /* set some flags */
220 /* loop forever, processing input */
223 adjuststats(); /* cleanup stats */
225 if (Throne
&& Player
.p_crowns
== 0 && Player
.p_specialtype
!= SC_KING
)
226 /* not allowed on throne -- move */
228 mvaddstr(5, 0, "You're not allowed in the Lord's Chamber without a crown.\n");
229 altercoordinates(0.0, 0.0, A_NEAR
);
231 checktampered();/* check for energy voids, etc. */
233 if (Player
.p_status
!= S_CLOAKED
235 && (dtemp
= fabs(Player
.p_x
)) == fabs(Player
.p_y
)
240 dtemp
= sqrt(dtemp
/ 100.0);
241 if (floor(dtemp
) == dtemp
)
242 /* |x| / 100 == n*n; at a trading post */
248 checkbattle(); /* check for player to player battle */
249 neatstuff(); /* gurus, medics, etc. */
251 if (Player
.p_status
== S_CLOAKED
) {
252 /* costs 3 mana per turn to be cloaked */
253 if (Player
.p_mana
> 3.0)
254 Player
.p_mana
-= 3.0;
256 /* ran out of mana, uncloak */
258 Player
.p_status
= S_PLAYING
;
263 if (Player
.p_status
!= S_PLAYING
&& Player
.p_status
!= S_CLOAKED
)
264 /* change status back to S_PLAYING */
266 Player
.p_status
= S_PLAYING
;
270 /* update file only if important stuff has changed */
272 writerecord(&Player
, Fileloc
);
276 readmessage(); /* read message, if any */
278 displaystats(); /* print statistics */
283 /* maybe make king, print prompt, etc. */
286 /* print status line */
287 addstr("1:Move 2:Players 3:Talk 4:Stats 5:Quit ");
288 if (Player
.p_level
>= MEL_CLOAK
&& Player
.p_magiclvl
>= ML_CLOAK
)
290 if (Player
.p_level
>= MEL_TELEPORT
&& Player
.p_magiclvl
>= ML_TELEPORT
)
291 addstr("7:Teleport ");
292 if (Player
.p_specialtype
>= SC_COUNCIL
|| Wizard
)
293 addstr("8:Intervene ");
295 procmain(); /* process input */
315 /* setup login name */
316 if ((Login
= getlogin()) == NULL
) {
317 pw
= getpwuid(getuid());
319 errx(1, "Who are you?");
324 /* open some files */
325 if ((Playersfp
= fopen(_PATH_PEOPLE
, "r+")) == NULL
)
328 if (fileno(Playersfp
) < 3)
331 if ((Monstfp
= fopen(_PATH_MONST
, "r+")) == NULL
)
335 if ((Messagefp
= fopen(_PATH_MESS
, "r")) == NULL
)
339 if ((Energyvoidfp
= fopen(_PATH_VOID
, "r+")) == NULL
)
341 if (fstat(fileno(Energyvoidfp
), &sb
) == -1)
343 if (sb
.st_size
== 0) {
344 /* initialize grail to new location */
345 Enrgyvoid
.ev_active
= TRUE
;
346 Enrgyvoid
.ev_x
= ROLL(-1.0e6
, 2.0e6
);
347 Enrgyvoid
.ev_y
= ROLL(-1.0e6
, 2.0e6
);
348 writevoid(&Enrgyvoid
, 0L);
353 srandom((unsigned) time(NULL
)); /* prime random numbers */
359 int chartype
; /* character type */
362 initplayer(&Player
); /* initialize player structure */
365 mvaddstr(4, 21, "Which type of character do you want:");
367 "1:Magic User 2:Fighter 3:Elf 4:Dwarf 5:Halfling 6:Experimento ");
369 addstr("7:Super ? ");
370 chartype
= getanswer("1234567", FALSE
);
373 chartype
= getanswer("123456", FALSE
);
377 genchar(chartype
); /* roll up a character */
379 /* print out results */
381 "Strength : %2.0f Quickness: %2.0f Mana : %2.0f\n",
382 Player
.p_strength
, Player
.p_quickness
, Player
.p_mana
);
384 "Energy Level: %2.0f Brains : %2.0f Magic Level: %2.0f\n",
385 Player
.p_energy
, Player
.p_brains
, Player
.p_magiclvl
);
387 if (Player
.p_type
== C_EXPER
|| Player
.p_type
== C_SUPER
)
390 mvaddstr(14, 14, "Type '1' to keep >");
391 ch
= getanswer(" ", TRUE
);
395 if (Player
.p_type
== C_EXPER
|| Player
.p_type
== C_SUPER
)
396 /* get coordinates for experimento */
398 mvaddstr(16, 0, "Enter the X Y coordinates of your experimento ? ");
399 getstring(Databuf
, SZ_DATABUF
);
400 sscanf(Databuf
, "%lf %lf", &Player
.p_x
, &Player
.p_y
);
402 if (fabs(Player
.p_x
) > D_EXPER
|| fabs(Player
.p_y
) > D_EXPER
)
403 mvaddstr(17, 0, "Invalid coordinates. Try again.\n");
409 /* name the new character */
412 "Give your character a name [up to %d characters] ? ", SZ_NAME
- 1);
413 getstring(Player
.p_name
, SZ_NAME
);
414 truncstring(Player
.p_name
); /* remove trailing blanks */
416 if (Player
.p_name
[0] == '\0')
418 mvaddstr(19, 0, "Invalid name.");
420 if (findname(Player
.p_name
, &Other
) >= 0L)
421 /* cannot have duplicate names */
422 mvaddstr(19, 0, "Name already in use.");
424 /* name is acceptable */
427 addstr(" Pick another.\n");
430 /* get a password for character */
434 mvaddstr(20, 0, "Give your character a password [up to 8 characters] ? ");
435 getstring(Player
.p_password
, SZ_PASSWORD
);
436 mvaddstr(21, 0, "Enter again to verify: ");
437 getstring(Databuf
, SZ_PASSWORD
);
439 while (strcmp(Player
.p_password
, Databuf
) != 0);
443 return (allocrecord());
450 double x
; /* desired new x coordinate */
451 double y
; /* desired new y coordinate */
452 double temp
; /* for temporary calculations */
453 FILE *fp
; /* for opening files */
454 int loop
; /* a loop counter */
455 bool hasmoved
= FALSE
; /* set if player has moved */
458 mvaddstr(4, 0, "\n\n"); /* clear status area */
461 clrtobot(); /* clear data on bottom area of screen */
463 if (Player
.p_specialtype
== SC_VALAR
&& (ch
== '1' || ch
== '7'))
464 /* valar cannot move */
468 case 'K': /* move up/north */
471 y
= Player
.p_y
+ MAXMOVE();
475 case 'J': /* move down/south */
478 y
= Player
.p_y
- MAXMOVE();
482 case 'L': /* move right/east */
484 x
= Player
.p_x
+ MAXMOVE();
489 case 'H': /* move left/west */
491 x
= Player
.p_x
- MAXMOVE();
497 Player
.p_energy
+= (Player
.p_maxenergy
+ Player
.p_shield
) / 15.0
498 + Player
.p_level
/ 3.0 + 2.0;
500 MIN(Player
.p_energy
, Player
.p_maxenergy
+ Player
.p_shield
);
502 if (Player
.p_status
!= S_CLOAKED
)
503 /* cannot find mana if cloaked */
505 Player
.p_mana
+= (Circle
+ Player
.p_level
) / 4.0;
507 if (drandom() < 0.2 && Player
.p_status
== S_PLAYING
&& !Throne
)
508 /* wandering monster */
513 case 'X': /* change/examine a character */
518 for (loop
= 3; loop
; --loop
) {
519 mvaddstr(4, 0, "X Y Coordinates ? ");
520 getstring(Databuf
, SZ_DATABUF
);
522 if (sscanf(Databuf
, "%lf %lf", &x
, &y
) != 2)
523 mvaddstr(5, 0, "Try again\n");
525 if (distance(Player
.p_x
, x
, Player
.p_y
, y
) > MAXMOVE())
534 case '2': /* players */
538 case '3': /* message */
539 mvaddstr(4, 0, "Message ? ");
540 getstring(Databuf
, SZ_DATABUF
);
541 /* we open the file for writing to erase any data which is
543 fp
= fopen(_PATH_MESS
, "w");
544 if (Databuf
[0] != '\0')
545 fprintf(fp
, "%s: %s", Player
.p_name
, Databuf
);
549 case '4': /* stats */
553 case '5': /* good-bye */
558 case '6': /* cloak */
559 if (Player
.p_level
< MEL_CLOAK
|| Player
.p_magiclvl
< ML_CLOAK
)
562 if (Player
.p_status
== S_CLOAKED
)
563 Player
.p_status
= S_PLAYING
;
565 if (Player
.p_mana
< MM_CLOAK
)
566 mvaddstr(5, 0, "No mana left.\n");
569 Player
.p_mana
-= MM_CLOAK
;
570 Player
.p_status
= S_CLOAKED
;
574 case '7': /* teleport */
576 * conditions for teleport
577 * - 20 per (level plus magic level)
578 * - OR council of the wise or valar or ex-valar
579 * - OR transport from throne
580 * transports from throne cost no mana
582 if (Player
.p_level
< MEL_TELEPORT
|| Player
.p_magiclvl
< ML_TELEPORT
)
585 for (loop
= 3; loop
; --loop
) {
586 mvaddstr(4, 0, "X Y Coordinates ? ");
587 getstring(Databuf
, SZ_DATABUF
);
589 if (sscanf(Databuf
, "%lf %lf", &x
, &y
) == 2) {
590 temp
= distance(Player
.p_x
, x
, Player
.p_y
, y
);
592 /* can transport anywhere from throne */
593 && Player
.p_specialtype
<= SC_COUNCIL
594 /* council, valar can transport
596 && temp
> (Player
.p_level
+ Player
.p_magiclvl
) * 20.0)
597 /* can only move 20 per exp.
598 * level + mag. level */
601 temp
= (temp
/ 75.0 + 1.0) * 20.0; /* mana used */
603 if (!Throne
&& temp
> Player
.p_mana
)
604 mvaddstr(5, 0, "Not enough power for that distance.\n");
607 Player
.p_mana
-= temp
;
617 case '9': /* monster */
619 /* no monsters while on throne */
620 mvaddstr(5, 0, "No monsters in the chamber!\n");
622 if (Player
.p_specialtype
!= SC_VALAR
)
623 /* the valar cannot call monsters */
625 Player
.p_sin
+= 1e-6;
630 case '0': /* decree */
631 if (Wizard
|| (Player
.p_specialtype
== SC_KING
&& Throne
))
632 /* kings must be on throne to decree */
638 case '8': /* intervention */
639 if (Wizard
|| Player
.p_specialtype
>= SC_COUNCIL
)
647 /* player has moved -- alter coordinates, and do random
650 altercoordinates(x
, y
, A_SPECIFIC
);
652 if (drandom() < 0.2 && Player
.p_status
== S_PLAYING
&& !Throne
)
660 FILE *fp
; /* used for opening various files */
661 bool councilfound
= FALSE
; /* set if we find a member of the
663 bool kingfound
= FALSE
; /* set if we find a king */
664 double hiexp
, nxtexp
; /* used for finding the two highest players */
665 double hilvl
, nxtlvl
; /* used for finding the two highest players */
666 char hiname
[21], nxtname
[21]; /* used for finding the two
671 "W e l c o m e t o P h a n t a s i a (vers. 3.3.2)!");
673 /* print message of the day */
674 if ((fp
= fopen(_PATH_MOTD
, "r")) != NULL
675 && fgets(Databuf
, SZ_DATABUF
, fp
) != NULL
) {
676 mvaddstr(2, 40 - strlen(Databuf
) / 2, Databuf
);
679 /* search for king */
680 fseek(Playersfp
, 0L, SEEK_SET
);
681 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
682 if (Other
.p_specialtype
== SC_KING
&&
683 Other
.p_status
!= S_NOTUSED
)
686 snprintf(Databuf
, SZ_DATABUF
,
687 "The present ruler is %s Level:%.0f",
688 Other
.p_name
, Other
.p_level
);
689 mvaddstr(4, 40 - strlen(Databuf
) / 2, Databuf
);
694 mvaddstr(4, 24, "There is no ruler at this time.");
696 /* search for valar */
697 fseek(Playersfp
, 0L, SEEK_SET
);
698 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
699 if (Other
.p_specialtype
== SC_VALAR
&& Other
.p_status
!= S_NOTUSED
)
700 /* found the valar */
702 snprintf(Databuf
, SZ_DATABUF
,
703 "The Valar is %s Login: %s",
704 Other
.p_name
, Other
.p_login
);
705 mvaddstr(6, 40 - strlen(Databuf
) / 2, Databuf
);
708 /* search for council of the wise */
709 fseek(Playersfp
, 0L, SEEK_SET
);
711 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
712 if (Other
.p_specialtype
== SC_COUNCIL
&& Other
.p_status
!= S_NOTUSED
)
713 /* found a member of the council */
716 mvaddstr(8, 30, "Council of the Wise:");
719 /* This assumes a finite (<=5) number of C.O.W.: */
720 snprintf(Databuf
, SZ_DATABUF
,
721 "%s Login: %s", Other
.p_name
, Other
.p_login
);
722 mvaddstr(Lines
++, 40 - strlen(Databuf
) / 2, Databuf
);
724 /* search for the two highest players */
725 nxtname
[0] = hiname
[0] = '\0';
729 fseek(Playersfp
, 0L, SEEK_SET
);
730 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
731 if (Other
.p_experience
> hiexp
&& Other
.p_specialtype
<= SC_KING
&& Other
.p_status
!= S_NOTUSED
)
732 /* highest found so far */
735 hiexp
= Other
.p_experience
;
737 hilvl
= Other
.p_level
;
738 strcpy(nxtname
, hiname
);
739 strcpy(hiname
, Other
.p_name
);
741 if (Other
.p_experience
> nxtexp
742 && Other
.p_specialtype
<= SC_KING
743 && Other
.p_status
!= S_NOTUSED
)
744 /* next highest found so far */
746 nxtexp
= Other
.p_experience
;
747 nxtlvl
= Other
.p_level
;
748 strcpy(nxtname
, Other
.p_name
);
750 mvaddstr(15, 28, "Highest characters are:");
751 snprintf(Databuf
, SZ_DATABUF
,
752 "%s Level:%.0f and %s Level:%.0f",
753 hiname
, hilvl
, nxtname
, nxtlvl
);
754 mvaddstr(17, 40 - strlen(Databuf
) / 2, Databuf
);
756 /* print last to die */
757 if ((fp
= fopen(_PATH_LASTDEAD
, "r")) != NULL
758 && fgets(Databuf
, SZ_DATABUF
, fp
) != NULL
) {
759 mvaddstr(19, 25, "The last character to die was:");
760 mvaddstr(20, 40 - strlen(Databuf
) / 2, Databuf
);
770 long loc
= 0L; /* location in player file */
771 int loop
; /* loop counter */
775 mvprintw(10, 0, "What was your character's name ? ");
776 getstring(Databuf
, SZ_NAME
);
777 truncstring(Databuf
);
779 if ((loc
= findname(Databuf
, &Player
)) >= 0L)
780 /* found character */
784 for (loop
= 0; loop
< 2; ++loop
) {
785 /* prompt for password */
786 mvaddstr(11, 0, "Password ? ");
787 getstring(Databuf
, SZ_PASSWORD
);
788 if (strcmp(Databuf
, Player
.p_password
) == 0)
793 if (Player
.p_status
!= S_OFF
)
794 /* player did not exit normally last
798 addstr("Your character did not exit normally last time.\n");
799 addstr("If you think you have good cause to have your character saved,\n");
800 printw("you may quit and mail your reason to 'root'.\n");
801 addstr("Otherwise, continuing spells certain death.\n");
802 addstr("Do you want to quit ? ");
803 ch
= getanswer("YN", FALSE
);
805 Player
.p_status
= S_HUNGUP
;
806 writerecord(&Player
, loc
);
815 mvaddstr(12, 0, "No good.\n");
820 mvaddstr(11, 0, "Not found.\n");
829 double temp
; /* for temporary calculations */
832 switch ((int) ROLL(0.0, 100.0)) {
835 if (Player
.p_poison
> 0.0) {
836 mvaddstr(4, 0, "You've found a medic! How much will you offer to be cured ? ");
837 temp
= floor(infloat());
838 if (temp
< 0.0 || temp
> Player
.p_gold
)
839 /* negative gold, or more than available */
841 mvaddstr(6, 0, "He was not amused, and made you worse.\n");
842 Player
.p_poison
+= 1.0;
844 if (drandom() / 2.0 > (temp
+ 1.0) / MAX(Player
.p_gold
, 1))
845 /* medic wants 1/2 of available gold */
846 mvaddstr(5, 0, "Sorry, he wasn't interested.\n");
848 mvaddstr(5, 0, "He accepted.");
849 Player
.p_poison
= MAX(0.0, Player
.p_poison
- 1.0);
850 Player
.p_gold
-= temp
;
856 mvaddstr(4, 0, "You've been caught raping and pillaging!\n");
857 Player
.p_experience
+= 4000.0;
862 temp
= ROLL(10.0, 75.0);
863 mvprintw(4, 0, "You've found %.0f gold pieces, want them ? ", temp
);
864 ch
= getanswer("NY", FALSE
);
867 collecttaxes(temp
, 0.0);
871 if (Player
.p_sin
> 1.0) {
872 mvaddstr(4, 0, "You've found a Holy Orb!\n");
873 Player
.p_sin
-= 0.25;
878 if (Player
.p_poison
< 1.0) {
879 mvaddstr(4, 0, "You've been hit with a plague!\n");
880 Player
.p_poison
+= 1.0;
885 mvaddstr(4, 0, "You've found some holy water.\n");
886 ++Player
.p_holywater
;
890 mvaddstr(4, 0, "You've met a Guru. . .");
891 if (drandom() * Player
.p_sin
> 1.0)
892 addstr("You disgusted him with your sins!\n");
894 if (Player
.p_poison
> 0.0) {
895 addstr("He looked kindly upon you, and cured you.\n");
896 Player
.p_poison
= 0.0;
898 addstr("He rewarded you for your virtue.\n");
899 Player
.p_mana
+= 50.0;
900 Player
.p_shield
+= 2.0;
905 mvaddstr(4, 0, "You've found an amulet.\n");
910 if (Player
.p_blindness
) {
911 mvaddstr(4, 0, "You've regained your sight!\n");
912 Player
.p_blindness
= FALSE
;
916 default: /* deal with poison */
917 if (Player
.p_poison
> 0.0) {
918 temp
= Player
.p_poison
* Statptr
->c_weakness
919 * Player
.p_maxenergy
/ 600.0;
920 if (Player
.p_energy
> Player
.p_maxenergy
/ 10.0
921 && temp
+ 5.0 < Player
.p_energy
)
922 Player
.p_energy
-= temp
;
931 int subscript
; /* used for subscripting into Stattable */
932 const struct charstats
*statptr
; /* for pointing into Stattable */
934 subscript
= type
- '1';
936 if (subscript
< C_MAGIC
|| subscript
> C_EXPER
)
937 if (subscript
!= C_SUPER
|| !Wizard
)
938 /* fighter is default */
939 subscript
= C_FIGHTER
;
941 statptr
= &Stattable
[subscript
];
944 ROLL(statptr
->c_quickness
.base
, statptr
->c_quickness
.interval
);
946 ROLL(statptr
->c_strength
.base
, statptr
->c_strength
.interval
);
948 ROLL(statptr
->c_mana
.base
, statptr
->c_mana
.interval
);
951 ROLL(statptr
->c_energy
.base
, statptr
->c_energy
.interval
);
953 ROLL(statptr
->c_brains
.base
, statptr
->c_brains
.interval
);
955 ROLL(statptr
->c_magiclvl
.base
, statptr
->c_magiclvl
.interval
);
957 Player
.p_type
= subscript
;
959 if (Player
.p_type
== C_HALFLING
)
960 /* give halfling some experience */
961 Player
.p_experience
= ROLL(600.0, 200.0);
967 /* catch/ingnore signals */
977 sigset(SIGHUP
, ill_sig
);
978 sigset(SIGTRAP
, ill_sig
);
979 sigset(SIGIOT
, ill_sig
);
980 sigset(SIGEMT
, ill_sig
);
981 sigset(SIGFPE
, ill_sig
);
982 sigset(SIGBUS
, ill_sig
);
983 sigset(SIGSEGV
, ill_sig
);
984 sigset(SIGSYS
, ill_sig
);
985 sigset(SIGPIPE
, ill_sig
);
988 signal(SIGQUIT
, ill_sig
);
989 signal(SIGALRM
, SIG_IGN
);
990 signal(SIGTERM
, SIG_IGN
);
991 signal(SIGTSTP
, SIG_IGN
);
992 signal(SIGTTIN
, SIG_IGN
);
993 signal(SIGTTOU
, SIG_IGN
);
994 signal(SIGINT
, ill_sig
);
995 signal(SIGHUP
, SIG_DFL
);
996 signal(SIGTRAP
, ill_sig
);
997 signal(SIGIOT
, ill_sig
);
998 signal(SIGEMT
, ill_sig
);
999 signal(SIGFPE
, ill_sig
);
1000 signal(SIGBUS
, ill_sig
);
1001 signal(SIGSEGV
, ill_sig
);
1002 signal(SIGSYS
, ill_sig
);
1003 signal(SIGPIPE
, ill_sig
);
1006 signal(SIGINT
, SIG_IGN
);
1007 signal(SIGQUIT
, SIG_IGN
);
1008 signal(SIGTERM
, SIG_IGN
);
1009 signal(SIGALRM
, SIG_IGN
);
1010 signal(SIGHUP
, ill_sig
);
1011 signal(SIGTRAP
, ill_sig
);
1012 signal(SIGIOT
, ill_sig
);
1013 signal(SIGEMT
, ill_sig
);
1014 signal(SIGFPE
, ill_sig
);
1015 signal(SIGBUS
, ill_sig
);
1016 signal(SIGSEGV
, ill_sig
);
1017 signal(SIGSYS
, ill_sig
);
1018 signal(SIGPIPE
, ill_sig
);
1021 signal(SIGINT
, SIG_IGN
);
1022 signal(SIGQUIT
, SIG_IGN
);
1023 signal(SIGTERM
, SIG_IGN
);
1024 signal(SIGALRM
, SIG_IGN
);
1025 signal(SIGHUP
, ill_sig
);
1026 signal(SIGTRAP
, ill_sig
);
1027 signal(SIGIOT
, ill_sig
);
1028 signal(SIGEMT
, ill_sig
);
1029 signal(SIGFPE
, ill_sig
);
1030 signal(SIGBUS
, ill_sig
);
1031 signal(SIGSEGV
, ill_sig
);
1032 signal(SIGSYS
, ill_sig
);
1033 signal(SIGPIPE
, ill_sig
);
1036 if (!initscr()) { /* turn on curses */
1037 fprintf(stderr
, "couldn't initialize screen\n");
1040 noecho(); /* do not echo input */
1041 cbreak(); /* do not process erase, kill */
1044 Windows
= TRUE
; /* mark the state */
1063 fclose(Energyvoidfp
);