From e97c8d59182a805414b8331061aa96824ea10234 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 14 Jan 2004 19:26:29 +0000
Subject: [PATCH] use nanosleep() instead of usleep(); the latter is only
 standard under BSD, whereas the former is POSIX compliant

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1623 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 5 +++++
 src/winio.c | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index eeaebf23..98fd04ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,11 @@ CVS code -
 	- Move the call to raw() on systems that don't define
 	  _POSIX_VDISABLE outside the main input/output loop, as it
 	  doesn't need to be called every time through the loop. (DLR)
+- winio.c:
+  do_credits()
+	- Use nanosleep() instead of usleep().  The latter is only
+	  standard under BSD, whereas the former is POSIX compliant.
+	  (DLR)
 - README:
 	- Reformat to 72 characters per line, fix wording in one spot,
 	  and fix spacing in several spots. (DLR)
diff --git a/src/winio.c b/src/winio.c
index 6020efcd..8da17f88 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -24,6 +24,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <assert.h>
@@ -2298,6 +2299,7 @@ void dump_buffer_reverse(void)
 void do_credits(void)
 {
     int i, j = 0, k, place = 0, start_x;
+    struct timespec scrolldelay;
 
     const char *what;
     const char *xlcredits[XLCREDIT_LEN];
@@ -2361,6 +2363,9 @@ void do_credits(void)
     xlcredits[6] = _("and anyone else we forgot...");
     xlcredits[7] = _("Thank you for using nano!\n");
 
+    scrolldelay.tv_sec = 0L;
+    scrolldelay.tv_nsec = 700000000L;
+
     curs_set(0);
     nodelay(edit, TRUE);
     blank_bottombars();
@@ -2392,7 +2397,7 @@ void do_credits(void)
 		start_x = COLS / 2 - strlen(what) / 2 - 1;
 		mvwaddstr(edit, i * 2 - k, start_x, what);
 	    }
-	    usleep(700000);
+	    nanosleep(&scrolldelay, NULL);
 	    wrefresh(edit);
 	}
 	if (j < editwinrows / 2 - 1)
-- 
GitLab