Returning the character that the user pressed after the reveal.
modified: src/nms.c modified: src/nms.h modified: src/sneakers.c
This commit is contained in:
parent
17348f7c85
commit
dd50839dae
@ -47,7 +47,7 @@ char getMaskChar(void);
|
||||
* Displays the characters stored in the / char * / parameter
|
||||
*
|
||||
*/
|
||||
void nmsexec(char *src) {
|
||||
char nmsexec(char *src) {
|
||||
struct winpos *list_pointer = NULL;
|
||||
struct winpos *start; // Always points to start of list
|
||||
struct winpos *temp; // Used for free()ing the list
|
||||
@ -56,6 +56,7 @@ void nmsexec(char *src) {
|
||||
int r_time, r_time_l, r_time_s;
|
||||
int ms, ls;
|
||||
bool first = true;
|
||||
char ret = 0;
|
||||
|
||||
// Start and initialize curses mode
|
||||
initscr();
|
||||
@ -216,7 +217,7 @@ void nmsexec(char *src) {
|
||||
|
||||
// If stdin is set to the keyboard, user must press a key to continue
|
||||
if (isatty(STDIN_FILENO))
|
||||
getch();
|
||||
ret = getch();
|
||||
else
|
||||
sleep(2);
|
||||
|
||||
@ -230,6 +231,8 @@ void nmsexec(char *src) {
|
||||
list_pointer = list_pointer->next;
|
||||
free(temp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4,6 +4,6 @@
|
||||
// Function prototypes
|
||||
|
||||
// Display the characters stored in the display queue
|
||||
void nmsexec(char *);
|
||||
char nmsexec(char *);
|
||||
|
||||
#endif
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
int main(void) {
|
||||
int l, termLines, termCols, spaces = 0;
|
||||
char input;
|
||||
char display[2000];
|
||||
char *head1Left = "DATANET PROC RECORD: 45-3456-W-3452";
|
||||
char *head1Right = "Transnet on/xc-3";
|
||||
@ -153,7 +154,28 @@ int main(void) {
|
||||
strcat(display, foot2Center);
|
||||
|
||||
// Display characters
|
||||
nmsexec(display);
|
||||
input = nmsexec(display);
|
||||
|
||||
switch (input) {
|
||||
case '1':
|
||||
printf("User chose 1\n");
|
||||
break;
|
||||
case '2':
|
||||
printf("User chose 2\n");
|
||||
break;
|
||||
case '3':
|
||||
printf("User chose 3\n");
|
||||
break;
|
||||
case '4':
|
||||
printf("User chose 4\n");
|
||||
break;
|
||||
case '5':
|
||||
printf("User chose 5\n");
|
||||
break;
|
||||
case '6':
|
||||
printf("User chose 6\n");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user