+int get_user_event(t_info *info) {
+ char event;
+ if(read(0,&event,1)!=1) {
+ perror("reading user interaction failed");
+ return -23;
+ }
+ printf("user event: %c ",event);
+ if(event=='h') {
+ info->mode^=MODE_HEXOUT;
+ printf("- hex output: %c\n",info->mode&MODE_HEXOUT?'a':'n');
+ }
+ if(event=='a') {
+ info->mode^=MODE_ASCIIOUT;
+ printf("- ascii output: %c\n",info->mode&MODE_ASCIIOUT?'a':'n');
+ }
+ if(event=='q') {
+ info->mode|=MODE_QUIT;
+ printf("- shutting down!\n");
+ }
+
+ return 23;
+}
+