summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-04 23:26:55 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-04 23:26:55 +0000
commiteb2ecd0b083611bdd07c5352ffc9cfa22e0de711 (patch)
tree5e61cf2b2ddc07dd19b577b7bfa3f83b81f7de8a /libc
parent4d6ba4ccf89262743eb2093474a571decb455d27 (diff)
Fix all the makefiles. Clean up some warnings, cleanup some headers.
-Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/Makefile61
-rw-r--r--libc/inet/rpc/Makefile52
-rw-r--r--libc/misc/regex/Makefile37
-rw-r--r--libc/misc/regex/rx.c36
-rw-r--r--libc/misc/time/Makefile37
-rw-r--r--libc/pwd_grp/Makefile30
-rw-r--r--libc/stdio/Makefile66
-rw-r--r--libc/stdlib/Makefile50
-rw-r--r--libc/stdlib/malloc/Makefile32
-rw-r--r--libc/string/Makefile42
-rw-r--r--libc/sysdeps/Makefile47
-rw-r--r--libc/sysdeps/linux/Makefile52
-rw-r--r--libc/sysdeps/linux/common/Makefile37
-rw-r--r--libc/sysdeps/linux/common/kernel_version.c115
-rw-r--r--libc/sysdeps/linux/i386/Makefile54
-rw-r--r--libc/termios/Makefile55
-rw-r--r--libc/termios/termios.c4
17 files changed, 521 insertions, 286 deletions
diff --git a/libc/inet/Makefile b/libc/inet/Makefile
index b73a5499e..519501180 100644
--- a/libc/inet/Makefile
+++ b/libc/inet/Makefile
@@ -1,37 +1,50 @@
-# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
-# Copyright (C) 1998-1999 D. Jeff Dionne <jeff@rt-control.com>
-# Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
-# Copyright (C) 1999 D. Jeff Dionne <jeff@rt-control.com>
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
-LIBC=../libc.a
+MSRC=addr.c
+MOBJ=inet_aton.o inet_addr.o inet_ntoa.o
-ASRC=addr.c
-AOBJ=inet_aton.o inet_addr.o inet_ntoa.o
+MSRC2=resolv.c
+MOBJ2=encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \
+ decodeq.o lengthq.o encodea.o decodea.o encodep.o decodep.o \
+ formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \
+ opennameservers.o closenameservers.o resolvename.o gethostbyname.o\
+ gethostbyaddr.o
-RSRC=resolv.c
-ROBJ= encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \
-decodeq.o lengthq.o encodea.o decodea.o encodep.o decodep.o \
-formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \
-opennameservers.o closenameservers.o resolvename.o gethostbyname.o\
-gethostbyaddr.o
+all: $(MOBJ) $(MOBJ2) $(LIBC)
-OBJ=$(AOBJ) $(ROBJ)
+$(LIBC): $(MOBJ) $(MOBJ2)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2)
-all: $(LIBC)
-
-$(LIBC): $(LIBC)($(OBJ))
-
-$(LIBC)($(AOBJ)): $(ASRC)
+$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
-$(LIBC)($(ROBJ)): $(RSRC)
+$(MOBJ2): $(MSRC2)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
clean:
- rm -f *.o libc.a
+ rm -f *.[oa] *~ core
+
diff --git a/libc/inet/rpc/Makefile b/libc/inet/rpc/Makefile
index e2c867703..907d55deb 100644
--- a/libc/inet/rpc/Makefile
+++ b/libc/inet/rpc/Makefile
@@ -1,25 +1,49 @@
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
+
TOPDIR=../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
CFLAGS+=-I$(TOPDIR)include/linux
-OBJS = auth_none.o auth_unix.o authunix_prot.o \
- bindresvport.o clnt_generic.o clnt_perror.o \
- clnt_raw.o clnt_simple.o clnt_tcp.o clnt_udp.o \
- get_myaddress.o getrpcent.o getrpcport.o pmap_clnt.o \
- pmap_getmaps.o pmap_getport.o pmap_prot.o pmap_prot2.o \
- pmap_rmt.o rpc_callmsg.o rpc_commondata.o \
- rpc_dtablesize.o rpc_prot.o svc.o svc_auth.o \
- svc_auth_unix.o svc_raw.o svc_run.o svc_simple.o \
- svc_tcp.o svc_udp.o xdr.o xdr_array.o xdr_float.o \
- xdr_mem.o xdr_rec.o xdr_reference.o xdr_stdio.o
+CSRC = auth_none.c auth_unix.c authunix_prot.c \
+ bindresvport.c clnt_generic.c clnt_perror.c \
+ clnt_raw.c clnt_simple.c clnt_tcp.c clnt_udp.c \
+ get_myaddress.c getrpcent.c getrpcport.c pmap_clnt.c \
+ pmap_getmaps.c pmap_getport.c pmap_prot.c pmap_prot2.c \
+ pmap_rmt.c rpc_callmsg.c rpc_commondata.c \
+ rpc_dtablesize.c rpc_prot.c svc.c svc_auth.c \
+ svc_auth_unix.c svc_raw.c svc_run.c svc_simple.c \
+ svc_tcp.c svc_udp.c xdr.c xdr_array.c xdr_float.c \
+ xdr_mem.c xdr_rec.c xdr_reference.c xdr_stdio.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
-LIBC = ../libc.a
+all: $(COBJS) $(LIBC)
-all: $(LIBC)
+$(LIBC): $(COBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(COBJS)
-$(LIBC): $(LIBC)($(OBJS))
+$(COBJS): $(CSRC)
clean:
rm -f *.[oa] *~ core
-
diff --git a/libc/misc/regex/Makefile b/libc/misc/regex/Makefile
index c6c8d8e52..ad0745020 100644
--- a/libc/misc/regex/Makefile
+++ b/libc/misc/regex/Makefile
@@ -1,17 +1,36 @@
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
+
TOPDIR=../
include $(TOPDIR)Rules.make
-
-LIBC=../libc.a
+LIBC=$(TOPDIR)libc.a
OBJ=rx.o
-all: $(LIBC)
+all: $(OBJ) $(LIBC)
-$(LIBC): $(LIBC)($(OBJ))
-
-$(LIBC)(rx.o): rx.c
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
+$(LIBC): $(OBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJ)
clean:
- rm -f libc.a *.o core mon.out timer.t.h dMakefile dtr try timer
+ rm -f *.[oa] *~ core
+
diff --git a/libc/misc/regex/rx.c b/libc/misc/regex/rx.c
index 8e85782f2..1abff8cc5 100644
--- a/libc/misc/regex/rx.c
+++ b/libc/misc/regex/rx.c
@@ -161,8 +161,8 @@ RX_DECL struct rexp_node
struct rexp_node *);
RX_DECL struct rexp_node
*rx_mk_r_side_effect (struct rx *, rx_side_effect);
-RX_DECL struct rexp_node
- *rx_mk_r_data (struct rx *, void *);
+//RX_DECL struct rexp_node
+// *rx_mk_r_data (struct rx *, void *);
RX_DECL void rx_free_rexp (struct rx *, struct rexp_node *);
RX_DECL struct rexp_node
*rx_copy_rexp (struct rx *, struct rexp_node *);
@@ -486,9 +486,9 @@ print_fastmap (fm)
/* This page: Bitsets. Completely unintersting. */
-RX_DECL int rx_bitset_is_equal (int, rx_Bitset, rx_Bitset);
+//RX_DECL int rx_bitset_is_equal (int, rx_Bitset, rx_Bitset);
RX_DECL int rx_bitset_is_subset (int, rx_Bitset, rx_Bitset);
-RX_DECL int rx_bitset_empty (int, rx_Bitset);
+//RX_DECL int rx_bitset_empty (int, rx_Bitset);
RX_DECL void rx_bitset_null (int, rx_Bitset);
RX_DECL void rx_bitset_complement (int, rx_Bitset);
RX_DECL void rx_bitset_complement (int, rx_Bitset);
@@ -496,11 +496,14 @@ RX_DECL void rx_bitset_assign (int, rx_Bitset, rx_Bitset);
RX_DECL void rx_bitset_union (int, rx_Bitset, rx_Bitset);
RX_DECL void rx_bitset_intersection (int, rx_Bitset, rx_Bitset);
RX_DECL void rx_bitset_difference (int, rx_Bitset, rx_Bitset);
-RX_DECL void rx_bitset_revdifference (int, rx_Bitset, rx_Bitset);
+//RX_DECL void rx_bitset_revdifference (int, rx_Bitset, rx_Bitset);
+#ifdef emacs
RX_DECL void rx_bitset_xor (int, rx_Bitset, rx_Bitset);
+#endif
RX_DECL unsigned long
rx_bitset_hash (int, rx_Bitset);
+#if 0
#ifdef __STDC__
RX_DECL int
rx_bitset_is_equal (int size, rx_Bitset a, rx_Bitset b)
@@ -522,6 +525,7 @@ rx_bitset_is_equal (size, a, b)
b[0] = s;
return !x && s == a[0];
}
+#endif
#ifdef __STDC__
RX_DECL int
@@ -539,7 +543,7 @@ rx_bitset_is_subset (size, a, b)
return x == -1;
}
-
+#if 0
#ifdef __STDC__
RX_DECL int
rx_bitset_empty (int size, rx_Bitset set)
@@ -558,6 +562,7 @@ rx_bitset_empty (size, set)
set[0] = s;
return !s;
}
+#endif
#ifdef __STDC__
RX_DECL void
@@ -676,6 +681,7 @@ rx_bitset_difference (size, a, b)
}
+#if 0
#ifdef __STDC__
RX_DECL void
rx_bitset_revdifference (int size,
@@ -692,7 +698,10 @@ rx_bitset_revdifference (size, a, b)
for (x = rx_bitset_numb_subsets(size) - 1; x >=0; --x)
a[x] = ~a[x] & b[x];
}
+#endif
+
+#ifdef emacs
#ifdef __STDC__
RX_DECL void
rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b)
@@ -708,6 +717,7 @@ rx_bitset_xor (size, a, b)
for (x = rx_bitset_numb_subsets(size) - 1; x >=0; --x)
a[x] ^= b[x];
}
+#endif
#ifdef __STDC__
@@ -1305,6 +1315,7 @@ rx_mk_r_side_effect (rx, a)
}
+#if 0
#ifdef __STDC__
RX_DECL struct rexp_node *
rx_mk_r_data (struct rx * rx,
@@ -1324,6 +1335,7 @@ rx_mk_r_data (rx, a)
}
return n;
}
+#endif
#ifdef __STDC__
RX_DECL void
@@ -5744,11 +5756,13 @@ rx_compile (pattern, size, syntax, rxb)
handle_close:
/* See similar code for backslashed left paren above. */
- if (COMPILE_STACK_EMPTY)
- if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
- goto normal_char;
- else
- return REG_ERPAREN;
+ if (COMPILE_STACK_EMPTY) {
+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) {
+ goto normal_char;
+ } else {
+ return REG_ERPAREN;
+ }
+ }
/* Since we just checked for an empty stack above, this
``can't happen''. */
diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile
index 2ee2a14e0..252a67e09 100644
--- a/libc/misc/time/Makefile
+++ b/libc/misc/time/Makefile
@@ -1,20 +1,37 @@
-# Copyright (C) 1996 Robert de Bath <robert@mayday.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
-
-CFLAGS+=-I$(TOPDIR)include/linux
-
-LIBC=../libc.a
+LIBC=$(TOPDIR)libc.a
OBJ=localtime.o gmtime.o asctime.o ctime.o asc_conv.o tm_conv.o mktime.o \
localtime_r.o gmtime_r.o asctime_r.o ctime_r.o
-all: $(LIBC)
+all: $(OBJ) $(LIBC)
-$(LIBC): $(LIBC)($(OBJ))
+$(LIBC): $(OBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJ)
clean:
- rm -f *.o libc.a
+ rm -f *.[oa] *~ core
+
diff --git a/libc/pwd_grp/Makefile b/libc/pwd_grp/Makefile
index efcb9c502..a8a916525 100644
--- a/libc/pwd_grp/Makefile
+++ b/libc/pwd_grp/Makefile
@@ -1,19 +1,37 @@
-# Copyright (C) 1996 Robert de Bath <robert@debath.thenet.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
-
LIBC=$(TOPDIR)libc.a
OBJ=__getpwent.o pwent.o getpwnam.o getpwuid.o putpwent.o getpw.o fgetpwent.o \
__getgrent.o grent.o getgrnam.o getgrgid.o fgetgrent.o initgroups.o \
utent.o
-all: $(LIBC)($(OBJ))
+all: $(OBJ) $(LIBC)
$(LIBC): $(OBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJ)
clean:
- rm -f *.o libc.a
+ rm -f *.[oa] *~ core
diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile
index 984af2106..6b0748237 100644
--- a/libc/stdio/Makefile
+++ b/libc/stdio/Makefile
@@ -1,48 +1,62 @@
-# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
-LIBC=../libc.a
-ASRC=stdio.c
-AOBJ=_stdio_init.o fputc.o fgetc.o fflush.o fgets.o gets.o fputs.o \
+MSRC=stdio.c
+MOBJ=_stdio_init.o fputc.o fgetc.o fflush.o fgets.o gets.o fputs.o \
puts.o fread.o fwrite.o fopen.o fclose.o fseek.o rewind.o ftell.o \
setbuffer.o setvbuf.o ungetc.o
-PSRC=printf.c
-POBJ=printf.o sprintf.o fprintf.o vprintf.o vsprintf.o vfprintf.o snprintf.o vsnprintf.o
+MSRC2=printf.c
+MOBJ2=printf.o sprintf.o fprintf.o vprintf.o vsprintf.o vfprintf.o snprintf.o vsnprintf.o
-SSRC=scanf.c
-SOBJ=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o
+MSRC3=scanf.c
+MOBJ3=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o
-OBJ= $(AOBJ) $(POBJ) $(SOBJ) dputs.o
+CSRC=dputs.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(LIBC)
-$(LIBC): $(LIBC)($(OBJ))
+all: $(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS) $(LIBC)
-$(LIBC)($(AOBJ)): $(ASRC)
+$(LIBC): $(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS)
+
+$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
-$(LIBC)($(POBJ)): $(PSRC)
+$(MOBJ2): $(MSRC2)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
-$(LIBC)($(SOBJ)): $(SSRC)
+$(MOBJ3): $(MSRC3)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
-#transfer:
-# -@rm -f ../include/stdio.h
-# cp -p stdio.h ../include/.
-#
-#$(LIBC)($(OBJ)): stdio.h
+$(COBJS): $(CSRC)
-clean:
- rm -f *.o libc.a
+clean:
+ rm -f *.[oa] *~ core
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index a7cf3a844..3db182c5f 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -1,42 +1,56 @@
-# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
LIBC=$(TOPDIR)libc.a
-
MSRC=aliases.c
-MOBJ=abs.o remove.o creat.o bcopy.o bzero.o
- # raise.o bcmp.o index.o rindex.o
+MOBJ=abs.o remove.o creat.o bcopy.o bzero.o # raise.o bcmp.o index.o rindex.o
MSRC2=atexit.c
MOBJ2=on_exit.o atexit.o __do_exit.o exit.o
-CFILES=atoi.c atol.c ltoa.c ltostr.c ctype.c qsort.c bsearch.c rand.c lsearch.c \
+CSRC=atoi.c atol.c ltoa.c ltostr.c ctype.c qsort.c bsearch.c rand.c lsearch.c \
getopt.c glob.c fnmatch.c itoa.c strtod.c strtol.c crypt.c sleep.c \
mkstemp.c mktemp.c realpath.c getenv.c putenv.c popen.c system.c \
getcwd.c setenv.c execl.c execv.c execlp.c execvp.c execvep.c
-COBJS=$(patsubst %.c,%.o, $(CFILES))
-
+COBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(COBJS) $(MOBJ) $(MOBJ2) $(LIBC)
+all: $(MOBJ) $(MOBJ2) $(COBJS) $(LIBC)
-$(COBJS): $(CFILES)
- $(CC) $(CFLAGS) -c $*.c -o $@
+$(LIBC): $(MOBJ) $(MOBJ2) $(COBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2) $(COBJS)
$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(MOBJ2): $(MSRC2)
- $(CC) $(CFLAGS) -DL_$* -c $(MSRC2) -o $@
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
-$(LIBC): $(COBJS) $(MOBJ) $(MOBJ2)
- $(AR) $(ARFLAGS) $(LIBC) $(COBJS) $(MOBJ) $(MOBJ2)
+$(COBJS): $(CSRC)
-clean:
- rm -f *.o
+clean:
+ rm -f *.[oa] *~ core
diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile
index 34c1b0538..d4ecab0b9 100644
--- a/libc/stdlib/malloc/Makefile
+++ b/libc/stdlib/malloc/Makefile
@@ -1,24 +1,40 @@
-# Copyright (C) 1996 Robert de Bath <robert@mayday.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
-
LIBC=$(TOPDIR)libc.a
MSRC=alloc.c
MOBJ=malloc.o realloc.o free.o calloc.o malloc_dbg.o free_dbg.o calloc_dbg.o
-all: $(LIBC)($(MOBJ))
+all: $(MOBJ) $(LIBC)
$(LIBC): $(MOBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ)
$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $(LIBC) $*.o
clean:
- rm -f *.o libc.a
-
+ rm -f *.[oa] *~ core
diff --git a/libc/string/Makefile b/libc/string/Makefile
index 35c09565c..3af022365 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -1,6 +1,24 @@
-# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
@@ -10,23 +28,21 @@ MSRC=string.c
MOBJ=strlen.o strcat.o strcpy.o strcmp.o strncat.o strncpy.o strncmp.o \
strchr.o strrchr.o strdup.o memcpy.o memccpy.o memchr.o memset.o \
memcmp.o memmove.o movedata.o
-CFILES=strpbrk.c strsep.c strstr.c strtok.c strcspn.c \
+CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c \
strspn.c strcasecmp.c strncasecmp.c config.c
COBJS=$(patsubst %.c,%.o, $(CFILES))
+all: $(MOBJ) $(COBJS) $(LIBC)
-all: $(COBJS) $(MOBJ) $(LIBC)
-
-$(COBJS): $(CFILES)
- $(CC) $(CFLAGS) -c $*.c -o $@
+$(LIBC): $(MOBJ) $(COBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(COBJS)
$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
-$(LIBC): $(COBJS) $(MOBJ)
- $(AR) $(ARFLAGS) $(LIBC) $(COBJS) $(MOBJ)
+$(COBJS): $(CSRC)
-clean:
- rm -f *.o
+clean:
+ rm -f *.[oa] *~ core
diff --git a/libc/sysdeps/Makefile b/libc/sysdeps/Makefile
index cdd7e4e24..45a34a25e 100644
--- a/libc/sysdeps/Makefile
+++ b/libc/sysdeps/Makefile
@@ -1,10 +1,45 @@
-all: linux
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
-linux: dummy
- make -C linux
+DIRS = linux
+
+all: libc.a
+
+libc.a: subdirs
+
+tags:
+ ctags -R
+
+clean: subdirs_clean
+
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
+
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+ $(MAKE) -C $(patsubst _dir_%, %, $@)
+
+$(patsubst %, _dirclean_%, $(DIRS)) : dummy
+ $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-clean:
- rm -f *.o
- make -C linux clean
.PHONY: dummy
+
diff --git a/libc/sysdeps/linux/Makefile b/libc/sysdeps/linux/Makefile
index 16980d1b3..1440898b5 100644
--- a/libc/sysdeps/linux/Makefile
+++ b/libc/sysdeps/linux/Makefile
@@ -1,20 +1,48 @@
-# Figure out what arch to build...
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
+# Figure out what arch to build...
ARCH = $(shell uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/')
-all: $(ARCH) common
+DIRS = $(ARCH) common
+
+all: libc.a
+
+libc.a: subdirs
-$(ARCH): dummy
- @echo Building for ARCH=$(ARCH)
- make -C $(ARCH)
+tags:
+ ctags -R
+
+clean: subdirs_clean
-common: dummy
- echo Building common stuff
- make -C common
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
+
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+ $(MAKE) -C $(patsubst _dir_%, %, $@)
+
+$(patsubst %, _dirclean_%, $(DIRS)) : dummy
+ $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-clean:
- rm -f *.o
- make -C common clean
- make -C $(ARCH) clean
.PHONY: dummy
+
diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile
index eac2dc3b4..b4a922eb5 100644
--- a/libc/sysdeps/linux/common/Makefile
+++ b/libc/sysdeps/linux/common/Makefile
@@ -1,24 +1,37 @@
# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../../../
include $(TOPDIR)Rules.make
-
-CFLAGS+= -D_GCC_LIMITS_H_
-
LIBC=$(TOPDIR)libc.a
include makefile.objs
-all: $(LIBC)
+all: $(OBJ) $(LIBC)
$(LIBC): $(OBJ)
- $(AR) $(ARFLAGS) $@ $(OBJ)
-
-transfer:
- -@rm -f ../include/stdio.h
- cp -p stdio.h ../include/.
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJ)
clean:
- rm -f *.o
+ rm -f *.[oa] *~ core
+
diff --git a/libc/sysdeps/linux/common/kernel_version.c b/libc/sysdeps/linux/common/kernel_version.c
index dacc4f0f7..c6b7eabea 100644
--- a/libc/sysdeps/linux/common/kernel_version.c
+++ b/libc/sysdeps/linux/common/kernel_version.c
@@ -1,89 +1,46 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <ansidecl.h>
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 1999,2000 by Lineo, inc.
+ * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
-#include <sys/param.h>
static int __linux_kernel_version = -1;
-static inline int
-asc2int (const char *s)
+/* Returns kernel version encoded as major*65536 + minor*256 + patch,
+ * so, for example, to check if the kernel is greater than 2.2.11:
+ * if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> }
+ */
+static int find_kernel_revision(void)
{
- int result = 0;
-
- for (; *s >= '0' && *s <= '9'; s++)
- {
- result = result * 10 + (*s - '0');
- }
-
- return result;
+ struct utsname name;
+ int major = 0, minor = 0, patch = 0;
+
+ if (uname(&name) == -1) {
+ return (0);
+ }
+ sscanf(name.version, "%d.%d.%d", &major, &minor, &patch);
+ return major * 65536 + minor * 256 + patch;
}
-static int
-set_linux_kernel_version (void)
-{
- struct utsname uts;
- char *version = NULL, *patchlevel = NULL, *sublevel = NULL;
-
- if (uname (&uts))
- {
- __linux_kernel_version = 0;
- return __linux_kernel_version;
- }
-
- version = uts.release;
- if (version != NULL)
- {
- patchlevel = strchr (version, '.');
- if (patchlevel != NULL)
- {
- *patchlevel = '\0';
- patchlevel++;
- sublevel = strchr (patchlevel, '.');
- if (sublevel != NULL)
- {
- *sublevel = '\0';
- sublevel++;
- }
- }
-
- __linux_kernel_version =
- GET_LINUX_KERNEL_VERSION (asc2int (version));
- if (patchlevel != NULL)
- {
- __linux_kernel_version |=
- GET_LINUX_KERNEL_PATCHLEVEL (asc2int (patchlevel));
- }
- if (sublevel != NULL)
- {
- __linux_kernel_version |=
- GET_LINUX_KERNEL_SUBLEVEL (asc2int (sublevel));
- }
- }
- else
- {
- __linux_kernel_version = 0;
- }
-
- return __linux_kernel_version;
-}
int
__get_linux_kernel_version (void)
@@ -91,5 +48,5 @@ __get_linux_kernel_version (void)
if (__linux_kernel_version != -1)
return __linux_kernel_version;
- return set_linux_kernel_version ();
+ return find_kernel_revision ();
}
diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile
index 165d16cbd..3c32b6464 100644
--- a/libc/sysdeps/linux/i386/Makefile
+++ b/libc/sysdeps/linux/i386/Makefile
@@ -1,35 +1,53 @@
-# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../../../
include $(TOPDIR)Rules.make
-
LIBC=$(TOPDIR)libc.a
-CFLAGS+= -D_GCC_LIMITS_H_
+ASFLAGS=$(CFLAGS)
MSRC=syscalls.S
include makefile.objs
-SFILES=setjmp.S longjmp.S _start.S _exit.S #fork.o
-SOBJS=$(patsubst %.S,%.o, $(SFILES))
-CFILES=readdir.c #select.c
-COBJS=$(patsubst %.c,%.o, $(CFILES))
+SSRC=setjmp.S longjmp.S _start.S _exit.S #fork.S
+SOBJS=$(patsubst %.S,%.o, $(SSRC))
+
+CSRC=readdir.c #select.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(SOBJS) $(COBJS) $(MOBJ) $(LIBC)
-$(SOBJS): $(SFILES)
- $(CC) $(CFLAGS) -c $*.S -o $@
+all: $(MOBJ) $(SOBJS) $(COBJS) $(LIBC)
-$(COBJS): $(CFILES)
- $(CC) $(CFLAGS) -c $*.c -o $@
+$(LIBC): $(MOBJ) $(SOBJS) $(COBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(SOBJS) $(COBJS)
$(MOBJ): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+
+$(SOBJS): $(SSRC)
+
+$(COBJS): $(CSRC)
-$(LIBC): $(SOBJS) $(COBJS) $(MOBJ)
- $(AR) $(ARFLAGS) $(LIBC) $(SOBJS) $(COBJS) $(MOBJ)
clean:
- rm -f *.o
+ rm -f *.[oa] *~ core
diff --git a/libc/termios/Makefile b/libc/termios/Makefile
index 4ab80e9da..322244104 100644
--- a/libc/termios/Makefile
+++ b/libc/termios/Makefile
@@ -1,30 +1,49 @@
-# Copyright (C) 1996 Robert de Bath <robert@mayday.compulink.co.uk>
-# This file is part of the Linux-8086 C library and is distributed
-# under the GNU Library General Public License.
+# Makefile for uCLibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources. Files within this library are copyright by their
+# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
-LIBC=../libc.a
+MSRC=termios.c
+MOBJ=tcsetattr.o tcgetattr.o tcdrain.o tcflow.o tcflush.o tcsendbreak.o \
+ tcsetpgrp.o tcgetpgrp.o isatty.o cfgetospeed.o cfgetispeed.o cfsetospeed.o \
+ cfsetispeed.o cfmakeraw.o
-TSRC=termios.c
-TOBJ=tcsetattr.o tcgetattr.o tcdrain.o tcflow.o tcflush.o tcsendbreak.o \
- tcsetpgrp.o tcgetpgrp.o isatty.o \
- cfgetospeed.o cfgetispeed.o cfsetospeed.o cfsetispeed.o cfmakeraw.o
+CSRC=ttyname.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
-# cfgetospeedn.o cfgetispeedn.o cfsetospeedn.o cfsetispeedn.o tcspeed.o
-OBJ=$(TOBJ) ttyname.o
-# unlike everything else, this does not compile out of the box...
-# ttyname.o
+all: $(MOBJ) $(COBJS) $(LIBC)
-all: $(LIBC)
+$(LIBC): $(MOBJ) $(COBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(COBJS)
-$(LIBC): $(LIBC)($(OBJ))
-
-$(LIBC)($(TOBJ)): $(TSRC)
+$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
+
+$(COBJS): $(CSRC)
+
clean:
- rm -f *.o libc.a
+ rm -f *.[oa] *~ core
+
diff --git a/libc/termios/termios.c b/libc/termios/termios.c
index c6c0117f0..7532259d4 100644
--- a/libc/termios/termios.c
+++ b/libc/termios/termios.c
@@ -11,10 +11,10 @@
#include <stddef.h>
#include <sys/ioctl.h>
#include <termios.h>
+#include <unistd.h>
#ifdef L_isatty
-isatty(fd)
-int fd;
+int isatty(int fd)
{
struct termios term;
int rv, err = errno;