From owner-freebsd-questions Sun Jan 14 14:41:32 2001 Delivered-To: freebsd-questions@freebsd.org Received: from ren.sasknow.com (ren.sasknow.com [207.195.92.131]) by hub.freebsd.org (Postfix) with ESMTP id 4F8F037B400 for ; Sun, 14 Jan 2001 14:41:13 -0800 (PST) Received: from localhost (ryan@localhost) by ren.sasknow.com (8.9.3/8.9.3) with ESMTP id QAA45607; Sun, 14 Jan 2001 16:40:57 -0600 (CST) (envelope-from ryan@sasknow.com) Date: Sun, 14 Jan 2001 16:40:57 -0600 (CST) From: Ryan Thompson To: Ron Klinkien Cc: freebsd-questions@freebsd.org Subject: Re: date command and it's return code.. In-Reply-To: <001301c07e71$d8cb9a00$0304a8c0@smalweer.nl> Message-ID: Organization: SaskNow Technologies [www.sasknow.com] MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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