Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Dec 1998 15:28:31 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Steve Price <sprice@hiwaay.net>
Cc:        Dag-Erling Smorgrav <des@flood.ping.uio.no>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/usr.bin/w w.c
Message-ID:  <199812242328.PAA85480@apollo.backplane.com>
References:   <Pine.OSF.4.02.9812241540390.30429-100000@fly.HiWAAY.net>

next in thread | previous in thread | raw e-mail | index | archive | help
:# Steve Price <steve@FreeBSD.ORG> 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.
    <dillon@backplane.com> (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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812242328.PAA85480>