From owner-freebsd-standards@FreeBSD.ORG Sat Apr 24 08:18:40 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 45D9716A4CE for ; Sat, 24 Apr 2004 08:18:40 -0700 (PDT) Received: from huva.hittite.isp.9tel.net (huva.hittite.isp.9tel.net [62.62.156.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id 65A4243D1F for ; Sat, 24 Apr 2004 08:18:39 -0700 (PDT) (envelope-from clefevre-lists@9online.fr) Received: from pc2k (26-119-118-80.kaptech.net [80.118.119.26]) by huva.hittite.isp.9tel.net (Postfix) with SMTP id 08C879BB5B; Sat, 24 Apr 2004 17:19:45 +0200 (CEST) Message-ID: <02bb01c42a0f$6ab37b80$7890a8c0@dyndns.org> From: "Cyrille Lefevre" To: "Garance A Drosihn" References: <019601c426b0$77dc91a0$7890a8c0@dyndns.org><1082504719.3444.534.camel@cube ><00ba01c427f3$b3477f40$7890a8c0@dyndns.org> <1082588650.3450.628.camel@cube> <01b401c428d1$27f77060$7890a8c0@dyndns.org> Date: Sat, 24 Apr 2004 17:18:37 +0200 Organization: ACME MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 cc: freebsd-standards@freebsd.org cc: Albert Cahalan Subject: Re: ps enhencements (posix syntax, and more) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2004 15:18:40 -0000 "Garance A Drosihn" wrote: > At 3:19 AM +0200 4/23/04, Cyrille Lefevre wrote: > >"Albert Cahalan" wrote: > >> > >> No, the point was that adding **any** option to switch > >> parser modes kind of defeats the whole idea of trying > >> to be compatible with anything. > > > >as suggested by Garrett Wollman, I will change -qQ to -W > >something, as done before through -X posix,etc. which have > >been retired from the current version. > > Don't go changing things around yet again. I don't think > Garrett *requested* a change. He just pointed out that -W > is reserved "for the implementation". I'll work on later, since it is better to have only one option to switch between more than mode than to have multiple options. As I do it w/ my original -X options (a kind of, but much simplier). > > > You can switch via $PATH and/or some other environment variable. > > > >currently, mode switch is also done through [...] and using > >an environment variable (see another email about that). > >but, some others dislike environment variables... > > I have no intention of installing any updates which cause `ps' > to completely change it's behavior and accepted options based > on the value of an environment variable. gnu's have _POSIXLY_CORRECT and other systems have a similary environment variable. why don't us ? for script portability, it may be much simplier to say BLAH=yes, than to modify the whole script, IMHO. > > > > static char bsd_fmtstr[] = "\ > >> > label:Z user:[ju](n!)& uid:([ju]n&)([ls]([ju]!)&)| pid:2! ppid:[jl] \ > >> > pgid:j sid:jX& tpgid:jX& tsid:jX& jobc:j sig:s sigmask:s sigignore:s \ > >> > sigcatch:s cpu:l pri:l nice:l %cpu:u %mem:u vsz:[lu] rss:[lu] \ > >> > mwchan:l(n!)& nwchan:ln& tt:[d2u](vX&)| state:1! tt:[jls]([du]!)& \ > >> > start:u time:1! sl:v re:v pagein:v vsz:v([lu]!)& rss:v([lu]!)& lim:v \ > >> > tsiz:v %cpu:v(u!)& %mem:v(u!)& command:1! \ > >> > "; > >> > >> I am reminded of sendmail. You're getting close. > > > >maybe, but this kept the code as small as possible. encode this > >using if else if etc. and the code will be at least twice the > >actual one. > > I am not sure of all that that section of code is doing, but I > will say that I am a little uncomfortable with how cryptic that > fmtstr is. well, at the first time, I use a simplier solution, but it was not working in some case. so, the answer was to implement a reverse-polish-calculator bcoz "it is really simple to implement, even if the syntax isn't so easy to understand". 1 and 2 are used by before and after -O fmtlist j, l, n, s, u, v and Z are enabled by -j, -l, -n, -s, -u, -v and -Z d is the default format string, X is enabled by -Q label:Z -> Z user:[ju](n!)& -> (j or u) and (not n) uid:([ju]n&)([ls]([ju]!)&)| -> (n and (j or u)) or ((l or s) and (not (j or u))) pid:2! -> not 2 ppid:[jl] -> j or u pgid:j -> j sid:jX& tpgid:jX& tsid:jX& -> j and X jobc:j -> j sig:s sigmask:s sigignore:s sigcatch:s -> s cpu:l pri:l nice:l -> l %cpu:u %mem:u -> u vsz:[lu] rss:[lu] -> (l or u) mwchan:l(n!)& -> l and (not n) nwchan:ln& -> l and n => I may implement -n as -c is implemented ? tt:[d2u](vX&)| -> (d or 2 or u) or (v and X) state:1! -> not 1 tt:[jls]([du]!)& -> (j or l or s) and (not (d or u)) => already printed by d or u start:u -> u time:1! -> not 1 sl:v re:v pagein:v -> v vsz:v([lu]!)& rss:v([lu]!)& -> v and (not (l or u)) => already printed by l or u lim:v tsiz:v -> v %cpu:v(u!)& %mem:v(u!)& -> v and (not u) => already printed by u command:1! -> not 1 is that help you ? Cyrille Lefevre. -- home: mailto:cyrille.lefevre@laposte.net