Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jan 2001 16:40:57 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        Ron Klinkien <ron@zappa.demon.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: date command and it's return code..
Message-ID:  <Pine.BSF.4.21.0101141630290.44600-100000@ren.sasknow.com>
In-Reply-To: <001301c07e71$d8cb9a00$0304a8c0@smalweer.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Ron Klinkien wrote to questions@FreeBSD.ORG:

> Why is the /bin/date command returning such weird return codes?
> 
> It returns 512 on an succesfull time change, and 256 when
> started with wrong arguments..
> 
> Ron.

Works fine for me on 3.4, 4.1, and 4.2,

ryan@ren $ date
Sun Jan 14 16:34:46 CST 2001
ryan@ren $ echo $?
0
ryan@ren $ date -v381731
381731: Cannot apply date adjustment
usage: date [-nu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]
ryan@ren $ echo $?
1


Shot in the dark:

256 and 512 aren't in the range of a valid exit status (8 bits).  Are you,
per chance, starting it from your own program?  The status return from
wait(2) doesn't just include the exit code.  In C, for example, use the
WEXITSTATUS() macro to return the lower 8 bits containing the exit code.
Other compiled or scripting languages may or may not behave similarly.

If I'm out to lunch, here, let us know how you are calling /bin/date
(i.e., which process is actually invoking /bin/date)

Hope this helps,

- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

        Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0101141630290.44600-100000>