DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T l

⟦cfa7c6382⟧ TextFile

    Length: 2704 (0xa90)
    Types: TextFile
    Names: »lib.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Hangman1/lib.c« 

TextFile

/*  lib.c
 *  group of short hangman library routines.
 *  written by: ritcv!jxs7451
 */
#include "hangman.h"
#include<stdio.h>

/* prints out the dead punk */
die(att)
int att;
{
   if (att > 1)
      printf("You used %d turns to lose %s.\n\n",att,getlogin());
   else
      printf("You used %d turn to lose %s.\n\n",att,getlogin());
   puts("Better luck next time!");
}

/* does shell escape to login shell */
doshell()
{
   char *getenv();

   clbtm();
   setcur(ERROR,1);
   printf("sporning a shell.  ^D to return to hangman %s\n",VERSION);
   reset_term();
   system(getenv("SHELL"));
}

/* function to print out some quick help info */
help()
{
   setcur(1,1);
   epage();
   printf("\nHangman %s help:\n",VERSION);
   puts("commands:");
   puts("   'a' to 'z'  : choose that letter");
   puts("   '!'         : shell escape to login shell");
   puts("   'G'         : try to guess the whole word");
   puts("   '?'         : print help");
   puts("   '^R'        : redraw screen (control r)");
   puts("   'Q'         : quit hangman\n");
   puts("- all words contain small letters only.");
   printf("- the default minimum word length is %d.\n",MINWORD);
   printf("- the -l option sets the minimum word lenth to %d.\n",LMINWORD);
   printf("- the -L option sets the minimum word lenth to %d.\n",LLMINWORD);
   puts("- the -D option is only for hangman development.");
   puts("- the -h option gives you less misses(ie harder).");
   puts("- the -e option gives you more misses(ie easier).");
   printf("- hangman %s is public domain.\n",VERSION);
   puts("- written by:  ritcv!jxs7451");
   printf("\nHit space to continue.");
   while (getchar() != ' ') ;
   drawscrn();
}

/* prints intro stuff */
drawscrn()
{
   setcur(1,1);
   epage();
   printf("Welcome, %s to hangman %s.\n",getlogin(),VERSION);
   printf("Hit '?' for help.");
}

/* prints error msg when use -h and -e at the same time */
twolev()
{
   puts("Cannot use 'e' and 'h' options at the same time.");
   exit(0);
}

/* prints the usage and quits.. */
usage()
{
   puts("usage: hangman [-ehlDL]");
   exit(0); /* terminate program */
}

/* function to clear out the tried array */
cltried(arr)
int arr[];
{
   int i;
   for (i = 0; i == 127; i++)
      arr[i] = 0;
   arr['!'] = 1; /* set so can shell escape */ 
   arr['G'] = 1; /* set so can guess all word */
   arr['Q'] = 1; /* set so can quit */
   arr['?'] = 1; /* set so can do help */
   arr[18]  = 1; /* set so can do ^R */
}

/* the options 'l' and 'L' used together */
twolen()
{
   puts("Cannot use 'l' and 'L' options at the same time.");
   exit(0);
}

/* clears the error area */
clbtm()
{
   int i;
   for (i = ERROR; i != (ERROR + 4); i++)
      erasel(i,1);
}