2008-01-03 Jeff Johnston <jjohnstn@redhat.com>
Make isatty syscall handling consistent with other newlib syscalls. * libc/include/_syslist.h: Add _isatty. * libc/include/reent.h: Add _isatty_r. * libc/include/sys/unistd.h: Add _isatty. * libc/posix/Makefile.am: Add new _isatty.c file. * libc/posix/Makefile.in: Regenerated. * libc/posix/_isatty.c: New file. * libc/posix/isatty.c: Changed to call _isatty(). * libc/reent/Makefile.am: Add new isattyr.c file. * libc/reent/Makefile.in: Regenerated. * libc/reent/isattyr.c: New file. * libc/stdio/freopen.c: Changed to call _isatty_r(). * libc/stdio/makebuf.c: Ditto. * libc/sys/a29khif/_isatty.S: Change isatty to _isatty. * libc/sys/arc/isatty.c: Ditto. * libc/sys/arm/syscalls.c: Ditto. * libc/sys/d10v/syscalls.c: Ditto. * libc/sys/h8300hms/syscalls.c: Ditto. * libc/sys/h8500hms/syscalls.c: Ditto. * libc/sys/linux/Makefile.am: Add new isatty.c file. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/isatty.c: New file. * libc/syscalls/Makefile.am: Add new sysisatty.c file. * libc/syscalls/Makefile.in: Regenerated. * libc/syscalls/sysisatty.c: New file.
This commit is contained in:
@ -4,10 +4,8 @@ gcc2_compiled.:
|
||||
.text
|
||||
.align 4
|
||||
.global __isatty
|
||||
.global _isatty
|
||||
.word 0x30000
|
||||
__isatty:
|
||||
_isatty:
|
||||
sub gr1,gr1,16
|
||||
asgeu V_SPILL,gr1,gr126
|
||||
add lr1,gr1,28
|
||||
|
@ -3,13 +3,14 @@
|
||||
/* Dumb implementation so programs will at least run. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <reent.h>
|
||||
|
||||
int
|
||||
isatty (int fd)
|
||||
_isatty_r (struct _reent *ptr, int fd)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (fstat (fd, &buf) < 0)
|
||||
if (_fstat_r (ptr, fd, &buf) < 0)
|
||||
return 0;
|
||||
if (S_ISCHR (buf.st_mode))
|
||||
return 1;
|
||||
|
@ -20,7 +20,7 @@
|
||||
/* Forward prototypes. */
|
||||
int _system _PARAMS ((const char *));
|
||||
int _rename _PARAMS ((const char *, const char *));
|
||||
int isatty _PARAMS ((int));
|
||||
int _isatty _PARAMS ((int));
|
||||
clock_t _times _PARAMS ((struct tms *));
|
||||
int _gettimeofday _PARAMS ((struct timeval *, void *));
|
||||
void _raise _PARAMS ((void));
|
||||
@ -612,7 +612,7 @@ _times (struct tms * tp)
|
||||
|
||||
|
||||
int
|
||||
isatty (int fd)
|
||||
_isatty (int fd)
|
||||
{
|
||||
#ifdef ARM_RDI_MONITOR
|
||||
int fh = remap_handle (fd);
|
||||
|
@ -64,7 +64,7 @@ _unlink ()
|
||||
}
|
||||
|
||||
int
|
||||
isatty (int fd)
|
||||
_isatty (int fd)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <_ansi.h>
|
||||
#include <errno.h>
|
||||
|
||||
int isatty(file)
|
||||
int _isatty(file)
|
||||
int file;
|
||||
{
|
||||
return 1;
|
||||
|
@ -93,7 +93,7 @@ _sbrk (incr)
|
||||
|
||||
|
||||
int
|
||||
isatty (file)
|
||||
_isatty (file)
|
||||
int file;
|
||||
{
|
||||
return 1;
|
||||
|
@ -47,6 +47,7 @@ GENERAL_SOURCES = \
|
||||
inode.c \
|
||||
io.c \
|
||||
ipc.c \
|
||||
isatty.c \
|
||||
linux.c \
|
||||
mallinfor.c \
|
||||
malloc.c \
|
||||
|
@ -138,7 +138,8 @@ DIST_COMMON = $(srcdir)/../../../../config.guess \
|
||||
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
|
||||
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
|
||||
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
|
||||
$(srcdir)/../../../../compile $(srcdir)/../../../../ltmain.sh \
|
||||
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
|
||||
$(srcdir)/../../../../ltmain.sh \
|
||||
$(srcdir)/../../../../config.guess \
|
||||
$(srcdir)/../../../../config.sub
|
||||
subdir = .
|
||||
@ -170,35 +171,36 @@ am__objects_1 = lib_a-aio.$(OBJEXT) lib_a-brk.$(OBJEXT) \
|
||||
lib_a-gethostid.$(OBJEXT) lib_a-gethostname.$(OBJEXT) \
|
||||
lib_a-getreent.$(OBJEXT) lib_a-ids.$(OBJEXT) \
|
||||
lib_a-inode.$(OBJEXT) lib_a-io.$(OBJEXT) lib_a-ipc.$(OBJEXT) \
|
||||
lib_a-linux.$(OBJEXT) lib_a-mallinfor.$(OBJEXT) \
|
||||
lib_a-malloc.$(OBJEXT) lib_a-mallocr.$(OBJEXT) \
|
||||
lib_a-mallstatsr.$(OBJEXT) lib_a-mmap.$(OBJEXT) \
|
||||
lib_a-mq_close.$(OBJEXT) lib_a-mq_getattr.$(OBJEXT) \
|
||||
lib_a-mq_notify.$(OBJEXT) lib_a-mq_open.$(OBJEXT) \
|
||||
lib_a-mq_receive.$(OBJEXT) lib_a-mq_send.$(OBJEXT) \
|
||||
lib_a-mq_setattr.$(OBJEXT) lib_a-mq_unlink.$(OBJEXT) \
|
||||
lib_a-msize.$(OBJEXT) lib_a-msizer.$(OBJEXT) \
|
||||
lib_a-mstats.$(OBJEXT) lib_a-mtrim.$(OBJEXT) \
|
||||
lib_a-mtrimr.$(OBJEXT) lib_a-ntp_gettime.$(OBJEXT) \
|
||||
lib_a-pread.$(OBJEXT) lib_a-process.$(OBJEXT) \
|
||||
lib_a-prof-freq.$(OBJEXT) lib_a-profile.$(OBJEXT) \
|
||||
lib_a-psignal.$(OBJEXT) lib_a-pwrite.$(OBJEXT) \
|
||||
lib_a-raise.$(OBJEXT) lib_a-realloc.$(OBJEXT) \
|
||||
lib_a-reallocr.$(OBJEXT) lib_a-rename.$(OBJEXT) \
|
||||
lib_a-resource.$(OBJEXT) lib_a-sched.$(OBJEXT) \
|
||||
lib_a-select.$(OBJEXT) lib_a-seteuid.$(OBJEXT) \
|
||||
lib_a-sethostid.$(OBJEXT) lib_a-sethostname.$(OBJEXT) \
|
||||
lib_a-shm_open.$(OBJEXT) lib_a-shm_unlink.$(OBJEXT) \
|
||||
lib_a-sig.$(OBJEXT) lib_a-sigaction.$(OBJEXT) \
|
||||
lib_a-sigqueue.$(OBJEXT) lib_a-signal.$(OBJEXT) \
|
||||
lib_a-siglongjmp.$(OBJEXT) lib_a-sigset.$(OBJEXT) \
|
||||
lib_a-sigwait.$(OBJEXT) lib_a-socket.$(OBJEXT) \
|
||||
lib_a-sleep.$(OBJEXT) lib_a-strsignal.$(OBJEXT) \
|
||||
lib_a-strverscmp.$(OBJEXT) lib_a-sysconf.$(OBJEXT) \
|
||||
lib_a-sysctl.$(OBJEXT) lib_a-systat.$(OBJEXT) \
|
||||
lib_a-tcdrain.$(OBJEXT) lib_a-tcsendbrk.$(OBJEXT) \
|
||||
lib_a-termios.$(OBJEXT) lib_a-time.$(OBJEXT) \
|
||||
lib_a-usleep.$(OBJEXT) lib_a-versionsort.$(OBJEXT)
|
||||
lib_a-isatty.$(OBJEXT) lib_a-linux.$(OBJEXT) \
|
||||
lib_a-mallinfor.$(OBJEXT) lib_a-malloc.$(OBJEXT) \
|
||||
lib_a-mallocr.$(OBJEXT) lib_a-mallstatsr.$(OBJEXT) \
|
||||
lib_a-mmap.$(OBJEXT) lib_a-mq_close.$(OBJEXT) \
|
||||
lib_a-mq_getattr.$(OBJEXT) lib_a-mq_notify.$(OBJEXT) \
|
||||
lib_a-mq_open.$(OBJEXT) lib_a-mq_receive.$(OBJEXT) \
|
||||
lib_a-mq_send.$(OBJEXT) lib_a-mq_setattr.$(OBJEXT) \
|
||||
lib_a-mq_unlink.$(OBJEXT) lib_a-msize.$(OBJEXT) \
|
||||
lib_a-msizer.$(OBJEXT) lib_a-mstats.$(OBJEXT) \
|
||||
lib_a-mtrim.$(OBJEXT) lib_a-mtrimr.$(OBJEXT) \
|
||||
lib_a-ntp_gettime.$(OBJEXT) lib_a-pread.$(OBJEXT) \
|
||||
lib_a-process.$(OBJEXT) lib_a-prof-freq.$(OBJEXT) \
|
||||
lib_a-profile.$(OBJEXT) lib_a-psignal.$(OBJEXT) \
|
||||
lib_a-pwrite.$(OBJEXT) lib_a-raise.$(OBJEXT) \
|
||||
lib_a-realloc.$(OBJEXT) lib_a-reallocr.$(OBJEXT) \
|
||||
lib_a-rename.$(OBJEXT) lib_a-resource.$(OBJEXT) \
|
||||
lib_a-sched.$(OBJEXT) lib_a-select.$(OBJEXT) \
|
||||
lib_a-seteuid.$(OBJEXT) lib_a-sethostid.$(OBJEXT) \
|
||||
lib_a-sethostname.$(OBJEXT) lib_a-shm_open.$(OBJEXT) \
|
||||
lib_a-shm_unlink.$(OBJEXT) lib_a-sig.$(OBJEXT) \
|
||||
lib_a-sigaction.$(OBJEXT) lib_a-sigqueue.$(OBJEXT) \
|
||||
lib_a-signal.$(OBJEXT) lib_a-siglongjmp.$(OBJEXT) \
|
||||
lib_a-sigset.$(OBJEXT) lib_a-sigwait.$(OBJEXT) \
|
||||
lib_a-socket.$(OBJEXT) lib_a-sleep.$(OBJEXT) \
|
||||
lib_a-strsignal.$(OBJEXT) lib_a-strverscmp.$(OBJEXT) \
|
||||
lib_a-sysconf.$(OBJEXT) lib_a-sysctl.$(OBJEXT) \
|
||||
lib_a-systat.$(OBJEXT) lib_a-tcdrain.$(OBJEXT) \
|
||||
lib_a-tcsendbrk.$(OBJEXT) lib_a-termios.$(OBJEXT) \
|
||||
lib_a-time.$(OBJEXT) lib_a-usleep.$(OBJEXT) \
|
||||
lib_a-versionsort.$(OBJEXT)
|
||||
am__objects_2 = lib_a-aio64.$(OBJEXT) lib_a-confstr.$(OBJEXT) \
|
||||
lib_a-ctermid.$(OBJEXT) lib_a-fclean.$(OBJEXT) \
|
||||
lib_a-fpathconf.$(OBJEXT) lib_a-fstab.$(OBJEXT) \
|
||||
@ -235,13 +237,13 @@ am__objects_6 = aio.lo brk.lo calloc.lo callocr.lo cfreer.lo \
|
||||
cfspeed.lo clock_getres.lo clock_gettime.lo clock_settime.lo \
|
||||
flockfile.lo free.lo freer.lo ftok.lo funlockfile.lo \
|
||||
getdate.lo getdate_err.lo gethostid.lo gethostname.lo \
|
||||
getreent.lo ids.lo inode.lo io.lo ipc.lo linux.lo mallinfor.lo \
|
||||
malloc.lo mallocr.lo mallstatsr.lo mmap.lo mq_close.lo \
|
||||
mq_getattr.lo mq_notify.lo mq_open.lo mq_receive.lo mq_send.lo \
|
||||
mq_setattr.lo mq_unlink.lo msize.lo msizer.lo mstats.lo \
|
||||
mtrim.lo mtrimr.lo ntp_gettime.lo pread.lo process.lo \
|
||||
prof-freq.lo profile.lo psignal.lo pwrite.lo raise.lo \
|
||||
realloc.lo reallocr.lo rename.lo resource.lo sched.lo \
|
||||
getreent.lo ids.lo inode.lo io.lo ipc.lo isatty.lo linux.lo \
|
||||
mallinfor.lo malloc.lo mallocr.lo mallstatsr.lo mmap.lo \
|
||||
mq_close.lo mq_getattr.lo mq_notify.lo mq_open.lo \
|
||||
mq_receive.lo mq_send.lo mq_setattr.lo mq_unlink.lo msize.lo \
|
||||
msizer.lo mstats.lo mtrim.lo mtrimr.lo ntp_gettime.lo pread.lo \
|
||||
process.lo prof-freq.lo profile.lo psignal.lo pwrite.lo \
|
||||
raise.lo realloc.lo reallocr.lo rename.lo resource.lo sched.lo \
|
||||
select.lo seteuid.lo sethostid.lo sethostname.lo shm_open.lo \
|
||||
shm_unlink.lo sig.lo sigaction.lo sigqueue.lo signal.lo \
|
||||
siglongjmp.lo sigset.lo sigwait.lo socket.lo sleep.lo \
|
||||
@ -465,6 +467,7 @@ GENERAL_SOURCES = \
|
||||
inode.c \
|
||||
io.c \
|
||||
ipc.c \
|
||||
isatty.c \
|
||||
linux.c \
|
||||
mallinfor.c \
|
||||
malloc.c \
|
||||
@ -807,6 +810,12 @@ lib_a-ipc.o: ipc.c
|
||||
lib_a-ipc.obj: ipc.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ipc.obj `if test -f 'ipc.c'; then $(CYGPATH_W) 'ipc.c'; else $(CYGPATH_W) '$(srcdir)/ipc.c'; fi`
|
||||
|
||||
lib_a-isatty.o: isatty.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isatty.o `test -f 'isatty.c' || echo '$(srcdir)/'`isatty.c
|
||||
|
||||
lib_a-isatty.obj: isatty.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isatty.obj `if test -f 'isatty.c'; then $(CYGPATH_W) 'isatty.c'; else $(CYGPATH_W) '$(srcdir)/isatty.c'; fi`
|
||||
|
||||
lib_a-linux.o: linux.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linux.o `test -f 'linux.c' || echo '$(srcdir)/'`linux.c
|
||||
|
||||
|
34
newlib/libc/sys/linux/isatty.c
Normal file
34
newlib/libc/sys/linux/isatty.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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 Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include <machine/weakalias.h>
|
||||
|
||||
/* Return 1 if FD is a terminal, 0 if not. */
|
||||
int
|
||||
__isatty (fd)
|
||||
int fd;
|
||||
{
|
||||
struct termios term;
|
||||
|
||||
return tcgetattr (fd, &term) == 0;
|
||||
}
|
||||
|
||||
weak_alias (__isatty, isatty)
|
Reference in New Issue
Block a user