From a57b7c129aada2ed7f08f1c43295035c97fdb977 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Mon, 24 Jun 2013 23:06:09 -0700 Subject: [PATCH] usleep is now backed with nanosleep --- src/interface.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/interface.c b/src/interface.c index 4d086982..f880488e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "interface.h" #include "keys.h" @@ -326,6 +327,14 @@ void c_interface_exit() } +static void c_usleep() { + // 1.5 secs + struct timespec delay; + delay.tv_sec=1; + delay.tv_nsec=500000000; + nanosleep(&delay, NULL); +} + /* ------------------------------------------------------------------------- c_interface_select_diskette() ------------------------------------------------------------------------- */ @@ -388,7 +397,7 @@ void c_interface_select_diskette( int drive ) legitimate directories... */ c_interface_print( 6, 11, 0, "Problem reading directory!" ); sprintf(disk_path, "/"); - usleep(1500000); + c_usleep(); c_interface_exit(); return; } @@ -493,7 +502,7 @@ void c_interface_select_diskette( int drive ) " Disk is read and write protected. " ); c_interface_print( 1, 22, 0, " " ); - usleep(1500000); + c_usleep(); c_mygetch(1); c_interface_redo_diskette_bottom(); continue; @@ -547,7 +556,7 @@ void c_interface_select_diskette( int drive ) " Problem gunzip'ing " ); c_interface_print( 1, 22, 0, " " ); - usleep(1500000); + c_usleep(); c_mygetch(1); c_interface_redo_diskette_bottom(); continue; @@ -562,7 +571,7 @@ void c_interface_select_diskette( int drive ) c_interface_print( 1, 21, 0, " Problem exec'ing /bin/gzip -d " ); c_interface_print( 1, 22, 0, temp); - usleep(1500000); + c_usleep(); exit(-1); } } else { @@ -570,7 +579,7 @@ void c_interface_select_diskette( int drive ) c_interface_print( 1, 21, 0, " Cannot fork! " ); c_interface_print( 1, 22, 0, temp); - usleep(1500000); + c_usleep(); c_mygetch(1); c_interface_redo_diskette_bottom(); continue; @@ -595,7 +604,7 @@ void c_interface_select_diskette( int drive ) " Problem gzip'ing " ); c_interface_print( 1, 22, 0, " " ); - usleep(1500000); + c_usleep(); c_mygetch(1); c_interface_redo_diskette_bottom(); continue; @@ -608,7 +617,7 @@ void c_interface_select_diskette( int drive ) c_interface_print( 1, 21, 0, " Problem exec'ing /bin/gzip " ); c_interface_print( 1, 22, 0, temp); - usleep(1500000); + c_usleep(); exit(-1); } } else { @@ -616,7 +625,7 @@ void c_interface_select_diskette( int drive ) c_interface_print( 1, 21, 0, " Cannot fork! " ); c_interface_print( 1, 22, 0, temp); - usleep(1500000); + c_usleep(); c_mygetch(1); c_interface_redo_diskette_bottom(); continue; @@ -632,7 +641,7 @@ void c_interface_select_diskette( int drive ) " Disk is read and write protected. " ); c_interface_print( 1, 22, 0, " " ); - usleep(1500000); + c_usleep(); c_mygetch(1); c_interface_redo_diskette_bottom(); continue;