*BSD News Article 48793


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!daffy!uwvax!uwm.edu!spool.mu.edu!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!gsb13580.uchicago.edu!frank
From: frank@gsb13580.uchicago.edu (Frank S. Fejes)
Subject: Simple BSD code acting funny in FreeBSD (correctly in Linux)
X-Nntp-Posting-Host: gsb13580.uchicago.edu
Message-ID: <DD06CB.It1@midway.uchicago.edu>
Sender: news@midway.uchicago.edu (News Administrator)
Organization: WoodNet
Date: Tue, 8 Aug 1995 17:38:35 GMT
Lines: 25

     Hello, I have been attempting to compile and run a simple ls-type
program under FreeBSD.  It is very simple Berkeley Unix C coding, but
I have run into a small problem running it under FreeBSD (it works
perfectly in Linux, though).  The problem lies in the ctime function 
and I am wondering if perhaps FreeBSD or BSD 4.4 has been changed a bit.
Here is a snippet from the program:

    printf("%7d %.12s ", sbuf.st_size, ctime(&sbuf.st_mtime)+4);

Here is a sample of the output when running the compiled binary under
FreeBSD (NULL replaces what should be the date last modified):

 3056 drwxr-xr-x 19   1001/100      2048 (NULL) .
 2048 drwxr-xr-x  6   1001/0        1024 (NULL) ..
 1723 -rw-------  1   1001/100       329 (NULL) .cshrc

Here is a sample of the output when running it under Linux:

 3072 drwxr-xr-x 12   502/100      2048 Aug  8 12:26 .
 2048 drwxr-xr-x 30   502/0        1024 Aug  7 14:40 ..
 1434 -rw-r--r--  1   502/100       410 Aug  3 12:36 .cshrc
 1058 -rw-r--r--  1   502/100        34 Nov 23 19:22 .less

     So, if anyone can help me figure out what the problem is, I would
greatly appreciate it.