From: Johannes Sixt Date: Fri, 05 Jun 2015 19:45:05 GMT Subject: [PATCH 2/4] help.c: wrap wait-only poll() invocation in sleep_millisec() Message-ID: <1bf3ed414ca35f378ac4934dee49a6fa595966ed.1433532968.git.j6t@kdbg.org> In-Reply-To: <55700F10.8030806@kdbg.org> We want to use the new function elsewhere in a moment. Signed-off-by: Johannes Sixt --- cache.h | 1 + help.c | 2 +- wrapper.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cache.h b/cache.h index 54f108a..328cdb7 100644 --- a/cache.h +++ b/cache.h @@ -1680,5 +1680,6 @@ int stat_validity_check(struct stat_validity *sv, const char *path); void stat_validity_update(struct stat_validity *sv, int fd); int versioncmp(const char *s1, const char *s2); +void sleep_millisec(int millisec); #endif /* CACHE_H */ diff --git a/help.c b/help.c index 2072a87..de1279b 100644 --- a/help.c +++ b/help.c @@ -372,7 +372,7 @@ const char *help_unknown_cmd(const char *cmd) if (autocorrect > 0) { fprintf_ln(stderr, _("in %0.1f seconds automatically..."), (float)autocorrect/10.0); - poll(NULL, 0, autocorrect * 100); + sleep_millisec(autocorrect * 100); } return assumed; } diff --git a/wrapper.c b/wrapper.c index c1a663f..ff49807 100644 --- a/wrapper.c +++ b/wrapper.c @@ -595,3 +595,8 @@ int write_file(const char *path, int fatal, const char *fmt, ...) } return 0; } + +void sleep_millisec(int millisec) +{ + poll(NULL, 0, millisec); +} -- 2.3.2.245.gb5bf9d3