1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
/*
* Q u e s t i o n s
*
*/
static int Questions()
{
int rep=0, n ;
char c, buf[3] ;
fprintf (stderr, "\n\n What would you like to do :\n");
fprintf (stderr, "\n 1 : Connect to a server (HELLO/WELCOME)");
fprintf (stderr, "\n 16 : Disconnect from server (BYE)\n");
fprintf (stderr, "\n 17 : Exit");
fprintf (stderr, "\n\n Please enter your choice : ");
while ( Checks_To_Read_Input() == ERROR )
{
}
n = 0 ;
c = 0 ;
while ( (c != '\n') || (c != 10) || (c != 13) )
{
fscanf ( stdin, "%c", &c );
if ( (c != '\n') || (c != 10)|| (c != 13) )
{
buf[n] = c ;
n = n + 1 ;
if ( n == 2 )
break ;
}
}
if ( n == 0 )
rep = Questions();
if ( (n == 2) && ((strcmp(buf, "-h") == 0) || (strcmp(buf, "-H") == 0)) )
{
Display_Help();
fscanf ( stdin, "%c", &c );
rep = Questions();
}
else
sscanf ( buf, "%d", &rep );
.....
} |
Partager