mailing list of musl libc
 help / color / mirror / code / Atom feed
* [0/3] _BSD_SOURCE patches: termios, ctype, stdio
@ 2012-04-19 20:52 Isaac Dunham
  2012-04-19 21:01 ` [1/3] _BSD_SOURCE for stdio.h Isaac Dunham
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Isaac Dunham @ 2012-04-19 20:52 UTC (permalink / raw)
  To: musl

I've gotten _BSD_SOURCE macros ready for termios.h, ctype.h, and
stdio.h
For termios.h, there properly should be the CCEQ macro
(#if (_BSD_SOURCE||_GNU_SOURCE) ).
This is a one-line convenience macro, whether you look in the *BSD
headers or glibc.
 /* Compare a character C to a value VAL from the `c_cc'array in a 
`struct termios'.  If VAL is _POSIX_VDISABLE, no character
can match it.  */
But _POSIX_VDISABLE is not defined here, so I have left it
unimplemented.

 By my estimate, there are about 33 headers left:
grepping through the glibc headers equivalent to ones in musl 
gives a total of 42 headers with __USE_{MISC,BSD}, I've done unistd.h,
math.h, and string.h, strings.h is likewise done, features.h is
irrelevant...
glibc regex.h implements two obsolete but much simpler interfaces,
from BSD:
re_comp(char *regex) and re_exec(char *string)
These are much simpler to use than the standard interface, but the
design has its defects: re_comp allocates a static buffer, which
re_exec overwrites on search.  I assume that these will not be
implemented?  If so, that's a third one where there's nothing to do.

Headers remaining:
include/arpa/inet.h 1
include/{signal.h,stdlib.h,fcntl.h,tgmath.h,glob.h,setjmp.h,mntent.h, 
  dirent.h,time.h,shadow.h,pwd.h,utmp.h,netdb.h,ftw.h,endian.h,grp.h} 16
include/sys/{syslog.h,select.h,wait.h,time.h, 
  socket.h,un.h,uio.h,mman.h,types.h,stat.h}  10
include/netinet/{ip.h,tcp.h,ip_icmp.h,in.h,if_ether.h} 5
/usr/include/net/if.h 1

Isaac Dunham



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [1/3] _BSD_SOURCE for stdio.h
  2012-04-19 20:52 [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
@ 2012-04-19 21:01 ` Isaac Dunham
  2012-04-19 21:03 ` [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
  2012-04-19 21:06 ` [3/3] _BSD_SOURCE for ctype.h Isaac Dunham
  2 siblings, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2012-04-19 21:01 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

This is compatible with NetBSD's _NETBSD_SOURCE, but is more
complete than glibc's _BSD_SOURCE.

Isaac Dunham

[-- Attachment #2: stdio.dif --]
[-- Type: application/octet-stream, Size: 1206 bytes --]

diff --git a/include/stdio.h b/include/stdio.h
index dca8acc..2227da6 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -10,7 +10,8 @@ extern "C" {
 #define __NEED_size_t
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ !! defined(_BSD_SOURCE)
 #define __NEED_ssize_t
 #define __NEED_off_t
 #endif
@@ -120,7 +121,8 @@ char *tmpnam(char *);
 FILE *tmpfile(void);
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
 FILE *fmemopen(void *, size_t, const char *);
 FILE *open_memstream(char **, size_t *);
 FILE *fdopen(int, const char *);
@@ -146,12 +148,13 @@ char *ctermid(char *);
 #endif
 
 
-#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
 #define P_tmpdir "/tmp"
 char *tempnam(const char *, const char *);
 #endif
 
-#if defined(_GNU_SOURCE)
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #define L_cuserid 20
 char *cuserid(char *);
 #undef off64_t

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [0/3] _BSD_SOURCE patches: termios, ctype, stdio
  2012-04-19 20:52 [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
  2012-04-19 21:01 ` [1/3] _BSD_SOURCE for stdio.h Isaac Dunham
@ 2012-04-19 21:03 ` Isaac Dunham
  2012-04-19 21:06 ` [3/3] _BSD_SOURCE for ctype.h Isaac Dunham
  2 siblings, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2012-04-19 21:03 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

Here's the termios.h patch, though it's still missing CCEQ.
> For termios.h, there properly should be the CCEQ macro
> (#if (_BSD_SOURCE||_GNU_SOURCE) ).
> This is a one-line convenience macro, whether you look in the *BSD
> headers or glibc.
>  /* Compare a character C to a value VAL from the `c_cc'array in a 
> `struct termios'.  If VAL is _POSIX_VDISABLE, no character
> can match it.  */
> But _POSIX_VDISABLE is not defined here, so I have left it
> unimplemented.

Isaac Dunham

[-- Attachment #2: termios.dif --]
[-- Type: application/octet-stream, Size: 354 bytes --]

diff --git a/include/termios.h b/include/termios.h
index 7690883..1041759 100644
--- a/include/termios.h
+++ b/include/termios.h
@@ -32,7 +32,7 @@ int tcflow (int, int);
 
 pid_t tcgetsid (int);
 
-#ifdef _GNU_SOURCE
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 void cfmakeraw(struct termios *);
 int cfsetspeed(struct termios *, speed_t);
 #endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [3/3] _BSD_SOURCE for ctype.h
  2012-04-19 20:52 [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
  2012-04-19 21:01 ` [1/3] _BSD_SOURCE for stdio.h Isaac Dunham
  2012-04-19 21:03 ` [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
@ 2012-04-19 21:06 ` Isaac Dunham
  2 siblings, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2012-04-19 21:06 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 41 bytes --]

Here's a patch for ctype.h
Isaac Dunham


[-- Attachment #2: ctype.dif --]
[-- Type: application/octet-stream, Size: 408 bytes --]

diff --git a/include/ctype.h b/include/ctype.h
index a85e907..8ceaa9f 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -30,7 +30,8 @@ int   toupper(int);
 
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
 
 #define __NEED_locale_t
 #include <bits/alltypes.h>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-19 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 20:52 [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
2012-04-19 21:01 ` [1/3] _BSD_SOURCE for stdio.h Isaac Dunham
2012-04-19 21:03 ` [0/3] _BSD_SOURCE patches: termios, ctype, stdio Isaac Dunham
2012-04-19 21:06 ` [3/3] _BSD_SOURCE for ctype.h Isaac Dunham

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).