From owner-cvs-all Thu Dec 24 15:28:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA04393 for cvs-all-outgoing; Thu, 24 Dec 1998 15:28:51 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA04388; Thu, 24 Dec 1998 15:28:48 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.1/8.9.1) id PAA85480; Thu, 24 Dec 1998 15:28:31 -0800 (PST) (envelope-from dillon) Date: Thu, 24 Dec 1998 15:28:31 -0800 (PST) From: Matthew Dillon Message-Id: <199812242328.PAA85480@apollo.backplane.com> To: Steve Price Cc: Dag-Erling Smorgrav , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/usr.bin/w w.c References: Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk :# Steve Price writes: :# > steve 1998/12/24 10:20:58 PST :# > :# > Modified files: :# > usr.bin/w w.c :# > Log: :# > Since argv is in scope, use argv[0] instead of __progname. :# :# Is that correct? __progname is (AFAIK) guaranteed to always be the :# base name (without the directory part) - at least now that it is fixed :# for Elf programs - whereas argv[0] may or may not contain a directory :# part. : :Userland applications shouldn't use __progname. Besides in this :case we really don't care if the path is present or not. All we :are looking for is something that looks like 'uptime'. Of course :this is still broken if you do something bizarre like /bin-uptime/w :and expect w(1) semantics. Then again the original version would :treat 'umm-w' as uptime(1) and 'my-uptime' as 'w'. Not a perfect :solution either way but I think the way it stands now fits the :original intent and doesn't use variables that aren't intended :for use in userland. : :-steve : :# DES :# -- :# Dag-Erling Smorgrav - des@flood.ping.uio.no You both have gone off the deep end :-) It's trivial to just add a few lines of C and use strrchr() to check the tail end of argv[0]. It makes no sense to use an internal global like __progname nor does it make sense to make exec path assumptions by using strstr(), especially when the exec path leading to /bin/w can be virtually anything. I've committed a fix. -Matt Matthew Dillon Engineering, HiWay Technologies, Inc. & BEST Internet Communications & God knows what else. (Please include original email in any response) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message