*BSD News Article 48290


Return to BSD News archive

Path: sserve!euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!pravda.aa.msen.com!spool.mu.edu!usenet.eel.ufl.edu!news.mathworks.com!tank.news.pipex.net!pipex!swrinde!elroy.jpl.nasa.gov!lll-winken.llnl.gov!parc!fenner
From: fenner@parc.xerox.com (Bill Fenner)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Simple BSD code acting funny in FreeBSD (correctly in Linux)
Date: 10 Aug 1995 15:51:42 GMT
Organization: Xerox Palo Alto Research Center
Lines: 17
Message-ID: <40d9ue$g9h@news.parc.xerox.com>
References: <DD06CB.It1@midway.uchicago.edu>
NNTP-Posting-Host: crevenia.parc.xerox.com

In article <DD06CB.It1@midway.uchicago.edu>,
Frank S. Fejes <frank@gsb13580.uchicago.edu> wrote:
>The problem lies in the ctime function 
>and I am wondering if perhaps FreeBSD or BSD 4.4 has been changed a bit.

Actually, it's not ctime that has changed, it is the st_size entry of the
stat buffer.  Using "cc -Wall" on your program says:

foo.c:8: warning: int format, different type arg (arg 2)

Changing your printf to have the correct format for a quad int:

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

will make the output look right.

  Bill