From owner-freebsd-standards Wed Jan 15 21:10:41 2003 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 85CC237B401 for ; Wed, 15 Jan 2003 21:10:40 -0800 (PST) Received: from web13407.mail.yahoo.com (web13407.mail.yahoo.com [216.136.175.65]) by mx1.FreeBSD.org (Postfix) with SMTP id 3496343F5F for ; Wed, 15 Jan 2003 21:10:40 -0800 (PST) (envelope-from giffunip@yahoo.com) Message-ID: <20030116051040.74303.qmail@web13407.mail.yahoo.com> Received: from [200.24.79.45] by web13407.mail.yahoo.com via HTTP; Thu, 16 Jan 2003 06:10:40 CET Date: Thu, 16 Jan 2003 06:10:40 +0100 (CET) From: "=?iso-8859-1?q?Pedro=20F.=20Giffuni?=" Subject: flex vs POSIX To: freebsd-standards@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi; I'm reading the flex(1) manpage, in particular the section "INCOMPATIBILITIES WITH LEX AND POSIX". I hate to suggest this for the performance implications it might bring, but for compliance reasons perhaps the -l option (maximum compatibility) should be turned on when flex is called as lex. cheers, Pedro. ps. Of course... this could break a lot of stuff if done right now. ______________________________________________________________________ Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Jan 16 0:53:22 2003 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 ACA6137B401 for ; Thu, 16 Jan 2003 00:53:20 -0800 (PST) Received: from falcon.midgard.homeip.net (h76n3fls20o913.telia.com [213.67.148.76]) by mx1.FreeBSD.org (Postfix) with SMTP id 4AFDD43F1E for ; Thu, 16 Jan 2003 00:53:19 -0800 (PST) (envelope-from erikt@falcon.midgard.homeip.net) Received: (qmail 12972 invoked by uid 1001); 16 Jan 2003 08:53:15 -0000 Date: Thu, 16 Jan 2003 09:53:15 +0100 From: Erik Trulsson To: "Pedro F. Giffuni" Cc: freebsd-standards@FreeBSD.org Subject: Re: flex vs POSIX Message-ID: <20030116085315.GA12863@falcon.midgard.homeip.net> Mail-Followup-To: "Pedro F. Giffuni" , freebsd-standards@FreeBSD.org References: <20030116051040.74303.qmail@web13407.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030116051040.74303.qmail@web13407.mail.yahoo.com> User-Agent: Mutt/1.5.3i Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Jan 16, 2003 at 06:10:40AM +0100, Pedro F. Giffuni wrote: > Hi; > > I'm reading the flex(1) manpage, in particular the > section "INCOMPATIBILITIES WITH LEX AND POSIX". I hate > to suggest this for the performance implications it > might bring, but for compliance reasons perhaps the -l > option (maximum compatibility) should be turned on > when flex is called as lex. Probably not. Reading the section you note it seems that flex is already compliant with POSIX (with one small exception that -l doesn't help with.) Flex has many extensions that are not in POSIX, but since these shouldn't be used by portable lexers anyway it doesn't matter. The -l option seems to turn on maximum compatibility, not with the standard, but with the original lex implementation. Today there are probably at least as many programs that depend on the behaviour of flex as there are that depend on the behaviour of the original implementation. > > cheers, > > Pedro. > > ps. Of course... this could break a lot of stuff if > done right now. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Jan 16 9:34:22 2003 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 6955637B401 for ; Thu, 16 Jan 2003 09:34:20 -0800 (PST) Received: from web13401.mail.yahoo.com (web13401.mail.yahoo.com [216.136.175.59]) by mx1.FreeBSD.org (Postfix) with SMTP id 0A76543F43 for ; Thu, 16 Jan 2003 09:34:20 -0800 (PST) (envelope-from giffunip@yahoo.com) Message-ID: <20030116173419.56970.qmail@web13401.mail.yahoo.com> Received: from [200.24.79.64] by web13401.mail.yahoo.com via HTTP; Thu, 16 Jan 2003 18:34:19 CET Date: Thu, 16 Jan 2003 18:34:19 +0100 (CET) From: "=?iso-8859-1?q?Pedro=20F.=20Giffuni?=" Subject: Re: flex vs SUS?? (was flex vs POSIX) To: freebsd-standards@FreeBSD.org In-Reply-To: <20030116085315.GA12863@falcon.midgard.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG You are right: -l would in fact break POSIX compliance. The documentation (and code) is quite old though. flex should be compared against the single Unix Specification to see what's the current state. About the behaviour... I think lex should just be lex, and flex must continue being flex :). cheers, Pedro. --- Erik Trulsson ha scritto: > On Thu, Jan 16, 2003 at 06:10:40AM +0100, Pedro F. > Giffuni wrote: > > Hi; > > > > I'm reading the flex(1) manpage, in particular the > > section "INCOMPATIBILITIES WITH LEX AND POSIX". I > hate > > to suggest this for the performance implications > it > > might bring, but for compliance reasons perhaps > the -l > > option (maximum compatibility) should be turned on > > when flex is called as lex. > > Probably not. Reading the section you note it seems > that flex is > already compliant with POSIX (with one small > exception that -l doesn't > help with.) > Flex has many extensions that are not in POSIX, but > since these > shouldn't be used by portable lexers anyway it > doesn't matter. > The -l option seems to turn on maximum > compatibility, not with the > standard, but with the original lex implementation. > Today there are probably at least as many programs > that depend on the > behaviour of flex as there are that depend on the > behaviour of the > original implementation. > > > > > > > cheers, > > > > Pedro. > > > > ps. Of course... this could break a lot of stuff > if > > done right now. > > > > > > -- > > Erik Trulsson > ertr1013@student.uu.se ______________________________________________________________________ Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Jan 17 20:34:33 2003 Delivered-To: freebsd-standards@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 931) id 6CE8837B401; Fri, 17 Jan 2003 20:34:27 -0800 (PST) Date: Fri, 17 Jan 2003 20:34:27 -0800 From: Juli Mallett To: arch@FreeBSD.org Cc: standards@FreeBSD.org Subject: ps(1) printing the same variable a few times. Message-ID: <20030117203427.A18843@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Organisation: The FreeBSD Project X-Alternate-Addresses: , , , , X-Towel: Yes X-LiveJournal: flata, jmallett X-Negacore: Yes Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The following prevents non-user-added-via-[oO] options from repeating themselves. This follows both POLA and BSD ps(1) mode of GNU ps in the behaviour. I'd just like a quick once-over to assure I'm not on the crack. Thanx, juli. %%% Index: extern.h =================================================================== RCS file: /home/ncvs/src/bin/ps/extern.h,v retrieving revision 1.29 diff -d -u -r1.29 extern.h --- extern.h 1 Nov 2002 23:26:20 -0000 1.29 +++ extern.h 18 Jan 2003 04:31:32 -0000 @@ -52,6 +52,7 @@ void cputime(KINFO *, VARENT *); int donlist(void); void elapsed(KINFO *, VARENT *); +VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, size_t); double getpcpu(const KINFO *); void kvar(KINFO *, VARENT *); @@ -63,7 +64,7 @@ void lockname(KINFO *, VARENT *); void mwchan(KINFO *, VARENT *); void pagein(KINFO *, VARENT *); -void parsefmt(const char *); +void parsefmt(const char *, int); void pcpu(KINFO *, VARENT *); void pmem(KINFO *, VARENT *); void pri(KINFO *, VARENT *); Index: keyword.c =================================================================== RCS file: /home/ncvs/src/bin/ps/keyword.c,v retrieving revision 1.58 diff -d -u -r1.58 keyword.c --- keyword.c 24 Oct 2002 00:00:57 -0000 1.58 +++ keyword.c 18 Jan 2003 04:31:32 -0000 @@ -54,7 +54,7 @@ #include "ps.h" -static VAR *findvar(char *); +static VAR *findvar(char *, int); static int vcmp(const void *, const void *); /* Compute offset in common structures. */ @@ -223,7 +223,7 @@ } void -parsefmt(const char *p) +parsefmt(const char *p, int user) { static struct varent *vtail; char *tempstr, *tempstr1; @@ -234,7 +234,7 @@ char *cp; VAR *v; struct varent *vent; - +again: /* * If an item contains an equals sign, it specifies a column * header, may contain embedded separator characters and @@ -248,8 +248,18 @@ cp = tempstr; tempstr = NULL; } - if (cp == NULL || !(v = findvar(cp))) + if (cp == NULL || !(v = findvar(cp, user))) continue; + if (!user) { + /* + * If the user is NOT adding this field manually, + * get on with our lives if this VAR is already + * represented in the list. + */ + vent = find_varentry(v); + if (vent != NULL) + continue; + } if ((vent = malloc(sizeof(struct varent))) == NULL) errx(1, "malloc failed"); vent->var = malloc(sizeof(*vent->var)); @@ -273,7 +283,7 @@ } static VAR * -findvar(char *p) +findvar(char *p, int user) { VAR *v, key; char *hp; @@ -290,7 +300,7 @@ warnx("%s: illegal keyword specification", p); eval = 1; } - parsefmt(v->alias); + parsefmt(v->alias, user); return ((VAR *)NULL); } if (!v) { Index: ps.c =================================================================== RCS file: /home/ncvs/src/bin/ps/ps.c,v retrieving revision 1.59 diff -d -u -r1.59 ps.c --- ps.c 24 Oct 2002 00:00:57 -0000 1.59 +++ ps.c 18 Jan 2003 04:31:32 -0000 @@ -193,7 +193,7 @@ prtheader = ws.ws_row > 5 ? ws.ws_row : 22; break; case 'j': - parsefmt(jfmt); + parsefmt(jfmt, 0); _fmt = 1; jfmt[0] = '\0'; break; @@ -201,7 +201,7 @@ showkey(); exit(0); case 'l': - parsefmt(lfmt); + parsefmt(lfmt, 0); _fmt = 1; lfmt[0] = '\0'; break; @@ -217,14 +217,14 @@ dropgid = 1; break; case 'O': - parsefmt(o1); - parsefmt(optarg); - parsefmt(o2); + parsefmt(o1, 1); + parsefmt(optarg, 1); + parsefmt(o2, 1); o1[0] = o2[0] = '\0'; _fmt = 1; break; case 'o': - parsefmt(optarg); + parsefmt(optarg, 1); _fmt = 1; break; #if defined(LAZY_PS) @@ -270,13 +270,13 @@ xflg++; /* XXX: intuitive? */ break; case 'u': - parsefmt(ufmt); + parsefmt(ufmt, 0); sortby = SORTCPU; _fmt = 1; ufmt[0] = '\0'; break; case 'v': - parsefmt(vfmt); + parsefmt(vfmt, 0); sortby = SORTMEM; _fmt = 1; vfmt[0] = '\0'; @@ -292,7 +292,7 @@ xflg = 1; break; case 'Z': - parsefmt(Zfmt); + parsefmt(Zfmt, 0); Zfmt[0] = '\0'; break; case '?': @@ -325,7 +325,7 @@ errx(1, "%s", errbuf); if (!_fmt) - parsefmt(dfmt); + parsefmt(dfmt, 0); /* XXX - should be cleaner */ if (!all && ttydev == NODEV && pid == -1 && !nuids) { @@ -454,6 +454,18 @@ errx(1, "No users specified"); return uids; +} + +VARENT * +find_varentry(VAR *v) +{ + struct varent *vent; + + for (vent = vhead; vent; vent = vent->next) { + if (strcmp(vent->var->name, v->name) == 0) + return vent; + } + return NULL; } static void %%% -- Juli Mallett AIM: BSDFlata -- IRC: juli on EFnet. OpenDarwin, Mono, FreeBSD Developer. ircd-hybrid Developer, EFnet addict. FreeBSD on MIPS-Anything on FreeBSD. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message