Example #1
0
int main()
{
    Personptr ls = make_person("Luke Skywalker", 34);
    Personptr wp = make_person("Winston Peters", 48);
    
    talk(ls);
    talk(wp);
}
Example #2
0
int main()
{
  PersonPtr ls,wp;

  ls = make_person("Luke Skywalker",34);
  wp = make_person("Winston Peters",48);

  talk(ls);
  talk(wp);
  return 0;
}
Example #3
0
void AnswMachine::start()
{
    /* Only wait if somebody could possibly answer.
       (The 'ringing your party again' has just been displayed,
       we want to leave a second chance for the callee to answer.)

       If NEU/not logged, start quickly. (Wait just a little for the 
       LEAVE_INVITE to come.) */
    sleep( (mode==PROC_REQ_ANSWMACH) ? Options.time_before_answmach : 1 );
    
    usercfg = init_user_config(local_user);
    
    if (LaunchIt("Answmach"))
    {
        talkconn->open_sockets();
        
        if (talkconn->look_for_invite(1/*mandatory*/))
            /* otherwise, either the caller gave up before we 
               started or the callee answered ... */
        {
            /* There was an invitation waiting for us,
             * so connect with the other (hopefully waiting) party */
            if (talkconn->connect())
            {
                /* send the first 3 chars, machine dependent */
                talkconn->set_edit_chars();
                
                /* Do the talking */
                talk();
            }
        }
    }
    if (usercfg) end_user_config();
}
Example #4
0
void Character::talk(talk_type tt, const std::string &message) { //only for say, whisper, shout
    talk(tt, message, message);

    if (getType() == player) {
#ifdef LOG_TALK
        std::string talkType;

        switch (tt) {
        case tt_say:
            talkType = "says";
            break;

        case tt_whisper:
            talkType = "whispers";
            break;

        case tt_yell:
            talkType = "shouts";
            break;
        }

        Logger::info(LogFacility::Chat) << *this << " " << talkType << ": " << message << Log::end;
#endif
        ServerCommandPointer cmd = std::make_shared<BBTalkTC>(id, static_cast<unsigned char>(tt), message);
        _world->monitoringClientList->sendCommand(cmd);
    }
}
Example #5
0
File: talk.c Project: 274914765/C
int main (int argc, char *argv[])
{
    int index;

    set_program_name (argv[0]);
    iu_argp_init ("talk", program_authors);
    argp_parse (&argp, argc, argv, 0, &index, NULL);

    argc -= index;
    argv += index;

    if (argc == 0)
    {
        printf ("Usage: talk user [ttyname]\n");
        exit (-1);
    }
    if (!isatty (0))
    {
        printf ("Standard input must be a tty, not a pipe or a file\n");
        exit (-1);
    }

    get_names (argc, argv);
    init_display ();
    open_ctl ();
    open_sockt ();
    start_msgs ();
    if (!check_local ())
        invite_remote ();
    end_msgs ();
    set_edit_chars ();
    talk ();
}
// runs job as supplied in script
int perform(Actor *actor){
	int i,performances;
  do{
    performances = 0; //counts the jobs that have been done this iteration
    // if poison_pill has been issued, kill everyone
		if(actor->poison_pill){
			for(i=0;i<number_of_processes;i++){
				talk(actor,i,-1);
			}
			return 0;
		}

    // if not retired, receive messages and read script
    if(!actor->retire){
			_be_interacted_with(actor);
      actor->script(actor);
      performances++;
    }
    // help proteges with their scripts
		performances += _help_proteges(actor);
  }
  while(performances > 0 && actor->mentor == NULL);
  // if you are the lead actor, iterate until there are no more jobs being done
  return performances;
}
Example #7
0
void
draw_nose(ModeInfo * mi)
{
	nosestruct *np;

	if (noses == NULL)
		return;
	np = &noses[MI_SCREEN(mi)];
	if (np->noseGC[0] == None)
		return;

	MI_IS_DRAWN(mi) = True;
	if (np->busyLoop > 0) {
		np->busyLoop--;
		return;
	}
	switch (np->state) {
		case MOVE:
			move(mi);
			break;
		case TALK:
			talk(mi, 0);
			break;
	}
}
Example #8
0
int
main(int argc, char *argv[])
{
	if (pledge("stdio rpath inet dns getpw tty", NULL) == -1)
		err(1, "pledge");

	get_names(argc, argv);
	init_display();
	open_ctl();
	open_sockt();
	start_msgs();
	if (!check_local())
		invite_remote();
	end_msgs();
	set_edit_chars();

	if (his_machine_addr.s_addr == my_machine_addr.s_addr) {
		if (pledge("stdio tty", NULL) == -1)
			err(1, "pledge");
	} else {
		if (pledge("stdio inet tty", NULL) == -1)
			err(1, "pledge");
	}

	talk();
	return (0);
}
Example #9
0
int main(void)
{
	PersonPtr Mike = make_person("Mike", 22);
	talk(Mike);
	commentAboutAge(Mike);

	return 0;
}
Example #10
0
/*
// Name: make_action
// In: tag, the tag of the message.
//	   command, the command that was send.
//	   message, the trailing message (arguments).
//	   c, the client that sent the message.
//	   msg_is_quoted, wheater or no teh message contains quotes.
//	   clients, all connected clients.
//	   curr_topic, the current topic.
// Out: The action that the client want to do in it's connection.
// Purpose: Parses the command and does the proper action.
*/
int make_action(char* tag, char* command, char* message, 
				clientconn_t *c, char msg_is_quoted, 
				hash *clients, char *curr_topic) {
	if(strlen(tag)==0) {
		return 0;
	}
	if(strcmp(tag, "\r\n")==0) {
		client_write(c, "BAD No tag.\r\n", 13);
		return 0;
	}
	if(strlen(command)==0) {
		client_write(c, tag, strlen(tag));
		client_write(c, " BAD No command.\r\n", 18);
		return 0;
	}
	if(msg_is_quoted && !msg_is_correctly_quoted(message, msg_is_quoted) &&
		strcmp(command, "PRIVATE")) {
		return badly_formed(c, tag);
	}
	if(strcmp(command, "CAPABILITY")==0) {
		return capability(c, tag);
	}
	if(strcmp(command, "JOIN")==0) {
		return join(c, tag, clients);
	}
	if(strcmp(command, "NICK")==0) {
		return nick(c, tag, message, msg_is_quoted, clients);
	}
	if(strcmp(command,"QUIT")==0) {
		return quit(c, tag, clients);
	}
	if(!c->joined) {
		return not_joined(c, tag);
	}
	if(strcmp(command, "LEAVE")==0) {
		return leave(c, tag, clients);
	}
	if(strcmp(command, "TALK")==0) {
		return talk(c, tag, message, clients);
	}
	if(strcmp(command, "NAMES")==0) {
		return names(c, tag, clients);
	}
	if(strcmp(command, "TOPIC")==0) {
		return topic(c, tag, message, clients, curr_topic);
	}
	if(strcmp(command, "PRIVATE")==0) {
		return private(c, tag, message, clients);
	}
	if(strcmp(command, "WHOIS")==0) {
		return whois(c, tag, message, clients);
	}
	client_write(c, tag, strlen(tag));
	client_write(c, " BAD Unkown command.\r\n", 22);
	return 0;

}
Example #11
0
int main(int argc, char *argv[]) {
  Animal* rover = dog("Rover");
  Animal* sassy = cat("Sassy");

  talk(rover);
  talk(sassy);

  Animal buddy;
  buddy.talk = bark;
  buddy.name[0] = 'B';
  buddy.name[1] = '\0';

  buddy.talk(&buddy);

  free(rover);
  free(sassy);

  return 0;
}
main() {
	
	void (*talk)(char, char);
	talk = &chatter;

	talk ('c', 'd');		//you can write it this way
	(*talk)('c', 'd');		//or this way. They are the same.

	return 0;
}
Example #13
0
void	ClapTrap::beRepaired(unsigned int amount) {

			//	Max repair
	if (hitPoints + amount > maxHitPoints)
		amount = maxHitPoints - hitPoints;

	std::cout << name << " repaired " << amount << " points of damage ! "
				<< talk("healing") << std::endl;

	hitPoints += amount;
}
void connect_server(GtkWidget *widget, struct args *data)
{
        GtkWidget *window3;
        GtkWidget *label1,label2,label3;
	data->ip=gtk_entry_get_text(GTK_ENTRY (data->entry_ip));
	data->port=gtk_entry_get_text(GTK_ENTRY (data->entry_port));
	data->me_id=gtk_entry_get_text(GTK_ENTRY (data->entry_me));
	data->u_id1=data->u_id=gtk_entry_get_text(GTK_ENTRY (data->entry_u));
	puts(data->u_id1);
//	strcpy(data->u_id1,data->u_id);
//	window3= gtk_window_new(GTK_WINDOW_TOPLEVEL);
//	gtk_signal_connect(GTK_OBJECT(window3),"delete_event",
//				GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);

//	puts(data->ip);
//	puts(data->port);
//	puts(data->u_id);
//	puts(data->me_id);
// creating a thread just because a single process cannot handle more than a //
// fixed number of file descriptors :) i am intelligent courtsy krishna //
	pthread_t thread_id;
	pthread_create(&thread_id,NULL,&connect_1,data);
	sleep(2);
	talk(data);
	pthread_join(thread_id,NULL);
/*
//	FILE *fd1,*fd2;
//	int asd=fork(); //just because a process can support a
			// ltd no. of file des.
//	if (asd==0)
	{
		mkfifo("./temp/gui_fifo",0777);
		puts("1\n");
		(data->fd_gui)=fopen("./temp/gui_fifo","w");
//		printf("%d\n",data->fd_gui);
		perror("file:");
		 puts("2\n");
		(data->fd_chat)=fopen("./temp/chat_fifo","r");
		 puts("3\n");
		fwrite(data->ip,100,1,data->fd_gui);
		 puts("4\n");
	        //write(data->fd_gui,data->port,100);
		fwrite(data->port,100,1,data->fd_gui);
		 puts("5\n");
	        //write(data->fd_gui,data->u_id,100);
		fwrite(data->me_id,100,1,data->fd_gui);
		 puts("6\n");
	        //write(data->fd_gui,data->me_id,100);
		fwrite(data->u_id,100,1,data->fd_gui);
		 puts("6\n");
		talk(data);
	}
*/
}
Example #15
0
void	SuperTrap::ninjaShoebox(std::string const & target) {

	if (energyPoints < 25)
		std::cout << name <<	": Like my old buddy used to say : \""\
								"You must construct additional pylons\"."
					<< std::endl;
	else {
		std::cout << name << ": Hey " << target << ", "\
				<< talk("special") << std::endl;
		energyPoints -= 25;
	}
}
Example #16
0
ClapTrap::ClapTrap( std::string	name ) :	talk(talk_fn),
											name(name),
											hitPoints (100),
											maxHitPoints (100),
											energyPoints (100),
											maxEnergyPoints (100),
											level (1),
											meleeAttackDamage (30),
											rangedAttackDamage (20),
											armorDamageReduction (3) {

	std::cout << name << ": " << talk("creation") << std::endl;
	(void)level;
}
Example #17
0
int
main(int argc, char **argv)
{
	(void) setlocale(LC_CTYPE, "");

	get_names(argc, argv);
	check_writeable();
	init_display();
	open_ctl();
	open_sockt();
	start_msgs();
	if (!check_local())
		invite_remote();
	end_msgs();
	set_edit_chars();
	talk();
	return 0;
}
Example #18
0
uint8 IEC::OutATN(uint8 byte)
{
	received_cmd = sec_addr = 0;	// Command is sent with secondary address
	switch (byte & 0xf0) {
		case ATN_LISTEN:
			listening = true;
			return listen(byte & 0x0f);
		case ATN_UNLISTEN:
			listening = false;
			return unlisten();
		case ATN_TALK:
			listening = false;
			return talk(byte & 0x0f);
		case ATN_UNTALK:
			listening = false;
			return untalk();
	}
	return ST_TIMEOUT;
}
Example #19
0
	void PanicActor::act()
	{
		//Panicking: running from room to room, screaming.

		std::vector<Environment *> possible_moves = currentroom().neighbours();

		Environment * next_room = nullptr;
		while (true) {
			unsigned int i = std::rand() % 8;
			next_room = possible_moves[i];
			if (next_room != nullptr) {
				go_to(next_room);
				break;
			}
		}

		talk();
				

	}
Example #20
0
size_t device::receive_data(std::vector<unsigned char>& data_buf,
			       int device_number,
			       int channel )
{
    talk( device_number );
    data_talk( channel );

    size_t received = 0;
    try
    {
	received = receive_from_bus(data_buf);
    }
    catch (raspbiec_error &e)
    {
	untalk();
	throw;
    }
    untalk();

    return received;
}
Example #21
0
File: knight.c Project: janisz/prir
void *Knight(void* thread_data)
{
    ThreadData data = (*(ThreadData*)thread_data);
    set_name(&data);
    printf("%s come\n", data.name);

    data.round = 0;

    while (data.round < MAX_ROUND) {
        int want_to_talk = RANDOM_BOOL;
        int repeat = 1;

        lock_table_mutex(data);
        do {
            if (want_to_talk && (can_talk(data))) {
                if (data.id == KING) {
                    set_king_state(data, IS_TALKING);
                }
                talk(data.name);
                if (data.id == KING) {
                    set_king_state(data, ACTIVE);
                }
                break;
            } else if (!want_to_talk) {
                lock_cup_and_plate_mutex(data);
                wait_for_meal_and_eat(&data);
                break;
            } else {
                pthread_cond_wait(&data.cond[TALKING_COND], &data.table_m[LEFT]);
            }
        } while (repeat);
        unlock_mutex_and_broadcast(data);
    }

    quit_party(data);
    pthread_exit(NULL);
}
static void
move (struct state *st)
{
    if (!st->move_length)
    {
	register int    tries = 0;
	st->move_dir = 0;
	if ((random() & 1) && think(st))
	{
	    talk(st, 0);		/* sets timeout to itself */
	    return;
	}
	if (!(random() % 3) && (st->interval = look(st)))
	{
	    st->next_fn = move;
	    return;
	}
	st->interval = 20 + random() % 100;
	do
	{
	    if (!tries)
		st->move_length = st->Width / 100 + random() % 90, tries = 8;
	    else
		tries--;
	    /* There maybe the case that we won't be able to exit from
	       this routine (especially when the geometry is too small)!!

	       Ensure that we can exit from this routine.
	     */
#if 1
	    if (!tries && (st->move_length <= 1)) {
	      st->move_length = 1;
	      break;
	    }
#endif
	    switch (random() % 8)
	    {
	    case 0:
		if (st->x - X_INCR * st->move_length >= 5)
		    st->move_dir = LEFT;
		break;
	    case 1:
		if (st->x + X_INCR * st->move_length <= st->Width - 70)
		    st->move_dir = RIGHT;
		break;
	    case 2:
		if (st->y - (Y_INCR * st->move_length) >= 5)
		    st->move_dir = UP, st->interval = 40;
		break;
	    case 3:
		if (st->y + Y_INCR * st->move_length <= st->Height - 70)
		    st->move_dir = DOWN, st->interval = 20;
		break;
	    case 4:
		if (st->x - X_INCR * st->move_length >= 5 && st->y - (Y_INCR * st->move_length) >= 5)
		    st->move_dir = (LEFT | UP);
		break;
	    case 5:
		if (st->x + X_INCR * st->move_length <= st->Width - 70 &&
		    st->y - Y_INCR * st->move_length >= 5)
		    st->move_dir = (RIGHT | UP);
		break;
	    case 6:
		if (st->x - X_INCR * st->move_length >= 5 &&
		    st->y + Y_INCR * st->move_length <= st->Height - 70)
		    st->move_dir = (LEFT | DOWN);
		break;
	    case 7:
		if (st->x + X_INCR * st->move_length <= st->Width - 70 &&
		    st->y + Y_INCR * st->move_length <= st->Height - 70)
		    st->move_dir = (RIGHT | DOWN);
		break;
	    default:
		/* No Defaults */
		break;
	    }
	} while (!st->move_dir);
    }
    if (st->move_dir)
      walk(st, st->move_dir);
    --st->move_length;
    st->next_fn = move;
}
void GameController::processTurn()
{
    ui->clearStatusBar();

    int oldHP = player->getHP();

    char command = getch();
    switch (command)
    {    
    case 2:
        player->move(player->getX(), player->getY() + 1);
        break;

    case 3:
        player->move(player->getX(), player->getY() - 1);
        break;

    case 4:
        player->move(player->getX() - 1, player->getY());
        break;

    case 5:
        player->move(player->getX() + 1, player->getY());
        break;

    case '1':
        player->move(player->getX() - 1, player->getY() + 1);
        break;

    case '2':
        player->move(player->getX(), player->getY() + 1);
        break;

    case '3':
        player->move(player->getX() + 1, player->getY() + 1);
        break;

    case '4':
        player->move(player->getX() - 1, player->getY());
        break;

    case '6':
        player->move(player->getX() + 1, player->getY());
        break;

    case '7':
        player->move(player->getX() - 1, player->getY() - 1);
        break;

    case '8':
        player->move(player->getX(), player->getY() - 1);
        break;

    case '9':
        player->move(player->getX() + 1, player->getY() - 1);
        break;

    case 'e':
        enter();
        break;

    case 'h':
        ui->writeToStatusBar("Commands: "
                             "e -- enter the map, "
                             "i -- browse inventory, "
                             "p -- pick up an item, \n"
                             "t -- talk, "
                             "f -- cast a flood spell, "
                             "q -- quit.\n");
        break;

    case 'i':
        ui->browseInventory(player);
        break;

    case 'p':
        pickUp();
        break;

    case 't':
        talk();
        break;

    case 'f':
        ui->writeToStatusBar(player->castAFlood());
        break;

    case 'q':
        tryToQuit();
        break;

    default:
        break;
    }

    string *message = new string();
    int enemiesKilled = currentMap->processActorsTurns(player, message);
    score += enemiesKilled;
    player->addExp(enemiesKilled);
    if (*message != "")
        ui->writeToStatusBar(*message + "\n");
    int newHP = player->getHP();
    if (newHP < oldHP)
        ui->writeToStatusBar("You were attacked!\n");

    ui->updateStatsBar(player);

    if (!player->isAlive())
    {
        if (player->drowned())
            ui->writeToStatusBar("You drowned!\n");
        state = over;
    }
}
Example #24
0
int main() {
   talk(1000);
   talk(1000000);
   talk(1000000000);
}
static void
talk_1 (struct state *st) 
{
  talk(st, 0);
}
Example #26
0
int
main(int argc, char **argv)
{
	struct passwd const *pw;
	struct servent const *sp;
	long omask;
	int argoff, asrsh, ch, dflag, nflag, one, rem;
	pid_t pid = 0;
	uid_t uid;
	char *args, *host, *p, *user;
	int timeout = 0;

	argoff = asrsh = dflag = nflag = 0;
	one = 1;
	host = user = NULL;

	/* if called as something other than "rsh", use it as the host name */
	if ((p = strrchr(argv[0], '/')))
		++p;
	else
		p = argv[0];
	if (strcmp(p, "rsh"))
		host = p;
	else
		asrsh = 1;

	/* handle "rsh host flags" */
	if (!host && argc > 2 && argv[1][0] != '-') {
		host = argv[1];
		argoff = 1;
	}

#define	OPTIONS	"468Lde:l:nt:w"
	while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
		switch(ch) {
		case '4':
			family = PF_INET;
			break;

		case '6':
			family = PF_INET6;
			break;

		case 'L':	/* -8Lew are ignored to allow rlogin aliases */
		case 'e':
		case 'w':
		case '8':
			break;
		case 'd':
			dflag = 1;
			break;
		case 'l':
			user = optarg;
			break;
		case 'n':
			nflag = 1;
			break;
		case 't':
			timeout = atoi(optarg);
			break;
		case '?':
		default:
			usage();
		}
	optind += argoff;

	/* if haven't gotten a host yet, do so */
	if (!host && !(host = argv[optind++]))
		usage();

	/* if no further arguments, must have been called as rlogin. */
	if (!argv[optind]) {
		if (asrsh)
			*argv = rlogin;
		execv(_PATH_RLOGIN, argv);
		err(1, "can't exec %s", _PATH_RLOGIN);
	}

	argc -= optind;
	argv += optind;

	if (!(pw = getpwuid(uid = getuid())))
		errx(1, "unknown user id");
	if (!user)
		user = pw->pw_name;

	args = copyargs(argv);

	sp = NULL;
	if (sp == NULL)
		sp = getservbyname("shell", "tcp");
	if (sp == NULL)
		errx(1, "shell/tcp: unknown service");

	if (timeout) {
		signal(SIGALRM, connect_timeout);
		alarm(timeout);
	}
	rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, &rfd2,
		      family);
	if (timeout) {
		signal(SIGALRM, SIG_DFL);
		alarm(0);
	}

	if (rem < 0)
		exit(1);

	if (rfd2 < 0)
		errx(1, "can't establish stderr");
	if (dflag) {
		if (setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one,
		    sizeof(one)) < 0)
			warn("setsockopt");
		if (setsockopt(rfd2, SOL_SOCKET, SO_DEBUG, &one,
		    sizeof(one)) < 0)
			warn("setsockopt");
	}

	setuid(uid);
	omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGTERM));
	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
		signal(SIGINT, sendsig);
	if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
		signal(SIGQUIT, sendsig);
	if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
		signal(SIGTERM, sendsig);

	if (!nflag) {
		pid = fork();
		if (pid < 0)
			err(1, "fork");
	}
	else
		shutdown(rem, SHUT_WR);

	ioctl(rfd2, FIONBIO, &one);
	ioctl(rem, FIONBIO, &one);

	talk(nflag, omask, pid, rem, timeout);

	if (!nflag)
		kill(pid, SIGKILL);
	exit(0);
}
Example #27
0
int
main (int argc, char **argv)
{
  talk ();
}
Example #28
0
void DreamGenContext::obname(uint8 command, uint8 commandType) {
	if (data.byte(kReasseschanges) == 0) {
		if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) {
			if (data.byte(kWalkandexam) == 1) {
				walkandexamine();
				return;
			} else if (data.word(kMousebutton) == 0)
				return;
			else if ((data.byte(kCommandtype) == 3) && (data.byte(kLastflag) < 2))
				return;
			else if ((data.byte(kManspath) != data.byte(kPointerspath)) || (data.byte(kCommandtype) == 3)) {
				setwalk();
				data.byte(kReasseschanges) = 1;
				return;
			} else if (! finishedwalkingCPP())
				return;
			else if (data.byte(kCommandtype) == 5) {
				if (data.word(kWatchingtime) == 0)
					talk();
				return;
			} else {
				if (data.word(kWatchingtime) == 0)
					examineob();
				return;
			}
		}
	} else
		data.byte(kReasseschanges) = 0;

	data.byte(kCommand) = command;
	data.byte(kCommandtype) = commandType;
	if ((data.byte(kLinepointer) != 254) || (data.word(kWatchingtime) != 0) || (data.byte(kFacing) != data.byte(kTurntoface))) {
		blocknametext();
		return;
	} else if (data.byte(kCommandtype) != 3) {
		if (data.byte(kManspath) != data.byte(kPointerspath)) {
			walktotext();
			return;
		} else if (data.byte(kCommandtype) == 3) {
			blocknametext();
			return;
		} else if (data.byte(kCommandtype) == 5) {
			personnametext();
			return;
		} else {
			examineobtext();
			return;
		}
	}
	if (data.byte(kManspath) == data.byte(kPointerspath)) {
		uint8 flag, flagEx, type, flagX, flagY;
		checkone(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY);
		if (flag < 2) {
			blocknametext();
			return;
		}
	}

	getflagunderp();
	if (data.byte(kLastflag) < 2) {
		blocknametext();
		return;
	} else if (data.byte(kLastflag) >= 128) {
		blocknametext();
		return;
	} else {
		walktotext();
		return;
	}
}
Example #29
0
main(int argc, char **argv)
{
talk(IP, "cool");
}
Example #30
0
/* deal with a new player command in dungeon or city mode*/
void p_process(void)
{
    static int searchval=0;

    if (Player.status[BERSERK])
        if (goberserk()) {
            setgamestatus(SKIP_PLAYER);
            drawvision(Player.x,Player.y);
        }
    if (! gamestatusp(SKIP_PLAYER)) {
        if (searchval > 0) {
            searchval--;
            if (searchval == 0) resetgamestatus(FAST_MOVE);
        }
        drawvision(Player.x,Player.y);
        if (! gamestatusp(FAST_MOVE)) {
            searchval = 0;
            Cmd = mgetc();
            clear_if_necessary();
        }
        Command_Duration = 0;
        switch (Cmd) {
        case ' ':
        case 13:
            setgamestatus(SKIP_MONSTERS);
            break; /*no op on space or return*/
        case 6:
            abortshadowform();
            break; /* ^f */
        case 7:
            wizard();
            break; /* ^g */
        case 4:
            player_dump();
            break; /* ^d */
        case 9:
            display_pack();
            morewait();
            xredraw();
            break; /* ^i */
        case 11:
            if (gamestatusp(CHEATED)) frobgamestatus();
            break;
        case 12:
            xredraw();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^l */
#if !defined(WIN32)
        case 16:
            bufferprint();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^p */
#else
        case 15:
            bufferprint();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^o */
#endif
        case 18:
            redraw();
            setgamestatus(SKIP_MONSTERS);
            break; /* ^r */
        case 23:
            if (gamestatusp(CHEATED)) drawscreen();
            break; /* ^w */
        case 24: /* ^x */
            if (gamestatusp(CHEATED) ||
                    Player.rank[ADEPT])
                wish(1);
            Command_Duration = 5;
            break;
        case 'a':
            zapwand();
            Command_Duration = Player.speed*8/5;
            break;
        case 'c':
            closedoor();
            Command_Duration = Player.speed*2/5;
            break;
        case 'd':
            drop();
            Command_Duration = Player.speed*5/5;
            break;
        case 'e':
            eat();
            Command_Duration = 30;
            break;
        case 'f':
            fire();
            Command_Duration = Player.speed*5/5;
            break;
        case 'g':
            pickup();
            Command_Duration = Player.speed*10/5;
            break;
        case 'i':
            do_inventory_control();
            break;
        case 'm':
            magic();
            Command_Duration = 12;
            break;
        case 'o':
            opendoor();
            Command_Duration = Player.speed*5/5;
            break;
        case 'p':
            pickpocket();
            Command_Duration = Player.speed*20/5;
            break;
        case 'q':
            quaff();
            Command_Duration = 10;
            break;
        case 'r':
            peruse();
            Command_Duration = 20;
            break;
        case 's':
            search(&searchval);
            Command_Duration = 20;
            break;
        case 't':
            talk();
            Command_Duration = 10;
            break;
        case 'v':
            vault();
            Command_Duration = Player.speed*10/5;
            break;
        case 'x':
            examine();
            Command_Duration = 1;
            break;
        case 'z':
            bash_location();
            Command_Duration = Player.speed*10/5;
            break;
        case 'A':
            activate();
            Command_Duration = 10;
            break;
        case 'C':
            callitem();
            break;
        case 'D':
            disarm();
            Command_Duration = 30;
            break;
        case 'E':
            dismount_steed();
            Command_Duration = Player.speed*10/5;
            break;
        case 'F':
            tacoptions();
            break;
        case 'G':
            give();
            Command_Duration = 10;
            break;
        case 'I':
            if (! optionp(TOPINV)) top_inventory_control();
            else {
                display_possessions();
                inventory_control();
            }
            break;
        case 'M':
            city_move();
            Command_Duration = 10;
            break;
        case 'O':
            setoptions();
#if defined(WIN32)
            show_screen();
            xredraw();
#endif
            break;
        case 'P':
            show_license();
            break; /* actually show_license is in file.c */
        case 'Q':
            quit();
            break;
        case 'R':
            rename_player();
            break;
        case 'S':
            save(FALSE);
            break;
        case 'T':
            tunnel();
            Command_Duration =  Player.speed*30/5;
            break;
        case 'V':
            version();
            break;
        case 'Z':
            bash_item();
            Command_Duration = Player.speed*10/5;
            break;
        case '.':
            rest();
            Command_Duration = 10;
            break;
        case ',':
            Command_Duration = 10;
            nap();
            break;
        case '>':
            downstairs();
            break;
        case '<':
            upstairs();
            break;
        case '@':
            p_movefunction(Level->site[Player.x][Player.y].p_locf);
            Command_Duration = 5;
            break;
        case '#':
            if (gamestatusp(CHEATED)) editstats();
            break; /* RAC - char editor */
        case '/':
            charid();
            setgamestatus(SKIP_MONSTERS);
            break;
        case '?':
            help();
            setgamestatus(SKIP_MONSTERS);
            break;
        case '4':
        case 'h':
            moveplayer(-1,0);
            Command_Duration = Player.speed*5/5;
            break;
        case '2':
        case 'j':
            moveplayer(0,1);
            Command_Duration = Player.speed*5/5;
            break;
        case '8':
        case 'k':
            moveplayer(0,-1);
            Command_Duration = Player.speed*5/5;
            break;
        case '6':
        case 'l':
            moveplayer(1,0);
            Command_Duration = Player.speed*5/5;
            break;
        case '1':
        case 'b':
            moveplayer(-1,1);
            Command_Duration = Player.speed*5/5;
            break;
        case '3':
        case 'n':
            moveplayer(1,1);
            Command_Duration = Player.speed*5/5;
            break;
        case '7':
        case 'y':
            moveplayer(-1,-1);
            Command_Duration = Player.speed*5/5;
            break;
        case '9':
        case 'u':
            moveplayer(1,-1);
            Command_Duration = Player.speed*5/5;
            break;
        case '5':
            setgamestatus(SKIP_MONSTERS); /* don't do anything; a dummy turn */
            Cmd = mgetc();
            while ((Cmd != ESCAPE) &&
                    ((Cmd < '1') || (Cmd > '9') || (Cmd=='5'))) {
                print3("Run in keypad direction [ESCAPE to abort]: ");
                Cmd = mgetc();
            }
            if (Cmd != ESCAPE) 
                setgamestatus(FAST_MOVE);
            else
                clearmsg3();
            break;
        case 'H':
            setgamestatus(FAST_MOVE);
            Cmd = 'h';
            moveplayer(-1,0);
            Command_Duration = Player.speed*4/5;
            break;
        case 'J':
            setgamestatus(FAST_MOVE);
            Cmd = 'j';
            moveplayer(0,1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'K':
            setgamestatus(FAST_MOVE);
            Cmd = 'k';
            moveplayer(0,-1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'L':
            setgamestatus(FAST_MOVE);
            Cmd = 'l';
            moveplayer(1,0);
            Command_Duration = Player.speed*4/5;
            break;
        case 'B':
            setgamestatus(FAST_MOVE);
            Cmd = 'b';
            moveplayer(-1,1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'N':
            setgamestatus(FAST_MOVE);
            Cmd = 'n';
            moveplayer(1,1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'Y':
            setgamestatus(FAST_MOVE);
            Cmd = 'y';
            moveplayer(-1,-1);
            Command_Duration = Player.speed*4/5;
            break;
        case 'U':
            setgamestatus(FAST_MOVE);
            Cmd = 'u';
            moveplayer(1,-1);
            Command_Duration = Player.speed*4/5;
            break;
        default:
            commanderror();
            setgamestatus(SKIP_MONSTERS);
            break;
        }
    }
    if (Current_Environment != E_COUNTRYSIDE) roomcheck();
    screencheck(Player.x,Player.y);
}