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 i

⟦b7d387540⟧ TextFile

    Length: 2091 (0x82b)
    Types: TextFile
    Names: »input.c«

Derivation

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

TextFile

#include "poker.h"



void  get_input(des,val)
      int des;
      char *val;

{/*  get a byte from the input descriptor */

   do
   {
     while(read(des,val,1) != 1);
     if(*val == '\012')
	 redraw_screen();
     if(*val == 'F')  /*  quitting  */
	 really();
    }
    while (*val == '\012' );

}/* get i/p  */



get_SDB(source,choice)
      int   source;
      char  *choice;

{
   do
      get_input(source,choice);
   while(*choice != 's' &&
	 *choice != 'd' &&
	 *choice != 'b');

}/* get SDB */




get_RCD(source,choice,turn)
      int   source;
      char  *choice;
      int   turn;

{
   do
      get_input(source,choice);
   while((*choice != 'r' && turn != 6) &&
	 *choice != 'd' &&
	 *choice != 'c');

}/* get RCD */



get_increment(source,amount)
      int  source;
      int  *amount;

/* This gets the bet value, as multiples of 5 units */
{
   char amt;

   do
     get_input(source,&amt);
   while (amt < '1' || amt > '5');

   *amount = ((amt - '0') * 5);

}


get_user_changes(source,reject,exchange)

       int    source;
       int    *reject;
       int    *exchange;

/* Get the cards to be rejected by the user */

{
       int  no_of_cards,complete,count,ok,value;
       char choice;

       ask_which();

       no_of_cards = 0;
       complete = 0;
       choice = ' ';

       do
       {
	   do
	     get_input(source,&choice);
	   while ((choice < '1' || choice > '5') && 
		   choice != '\n' && choice != '\b' && choice != '\177');
	      
		switch (choice) {

		case '\n' :  complete = 1;
                             *reject = no_of_cards;
			     break;
		case '\b' :  case '\177' :
			     delete_line();
		             no_of_cards = 0;
			     break;
		default : if(no_of_cards < 3)
			    {
			      value = choice - '1';
			      ok = 1;
			      for(count=0;count<no_of_cards;count++)
				if(value == exchange[count])
				     ok = 0;

			      if(ok)
				 {
			         show_choice(choice,no_of_cards);
			         exchange[no_of_cards++] = value;
				 }
			    }

		}/* switch */

       }
       while(!complete);


}/*get_users_changes*/