summaryrefslogtreecommitdiffstats
path: root/lib/libedit/sys.h
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-01-09 07:40:56 +0000
committerbapt <bapt@FreeBSD.org>2015-01-09 07:40:56 +0000
commit9092259f68a804406ade5c84b5ceb67aae8c8303 (patch)
treed33ef1b987208879e7fa795c6b8d9fb885b151a9 /lib/libedit/sys.h
parentced5b3dac1efcd02dc8fdf099780b1245832ae94 (diff)
downloadFreeBSD-src-9092259f68a804406ade5c84b5ceb67aae8c8303.zip
FreeBSD-src-9092259f68a804406ade5c84b5ceb67aae8c8303.tar.gz
Synchronize libedit with NetBSD and activate UTF-8 support [1]
Differences with NetBSD Reapply our local patches on top of it Fix Unicode environement detection Fix reading a line in unicode environment. It allows /bin/sh to works in UTF-8 envs Differential Revision: https://reviews.freebsd.org/D1455 Reviewed by: jilles, pfg Obtained from: NetBSD [1] MFC after: 1 month Relnotes: yes
Diffstat (limited to 'lib/libedit/sys.h')
-rw-r--r--lib/libedit/sys.h99
1 files changed, 55 insertions, 44 deletions
diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h
index 5c017d3..d005ffd 100644
--- a/lib/libedit/sys.h
+++ b/lib/libedit/sys.h
@@ -1,3 +1,5 @@
+/* $NetBSD: sys.h,v 1.17 2011/09/28 14:08:04 christos Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -30,7 +32,6 @@
* SUCH DAMAGE.
*
* @(#)sys.h 8.1 (Berkeley) 6/4/93
- * $NetBSD: sys.h,v 1.12 2009/08/31 00:05:43 christos Exp $
* $FreeBSD$
*/
@@ -40,8 +41,24 @@
#ifndef _h_sys
#define _h_sys
+#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
+#endif
+
+#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
+# define __attribute__(A)
+#endif
+#ifndef __BEGIN_DECLS
+# ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+# else
+# define __BEGIN_DECLS
+# define __END_DECLS
+# endif
+#endif
+
#ifndef public
# define public /* Externally visible functions/variables */
#endif
@@ -55,17 +72,47 @@
/* When we want to hide everything */
#endif
-#ifndef _PTR_T
-# define _PTR_T
-typedef void *ptr_t;
+#ifndef __arraycount
+# define __arraycount(a) (sizeof(a) / sizeof(*(a)))
+#endif
+
+#include <stdio.h>
+
+#ifndef HAVE_STRLCAT
+#define strlcat libedit_strlcat
+size_t strlcat(char *dst, const char *src, size_t size);
#endif
-#ifndef _IOCTL_T
-# define _IOCTL_T
-typedef void *ioctl_t;
+#ifndef HAVE_STRLCPY
+#define strlcpy libedit_strlcpy
+size_t strlcpy(char *dst, const char *src, size_t size);
#endif
-#include <stdio.h>
+#ifndef HAVE_FGETLN
+#define fgetln libedit_fgetln
+char *fgetln(FILE *fp, size_t *len);
+#endif
+
+#ifndef HAVE_WCSDUP
+#include <wchar.h>
+wchar_t *wcsdup(const wchar_t *);
+#endif
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(x)
+#endif
+
+#ifndef __RCSID
+#define __RCSID(x)
+#endif
+
+#ifndef HAVE_U_INT32_T
+typedef unsigned int u_int32_t;
+#endif
+
+#ifndef SIZE_T_MAX
+#define SIZE_T_MAX ((size_t)-1)
+#endif
#define REGEX /* Use POSIX.2 regular expression functions */
#undef REGEXP /* Use UNIX V8 regular expression functions */
@@ -79,40 +126,4 @@ extern char* tgoto(const char*, int, int);
extern char* tgetstr(char*, char**);
#endif
-#ifdef notdef
-# undef REGEX
-# undef REGEXP
-# include <malloc.h>
-# ifdef __GNUC__
-/*
- * Broken hdrs.
- */
-extern int tgetent(const char *bp, char *name);
-extern int tgetflag(const char *id);
-extern int tgetnum(const char *id);
-extern char *tgetstr(const char *id, char **area);
-extern char *tgoto(const char *cap, int col, int row);
-extern int tputs(const char *str, int affcnt, int (*putc)(int));
-extern char *getenv(const char *);
-extern int fprintf(FILE *, const char *, ...);
-extern int sigsetmask(int);
-extern int sigblock(int);
-extern int fputc(int, FILE *);
-extern int fgetc(FILE *);
-extern int fflush(FILE *);
-extern int tolower(int);
-extern int toupper(int);
-extern int errno, sys_nerr;
-extern char *sys_errlist[];
-extern void perror(const char *);
-# include <string.h>
-# define strerror(e) sys_errlist[e]
-# endif
-# ifdef SABER
-extern ptr_t memcpy(ptr_t, const ptr_t, size_t);
-extern ptr_t memset(ptr_t, int, size_t);
-# endif
-extern char *fgetline(FILE *, int *);
-#endif
-
#endif /* _h_sys */
OpenPOWER on IntegriCloud