1 /* 2 * Common user interface functionality. 3 * 4 * Copyright (C) 2013 Paul Boddie 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 */ 11 12 #include <stdio.h> 13 #include <stdlib.h> 14 #include <ubb/ubb.h> 15 #include <pthread.h> 16 #include "ui.h" 17 #include "shutdown.h" 18 19 void text_shutdown(int signum) 20 { 21 init_shutdown(signum); 22 } 23 24 void text_shutdown_threaded(int signum) 25 { 26 extern pthread_t thread; 27 void *threadresult; 28 29 if (pthread_cancel(thread) == 0) 30 pthread_join(thread, &threadresult); 31 32 text_shutdown(signum); 33 } 34 35 /* Textual interface functions. */ 36 37 imu_ui_op text_handle_events() 38 { 39 return IMU_UI_OP_NULL; 40 } 41 42 void text_flush() 43 { 44 fflush(stdout); 45 } 46 47 void text_clear() 48 { 49 } 50 51 void text_quit() 52 { 53 printf("Closing...\n"); 54 ubb_close(0); 55 }