diff mbox

histedit: fix build with musl libc

Message ID 2da5b72c704fed10f1b04b5432ac6b078d016fae.1519972336.git.baruch@tkos.co.il (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Baruch Siach March 2, 2018, 6:32 a.m. UTC
musl libc defines the optreset BSD extension only in getopt.h. This
fixes the following build failure:

histedit.c: In function 'histcmd':
histedit.c:220:2: error: 'optreset' undeclared (first use in this function)
  optreset = 1; optind = 1; /* initialize getopt */
  ^~~~~~~~

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 src/histedit.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Herbert Xu March 10, 2018, 8:04 a.m. UTC | #1
On Fri, Mar 02, 2018 at 08:32:16AM +0200, Baruch Siach wrote:
> musl libc defines the optreset BSD extension only in getopt.h. This
> fixes the following build failure:
> 
> histedit.c: In function 'histcmd':
> histedit.c:220:2: error: 'optreset' undeclared (first use in this function)
>   optreset = 1; optind = 1; /* initialize getopt */
>   ^~~~~~~~
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/src/histedit.c b/src/histedit.c
index 94465d785cc9..f5c90aba873b 100644
--- a/src/histedit.c
+++ b/src/histedit.c
@@ -39,6 +39,7 @@ 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <getopt.h>
 /*
  * Editline and history functions (and glue).
  */