-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27 Apr 2008 at 22:30, Denys Vlasenko wrote:

From:                   Denys Vlasenko <[EMAIL PROTECTED]>
To:                     [email protected]
Subject:                Re: Operation of more command
Date sent:              Sun, 27 Apr 2008 22:30:32 +0200
Copies to:              "Michael D. Setzer II" <[EMAIL PROTECTED]>

> On Sunday 27 April 2008 16:19, Michael D. Setzer II wrote:
> > > > >         /* Another popular pager, most, detects when stdout
> > > > >          * is not a tty and turns into cat. This makes sense. */
> > > > >         if (!isatty(STDOUT_FILENO))
> > > > >                 return bb_cat(argv);
> > > > >
> > > > > This is needed to make e.g. "man <cmd> | sed ... >file"
> > > > > work (man internally starts more, or another $PAGER).
> > > > >
> > > >
> > > > cat scriptfile | more
> > > > dmesg | more
> > > >
> > > > Using the same thing within a Fedora machine works fine with the more
> > > > lines.
> > >
> > > Works for me. Look at the above code. It says "isatty(STDOUT_FILENO)".
> > > It checks *stdout*, not stdin. In your example, stdout is
> > > (presumed to be) a tty, so it has to work.
> > >
> > 
> > It does work fine when using it on a Fedora system with busybox, but
> > doesn't work when booted from the kernel.org kernel and using the /dev/tty1,
> > but then same thing happens when I copy the Fedora8 more command to
> > the cd. I just don't know why?
> 
> Me neither. Let's find out. Run:
> 
> cat scriptfile | strace -o strace.log more
> 
> and post strace.log to the mailing list.

Not sure what all the stuff means, but perhaps it shows something I need to add 
to the 
ramdrive.gz image file.

I created a test file with just 1 - 0 a number of times with one per line.

testmore.log
execve("/bin/more", ["more"], [/* 10 vars */]) = 0
brk(0)                                  = 0x80af000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libcrypt.so.1", O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64("/lib/tls/i686", 0xbf9e56fc)     = -1 ENOENT (No such file or directory)
open("/lib/tls/libcrypt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0xbf9e56fc)          = -1 ENOENT (No such file or directory)
open("/lib/i686/libcrypt.so.1", O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64("/lib/i686", 0xbf9e56fc)         = -1 ENOENT (No such file or directory)
open("/lib/libcrypt.so.1", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 
\367\276\0044\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=45316, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -
1, 0) = 0xb7fe5000
mmap2(0x4bef000, 201020, PROT_READ|PROT_EXEC, 
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x4bef000
mmap2(0x4bf8000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8) = 0x4bf8000
mmap2(0x4bfa000, 155964, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4bfa000
close(3)                                = 0
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, 
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\324\256\0004\0\0\0"..., 
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=210324, ...}) = 0
mmap2(0xaea000, 163952, PROT_READ|PROT_EXEC, 
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xaea000
mmap2(0xb11000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26) = 0xb11000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, 
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360T\232\0004\0\0\0"..., 512) 
= 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1692524, ...}) = 0
mmap2(0x98f000, 1410608, PROT_READ|PROT_EXEC, 
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x98f000
mmap2(0xae2000, 12288, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x153) = 0xae2000
mmap2(0xae5000, 9776, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xae5000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -
1, 0) = 0xb7fe4000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7fe46c0, limit:1048575, 
seg_32bit:1, 
contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) 
= 0
mprotect(0xae2000, 8192, PROT_READ)     = 0
mprotect(0xb11000, 4096, PROT_READ)     = 0
mprotect(0x4bf8000, 4096, PROT_READ)    = 0
mprotect(0x98b000, 4096, PROT_READ)     = 0
getuid32()                              = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(0)                                  = 0x80af000
brk(0x80d0000)                          = 0x80d0000
open("/dev/tty", O_RDONLY|O_LARGEFILE)  = -1 ENOENT (No such file or directory)
read(0, "1\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5\n6\n"..., 4096) = 61
write(1, "1\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5\n6\n"..., 61) = 61
read(0, "", 4096)                       = 0
exit_group(0)                           = ?


Using my morex program instead of the  busybox more command.

execve("/usr/bin/morex", ["morex"], [/* 10 vars */]) = 0
brk(0)                                  = 0x804a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
directory)
stat64("/lib/tls/i686", 0xbfd922ac)     = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0xbfd922ac)          = -1 ENOENT (No such file or directory)
open("/lib/i686/libc.so.6", O_RDONLY)   = -1 ENOENT (No such file or directory)
stat64("/lib/i686", 0xbfd922ac)         = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, 
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360T\232\0004\0\0\0"..., 512) 
= 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1692524, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -
1, 0) = 0xb7f91000
mmap2(0x98f000, 1410608, PROT_READ|PROT_EXEC, 
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x98f000
mmap2(0xae2000, 12288, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x153) = 0xae2000
mmap2(0xae5000, 9776, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xae5000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -
1, 0) = 0xb7f90000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f906c0, limit:1048575, 
seg_32bit:1, 
contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) 
= 0
mprotect(0xae2000, 8192, PROT_READ)     = 0
mprotect(0x98b000, 4096, PROT_READ)     = 0
fstat64(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -
1, 0) = 0xb7f8f000
read(0, "1\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5\n6\n"..., 1024) = 61
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 1), ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -
1, 0) = 0xb7f8e000
write(1, "1\n", 2)                      = 2
write(1, "2\n", 2)                      = 2
write(1, "3\n", 2)                      = 2
write(1, "4\n", 2)                      = 2
write(1, "5\n", 2)                      = 2
write(1, "6\n", 2)                      = 2
write(1, "7\n", 2)                      = 2
write(1, "8\n", 2)                      = 2
write(1, "9\n", 2)                      = 2
write(1, "0\n", 2)                      = 2
write(1, "1\n", 2)                      = 2
write(1, "2\n", 2)                      = 2
write(1, "3\n", 2)                      = 2
write(1, "4\n", 2)                      = 2
write(1, "5\n", 2)                      = 2
write(1, "6\n", 2)                      = 2
write(1, "7\n", 2)                      = 2
write(1, "8\n", 2)                      = 2
write(1, "9\n", 2)                      = 2
write(1, "0\n", 2)                      = 2
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({5, 0}, {5, 0})               = 0
write(1, "1\n", 2)                      = 2
write(1, "2\n", 2)                      = 2
write(1, "3\n", 2)                      = 2
write(1, "4\n", 2)                      = 2
write(1, "5\n", 2)                      = 2
write(1, "6\n", 2)                      = 2
write(1, "7\n", 2)                      = 2
write(1, "8\n", 2)                      = 2
write(1, "9\n", 2)                      = 2
write(1, "0\n", 2)                      = 2
write(1, "\n", 1)                       = 1
read(0, "", 1024)                       = 0
exit_group(0)                           = ?


> --
> vda


+----------------------------------------------------------+
  Michael D. Setzer II -  Computer Science Instructor      
  Guam Community College  Computer Center                  
  mailto:[EMAIL PROTECTED]                            
  mailto:[EMAIL PROTECTED]
  http://www.guam.net/home/mikes
  Guam - Where America's Day Begins                        
+----------------------------------------------------------+

http://setiathome.berkeley.edu (Original)
Number of Seti Units Returned:  19,471
Processing time:  32 years, 290 days, 12 hours, 58 minutes
(Total Hours: 287,489)

[EMAIL PROTECTED] CREDITS
SETI 5,269,727.070797 | EINSTEIN 1,573,038.609732 | ROSETTA 480,077.992597


-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8 -- QDPGP 2.61c
Comment: http://community.wow.net/grt/qdpgp.html

iQA/AwUBSBR2LCzGQcr/2AKZEQKa4QCcCRZWvPJC1tMpoyJXiTymcE5gq6wAn2uS
ieSHT89EkTtS3lSaV+7SK5cs
=r+uT
-----END PGP SIGNATURE-----
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to