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