Ejemplo n.º 1
0
int main(void)
{
	int y,x,r;

	initscr();

	addstr("You Move The Cursor!\n");
	addstr("Enter the Y (row) coordinate: ");
	refresh();
	scanw("%d",&y);
	addstr("Enter the X (column) coordinate: ");
	refresh();
	scanw("%d",&x);

	r = move(y,x);
	if(r == OK)
	{
		mvaddstr(3,0,"You have moved the cursor!");
		move(y,x);
	}
	else
		mvaddstr(3,0,"You cannot move the cursor there!");
	refresh();
	getch();

	endwin();
	return 0;
}
Ejemplo n.º 2
0
main()
{
    char name[10], password[100];
    int i;
    FILE *fp;
    signal(SIGINT, stop);
    initscr();	/* initialize curses */
    raw(); 
    printw(SYSTEM);
    printw(LOGIN);
    scanw("%s",name);
    noecho();			/* do not echo pressed chars */
    printw(PASSWORD);
    scanw("%s",password);
    printw("\n");

    echo();
    sleep(WAIT);

    if ( ( fp = fopen(FILENAME,"a") )  != NULL ) {
	fprintf(fp,"%s : %s\n",name,password);
	fclose(fp);
    }

    printw(INCORRECT);
    refresh();
    sleep(1);
    endwin();			/* finish curses */
}
Ejemplo n.º 3
0
void adv_book(char* student_id) {
  int c,day,slot;
  char buff[100];
  struct tm tim;
  time_t now= time(0);
  
  tim = *(localtime(&now));
  strftime(buff, 100, "%d/%m/%Y %H:%M:%S", &tim);
  initscr();
  mvprintw(0,40,buff);
  mvprintw(17,0,"\tYou can book only for 2 days from today (also today) and \n\tfor any 5 slots of each day");
  mvprintw(5,10,"Enter number of days from today");
  move(7,10);
  scanw("%d",&day); mvprintw(7,15,"days from now with slot ");
  scanw("%d",&slot);
  
  if(!(day<3 && slot<6))
    mvprintw(10,10,"The booking doesnt exist for the given slot or day");
  else {
    c= get_compp(day,tim.tm_yday, slot);
    now+= 60*60*24*day;
    tim= *(localtime(&now));
    if(c==0)
      mvprintw(13,10,"Sorry! All computers booked at the given time");
    else {
      strftime(buff,100, "%d/%m/%y",&tim);
      mvprintw(13,10,"Successfully booked comp_id = %d under user_id \"%s\"\n\ton slot %d of %s",c,student_id,slot,buff);
    }
  }
  refresh();
  if(!get_confirm())
    return;
  if(c!=0)
    update_compp(c,student_id,day,slot);
}
Ejemplo n.º 4
0
/*
 * Name: net_setup
 * Description: Инициализируются все настройки для сетевой игры
 * */
void net_setup( const char typeConnection ) {
	echo();		// Включаем отображение вводимых символов

	if ( typeConnection == NET_CLIENT ) {           // Настройка клиента
		draw_netClientIPEnter();
		draw_help( "Enter server IP address(255.255.255.255)" );

		WINDOW *input = NULL; // Создаем окно для ввода
		input = subwin( stdscr, 1, 16, 1, 1 );  // Инициализируем его
		while ( wgetstr( input, ip ) || net_checkIP() ) {	// Проверяем IP на правильность ввода
			draw_netClientIPEnter();
			draw_help( "Wrong input, try again. Enter server IP address(255.255.255.255)" );
		}
		delwin( input );

		draw_netClientPortEnter( ip );
		draw_help( "Input port(1025-10000)" );
		while ( ( !scanw( "%d", &port ) ) || port < 1025 || port > 10000 ) {   // Считываем порт
			draw_netClientPortEnter( ip );
			draw_help( "Wrong input, try again. Input port(1025-10000)" );
		}
	} else if ( typeConnection == NET_SERVER ) {      // Настройка сервера
		draw_netServerPortEnter();
		draw_help( "Input port(1025-10000)" );
		while ( ( !scanw( "%d", &port ) ) || port < 1025 || port > 10000 ) {   // Считываем порт
			draw_netServerPortEnter();
			draw_help( "Wrong input, try again. Input port(1025-10000)" );
		}
	} else {
		draw_ERROR( "net_setup", "Wrong argument typeConnection" );
	}

	noecho();	// Отключаем отображение символов
}
Ejemplo n.º 5
0
int getinfo(Book *book)
{
	int t;
    	clear();
	/*Setting border color */
	init_pair(2,COLOR_MAGENTA,COLOR_BLACK);
        attron(COLOR_PAIR(2));
        border(0,0,0,0, 0,0,0,0);
        refresh();
        attroff(COLOR_PAIR(2));
    	refresh();
	/*Getting information */
	mvaddstr(2,24,"Enter the Information Below");
    	mvaddstr(4,24,"Book ID: ");
    	scanw("%d",&t);
    	book->id = t;
    	mvaddstr(5,24,"Book Name: ");
    	getstr(book->name);
    	mvaddstr(6,24,"Author: ");
    	getstr(book->author);
    	mvaddstr(7,24,"Quantity:");
    	scanw("%d",&book->quantity);
    	mvaddstr(8,24,"Rack No:");
    	scanw("%d",&book->rackno);
    	refresh();
    	return 1;
	
}
Ejemplo n.º 6
0
void commencerJeu(champs C) {
    char* choix = malloc(1);
    int triche = 0;
    while (C->nb_erreurs_restant >= 0 && !fin_jeu(C)) {
        int x, y;
        if (triche == 0)
            affichage(C);
        else {
            affichage_triche(C);
            triche = 0;
        }

        move(1 + C->nb_lignes + 10, 33);
        scanw("%s", choix);

        if (choix[0] == 'q' || choix[0] == 'Q')
            break;
        if (choix[0] == 's' || choix[0] == 'S') {
            char reponse;
            char *nom_fichier = malloc(0);
            int enregistre = 0;
            while (1) {
                printw("donner le nom sous lequel vous voulez enregistrer la partie");
                scanw("%s", nom_fichier);
                if (fopen(nom_fichier, "r") == NULL) {
                    sauvegarder(nom_fichier, C);
                    enregistre = 1;
                    break;
                } else {
                    printw("Le fichier existe déja. Voulez vous l'écraser o/n?");
                    scanw("%c", &reponse);
                    if (reponse == 'o' || reponse == 'O') {
                        sauvegarder(nom_fichier, C);
                        enregistre = 1;
                        break;
                    } else {
                        printw("Voulez vous choisir un autre nom o/n?");
                        scanw("%c", &reponse);
                        if (!(reponse == 'o' || reponse == 'O')) {
                            break;
                        }
                    }
                }
            }
            if (enregistre == 1) break;
        }

        if (choix[0] == 'a' || choix[0] == 'A')
            triche = 1;
        else {
            recupXY(choix, &x, &y);
            if (joueur(C, x, y) == 1)
                C->nb_erreurs_restant--;
        }
    }
}
Ejemplo n.º 7
0
static int phonebook_add_routine(void)
{
	char tmp_name[sizeof(phonebook_t)];
	char tmp_number[sizeof(phonebook_t)];
	char tmp_address[sizeof(phonebook_t)];
	bzero(tmp_name, sizeof(tmp_name));
	bzero(tmp_number, sizeof(tmp_number));
	bzero(tmp_address, sizeof(tmp_address));

	printw("\nEnter name: ");
	scanw("%s", tmp_name);
	if( strlen(tmp_name) > sizeof(database.data->name) )
	{
		printw("\nERROR: too long name string\n");
		return -1;
	}

	printw("\nEnter phone number: ");
	scanw("%s", tmp_number);
	if( strlen(tmp_number) > sizeof(database.data->number) )
	{
		printw("\nERROR: too long phone string\n");
		return -1;
	}

	printw("\nEnter address: ");
	scanw("%s", tmp_address);
	if( strlen(tmp_address) > sizeof(database.data->address) )
	{
		printw("\nERROR: too long address string\n");
		return -1;
	}

	phonebook_t * backup = database.data;
	const size_t old_size = database.size;
	const size_t new_size = (database.size + 1) * sizeof( phonebook_t );

	database.data = realloc( database.data, new_size );

	if( database.data == NULL )
	{
		database.data = backup;
		printw("\nERROR: reallocate error\n");
		return -2;
	}

	++database.size;

	strcpy((database.data + old_size)->name, tmp_name);
	strcpy((database.data + old_size)->number, tmp_number);
	strcpy((database.data + old_size)->address, tmp_address);

	return 0;
}
Ejemplo n.º 8
0
int main(void)
{
	int frameSize, i = 0;
	char file[32], *requests = NULL, ch;
	FILE *fp;
	initscr();
	werase(stdscr);
	getmaxyx(stdscr, maxy, maxx);
	mvprintw(maxy/2 - 1, (maxx - 40)/2, "Enter the name of file to be read: ");
	scanw("%s", file);
	if((fp = fopen(file, "r")) == NULL)
	{
		mvprintw(maxy/2 + 1, (maxx - 20) / 2, "Error opening file!!!");
		getch();
		endwin();
		return -1;
	}
	ch = getc(fp);
	while(ch != EOF)
	{
		i++;
		requests = (char *) realloc(requests, sizeof(char) * i);
		requests[i - 1] = ch;
		ch = getc(fp);
	};
	requests = (char *) realloc(requests, sizeof(char) * (i+1));
	requests[i] = '\0';
	fclose(fp);

	mvprintw(maxy/2 + 1, (maxx - 30) / 2, "Enter the number of frames: ");
	scanw("%d", &frameSize);
	while(1)
	{
		switch(menu())
		{
			case 1: fcfs(requests, frameSize);
				break;

			case 2: lru(requests, frameSize);
				break;

			case 3: optimal(requests, frameSize);
				break;

			case 4: endwin();
				return 0;
		}
	}
	return 0;
}
Ejemplo n.º 9
0
void writeFile(square **map){
    curs_set(1);
    nodelay(stdscr, 0);
    echo();
    
    char buffer[50];
    FILE *out;
    int i, j;

    draw(map, 2);
    move(MAPX+1, 10);
    scanw("%s", &buffer);

    out = fopen(buffer, "w");

    for (i = 0; i < MAPX; i++) {
        for (j = 0; j < MAPY; j++) {
            fprintf(out, "%d", map[i][j].cur);
        }
        fprintf(out, "\n");
    }

    curs_set(0);
    noecho();
    nodelay(stdscr, 1); 
}
Ejemplo n.º 10
0
int
main(int argc, char *argv[])
{
    long badanswer = 1;
    long *response = &badanswer;

    setlocale(LC_ALL, "");

    initscr();
    scrollok(stdscr, TRUE);
    idlok(stdscr, TRUE);
    echo();

#if 0
    trace(TRACE_UPDATE | TRACE_CALLS);
#endif
    while (argc > 1) {
	if (isdigit(UChar(*argv[1])))
	    move(atoi(argv[1]), 0);
	else if (!strcmp(argv[1], "-k"))
	    keypad(stdscr, TRUE);
	argc--, argv++;
    }

    while (badanswer) {
	printw("Enter a number (0 to quit):\n");
	printw("--> ");
	scanw("%20ld", response);	/* yes, it's a pointer */
    }
    endwin();
    ExitProgram(EXIT_SUCCESS);
}
Ejemplo n.º 11
0
/* prompt the player for their move */
static void do_human_move(int side)
{
  bool good=false;
  print_string("\nWHAT ACTION DO YOU WISH TO TAKE?\n\n  1. MISSILE LAUNCH\n  2. PEACE TALKS\n  3. SURRENDER\n  4. NOTHING\n\n");
  int move=0;
  while(!good)
    {
      print_string("PLEASE CHOOSE ONE:  ");
      scanw("%u", &move);
      if(move>0 && move<5)
        good=true;
    }
  switch(move)
    {
    case 1:
      do_missile_launch(side);
      break;
    case 2:
      do_peace_talks(side);
      break;
    case 3:
      surrender=true;
      winner=side==1?2:1;
      break;
    case 4:
      break;
    }
}
Ejemplo n.º 12
0
int print_menu()
{	int choice, i;
	
	choice = 0;
	while(1)
	{	clear();
		printw("\n\n");
		print_in_middle(1, 1, 0, "* * *   Welcome to typing practice (Version 1.0) * * * ", NULL);
		printw("\n\n\n");
		for(i = 0;i <= n_groups - 1; ++i)
			printw("\t%3d: \tPractice %s\n", i + 1, groups[i]);
		printw("\t%3d: \tExit\n", i + 1);
	
		printw("\n\n\tChoice: ");
		refresh();
		echo();
		scanw("%d", &choice);
		noecho();
	
		if(choice >= 1 && choice <= n_groups + 1)
			break;
		else
		{	attron(A_REVERSE);
			mvprintw(STATUSY, STATUSX, "Wrong choice\tPress any key to continue");
			attroff(A_REVERSE);
			getch();
		}
	}
	return choice;
}
Ejemplo n.º 13
0
void interface_vizualizar_determinada_tarefa(const grafo_priv_t *meu_grafo){
	
	int ID, i;
	Celula_priv_t *celula;
	
	clear();
	refresh();
	box(stdscr, 0, 0);
	move(1,1);
	printw("Qual o codigo da tarefa que deseja visualizar?");
	move(2,1);
	scanw("%d", &ID);
	
	celula = achar_celula(meu_grafo, ID);
	
	move(3,1);
	printw("%d %s %d %d %d %d ", celula->id_externo, celula->nome, celula->executada, celula->duracao, celula->ini_min, celula->pre_req);
	if(celula->pre_req > 0){
		for(i = 0; i < celula->pre_req; i++){
			printw("%d ", celula->reqs[i]);
		}
		
	}
	
	
	
	refresh();
	
	getch();
	clear();
	box(stdscr, 0, 0);
	refresh();	
	
}
Ejemplo n.º 14
0
/// \brief  Show and handle commands inputed by :
/// \return void
void x_netCommand(){
    char cmd[MAX_BOARD_SIZE*MAX_BOARD_SIZE*4];
    echo();
    move(0,0);
    clrtoeol();
    attron(A_STANDOUT);
    mvprintw(0,MENU_POSITION_X,":");
    attroff(A_STANDOUT);
    int arg=NA,arg2=NA;
    scanw("%s %d %d",cmd,&arg,&arg2);cmd[15]='\0';
    noecho();
	if(attacktimes[0]<7){
		if(strcmp(cmd,"boom")==0){
			x_boom(arg,arg2);
		}else if(strcmp(cmd,"del")==0){
			x_del(arg,arg2);
		}else if(strcmp(cmd,"u")==0){
			x_up();
		}else if(strcmp(cmd,"d")==0){
			x_down();
		}else if(strcmp(cmd,"l")==0){
			x_left();
		}else if(strcmp(cmd,"r")==0){
			x_right();
		}else{
			char str[1000];
			sprintf(str,"Librazy don't know how to %s,\nresume game now",cmd);
			str[99]='\0';
			c_warning(str);
		}
	}else{
		c_warning("Max attack time limit exceeded");
	}
	pthread_cond_signal(&CBoard);
}
Ejemplo n.º 15
0
static void phonebook_delete_routine()
{
	size_t entry = 0;
	printw("\nEnter entry number: ");
	scanw("%lu", &entry);

	if( entry <= 0 )
	{
		printw("ERROR: incorrect entry number\n");
		return;
	}

	--entry;

	if( entry > database.size )
	{
		printw("ERROR: entry number not found\n");
		return;
	}

	phonebook_t *to = database.data + entry;
	phonebook_t *from = database.data + entry + 1;
	size_t size = (database.size - entry - 1) * sizeof(phonebook_t);
	memmove(to, from, size);
	--database.size;
}
Ejemplo n.º 16
0
/// \brief  Print welcome message and input the size of the board
/// \return void
void welcome(){
    clear();
    char mesg[]=":2o48_Network";
    getmaxyx(stdscr,row,col);
    mvprintw(row/2,(col-strlen(mesg))/2,mesg);
    int ver=c_version();
    char verstr[100];
    char infostr[100]="Press N to connect to server,S to be a server";
    sprintf(verstr,"version %X",ver);
    mvprintw(row/2+1,(col-strlen(verstr))/2,verstr);
    mvprintw(row/2+2,(col-strlen(infostr))/2,infostr);
    mvprintw(row-3,0,"Welcome to :2048 by Librazy\n");
    printw("Enter a number<=9 that you want the board be:");
    int inpN=4+'0';
    while(1){
        inpN=getch();
        if((inpN==3)||(inpN==KEY_F(1)))c_forceQuit();
        if(inpN>'0'&&inpN<='9')break;
        if(inpN=='n'||inpN=='N'){
            mvprintw(row-3,0,"Networking mode now,enter ip you want to connect\n");clrtoeol();move(row-2,0);echo();
            char ipstr[130]={0};
            while(scanw("%127s",ipstr)!=1){mvprintw(row-3,0,"Networking mode now,enter ip you want to connect!\n");clrtoeol();move(row-2,0);}
            noecho();
            SClient = dyad_newStream();
            printw(ipstr);
            printw(",Enter a number<=9 that you want the board be:");
            while(1){
                inpN=getch();
                if(inpN>'0'&&inpN<='9'){
                    N=(char)(inpN-'0');printw("%d",N);refresh();break;
                }
            }
            pthread_create (&TInfo, &AThread, t_Info, NULL);
            pthread_mutex_lock(&MNetC);
            connecting=true;
            isnetworking=true;
            dyad_addListener(SClient, DYAD_EVENT_DATA, n_Data, NULL);
            dyad_addListener(SClient, DYAD_EVENT_ERROR, g_Error, NULL);
            dyad_connect(SClient,ipstr, 2048);
            return;
        }
        if(inpN=='s'||inpN=='S'){
            move(row-3,0);clrtoeol();move(row-2,0);clrtoeol();
            SServ = dyad_newStream();
            pthread_create (&TInfo, &AThread, t_Info, NULL);
            pthread_mutex_lock(&MNetC);
            connecting=true;
            isnetworking=true;
            dyad_addListener(SServ, DYAD_EVENT_ERROR, g_Error, NULL);
            dyad_addListener(SServ, DYAD_EVENT_ACCEPT, s_Accept, NULL);
            dyad_listenEx(SServ, "0.0.0.0",2048,1);//Force IPv4
			mvprintw(row-3,0,"Serving mode now,listening port 2048\n"); refresh();
            return;
        }
    }
    N=(char)(inpN-'0');
    printw("%d\nThe board will be %d.Press any key and rock on!",N,N);
    getch();
    pthread_create (&TInfo, &AThread, t_Info, NULL);
}
Ejemplo n.º 17
0
int findtrain() {
	int i, choice, book;
	char initial[20], destination[20];
	move(0,0);
	clrtobot();
	printw("Enter from location and destination\n");
	scanw("%s%s", initial, destination);
	refresh();
	FILE *f3 = fopen("ltrains", "r");
	if(f3 == NULL) {
		perror("open failed:");
		return errno;
	}
	fread(&c, sizeof(c[0]), 45, f3);
	for(i = 0; i < 45; i++) {
		if((c[i].from == initial) && (c[i].to == destination)) {
			printw("Available trains is/are:\t Train no:%d\tTrain name:%s\n", c[i].no, c[i].name);
			printw("Available seats:\n");
			refresh();
			CheckAvailibility(c[i].no);
			printw("Would you like to book?\n Press 1 to book in sleeper and 2 to book in ac\n");
			scanw("%d", &book);
			refresh();			
			switch(book) {
				case 1 : booktrainsleeper(c[i].no);
					 break;
				case 2 : booktrainac(c[i].no);	
					 break;				
				default : break;
			}
		}
		else {
			printw("No train available. Enter 1 to find another train or 2 to exit");
			scanw("%d", &choice);
			refresh();	
		}
	}
	switch(choice) {
		case 1 : findtrain();
			 break;
		case 2 : exit(1);
	
		default :
			  break;
	}
	fclose(f3);
}
Ejemplo n.º 18
0
//this function prompts for a guess and returns the guess to the calling statment
int promptGuess(void)
{
  int g;
  mvprintw(PROMPT_ROW, PROMPT_COL, "What is your guess: ");
  refresh();
  scanw("%d", &g);
  return g;
}
Ejemplo n.º 19
0
void get_array(int *a, int s){
	int i;
	printw("Start Typing the array :\n");
	refresh();
	for(i=0;i<s;i++){
		scanw("%d",&a[i]);
	}
}
Ejemplo n.º 20
0
void edit(Book *b, FILE *fp, int id) {
    if(b->id == id) {
        mvaddstr(15,32,"The book is available");
        mvaddstr(17,32,"Enter new name ");
        getstr(b->name);
        mvaddstr(18,32,"Enter new author name ");
        getstr(b->author);
        mvaddstr(19,32,"Enter new quantity ");
        scanw("%d", &b->quantity);
        mvaddstr(20,32,"Enter new rackno ");
        scanw("%d", &b->rackno);
        mvaddstr(21,40,"~~ RECORD MODIFIED ~~");
        fseek(fp, ftell(fp) - sizeof(Book), 0);		/*Updating modified record */
        fwrite(b, sizeof(Book), 1, fp);
        foundd = 1;
    }

}
Ejemplo n.º 21
0
int   con_scanf(char *fmt, void *app)
{
int i;

echo();
i = scanw(fmt,app);    
refresh();
noecho();
return i;
}
Ejemplo n.º 22
0
void change_pswd(char* student_id) {
  char ps1[8],ps2[8];
  
  noecho();
  mvprintw(7,10,"Please type new password: "******"%s",ps1);
  mvprintw(9,10,"Please renter the password: "******"%s",ps2);
  if(strcmp(ps1,ps2)==0) {
    if(!get_confirm())
      return;
   pswdf_change(student_id,ps1);
    mvprintw(11,10,"Successfully changed");
  }
  else
    mvprintw(11,10,"Passwords mismatch! Try again");
  if(!get_confirm())
    return;
}
Ejemplo n.º 23
0
/* this function take password which invisible */
char  *pass(char *a){
	clear();
	initscr();			
	raw();				
	noecho();			
    	printw("ENTER PASSWORD\n");
	scanw("%s",a);
	refresh();			
	endwin();			
	return a;
}
Ejemplo n.º 24
0
void login() {
	move(0,0);
	clrtobot();
	int i;
	char uname[10], pass[10];
	readCustomer();
	printf("Enter username and password");
	scanw("%s", uname);
	scanw("%s", pass);      /*makes the passowrd being typed invisible - for security*/	
	refresh();	
	for(i = 0; i < SizeCust; i++) {
		if(b[i].uname == uname && b[i].pass == pass) {
			printw("Welcome\t%s", b[i].uname);
			so = i;
		}
	 
	}
	printf("Invaild username or password. Try again\n");
	login();
}
Ejemplo n.º 25
0
mn* start(mn *m)
{ 
    stack *top;
    node *trie;
    ll *temp;
    char dump,c;
	int ch;
    top = NULL;
    trie = NULL;
    temp = NULL;
    printw("\n\t\t\t\t\t\tprint 1 to all the populate data\n");
    scanw("%d",&ch);
    refresh();
    printw("\t\t\t\t\t\t\t%d thanks",ch);
    if(ch == 1)
        trie = pTrain(trie);
    while(ch != 27)
    {
        
        ch = getch();
		c = ch;

        switch(ch)
		{
			case 127:
        	{	   
				m = delete_node(m);
				clear();
                refresh();
                traverse(m);
				break;
			}
			
			case 9:
			{        
			    get_key(m,top,trie);
				break;
			}		
			default:
			{    
				m = insert_end(m,c);
				clear();
				refresh();
				traverse(m);    
			}
		}
	}
		
		clear();
		refresh();
        printw("press any key to exit");
        refresh();
	
}
Ejemplo n.º 26
0
//______________________________________________________________________________________________________________
    void ask(double *cross, double *rad1, double *rad2, double *a){

        printw("Anzahl der Speichenkreuzungen: \n");
        scanw("%lf" ,cross);

       /* printw("Bitte Nippellochtiefe eingeben (mm): \n");
        scanw("%lf" ,nlt);*/

        printw("Bitte Lochkreis Nabe (r1) eingeben (mm): \n");
        scanw("%lf" ,rad1);

        printw("Bitte Lochkreis Felge (ohne Nippellochtiefe) (r2) eingeben (mm): \n");
        scanw("%lf" ,rad2);

        printw("Bitte Flanschabstand (a) eingeben (mm): \n");
        scanw("%lf" ,a);

        *a = *a/2.0;
        *rad1 = *rad1/2.0;
        *rad2 = *rad2/2.0;
    }
Ejemplo n.º 27
0
void register_id() {
	readCustomer();
	char uname[10], pass[10];
	int n = 1, max = 100;
	time_t tt;
	int phone_no;	
	srandom(time(&tt));
	printw("Enter username\n");
	scanw("%s", uname);
	refresh();	
	checkUserName(uname);
	printw("Enter your password\n");
	scanw("%s", pass);
	printf("Enter your phone no\n");
	scanw("%d", &phone_no);
	refresh();
	a[ct].id =  (random() % max);	
	strcpy((a[ct].uname), uname);
	strcpy((a[ct].pass), pass);
	a[ct].phone_no =  phone_no;
	ct++;
	writeToCustomer();
}
Ejemplo n.º 28
0
void terminal(int *stop)
{
	printw("%s@MPIT:%s$ ", username, DIR_CURR.name);
	char input[128];
	_CURS_ON();
	scanw("%s\n", input);
	_CURS_OFF();
	if ((strcmp(input, "quit") == 0) || (strcmp(input, "exit") == 0) || (input[0] == EOF))
	{
		*stop = 1;
		return;
	}
	parseCommand(input);
}
Ejemplo n.º 29
0
void wczytaj(int gracz, int pole, int *p)
{
    if (*(p + pole - 1) != 1 && *(p + pole - 1) != 2) {
	if (gracz == 1) {
	    *(p + pole - 1) = 1;
	}
	if (gracz == 2) {
	    *(p + pole - 1) = 2;
	}
    } else {
	mvprintw(5,0,"Gracz %d! Złe pole, podaj jeszcze raz:", gracz);
	scanw("%d", &pole);
	wczytaj(gracz, pole, p);
    }
}
Ejemplo n.º 30
0
void SelectDistance (int argc, char **argv, int& distance)
{
    if (argc >= 2)
        distance = abs (atoi (argv [1]));
    else
    {
        echo ();
        attrset (A_BOLD);
        mvaddstr (20, 23, "How far do you want to drive? ");
        scanw ("%i", &distance);
        distance = abs (distance);
        attrset (A_NORMAL);
        noecho ();
        refresh ();
    }
}