[cs631apue] [cs631] ls -s flag

tparisi tparisi at stevens.edu
Tue Oct 2 14:03:26 EDT 2012


Hi Professor,
I have a question about the -s flag when we are writing our own ls 
program.  If you set BLOCKSIZE = 512 through export, and divide the size 
of the file by the BLOCKSIZE, it does not match the output of the real 
ls.  For example, the real ls yields an answer of 8 blocks used for a 
file that is 533 bytes in the /tmp directory.  The size of the file was 
gotten through ls -ls for comparison reasons.  Obviously, if you divide 
533 by 512 you get 1.033...Which means it uses two blocks however, ls 
-ls says it uses 8.  How can this be?
Thanks,
Tom Parisi


More information about the cs631apue mailing list