]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - phantasia/main.c
1 /* $NetBSD: main.c,v 1.16 2006/05/13 22:29:53 christos 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.
31 #include <sys/types.h>
35 * The program allocates as much file space as it needs to store characters,
36 * so the possibility exists for the character file to grow without bound.
37 * The file is purged upon normal entry to try to avoid that problem.
38 * A similar problem exists for energy voids. To alleviate the problem here,
39 * the void file is cleared with every new king, and a limit is placed
40 * on the size of the energy void file.
44 * Put one line of text into the file 'motd' for announcements, etc.
48 * The scoreboard file is updated when someone dies, and keeps track
49 * of the highest character to date for that login.
50 * Being purged from the character file does not cause the scoreboard
56 * main.c Main routines for Phantasia
63 int main(int, char **);
70 bool noheader
= FALSE
; /* set if don't want header */
71 bool headeronly
= FALSE
; /* set if only want header */
72 bool examine
= FALSE
; /* set if examine a character */
73 time_t seconds
; /* for time of day */
74 double dtemp
; /* for temporary calculations */
76 initialstate(); /* init globals */
78 /* process arguments */
79 while (--argc
&& (*++argv
)[0] == '-')
85 case 'H': /* Header */
89 case 'a': /* all users */
94 case 'p': /* purge old players */
99 case 'S': /* set 'Wizard' */
103 case 'x': /* examine */
107 case 'm': /* monsters */
112 case 'b': /* scoreboard */
118 if (!isatty(0)) /* don't let non-tty's play */
122 playinit(); /* set up to catch signals, init curses */
131 purgeoldplayers(); /* clean up old characters */
138 /* get the player structure filled */
142 mvaddstr(22, 17, "Do you have a character to run [Q = Quit] ? ");
144 switch (getanswer("NYQ", FALSE
)) {
146 Fileloc
= recallplayer();
154 Fileloc
= rollnewplayer();
159 while (Fileloc
< 0L);
161 if (Player
.p_level
> 5.0)
162 /* low level players have long timeout */
165 /* update some important player statistics */
166 strcpy(Player
.p_login
, Login
);
168 Player
.p_lastused
= localtime(&seconds
)->tm_yday
;
169 Player
.p_status
= S_PLAYING
;
170 writerecord(&Player
, Fileloc
);
172 Statptr
= &Stattable
[Player
.p_type
]; /* initialize pointer */
174 /* catch interrupts */
176 sigset(SIGINT
, interrupt
);
179 signal(SIGINT
, interrupt
);
182 signal(SIGINT
, interrupt
);
185 signal(SIGINT
, interrupt
);
188 altercoordinates(Player
.p_x
, Player
.p_y
, A_FORCED
); /* set some flags */
193 /* loop forever, processing input */
196 adjuststats(); /* cleanup stats */
198 if (Throne
&& Player
.p_crowns
== 0 && Player
.p_specialtype
!= SC_KING
)
199 /* not allowed on throne -- move */
201 mvaddstr(5, 0, "You're not allowed in the Lord's Chamber without a crown.\n");
202 altercoordinates(0.0, 0.0, A_NEAR
);
204 checktampered();/* check for energy voids, etc. */
206 if (Player
.p_status
!= S_CLOAKED
208 && (dtemp
= fabs(Player
.p_x
)) == fabs(Player
.p_y
)
213 dtemp
= sqrt(dtemp
/ 100.0);
214 if (floor(dtemp
) == dtemp
)
215 /* |x| / 100 == n*n; at a trading post */
221 checkbattle(); /* check for player to player battle */
222 neatstuff(); /* gurus, medics, etc. */
224 if (Player
.p_status
== S_CLOAKED
) {
225 /* costs 3 mana per turn to be cloaked */
226 if (Player
.p_mana
> 3.0)
227 Player
.p_mana
-= 3.0;
229 /* ran out of mana, uncloak */
231 Player
.p_status
= S_PLAYING
;
236 if (Player
.p_status
!= S_PLAYING
&& Player
.p_status
!= S_CLOAKED
)
237 /* change status back to S_PLAYING */
239 Player
.p_status
= S_PLAYING
;
243 /* update file only if important stuff has changed */
245 writerecord(&Player
, Fileloc
);
249 readmessage(); /* read message, if any */
251 displaystats(); /* print statistics */
256 /* maybe make king, print prompt, etc. */
259 /* print status line */
260 addstr("1:Move 2:Players 3:Talk 4:Stats 5:Quit ");
261 if (Player
.p_level
>= MEL_CLOAK
&& Player
.p_magiclvl
>= ML_CLOAK
)
263 if (Player
.p_level
>= MEL_TELEPORT
&& Player
.p_magiclvl
>= ML_TELEPORT
)
264 addstr("7:Teleport ");
265 if (Player
.p_specialtype
>= SC_COUNCIL
|| Wizard
)
266 addstr("8:Intervene ");
268 procmain(); /* process input */
287 /* setup login name */
288 if ((Login
= getlogin()) == NULL
)
289 Login
= getpwuid(getuid())->pw_name
;
291 /* open some files */
292 if ((Playersfp
= fopen(_PATH_PEOPLE
, "r+")) == NULL
)
295 if (fileno(Playersfp
) < 3)
298 if ((Monstfp
= fopen(_PATH_MONST
, "r+")) == NULL
)
302 if ((Messagefp
= fopen(_PATH_MESS
, "r")) == NULL
)
306 if ((Energyvoidfp
= fopen(_PATH_VOID
, "r+")) == NULL
)
308 if (fstat(fileno(Energyvoidfp
), &sb
) == -1)
310 if (sb
.st_size
== 0) {
311 /* initialize grail to new location */
312 Enrgyvoid
.ev_active
= TRUE
;
313 Enrgyvoid
.ev_x
= ROLL(-1.0e6
, 2.0e6
);
314 Enrgyvoid
.ev_y
= ROLL(-1.0e6
, 2.0e6
);
315 writevoid(&Enrgyvoid
, 0L);
320 srandom((unsigned) time(NULL
)); /* prime random numbers */
326 int chartype
; /* character type */
329 initplayer(&Player
); /* initialize player structure */
332 mvaddstr(4, 21, "Which type of character do you want:");
334 "1:Magic User 2:Fighter 3:Elf 4:Dwarf 5:Halfling 6:Experimento ");
336 addstr("7:Super ? ");
337 chartype
= getanswer("1234567", FALSE
);
340 chartype
= getanswer("123456", FALSE
);
344 genchar(chartype
); /* roll up a character */
346 /* print out results */
348 "Strength : %2.0f Quickness: %2.0f Mana : %2.0f\n",
349 Player
.p_strength
, Player
.p_quickness
, Player
.p_mana
);
351 "Energy Level: %2.0f Brains : %2.0f Magic Level: %2.0f\n",
352 Player
.p_energy
, Player
.p_brains
, Player
.p_magiclvl
);
354 if (Player
.p_type
== C_EXPER
|| Player
.p_type
== C_SUPER
)
357 mvaddstr(14, 14, "Type '1' to keep >");
358 ch
= getanswer(" ", TRUE
);
362 if (Player
.p_type
== C_EXPER
|| Player
.p_type
== C_SUPER
)
363 /* get coordinates for experimento */
365 mvaddstr(16, 0, "Enter the X Y coordinates of your experimento ? ");
366 getstring(Databuf
, SZ_DATABUF
);
367 sscanf(Databuf
, "%lf %lf", &Player
.p_x
, &Player
.p_y
);
369 if (fabs(Player
.p_x
) > D_EXPER
|| fabs(Player
.p_y
) > D_EXPER
)
370 mvaddstr(17, 0, "Invalid coordinates. Try again.\n");
376 /* name the new character */
379 "Give your character a name [up to %d characters] ? ", SZ_NAME
- 1);
380 getstring(Player
.p_name
, SZ_NAME
);
381 truncstring(Player
.p_name
); /* remove trailing blanks */
383 if (Player
.p_name
[0] == '\0')
385 mvaddstr(19, 0, "Invalid name.");
387 if (findname(Player
.p_name
, &Other
) >= 0L)
388 /* cannot have duplicate names */
389 mvaddstr(19, 0, "Name already in use.");
391 /* name is acceptable */
394 addstr(" Pick another.\n");
397 /* get a password for character */
401 mvaddstr(20, 0, "Give your character a password [up to 8 characters] ? ");
402 getstring(Player
.p_password
, SZ_PASSWORD
);
403 mvaddstr(21, 0, "Enter again to verify: ");
404 getstring(Databuf
, SZ_PASSWORD
);
406 while (strcmp(Player
.p_password
, Databuf
) != 0);
410 return (allocrecord());
417 double x
; /* desired new x coordinate */
418 double y
; /* desired new y coordinate */
419 double temp
; /* for temporary calculations */
420 FILE *fp
; /* for opening files */
421 int loop
; /* a loop counter */
422 bool hasmoved
= FALSE
; /* set if player has moved */
425 mvaddstr(4, 0, "\n\n"); /* clear status area */
428 clrtobot(); /* clear data on bottom area of screen */
430 if (Player
.p_specialtype
== SC_VALAR
&& (ch
== '1' || ch
== '7'))
431 /* valar cannot move */
435 case 'K': /* move up/north */
438 y
= Player
.p_y
+ MAXMOVE();
442 case 'J': /* move down/south */
445 y
= Player
.p_y
- MAXMOVE();
449 case 'L': /* move right/east */
451 x
= Player
.p_x
+ MAXMOVE();
456 case 'H': /* move left/west */
458 x
= Player
.p_x
- MAXMOVE();
464 Player
.p_energy
+= (Player
.p_maxenergy
+ Player
.p_shield
) / 15.0
465 + Player
.p_level
/ 3.0 + 2.0;
467 MIN(Player
.p_energy
, Player
.p_maxenergy
+ Player
.p_shield
);
469 if (Player
.p_status
!= S_CLOAKED
)
470 /* cannot find mana if cloaked */
472 Player
.p_mana
+= (Circle
+ Player
.p_level
) / 4.0;
474 if (drandom() < 0.2 && Player
.p_status
== S_PLAYING
&& !Throne
)
475 /* wandering monster */
480 case 'X': /* change/examine a character */
485 for (loop
= 3; loop
; --loop
) {
486 mvaddstr(4, 0, "X Y Coordinates ? ");
487 getstring(Databuf
, SZ_DATABUF
);
489 if (sscanf(Databuf
, "%lf %lf", &x
, &y
) != 2)
490 mvaddstr(5, 0, "Try again\n");
492 if (distance(Player
.p_x
, x
, Player
.p_y
, y
) > MAXMOVE())
501 case '2': /* players */
505 case '3': /* message */
506 mvaddstr(4, 0, "Message ? ");
507 getstring(Databuf
, SZ_DATABUF
);
508 /* we open the file for writing to erase any data which is
510 fp
= fopen(_PATH_MESS
, "w");
511 if (Databuf
[0] != '\0')
512 fprintf(fp
, "%s: %s", Player
.p_name
, Databuf
);
516 case '4': /* stats */
520 case '5': /* good-bye */
524 case '6': /* cloak */
525 if (Player
.p_level
< MEL_CLOAK
|| Player
.p_magiclvl
< ML_CLOAK
)
528 if (Player
.p_status
== S_CLOAKED
)
529 Player
.p_status
= S_PLAYING
;
531 if (Player
.p_mana
< MM_CLOAK
)
532 mvaddstr(5, 0, "No mana left.\n");
535 Player
.p_mana
-= MM_CLOAK
;
536 Player
.p_status
= S_CLOAKED
;
540 case '7': /* teleport */
542 * conditions for teleport
543 * - 20 per (level plus magic level)
544 * - OR council of the wise or valar or ex-valar
545 * - OR transport from throne
546 * transports from throne cost no mana
548 if (Player
.p_level
< MEL_TELEPORT
|| Player
.p_magiclvl
< ML_TELEPORT
)
551 for (loop
= 3; loop
; --loop
) {
552 mvaddstr(4, 0, "X Y Coordinates ? ");
553 getstring(Databuf
, SZ_DATABUF
);
555 if (sscanf(Databuf
, "%lf %lf", &x
, &y
) == 2) {
556 temp
= distance(Player
.p_x
, x
, Player
.p_y
, y
);
558 /* can transport anywhere from throne */
559 && Player
.p_specialtype
<= SC_COUNCIL
560 /* council, valar can transport
562 && temp
> (Player
.p_level
+ Player
.p_magiclvl
) * 20.0)
563 /* can only move 20 per exp.
564 * level + mag. level */
567 temp
= (temp
/ 75.0 + 1.0) * 20.0; /* mana used */
569 if (!Throne
&& temp
> Player
.p_mana
)
570 mvaddstr(5, 0, "Not enough power for that distance.\n");
573 Player
.p_mana
-= temp
;
583 case '9': /* monster */
585 /* no monsters while on throne */
586 mvaddstr(5, 0, "No monsters in the chamber!\n");
588 if (Player
.p_specialtype
!= SC_VALAR
)
589 /* the valar cannot call monsters */
591 Player
.p_sin
+= 1e-6;
596 case '0': /* decree */
597 if (Wizard
|| (Player
.p_specialtype
== SC_KING
&& Throne
))
598 /* kings must be on throne to decree */
604 case '8': /* intervention */
605 if (Wizard
|| Player
.p_specialtype
>= SC_COUNCIL
)
613 /* player has moved -- alter coordinates, and do random
616 altercoordinates(x
, y
, A_SPECIFIC
);
618 if (drandom() < 0.2 && Player
.p_status
== S_PLAYING
&& !Throne
)
626 FILE *fp
; /* used for opening various files */
627 bool councilfound
= FALSE
; /* set if we find a member of the
629 bool kingfound
= FALSE
; /* set if we find a king */
630 double hiexp
, nxtexp
; /* used for finding the two highest players */
631 double hilvl
, nxtlvl
; /* used for finding the two highest players */
632 char hiname
[21], nxtname
[21]; /* used for finding the two
637 "W e l c o m e t o P h a n t a s i a (vers. 3.3.2)!");
639 /* print message of the day */
640 if ((fp
= fopen(_PATH_MOTD
, "r")) != NULL
641 && fgets(Databuf
, SZ_DATABUF
, fp
) != NULL
) {
642 mvaddstr(2, 40 - strlen(Databuf
) / 2, Databuf
);
645 /* search for king */
646 fseek(Playersfp
, 0L, SEEK_SET
);
647 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
648 if (Other
.p_specialtype
== SC_KING
&&
649 Other
.p_status
!= S_NOTUSED
)
652 sprintf(Databuf
, "The present ruler is %s Level:%.0f",
653 Other
.p_name
, Other
.p_level
);
654 mvaddstr(4, 40 - strlen(Databuf
) / 2, Databuf
);
659 mvaddstr(4, 24, "There is no ruler at this time.");
661 /* search for valar */
662 fseek(Playersfp
, 0L, SEEK_SET
);
663 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
664 if (Other
.p_specialtype
== SC_VALAR
&& Other
.p_status
!= S_NOTUSED
)
665 /* found the valar */
667 sprintf(Databuf
, "The Valar is %s Login: %s", Other
.p_name
, Other
.p_login
);
668 mvaddstr(6, 40 - strlen(Databuf
) / 2, Databuf
);
671 /* search for council of the wise */
672 fseek(Playersfp
, 0L, SEEK_SET
);
674 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
675 if (Other
.p_specialtype
== SC_COUNCIL
&& Other
.p_status
!= S_NOTUSED
)
676 /* found a member of the council */
679 mvaddstr(8, 30, "Council of the Wise:");
682 /* This assumes a finite (<=5) number of C.O.W.: */
683 sprintf(Databuf
, "%s Login: %s", Other
.p_name
, Other
.p_login
);
684 mvaddstr(Lines
++, 40 - strlen(Databuf
) / 2, Databuf
);
686 /* search for the two highest players */
687 nxtname
[0] = hiname
[0] = '\0';
691 fseek(Playersfp
, 0L, SEEK_SET
);
692 while (fread((char *) &Other
, SZ_PLAYERSTRUCT
, 1, Playersfp
) == 1)
693 if (Other
.p_experience
> hiexp
&& Other
.p_specialtype
<= SC_KING
&& Other
.p_status
!= S_NOTUSED
)
694 /* highest found so far */
697 hiexp
= Other
.p_experience
;
699 hilvl
= Other
.p_level
;
700 strcpy(nxtname
, hiname
);
701 strcpy(hiname
, Other
.p_name
);
703 if (Other
.p_experience
> nxtexp
704 && Other
.p_specialtype
<= SC_KING
705 && Other
.p_status
!= S_NOTUSED
)
706 /* next highest found so far */
708 nxtexp
= Other
.p_experience
;
709 nxtlvl
= Other
.p_level
;
710 strcpy(nxtname
, Other
.p_name
);
712 mvaddstr(15, 28, "Highest characters are:");
713 sprintf(Databuf
, "%s Level:%.0f and %s Level:%.0f",
714 hiname
, hilvl
, nxtname
, nxtlvl
);
715 mvaddstr(17, 40 - strlen(Databuf
) / 2, Databuf
);
717 /* print last to die */
718 if ((fp
= fopen(_PATH_LASTDEAD
, "r")) != NULL
719 && fgets(Databuf
, SZ_DATABUF
, fp
) != NULL
) {
720 mvaddstr(19, 25, "The last character to die was:");
721 mvaddstr(20, 40 - strlen(Databuf
) / 2, Databuf
);
731 long loc
= 0L; /* location in player file */
732 int loop
; /* loop counter */
736 mvprintw(10, 0, "What was your character's name ? ");
737 getstring(Databuf
, SZ_NAME
);
738 truncstring(Databuf
);
740 if ((loc
= findname(Databuf
, &Player
)) >= 0L)
741 /* found character */
745 for (loop
= 0; loop
< 2; ++loop
) {
746 /* prompt for password */
747 mvaddstr(11, 0, "Password ? ");
748 getstring(Databuf
, SZ_PASSWORD
);
749 if (strcmp(Databuf
, Player
.p_password
) == 0)
754 if (Player
.p_status
!= S_OFF
)
755 /* player did not exit normally last
759 addstr("Your character did not exit normally last time.\n");
760 addstr("If you think you have good cause to have your character saved,\n");
761 printw("you may quit and mail your reason to 'root'.\n");
762 addstr("Otherwise, continuing spells certain death.\n");
763 addstr("Do you want to quit ? ");
764 ch
= getanswer("YN", FALSE
);
766 Player
.p_status
= S_HUNGUP
;
767 writerecord(&Player
, loc
);
776 mvaddstr(12, 0, "No good.\n");
781 mvaddstr(11, 0, "Not found.\n");
790 double temp
; /* for temporary calculations */
793 switch ((int) ROLL(0.0, 100.0)) {
796 if (Player
.p_poison
> 0.0) {
797 mvaddstr(4, 0, "You've found a medic! How much will you offer to be cured ? ");
798 temp
= floor(infloat());
799 if (temp
< 0.0 || temp
> Player
.p_gold
)
800 /* negative gold, or more than available */
802 mvaddstr(6, 0, "He was not amused, and made you worse.\n");
803 Player
.p_poison
+= 1.0;
805 if (drandom() / 2.0 > (temp
+ 1.0) / MAX(Player
.p_gold
, 1))
806 /* medic wants 1/2 of available gold */
807 mvaddstr(5, 0, "Sorry, he wasn't interested.\n");
809 mvaddstr(5, 0, "He accepted.");
810 Player
.p_poison
= MAX(0.0, Player
.p_poison
- 1.0);
811 Player
.p_gold
-= temp
;
817 mvaddstr(4, 0, "You've been caught raping and pillaging!\n");
818 Player
.p_experience
+= 4000.0;
823 temp
= ROLL(10.0, 75.0);
824 mvprintw(4, 0, "You've found %.0f gold pieces, want them ? ", temp
);
825 ch
= getanswer("NY", FALSE
);
828 collecttaxes(temp
, 0.0);
832 if (Player
.p_sin
> 1.0) {
833 mvaddstr(4, 0, "You've found a Holy Orb!\n");
834 Player
.p_sin
-= 0.25;
839 if (Player
.p_poison
< 1.0) {
840 mvaddstr(4, 0, "You've been hit with a plague!\n");
841 Player
.p_poison
+= 1.0;
846 mvaddstr(4, 0, "You've found some holy water.\n");
847 ++Player
.p_holywater
;
851 mvaddstr(4, 0, "You've met a Guru. . .");
852 if (drandom() * Player
.p_sin
> 1.0)
853 addstr("You disgusted him with your sins!\n");
855 if (Player
.p_poison
> 0.0) {
856 addstr("He looked kindly upon you, and cured you.\n");
857 Player
.p_poison
= 0.0;
859 addstr("He rewarded you for your virtue.\n");
860 Player
.p_mana
+= 50.0;
861 Player
.p_shield
+= 2.0;
866 mvaddstr(4, 0, "You've found an amulet.\n");
871 if (Player
.p_blindness
) {
872 mvaddstr(4, 0, "You've regained your sight!\n");
873 Player
.p_blindness
= FALSE
;
877 default: /* deal with poison */
878 if (Player
.p_poison
> 0.0) {
879 temp
= Player
.p_poison
* Statptr
->c_weakness
880 * Player
.p_maxenergy
/ 600.0;
881 if (Player
.p_energy
> Player
.p_maxenergy
/ 10.0
882 && temp
+ 5.0 < Player
.p_energy
)
883 Player
.p_energy
-= temp
;
893 int subscript
; /* used for subscripting into Stattable */
894 const struct charstats
*statptr
; /* for pointing into Stattable */
896 subscript
= type
- '1';
898 if (subscript
< C_MAGIC
|| subscript
> C_EXPER
)
899 if (subscript
!= C_SUPER
|| !Wizard
)
900 /* fighter is default */
901 subscript
= C_FIGHTER
;
903 statptr
= &Stattable
[subscript
];
906 ROLL(statptr
->c_quickness
.base
, statptr
->c_quickness
.interval
);
908 ROLL(statptr
->c_strength
.base
, statptr
->c_strength
.interval
);
910 ROLL(statptr
->c_mana
.base
, statptr
->c_mana
.interval
);
913 ROLL(statptr
->c_energy
.base
, statptr
->c_energy
.interval
);
915 ROLL(statptr
->c_brains
.base
, statptr
->c_brains
.interval
);
917 ROLL(statptr
->c_magiclvl
.base
, statptr
->c_magiclvl
.interval
);
919 Player
.p_type
= subscript
;
921 if (Player
.p_type
== C_HALFLING
)
922 /* give halfling some experience */
923 Player
.p_experience
= ROLL(600.0, 200.0);
929 /* catch/ingnore signals */
939 sigset(SIGHUP
, ill_sig
);
940 sigset(SIGTRAP
, ill_sig
);
941 sigset(SIGIOT
, ill_sig
);
942 sigset(SIGEMT
, ill_sig
);
943 sigset(SIGFPE
, ill_sig
);
944 sigset(SIGBUS
, ill_sig
);
945 sigset(SIGSEGV
, ill_sig
);
946 sigset(SIGSYS
, ill_sig
);
947 sigset(SIGPIPE
, ill_sig
);
950 signal(SIGQUIT
, ill_sig
);
951 signal(SIGALRM
, SIG_IGN
);
952 signal(SIGTERM
, SIG_IGN
);
953 signal(SIGTSTP
, SIG_IGN
);
954 signal(SIGTTIN
, SIG_IGN
);
955 signal(SIGTTOU
, SIG_IGN
);
956 signal(SIGINT
, ill_sig
);
957 signal(SIGHUP
, SIG_DFL
);
958 signal(SIGTRAP
, ill_sig
);
959 signal(SIGIOT
, ill_sig
);
960 signal(SIGEMT
, ill_sig
);
961 signal(SIGFPE
, ill_sig
);
962 signal(SIGBUS
, ill_sig
);
963 signal(SIGSEGV
, ill_sig
);
964 signal(SIGSYS
, ill_sig
);
965 signal(SIGPIPE
, ill_sig
);
968 signal(SIGINT
, SIG_IGN
);
969 signal(SIGQUIT
, SIG_IGN
);
970 signal(SIGTERM
, SIG_IGN
);
971 signal(SIGALRM
, SIG_IGN
);
972 signal(SIGHUP
, ill_sig
);
973 signal(SIGTRAP
, ill_sig
);
974 signal(SIGIOT
, ill_sig
);
975 signal(SIGEMT
, ill_sig
);
976 signal(SIGFPE
, ill_sig
);
977 signal(SIGBUS
, ill_sig
);
978 signal(SIGSEGV
, ill_sig
);
979 signal(SIGSYS
, ill_sig
);
980 signal(SIGPIPE
, ill_sig
);
983 signal(SIGINT
, SIG_IGN
);
984 signal(SIGQUIT
, SIG_IGN
);
985 signal(SIGTERM
, SIG_IGN
);
986 signal(SIGALRM
, SIG_IGN
);
987 signal(SIGHUP
, ill_sig
);
988 signal(SIGTRAP
, ill_sig
);
989 signal(SIGIOT
, ill_sig
);
990 signal(SIGEMT
, ill_sig
);
991 signal(SIGFPE
, ill_sig
);
992 signal(SIGBUS
, ill_sig
);
993 signal(SIGSEGV
, ill_sig
);
994 signal(SIGSYS
, ill_sig
);
995 signal(SIGPIPE
, ill_sig
);
998 initscr(); /* turn on curses */
999 noecho(); /* do not echo input */
1000 cbreak(); /* do not process erase, kill */
1003 Windows
= TRUE
; /* mark the state */
1023 fclose(Energyvoidfp
);