From owner-freebsd-standards Mon Jan 28 14:55:24 2002 Delivered-To: freebsd-standards@freebsd.org Received: from opus.sandiegoca.ncr.com (tan7.ncr.com [192.127.94.7]) by hub.freebsd.org (Postfix) with ESMTP id A252537B416 for ; Mon, 28 Jan 2002 14:55:21 -0800 (PST) Received: from localhost (chuckr@localhost) by opus.sandiegoca.ncr.com (8.11.6/8.11.6) with ESMTP id g0SMwfs90989; Mon, 28 Jan 2002 14:58:42 -0800 (PST) (envelope-from chuckr@opus.sandiegoca.ncr.com) Date: Mon, 28 Jan 2002 14:58:41 -0800 (PST) From: chuck rouillard To: "Tim J. Robbins" Cc: Subject: Re: csplit(1) In-Reply-To: <20020125044235.A1126@descent.robbins.dropbear.id.au> Message-ID: <20020128144627.O90944-100000@opus.sandiegoca.ncr.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Fri, 25 Jan 2002, Tim J. Robbins wrote: > I've implemented the csplit(1) utility for FreeBSD. I've decided to > stick everything on a web page rather than attach them to mail. > http://www.wiretapped.net/~fyre/freebsd/ has this csplit implementation > as well as tabs, and the patch to split. > > mdoc'ing needs more work, as usual. I rather doubt anyone will miss your offerings for the additional week you might spend fixing up -your- documentation for -your- utility. 'mdoc' is hardly difficult. > > Tim > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-standards" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Jan 28 21:58:38 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (203.d.010.mel.iprimus.net.au [210.50.203.203]) by hub.freebsd.org (Postfix) with ESMTP id DD5F037B404 for ; Mon, 28 Jan 2002 21:58:34 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g0T5u1k01653; Tue, 29 Jan 2002 16:56:01 +1100 (EST) (envelope-from tim) Date: Tue, 29 Jan 2002 16:55:57 +1100 From: "Tim J. Robbins" To: chuck rouillard Cc: freebsd-standards@FreeBSD.ORG Subject: Re: csplit(1) Message-ID: <20020129165557.A1525@descent.robbins.dropbear.id.au> References: <20020125044235.A1126@descent.robbins.dropbear.id.au> <20020128144627.O90944-100000@opus.sandiegoca.ncr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020128144627.O90944-100000@opus.sandiegoca.ncr.com>; from chuckr@opus.sandiegoca.ncr.com on Mon, Jan 28, 2002 at 02:58:41PM -0800 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 Mon, Jan 28, 2002 at 02:58:41PM -0800, chuck rouillard wrote: > I rather doubt anyone will miss your offerings > for the additional week you might spend fixing > up -your- documentation for -your- utility. > 'mdoc' is hardly difficult. Keep such comments to yourself. I had hoped someone more skilled with mdoc than myself could look over the markup and offer some constructive comments. That said, I've had a look around at the other system manual pages, seen how they handled certain situations and made a few changes to tabs.1 and csplit.1. I'm happy with them now. (These updated copies are available in the usual place). Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 2:59:15 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (058.a.006.mel.iprimus.net.au [210.50.44.58]) by hub.freebsd.org (Postfix) with ESMTP id 967F437B404 for ; Tue, 29 Jan 2002 02:59:12 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g0TAx2503342 for freebsd-standards@FreeBSD.ORG; Tue, 29 Jan 2002 21:59:02 +1100 (EST) (envelope-from tim) Date: Tue, 29 Jan 2002 21:59:01 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: newgrp Message-ID: <20020129215901.A3335@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 Here's an implementation of newgrp I've written that attempts to conform to SUSV2: http://www.wiretapped.net/~fyre/freebsd/newgrp.tar.gz It does not use PAM for authentication, instead it does traditional authentication using /etc/group when it needs to. I don't think this is a problem since SUSV2 discourages using group passwords anyway. Is it worth the effort to make newgrp use PAM? Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 11:51:52 2002 Delivered-To: freebsd-standards@freebsd.org Received: from opus.sandiegoca.ncr.com (tan7.ncr.com [192.127.94.7]) by hub.freebsd.org (Postfix) with ESMTP id 2407B37B402 for ; Tue, 29 Jan 2002 11:51:47 -0800 (PST) Received: from localhost (chuckr@localhost) by opus.sandiegoca.ncr.com (8.11.6/8.11.6) with ESMTP id g0TJtkC92429 for ; Tue, 29 Jan 2002 11:55:46 -0800 (PST) (envelope-from chuckr@opus.sandiegoca.ncr.com) Date: Tue, 29 Jan 2002 11:55:46 -0800 (PST) From: chuck rouillard To: FreeBSD-Standards Subject: pathchk In-Reply-To: <20020129215901.A3335@descent.robbins.dropbear.id.au> Message-ID: <20020129114708.A92418-101000@opus.sandiegoca.ncr.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1569156913-1012334146=:92418" 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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1569156913-1012334146=:92418 Content-Type: TEXT/PLAIN; charset=US-ASCII My implementation of pathchk for review. Note that it handles the illegal filesystem access of /proc, the case where `/'^n is specified, and others. thanks, .cr --0-1569156913-1012334146=:92418 Content-Type: APPLICATION/octet-stream; name="pathchk.tar.gz" Content-Transfer-Encoding: BASE64 Content-ID: <20020129115546.N92418@opus.sandiegoca.ncr.com> Content-Description: Content-Disposition: attachment; filename="pathchk.tar.gz" H4sICMDKUzwAA3BhdGhjaGsudGFyAO0aa1PbSDJf7V/Ry9UtNpEFdkhymxzZ EkYE7Rqbtewk7KMSWRpjXWTJqweEvc1/v+6ekSwbyKMg+7jSVBFLMz09/X6M snDSmTt7u33svBVTPxD3vsBo7+w82t2FewDtxw/b5V81dh8BPN7t7D7efdh5 uIvLD9qPdu7BzpcgZn1kSerEAPfcWea+jW+G+9j633ScDAfP92oLaQX1uu6H bpB5Av49STx9EUdn+vzts/qfTWU1vtRQmt9Wv3r7C5zxEf9/9PBRZ+n/ncfk /53HDyv//yOG/vMGdKPFZeyfzVJouE3o7Oy0Nfq3A13iGYZR5geBE3t1AjaC ABg4gVgkIj4Xnk4LvDgUnp+ksT/JUj8KwQk9yBIBfghJlMWu4JmJHzrxJUyj eJ5ocOGnM4hi/o2ylNHMI8+f+q5DSDRwYgELEc/9NBUeYEw69z18SGdOiv8I RBQE0YUfnoEbhZ5PmxJGQxvnIn3CL219jboEomlOlhthyJujKSBPqYPkEl5n Ep3TkhIOY8ERRqnvCg1B/AQCREh4liczi6tk4alu4PhzEbOkoHOVFDyyJJac FOTVy5C8L0QNSEZzVF7kZnMRpk6uu21US4QAMcydVMS+EyRL8bPeCHOZEcnf Ax1GuBA6c0HUMPUZapfwXBLFMBFkF0hZBCL0ohhtBFcR9zxKC3ok92hnHp6N ZgZTXJeMJtE0vSD1KquBZCFcMhnc5JMxxWQsYYGJrCdJcgJ5enRk2WAPDkcv j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a5ZS2Ll9M4RbKShPfF GYZp1jB/DpHXCuWiEY2vsHHeslq/lQQeExyafP4tgj+jLbWCcVvmBdpWfDGh Iwg1fZuhD2sCS0baMs1ivtRIhYRhX0MbwYXQlbcYUpV/iZpEqiPP7DRDXpvD fo3e2yxpkgbJnwb1hdhiCenmUwc58DRl6pznuIjOQUkKySy6UBJdfgSBlhRu qwD1S2GXEm24qaIaNGTCbOo57LZ8uGJY6VXLghvGai1SrkZU2VR7DyLAZH2V fUN+mMk/MjDBdH+U+rLC8D2tgD2XDQ7fVtFN2bIpkGF1RVBrUbn4RIb2V8Bx gXIlf69L5poIoVS7HgtoXBMPStBlz8+l/gne/8kauloZrqlD6SNXS31dN0o1 a5l7xYQ0mQ4xL+agiJ+uNX03/9ZHOTCdRYh14tAtYhTmoDKLrnzIvKqtHDiv ho5z5RHeHCMXCzmk+qQ0zQLOVOQbufj1elmbqz2EEn0hvE+tym/uHtalX5L9 +4KAZfumVP35BKw0cJ9DwBfrD2hrna9TJBYqYj5eZ6urGEJYFAGIjGoj+h7e 8LmiOnM11Q5s4ct50cw3tqaLNG42mqrgQbDFNHDOVMkDVN7QO8rjmkzh4vsZ qnGRNuQRhBvJW6hckTtf3nm48pXbjs3FJnUXEv39+yzgQtQS4luGKLUiNSmd ZpGIa3QstPb4S3zoPeWJc7hfmiA1MdQeZaR6GQexjhw0FIecsb6FZUWJJUdx E7LkmpC1WoSJJfI7IpAyZMnev19ogpZZGX/2h69qVKMa1ahGNapRjWpUoxrV qEY1qlGNalSjGtWoRjWqUY1qVKMa1ahGNf6Pxv8A/CGGHABQAAA= --0-1569156913-1012334146=:92418-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 13: 8:36 2002 Delivered-To: freebsd-standards@freebsd.org Received: from gw.nectar.cc (gw.nectar.cc [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id E3D5C37B404 for ; Tue, 29 Jan 2002 13:08:32 -0800 (PST) Received: from madman.nectar.cc (madman.nectar.cc [10.0.1.111]) by gw.nectar.cc (Postfix) with ESMTP id 4525940; Tue, 29 Jan 2002 15:08:32 -0600 (CST) Received: (from nectar@localhost) by madman.nectar.cc (8.11.6/8.11.6) id g0TL8UI50547; Tue, 29 Jan 2002 15:08:30 -0600 (CST) (envelope-from nectar) Date: Tue, 29 Jan 2002 15:08:29 -0600 From: "Jacques A. Vidrine" To: chuck rouillard Cc: FreeBSD-Standards Subject: Re: pathchk Message-ID: <20020129210829.GC50337@madman.nectar.cc> Mail-Followup-To: "Jacques A. Vidrine" , chuck rouillard , FreeBSD-Standards References: <20020129215901.A3335@descent.robbins.dropbear.id.au> <20020129114708.A92418-101000@opus.sandiegoca.ncr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020129114708.A92418-101000@opus.sandiegoca.ncr.com> User-Agent: Mutt/1.3.27i X-Url: http://www.nectar.cc/ 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 Tue, Jan 29, 2002 at 11:55:46AM -0800, chuck rouillard wrote: > My implementation of pathchk for review. Note that > it handles the illegal filesystem access of /proc, > the case where `/'^n is specified, and others. A quick look at the code turns up: = sizeof(char) is defined to be 1. = use of calloc appears to be redundant. = some operations are out of order: memory allocations or made or memory is written even after it is demonstrable that the path name or component is too long. also, in a `||' construction, do the least expensive operation first. = the arguments are modified. while not strictly an error, it is not nice. = it would be nicer if errno were explicitly passed to pe() Otherwise it's looking good! Cheers, -- Jacques A. Vidrine http://www.nectar.cc/ NTT/Verio SME . FreeBSD UNIX . Heimdal Kerberos jvidrine@verio.net . nectar@FreeBSD.org . nectar@kth.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 14:11:50 2002 Delivered-To: freebsd-standards@freebsd.org Received: from opus.sandiegoca.ncr.com (tan7.ncr.com [192.127.94.7]) by hub.freebsd.org (Postfix) with ESMTP id 14D7C37B402 for ; Tue, 29 Jan 2002 14:11:47 -0800 (PST) Received: from localhost (chuckr@localhost) by opus.sandiegoca.ncr.com (8.11.6/8.11.6) with ESMTP id g0TMFhF92556; Tue, 29 Jan 2002 14:15:44 -0800 (PST) (envelope-from chuckr@opus.sandiegoca.ncr.com) Date: Tue, 29 Jan 2002 14:15:43 -0800 (PST) From: chuck rouillard To: "Jacques A. Vidrine" Cc: FreeBSD-Standards Subject: Re: pathchk In-Reply-To: <20020129210829.GC50337@madman.nectar.cc> Message-ID: <20020129135626.P92533-100000@opus.sandiegoca.ncr.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Tue, 29 Jan 2002, Jacques A. Vidrine wrote: > On Tue, Jan 29, 2002 at 11:55:46AM -0800, chuck rouillard wrote: > > My implementation of pathchk for review. Note that > > it handles the illegal filesystem access of /proc, > > the case where `/'^n is specified, and others. > > A quick look at the code turns up: > > = sizeof(char) is defined to be 1. Agreed. > = use of calloc appears to be redundant. I'm not sure what you mean here, but I'll take a look. > = some operations are out of order: memory allocations or made or > memory is written even after it is demonstrable that the path name > or component is too long. I'll take a closer look at this. At the very least, a comment of justification may be in order. 8-) > also, in a `||' construction, do the least expensive operation first. Yes, that's an oversight. :-) > = the arguments are modified. while not strictly an error, it is not > nice. > = it would be nicer if errno were explicitly passed to pe() Agreed. > > Otherwise it's looking good! Thanks for your time; it's appreciated. I'll fix these issues and pass them back soon. .cr > Cheers, > -- > Jacques A. Vidrine http://www.nectar.cc/ > NTT/Verio SME . FreeBSD UNIX . Heimdal Kerberos > jvidrine@verio.net . nectar@FreeBSD.org . nectar@kth.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 21:18: 3 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (010.c.009.mel.iprimus.net.au [210.50.114.10]) by hub.freebsd.org (Postfix) with ESMTP id CA97B37B400 for ; Tue, 29 Jan 2002 21:17:59 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g0U5DiR07832 for freebsd-standards@FreeBSD.ORG; Wed, 30 Jan 2002 16:13:44 +1100 (EST) (envelope-from tim) Date: Wed, 30 Jan 2002 16:13:43 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: asa utility Message-ID: <20020130161343.A7805@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 NetBSD has an implementation of the asa utility in basesrc/usr.bin/asa that compiles and works without modification on FreeBSD. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 21:32:23 2002 Delivered-To: freebsd-standards@freebsd.org Received: from stash.attlabs.att.com (mpfg.attlabs.net [12.106.35.2]) by hub.freebsd.org (Postfix) with ESMTP id 62A3337B400 for ; Tue, 29 Jan 2002 21:32:00 -0800 (PST) Received: (from fenner@localhost) by stash.attlabs.att.com (8.11.6/8.11.6) id g0U5VEh48095; Tue, 29 Jan 2002 21:31:14 -0800 (PST) (envelope-from fenner) From: Bill Fenner Message-Id: <200201300531.g0U5VEh48095@stash.attlabs.att.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=19701020; charset=US-ASCII To: standards@freebsd.org Subject: scanf(3) patches for review Date: Tue, 29 Jan 2002 21:31:13 -0800 Versions: dmail (bsd44) 2.2c/makemail 2.8t 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 --19701020 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Here are some long-standing scanf(3) patches, which add the new c99 size modifiers to scanf(3). They've been languishing in my tree waiting for me to get around to implementing %n$, but I am clearly not getting to it so there's nothing to win by sitting on 'em. One thing that I haven't decided yet is whether it makes sense to rewrite the size modifier narrative to a table in the same way as I did for printf(3). Input is solicited. Thanks, Bill --19701020 Content-Type: text/plain; name="scanf.diff"; x-unix-mode=0664 Content-Disposition: attachment; filename="scanf.diff" Index: scanf.3 =================================================================== RCS file: /home/ncvs/src/lib/libc/stdio/scanf.3,v retrieving revision 1.13 diff -u -r1.13 scanf.3 --- scanf.3 1 Oct 2001 16:08:59 -0000 1.13 +++ scanf.3 30 Jan 2002 05:04:55 -0000 @@ -137,11 +137,20 @@ there may be a number of .Em flag characters, as follows: -.Bl -tag -width indent +.Bl -tag -width ".Cm l No (ell)" .It Cm * Suppresses assignment. The conversion that follows occurs as usual, but no pointer is used; the result of the conversion is simply discarded. +.It Cm hh +Indicates that the conversion will be one of +.Cm dioux +or +.Cm n +and the next pointer is a pointer to a +.Em char +(rather than +.Em int ) . .It Cm h Indicates that the conversion will be one of .Cm dioux @@ -151,7 +160,7 @@ .Em short int (rather than .Em int ) . -.It Cm l +.It Cm l No (ell) Indicates either that the conversion will be one of .Cm dioux or @@ -160,21 +169,66 @@ .Em long int (rather than .Em int ) , -or that the conversion will be one of -.Cm efg +that the conversion will be one of +.Cm aefg and the next pointer is a pointer to .Em double (rather than -.Em float ) . +.Em float ) , +orthat the conversion will be one of +.Cm c +or +.Cm s +and the next pointer is a pointer to an array of +.Em wchar_t +(rather than +.Em char ) . +.It Cm ll No (ell ell) +Indicates either that the conversion will be one of +.Cm dioux +or +.Cm n +and the next pointer is a pointer to a +.Em long long int +(rather than +.Em int ) . .It Cm L Indicates that the conversion will be -.Cm efg +.Cm aefg and the next pointer is a pointer to .Em long double . (This type is not implemented; the .Cm L flag is currently ignored.) +.It Cm j +Indicates either that the conversion will be one of +.Cm dioux +or +.Cm n +and the next pointer is a pointer to a +.Em intmax_t +(rather than +.Em int ) . +.It Cm t +Indicates either that the conversion will be one of +.Cm dioux +or +.Cm n +and the next pointer is a pointer to a +.Em ptrdiff_t +(rather than +.Em int ) . +.It Cm z +Indicates either that the conversion will be one of +.Cm dioux +or +.Cm n +and the next pointer is a pointer to a +.Em size_t +(rather than +.Em int ) . .It Cm q +(deprecated.) Indicates either that the conversion will be one of .Cm dioux or @@ -182,7 +236,7 @@ and the next pointer is a pointer to a .Em long long int (rather than -.Em int ) , +.Em int ) . .El .Pp In addition to these flags, @@ -210,10 +264,6 @@ Matches an optionally signed decimal integer; the next pointer must be a pointer to .Em int . -.It Cm D -Equivalent to -.Cm ld ; -this exists only for backwards compatibility. .It Cm i Matches an optionally signed integer; the next pointer must be a pointer to @@ -231,48 +281,37 @@ Matches an octal integer; the next pointer must be a pointer to .Em unsigned int . -.It Cm O -Equivalent to -.Cm lo ; -this exists for backwards compatibility. .It Cm u Matches an optionally signed decimal integer; the next pointer must be a pointer to .Em unsigned int . -.It Cm x +.It Cm x , X Matches an optionally signed hexadecimal integer; the next pointer must be a pointer to .Em unsigned int . -.It Cm X -Equivalent to -.Cm lx ; -this violates the -.St -isoC , -but is backwards compatible with previous -.Ux -systems. -.It Cm f +.It Cm e , E , f , F , g , G Matches an optionally signed floating-point number; the next pointer must be a pointer to .Em float . -.It Cm e -Equivalent to -.Cm f . -.It Cm g -Equivalent to -.Cm f . -.It Cm E -Equivalent to -.Cm lf ; -this violates the -.St -isoC , -but is backwards compatible with previous -.Ux -systems. -.It Cm F -Equivalent to -.Cm lf ; -this exists only for backwards compatibility. +.It Cm a , A +Matches a hexadecimal number represented in the style +.Sm off +.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d . +.Sm off +This is an exact coversion of the mantissa+exponent internal +floating point representation; the +.Sm off +.Oo \- Oc Li 0x Ar h Li \&. Ar hhh +.Sm on +portion represents exactly the mantissa; only denormalized +mantissas have a zero value to the left of the hexadecimal +point. +The +.Cm p +is a literal character +.Ql p ; +the exponent is preceded by a positive or negative sign +and is represented in decimal. .It Cm s Matches a sequence of non-white-space characters; the next pointer must be a pointer to @@ -283,6 +322,9 @@ character. The input string stops at white space or at the maximum field width, whichever occurs first. +.It Cm S +The same as +.Cm ls . .It Cm c Matches a sequence of .Em width @@ -296,6 +338,9 @@ is added). The usual skip of leading white space is suppressed. To skip white space first, use an explicit space in the format. +.It Cm C +The same as +.Cm lc . .It Cm \&[ Matches a nonempty sequence of characters from the specified set of accepted characters; @@ -363,29 +408,10 @@ .Dv LC_NUMERIC ) . .Pp For backwards compatibility, -other conversion characters (except -.Ql \e0 ) -are taken as if they were -.Ql %d -or, if uppercase, -.Ql %ld , -and a `conversion' of +a `conversion' of .Ql %\e0 causes an immediate return of .Dv EOF . -The -.Cm F -and -.Cm X -conversions will be changed in the future -to conform to the -.Tn ANSI -C standard, -after which they will act like -.Cm f -and -.Cm x -respectively. .Sh RETURN VALUES These functions @@ -419,7 +445,7 @@ and .Fn sscanf conform to -.St -isoC . +.St -isoC-99 . .Sh HISTORY The functions .Fn vscanf , @@ -428,13 +454,21 @@ .Fn vfscanf are new to this release. .Sh BUGS -The current situation with -.Cm %F +Earlier implementations of +.Nm +treated +.Cm \&%D , \&%E , \&%F , \&%O and -.Cm %X -conversions is unfortunate. -.Pp -All of the backwards compatibility formats will be removed in the future. +.Cm \&%X +as their lowercase equivalents with an +.Cm l +modifier. In addition, +.Nm +treated an unknown conversion character as +.Cm \&%d +or +.Cm \&%D , +depending on its case. This functionality has been removed. .Pp Numerical strings are truncated to 512 characters; for example, .Cm %f @@ -444,3 +478,25 @@ .Cm %512f and .Cm %512d . +.Pp +The +.Cm %n$ +modifiers for positional arguments are not implemented. +.Pp +The +.Cm l +modifier for +.Cm %c +and +.Cm %s +(and +.Cm %C +and +.Cm %S ) +to specify wide characters and strings is not implemented. +.Pp +The +.Cm \&%a +and +.Cm \&%A +floating-point formats are not implemented. Index: vfscanf.c =================================================================== RCS file: /home/ncvs/src/lib/libc/stdio/vfscanf.c,v retrieving revision 1.19 diff -u -r1.19 vfscanf.c --- vfscanf.c 29 Nov 2001 03:03:55 -0000 1.19 +++ vfscanf.c 30 Jan 2002 05:16:58 -0000 @@ -45,6 +45,7 @@ #include "namespace.h" #include #include +#include #include #if __STDC__ #include @@ -52,6 +53,7 @@ #include #endif #include +#include #include "un-namespace.h" #include "collate.h" @@ -76,7 +78,11 @@ #define SUPPRESS 0x08 /* suppress assignment */ #define POINTER 0x10 /* weird %p pointer (`fake hex') */ #define NOSKIP 0x20 /* do not skip blanks */ -#define QUAD 0x400 +#define LONGLONG 0x400 /* ll: long long (+ deprecated q: quad) */ +#define INTMAXT 0x800 /* j: intmax_t */ +#define PTRDIFFT 0x1000 /* t: ptrdiff_t */ +#define SIZET 0x2000 /* z: size_t */ +#define SHORTSHORT 0x4000 /* hh: char */ /* * The following are used in numeric conversions only: @@ -98,13 +104,10 @@ #define CT_CHAR 0 /* %c conversion */ #define CT_CCL 1 /* %[...] conversion */ #define CT_STRING 2 /* %s conversion */ -#define CT_INT 3 /* integer, i.e., strtoq or strtouq */ +#define CT_INT 3 /* integer, i.e., strtoimax or strtoumax */ #define CT_FLOAT 4 /* floating, i.e., strtod */ -#define u_char unsigned char -#define u_long unsigned long - -static u_char *__sccl(char *, u_char *); +static const u_char *__sccl(char *, const u_char *); /* * __vfscanf - MT-safe version @@ -124,9 +127,9 @@ * __svfscanf - non-MT-safe version of __vfscanf */ int -__svfscanf(FILE *fp, char const *fmt0, va_list ap) +__svfscanf(FILE *fp, const char *fmt0, va_list ap) { - u_char *fmt = (u_char *)fmt0; + const u_char *fmt = (const u_char *)fmt0; int c; /* character from format, or conversion */ size_t width; /* field width, or 0 */ char *p; /* points into all kinds of strings */ @@ -136,8 +139,8 @@ int nassigned; /* number of fields assigned */ int nconversions; /* number of conversions */ int nread; /* number of characters consumed from fp */ - int base; /* base argument to strtoq/strtouq */ - u_quad_t(*ccfn)(); /* conversion function (strtoq/strtouq) */ + int base; /* base argument to strtoimax/strtoumax */ + uintmax_t(*ccfn)(); /* conversion function (strtoimax/strtoumax) */ char ccltab[256]; /* character class table for %[...] */ char buf[BUF]; /* buffer for numeric conversions */ @@ -185,17 +188,34 @@ case '*': flags |= SUPPRESS; goto again; + case 'j': + flags |= INTMAXT; + goto again; case 'l': - flags |= LONG; + if (flags & LONG) { + flags &= ~LONG; + flags |= LONGLONG; + } else + flags |= LONG; goto again; case 'q': - flags |= QUAD; + flags |= LONGLONG; /* not quite */ + goto again; + case 't': + flags |= PTRDIFFT; + goto again; + case 'z': + flags |= SIZET; goto again; case 'L': flags |= LONGDBL; goto again; case 'h': - flags |= SHORT; + if (flags & SHORT) { + flags &= ~SHORT; + flags |= SHORTSHORT; + } else + flags |= SHORT; goto again; case '0': case '1': case '2': case '3': case '4': @@ -205,61 +225,49 @@ /* * Conversions. - * Those marked `compat' are for 4.[123]BSD compatibility. - * - * (According to ANSI, E and X formats are supposed - * to the same as e and x. Sorry about that.) */ - case 'D': /* compat */ - flags |= LONG; - /* FALLTHROUGH */ case 'd': c = CT_INT; - ccfn = (u_quad_t (*)())strtoq; + ccfn = (uintmax_t (*)())strtoimax; base = 10; break; case 'i': c = CT_INT; - ccfn = (u_quad_t (*)())strtoq; + ccfn = (uintmax_t (*)())strtoimax; base = 0; break; - case 'O': /* compat */ - flags |= LONG; - /* FALLTHROUGH */ case 'o': c = CT_INT; - ccfn = strtouq; + ccfn = strtoumax; base = 8; break; case 'u': c = CT_INT; - ccfn = strtouq; + ccfn = strtoumax; base = 10; break; - case 'X': /* compat XXX */ - flags |= LONG; - /* FALLTHROUGH */ + case 'X': case 'x': flags |= PFXOK; /* enable 0x prefixing */ c = CT_INT; - ccfn = strtouq; + ccfn = strtoumax; base = 16; break; #ifdef FLOATING_POINT - case 'E': /* compat XXX */ - case 'F': /* compat */ - flags |= LONG; - /* FALLTHROUGH */ + case 'E': case 'F': case 'G': case 'e': case 'f': case 'g': c = CT_FLOAT; break; #endif + case 'S': + flags |= LONG; + /* FALLTHROUGH */ case 's': c = CT_STRING; break; @@ -270,6 +278,9 @@ c = CT_CCL; break; + case 'C': + flags |= LONG; + /* FALLTHROUGH */ case 'c': flags |= NOSKIP; c = CT_CHAR; @@ -278,7 +289,7 @@ case 'p': /* pointer format is like hex */ flags |= POINTER | PFXOK; c = CT_INT; - ccfn = strtouq; + ccfn = strtoumax; base = 16; break; @@ -286,29 +297,32 @@ nconversions++; if (flags & SUPPRESS) /* ??? */ continue; - if (flags & SHORT) + if (flags & SHORTSHORT) + *va_arg(ap, char *) = nread; + else if (flags & SHORT) *va_arg(ap, short *) = nread; else if (flags & LONG) *va_arg(ap, long *) = nread; - else if (flags & QUAD) - *va_arg(ap, quad_t *) = nread; + else if (flags & LONGLONG) + *va_arg(ap, long long *) = nread; + else if (flags & INTMAXT) + *va_arg(ap, intmax_t *) = nread; + else if (flags & SIZET) + *va_arg(ap, size_t *) = nread; + else if (flags & PTRDIFFT) + *va_arg(ap, ptrdiff_t *) = nread; else *va_arg(ap, int *) = nread; continue; + default: + goto match_failure; + /* - * Disgusting backwards compatibility hacks. XXX + * Disgusting backwards compatibility hack. XXX */ case '\0': /* compat */ return (EOF); - - default: /* compat */ - if (isupper(c)) - flags |= LONG; - c = CT_INT; - ccfn = (u_quad_t (*)())strtoq; - base = 10; - break; } /* @@ -451,7 +465,7 @@ continue; case CT_INT: - /* scan an integer as if by strtoq/strtouq */ + /* scan an integer as if by strtoimax/strtoumax */ #ifdef hardway if (width == 0 || width > sizeof(buf) - 1) width = sizeof(buf) - 1; @@ -569,19 +583,27 @@ (void) __ungetc(c, fp); } if ((flags & SUPPRESS) == 0) { - u_quad_t res; + uintmax_t res; *p = 0; res = (*ccfn)(buf, (char **)NULL, base); if (flags & POINTER) *va_arg(ap, void **) = - (void *)(u_long)res; + (void *)(uintptr_t)res; + else if (flags & SHORTSHORT) + *va_arg(ap, char *) = res; else if (flags & SHORT) *va_arg(ap, short *) = res; else if (flags & LONG) *va_arg(ap, long *) = res; - else if (flags & QUAD) - *va_arg(ap, quad_t *) = res; + else if (flags & LONGLONG) + *va_arg(ap, long long *) = res; + else if (flags & INTMAXT) + *va_arg(ap, intmax_t *) = res; + else if (flags & PTRDIFFT) + *va_arg(ap, ptrdiff_t *) = res; + else if (flags & SIZET) + *va_arg(ap, size_t *) = res; else *va_arg(ap, int *) = res; nassigned++; @@ -700,10 +722,10 @@ * closing `]'. The table has a 1 wherever characters should be * considered part of the scanset. */ -static u_char * +static const u_char * __sccl(tab, fmt) register char *tab; - register u_char *fmt; + register const u_char *fmt; { register int c, n, v, i; --19701020-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Jan 29 23:19:32 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (147.a.009.mel.iprimus.net.au [210.50.112.147]) by hub.freebsd.org (Postfix) with ESMTP id 1700E37B448 for ; Tue, 29 Jan 2002 23:18:51 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g0U7GcA08543 for freebsd-standards@FreeBSD.ORG; Wed, 30 Jan 2002 18:16:38 +1100 (EST) (envelope-from tim) Date: Wed, 30 Jan 2002 18:16:38 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: pwd -L option Message-ID: <20020130181638.A8510@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This patch adds the -L option to pwd; most of the source changes were taken from NetBSD, but adapted so as not to break FreeBSD's realpath utility. I added an info line in usage() for realpath while I was at it. It uses the PWD environment variable that sh, ksh93, etc. export and checks to make sure it "points" to the physical CWD. Tim --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pwd.diff" Index: pwd/pwd.1 =================================================================== RCS file: /home/ncvs/src/bin/pwd/pwd.1,v retrieving revision 1.15 diff -u -r1.15 pwd.1 --- pwd/pwd.1 2001/08/15 09:09:36 1.15 +++ pwd/pwd.1 2002/01/30 07:18:10 @@ -43,6 +43,7 @@ .Nd return working directory name .Sh SYNOPSIS .Nm +.Op Fl LP .Sh DESCRIPTION .Nm Pwd writes the absolute pathname of the current working directory to @@ -54,17 +55,28 @@ Consult the .Xr builtin 1 manual page. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl L +Display the logical current working directory. +.It Fl P +Display the physical current working directory (all symbolic links resolved) +(default). .Sh DIAGNOSTICS .Ex -std +.Sh ENVIRONMENT +Environment variables used by +.Nm : +.Bl -tag -width PWD +.It Ev PWD +Logical current working directory. .Sh STANDARDS The .Nm utility is expected to be .St -p1003.2 compatible. -The -.Fl L -flag is not supported. .Sh SEE ALSO .Xr builtin 1 , .Xr cd 1 , @@ -80,3 +92,9 @@ However, it can give a different answer in the rare case that the current directory or a containing directory was moved after the shell descended into it. +.Pp +The +.Fl L +option does not work unless the +.Ev PWD +variable is exported by the shell. Index: pwd/pwd.c =================================================================== RCS file: /home/ncvs/src/bin/pwd/pwd.c,v retrieving revision 1.13 diff -u -r1.13 pwd.c --- pwd/pwd.c 2001/05/30 03:28:29 1.13 +++ pwd/pwd.c 2002/01/30 07:18:11 @@ -45,13 +45,18 @@ "$FreeBSD: src/bin/pwd/pwd.c,v 1.13 2001/05/30 03:28:29 imp Exp $"; #endif /* not lint */ +#include +#include + #include +#include #include #include #include #include #include +static char *getcwd_logical __P((char *, size_t)); int main __P((int, char *[])); void usage __P((void)); @@ -63,16 +68,15 @@ int ch; char *p; char buf[PATH_MAX]; + int lflag = 0; - /* - * Flags for pwd are a bit strange. The POSIX 1003.2B/D9 document - * has an optional -P flag for physical, which is what this program - * will produce by default. The logical flag, -L, should fail, as - * there's no way to display a logical path after forking. - */ - while ((ch = getopt(argc, argv, "P")) != -1) + while ((ch = getopt(argc, argv, "LP")) != -1) switch (ch) { + case 'L': + lflag = 1; + break; case 'P': + lflag = 0; break; case '?': default: @@ -87,7 +91,8 @@ err(1, "%s", argv[0]); (void)printf("%s\n", p); } else if (argc == 0) { - p = getcwd(NULL, (size_t)0); + p = lflag ? getcwd_logical(NULL, (size_t)0) : + getcwd(NULL, (size_t)0); if (p == NULL) err(1, "."); (void)printf("%s\n", p); @@ -98,10 +103,51 @@ exit(0); } +static char * +getcwd_logical(char *pt, size_t size) +{ + char *pwd; + size_t pwdlen; + dev_t dev; + ino_t ino; + struct stat s; + + /* Check $PWD -- if it's right, it's fast. */ + if ((pwd = getenv("PWD")) != NULL && pwd[0] == '/') { + if (stat(pwd, &s) != -1) { + dev = s.st_dev; + ino = s.st_ino; + if (stat(".", &s) != -1 && dev == s.st_dev && + ino == s.st_ino) { + pwdlen = strlen(pwd); + if (pt) { + if (!size) { + errno = EINVAL; + return (NULL); + } + if (pwdlen + 1 > size) { + errno = ERANGE; + return (NULL); + } + } else if ((pt = malloc(pwdlen + 1)) == NULL) + return (NULL); + (void)memmove(pt, pwd, pwdlen); + pt[pwdlen] = '\0'; + return (pt); + } + } + } else + errno = ENOENT; + + return (NULL); +} + + void usage() { - (void)fprintf(stderr, "usage: pwd\n"); + (void)fprintf(stderr, "usage: pwd [-LP]\n"); + (void)fprintf(stderr, " realpath [file ...]\n"); exit(1); } --7AUc2qLy4jB3hD7Z-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 0:50:41 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (147.a.009.mel.iprimus.net.au [210.50.112.147]) by hub.freebsd.org (Postfix) with ESMTP id 1365037B405 for ; Wed, 30 Jan 2002 00:50:02 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g0U8ht408999 for freebsd-standards@FreeBSD.ORG; Wed, 30 Jan 2002 19:43:55 +1100 (EST) (envelope-from tim) Date: Wed, 30 Jan 2002 19:43:55 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: Patch for pr -f and -p options Message-ID: <20020130194355.A8993@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This patch adds the -f and -p options to pr. Tim --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pr.diff" Index: pr/pr.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/pr/pr.1,v retrieving revision 1.17 diff -u -r1.17 pr.1 --- pr/pr.1 2001/09/21 02:57:56 1.17 +++ pr/pr.1 2002/01/30 08:45:17 @@ -50,7 +50,7 @@ .Bk -words .Op Fl Ar column .Ek -.Op Fl adFmrt +.Op Fl adFfmprt .Bk -words .Oo .Op Fl e @@ -197,6 +197,10 @@ sequence of .Em characters. +.It Fl f +Same as +.Fl F +but pause before beginning the first page if standard output is a terminal. .It Fl h Ar header Use the string .Ar header @@ -293,6 +297,11 @@ .Fl o option is not specified, the default is zero. The space taken is in addition to the output line width. +.It Fl p +Pause before each page if the standard output is a terminal. +.Nm +will write an alert character to standard error and wait for a carriage +return to be read on the terminal. .It Fl r Write no diagnostic reports on failure to open a file. .It Fl s Ar char Index: pr/pr.c =================================================================== RCS file: /home/ncvs/src/usr.bin/pr/pr.c,v retrieving revision 1.11 diff -u -r1.11 pr.c --- pr/pr.c 2001/03/21 14:32:02 1.11 +++ pr/pr.c 2002/01/30 08:45:23 @@ -84,6 +84,8 @@ int dspace; /* double space flag */ char inchar; /* expand input char */ int ingap; /* expand input gap */ +int pausefst; /* Pause before first page */ +int pauseall; /* Pause before each page */ int formfeed; /* use formfeed as trailer */ char *header; /* header name instead of file name */ char ochar; /* contract output char */ @@ -139,6 +141,23 @@ } /* + * Write an alert character and wait for a carriage return on /dev/tty. + */ +void +ttypause(void) +{ + int pch; + FILE *ttyfp; + + if ((ttyfp = fopen("/dev/tty", "r")) != NULL) { + (void)putc('\a', stderr); + while ((pch = getc(ttyfp)) != '\n' && pch != EOF) + ; + fclose(ttyfp); + } +} + +/* * onecol: print files with only one column of output. * Line length is unlimited. */ @@ -222,6 +241,10 @@ ips = 0; cps = 0; + if ((pauseall || (pausefst && pagecnt == 1)) && + isatty(STDOUT_FILENO)) + ttypause(); + /* * loop by line */ @@ -410,6 +433,9 @@ * loop by page */ for(;;) { + if ((pauseall || (pausefst && pagecnt == 1)) && + isatty(STDOUT_FILENO)) + ttypause(); /* * loop by column */ @@ -666,6 +692,10 @@ * loop by page */ for(;;) { + if ((pauseall || (pausefst && pagecnt == 1)) && + isatty(STDOUT_FILENO)) + ttypause(); + /* * loop by line */ @@ -856,6 +886,10 @@ * continue to loop while any file still has data */ while (actf > 0) { + if ((pauseall || (pausefst && pagecnt == 1)) && + isatty(STDOUT_FILENO)) + ttypause(); + /* * loop by line */ @@ -1561,7 +1595,8 @@ usage() { (void)fputs( - "usage: pr [+page] [-col] [-adFmrt] [-e[ch][gap]] [-h header]\n",err); + "usage: pr [+page] [-col] [-adFfmprt] [-e[ch][gap]] [-h header]\n", + err); (void)fputs( " [-i[ch][gap]] [-l line] [-n[ch][width]] [-o offset]\n",err); (void)fputs( @@ -1595,7 +1630,7 @@ } } else err = stderr; - while ((c = egetopt(argc, argv, "#adFmrte?h:i?L:l:n?o:s?w:")) != -1) { + while ((c = egetopt(argc, argv, "#adFfmrte?h:i?L:l:n?o:ps?w:")) != -1) { switch (c) { case '+': if ((pgnm = atoi(eoptarg)) < 1) { @@ -1639,6 +1674,9 @@ } else ingap = INGAP; break; + case 'f': + ++pausefst; + /*FALLTHROUGH*/ case 'F': ++formfeed; break; @@ -1703,6 +1741,9 @@ err); return(1); } + break; + case 'p': + ++pauseall; break; case 'r': ++nodiag; --SUOF0GtieIMvvwua-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 1:24: 6 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (147.a.009.mel.iprimus.net.au [210.50.112.147]) by hub.freebsd.org (Postfix) with ESMTP id 1351937B400 for ; Wed, 30 Jan 2002 01:23:56 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g0U9GFU09158 for freebsd-standards@FreeBSD.ORG; Wed, 30 Jan 2002 20:16:15 +1100 (EST) (envelope-from tim) Date: Wed, 30 Jan 2002 20:16:15 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: fold -b and -s options patch Message-ID: <20020130201615.A9151@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="T4sUOijqQbZv57TR" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This patch adds the -b and -s options to fold. It's mostly taken from NetBSD but I've hopefully kept it compilable by K&R compilers. Tim --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fold.diff" Index: fold/fold.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/fold/fold.1,v retrieving revision 1.7 diff -u -r1.7 fold.1 --- fold/fold.1 2001/12/12 18:25:53 1.7 +++ fold/fold.1 2002/01/30 09:16:34 @@ -40,6 +40,7 @@ .Nd "fold long lines for finite width output device" .Sh SYNOPSIS .Nm +.Op Fl bs .Op Fl w Ar width .Op Ar .Sh DESCRIPTION @@ -50,6 +51,14 @@ .Pp The following option is available: .Bl -tag -width indent +.It Fl b +Count +.Ar width +in bytes rather than column positions. +.It Fl s +Fold line after the last blank character within the first +.Ar width +column positions (or bytes). .It Fl w Ar width Specify a line width to use instead of the default 80 characters. .Ar Width Index: fold/fold.c =================================================================== RCS file: /home/ncvs/src/usr.bin/fold/fold.c,v retrieving revision 1.6 diff -u -r1.6 fold.c --- fold/fold.c 2001/12/12 18:25:53 1.6 +++ fold/fold.c 2002/01/30 09:16:35 @@ -52,13 +52,19 @@ #include #include #include +#include +#include #include #define DEFLINEWIDTH 80 void fold __P((int)); +static int new_column_position __P((int, int)); static void usage __P((void)); +int count_bytes = 0; +int split_words = 0; + int main(argc, argv) int argc; @@ -69,8 +75,14 @@ char *p; width = -1; - while ((ch = getopt(argc, argv, "0123456789w:")) != -1) + while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) switch (ch) { + case 'b': + count_bytes = 1; + break; + case 's': + split_words = 1; + break; case 'w': if ((width = atoi(optarg)) <= 0) { errx(1, "illegal width value"); @@ -98,7 +110,7 @@ fold(width); else for (; *argv; ++argv) if (!freopen(*argv, "r", stdin)) { - err(1, "%s", *argv); + err(EX_NOINPUT, "%s", *argv); } else fold(width); exit(0); @@ -107,57 +119,115 @@ static void usage() { - (void)fprintf(stderr, "usage: fold [-w width] [file ...]\n"); + (void)fprintf(stderr, "usage: fold [-bs] [-w width] [file ...]\n"); exit(1); } +/* + * Fold the contents of standard input to fit within WIDTH columns + * (or bytes) and write to standard output. + * + * If split_words is set, split the line at the last space character + * on the line. This flag necessitates storing the line in a buffer + * until the current column > width, or a newline or EOF is read. + * + * The buffer can grow larger than WIDTH due to backspaces and carriage + * returns embedded in the input stream. + */ void fold(width) register int width; { - register int ch, col, new; - - for (col = 0;;) { - switch (ch = getchar()) { - case EOF: - return; - case '\b': - new = col ? col - 1 : 0; - break; - case '\n': - case '\r': - new = 0; - break; - case '\t': - new = (col + 8) & ~7; - break; - default: - new = col + 1; - break; + static char *buf = NULL; + static int buf_max = 0; + register int ch, col; + int indx; + + col = indx = 0; + while ((ch = getchar()) != EOF) { + if (ch == '\n') { + if (indx != 0) + fwrite (buf, 1, indx, stdout); + putchar('\n'); + col = indx = 0; + continue; } + + col = new_column_position (col, ch); + if (col > width) { + int i, last_space; + +#ifdef __GNUC__ + last_space = 0; /* XXX gcc */ +#endif + if (split_words) { + for (i = 0, last_space = -1; i < indx; i++) + if (buf[i] == ' ') + last_space = i; + } + + if (split_words && last_space != -1) { + last_space++; - if (new > width) { + fwrite (buf, 1, last_space, stdout); + memmove (buf, buf+last_space, indx-last_space); + + indx -= last_space; + col = 0; + for (i = 0; i < indx; i++) { + col = new_column_position (col, buf[i]); + } + } else { + fwrite (buf, 1, indx, stdout); + col = indx = 0; + } putchar('\n'); - col = 0; + + /* calculate the column position for the next line. */ + col = new_column_position (col, ch); + } + + if (indx + 1 > buf_max) { + /* Allocate buffer in LINE_MAX increments */ + buf_max += 2048; + if((buf = realloc (buf, buf_max)) == NULL) { + err (1, "realloc"); + /* NOTREACHED */ + } } - putchar(ch); + buf[indx++] = ch; + } + if (indx != 0) + fwrite (buf, 1, indx, stdout); +} + +/* + * calculate the column position + */ +static int +new_column_position (col, ch) + int col, ch; +{ + if (!count_bytes) { switch (ch) { case '\b': if (col > 0) --col; break; - case '\n': case '\r': col = 0; break; case '\t': - col += 8; - col &= ~7; + col = (col + 8) & ~7; break; default: ++col; break; } + } else { + ++col; } + + return col; } --T4sUOijqQbZv57TR-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 1:41:12 2002 Delivered-To: freebsd-standards@freebsd.org Received: from web14606.mail.yahoo.com (web14606.mail.yahoo.com [216.136.224.86]) by hub.freebsd.org (Postfix) with SMTP id B5F1937B402 for ; Wed, 30 Jan 2002 01:41:10 -0800 (PST) Message-ID: <20020130094110.16065.qmail@web14606.mail.yahoo.com> Received: from [213.38.69.142] by web14606.mail.yahoo.com via HTTP; Wed, 30 Jan 2002 09:41:10 GMT Date: Wed, 30 Jan 2002 09:41:10 +0000 (GMT) From: =?iso-8859-1?q?Michael=20Henry?= Reply-To: Aviast@yahoo.com Subject: RE: pathchk 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 > = sizeof(char) is defined to be 1. Are you proposing replacing "sizeof(char)" with "1"? Surely the former is more clear? On another point: what is the general consensus on casting functions to void? ie. "(void)fprintf(stderr, "%s\n", memoryerror);" Am I the only one who finds this needless obfuscation of the code irritating? (It's just a general question; nothing aimed specifically at Chuck's code). Regards, Michael ===== -- Michael Henry Men are born ignorant, not stupid. They are made stupid by education. --Bertrand Russell __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 12: 2: 8 2002 Delivered-To: freebsd-standards@freebsd.org Received: from bremen.shuttle.de (bremen.shuttle.de [194.95.249.251]) by hub.freebsd.org (Postfix) with ESMTP id F301337B402 for ; Wed, 30 Jan 2002 12:02:05 -0800 (PST) Received: from bremen.shuttle.de (localhost [127.0.0.1]) by bremen.shuttle.de (Postfix) with ESMTP id 726C017D15; Wed, 30 Jan 2002 21:02:04 +0100 (CET) Received: (from uucp@localhost) by bremen.shuttle.de (8.12.1/8.12.1/Debian -5) with UUCP id g0UK24Rl007012; Wed, 30 Jan 2002 21:02:04 +0100 Received: (from schweikh@localhost) by hal9000.schweikhardt.net (8.11.6/8.11.6) id g0UJR9I14817; Wed, 30 Jan 2002 20:27:09 +0100 (CET) (envelope-from schweikh) Date: Wed, 30 Jan 2002 20:27:09 +0100 From: Jens Schweikhardt To: Michael Henry Cc: freebsd-standards@freebsd.org Subject: Re: pathchk Message-ID: <20020130202709.B970@schweikhardt.net> References: <20020130094110.16065.qmail@web14606.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020130094110.16065.qmail@web14606.mail.yahoo.com>; from aviast@yahoo.com on Wed, Jan 30, 2002 at 09:41:10AM +0000 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 Wed, Jan 30, 2002 at 09:41:10AM +0000, Michael Henry wrote: # # > = sizeof(char) is defined to be 1. # # Are you proposing replacing "sizeof(char)" with "1"? # Surely the former is more clear? No, the multiplication with sizeof(char) should just be removed. Sizeof(char) is cast in stone as per ISO 9899. # On another point: what is the general consensus on casting # functions to void? ie. "(void)fprintf(stderr, "%s\n", memoryerror);" # Am I the only one who finds this needless obfuscation of # the code irritating? (It's just a general question; nothing # aimed specifically at Chuck's code). A lot of lint implementations (and I think FreeBSD's too) will complain if you ignore the return value of non-void functions. A void cast is the canonical way to suppress this if there's really no point in testing the return value. Regards, Jens -- Jens Schweikhardt http://www.schweikhardt.net/ SIGSIG -- signature too long (core dumped) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 13:41:23 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 30A0437B400 for ; Wed, 30 Jan 2002 13:41:21 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g0ULf6J84116; Wed, 30 Jan 2002 16:41:06 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20020130201615.A9151@descent.robbins.dropbear.id.au> References: <20020130201615.A9151@descent.robbins.dropbear.id.au> Date: Wed, 30 Jan 2002 16:41:04 -0500 To: "Tim J. Robbins" , freebsd-standards@FreeBSD.ORG From: Garance A Drosihn Subject: Re: fold -b and -s options patch Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 8:16 PM +1100 1/30/02, Tim J. Robbins wrote: >This patch adds the -b and -s options to fold. It's mostly taken from >NetBSD but I've hopefully kept it compilable by K&R compilers. If you're picking up code from NetBSD or OpenBSD, then you certainly do not need to add __P()'s to it. FreeBSD developers have repeatedly decided that we should also move to ANSI instead of K&R, even though there are a few holdouts who seem to believe that no such agreement has been reached. One justification for *keeping* __P()'s is to be compatible with source from the other BSD's, and in this case even that argument would say that __P()'s should not be added. [this is just a minor comment on your changes though, obviously it's good that you're trying to chip away at the list of programs we want to update to the latest standards!] -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 13:44: 9 2002 Delivered-To: freebsd-standards@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 819EA37B400 for ; Wed, 30 Jan 2002 13:44:07 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g0ULi5o31638; Wed, 30 Jan 2002 14:44:06 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g0ULi0x26787; Wed, 30 Jan 2002 14:44:04 -0700 (MST) (envelope-from imp@village.org) Date: Wed, 30 Jan 2002 14:43:43 -0700 (MST) Message-Id: <20020130.144343.58436074.imp@village.org> To: drosih@rpi.edu Cc: tim@robbins.dropbear.id.au, freebsd-standards@FreeBSD.ORG Subject: Re: fold -b and -s options patch From: "M. Warner Losh" In-Reply-To: References: <20020130201615.A9151@descent.robbins.dropbear.id.au> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 In message: Garance A Drosihn writes: : If you're picking up code from NetBSD or OpenBSD, then you certainly : do not need to add __P()'s to it. Well, that's a little strange at the moment. NetBSD is agressively moving away from __P and embracing the "You must have an ANSI compiler to build NetBSD." OpenBSD seems intent on preserving them in some cases and killing them in others. Generally speaking... Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 13:54:21 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 3326D37B405 for ; Wed, 30 Jan 2002 13:54:19 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g0ULs9J108952; Wed, 30 Jan 2002 16:54:09 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20020130.144343.58436074.imp@village.org> References: <20020130201615.A9151@descent.robbins.dropbear.id.au> <20020130.144343.58436074.imp@village.org> Date: Wed, 30 Jan 2002 16:54:07 -0500 To: "M. Warner Losh" From: Garance A Drosihn Subject: Re: fold -b and -s options patch Cc: tim@robbins.dropbear.id.au, freebsd-standards@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 2:43 PM -0700 1/30/02, M. Warner Losh wrote: >In message: > Garance A Drosihn writes: >: If you're picking up code from NetBSD or OpenBSD, then you certainly >: do not need to add __P()'s to it. > >Well, that's a little strange at the moment. NetBSD is agressively >moving away from __P and embracing the "You must have an ANSI compiler >to build NetBSD." OpenBSD seems intent on preserving them in some >cases and killing them in others. Generally speaking... I was thinking more that there is never a reason we should take code from either NetBSD or OpenBSD and *add* __P() to it. A separate issue is whether we should remove __P()'s from code where they still have it ("they" being whoever we are picking up the code from...). -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 14:16: 4 2002 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 8ED8437B400 for ; Wed, 30 Jan 2002 14:16:02 -0800 (PST) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) id g0UMG1Y64367; Wed, 30 Jan 2002 17:16:01 -0500 (EST) (envelope-from wollman) Date: Wed, 30 Jan 2002 17:16:01 -0500 (EST) From: Garrett Wollman Message-Id: <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu> To: Aviast@yahoo.com Cc: freebsd-standards@FreeBSD.ORG Subject: RE: pathchk In-Reply-To: <20020130094110.16065.qmail@web14606.mail.yahoo.com> References: <20020130094110.16065.qmail@web14606.mail.yahoo.com> 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 < said: > Are you proposing replacing "sizeof(char)" with "1"? > Surely the former is more clear? It makes it more clear that the author does not understand the C language, perhaps. > On another point: what is the general consensus on casting > functions to void? I am of the opinion that it is silly. Other reasonable people disagree. (I happen to think that their reasons for disagreement are the result of inadequate tools, and the appropriate response is to fix the tool, not kluge up the source code.) -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 14:18: 8 2002 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 74DF837B402 for ; Wed, 30 Jan 2002 14:18:06 -0800 (PST) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) id g0UMI5Y64383; Wed, 30 Jan 2002 17:18:05 -0500 (EST) (envelope-from wollman) Date: Wed, 30 Jan 2002 17:18:05 -0500 (EST) From: Garrett Wollman Message-Id: <200201302218.g0UMI5Y64383@khavrinen.lcs.mit.edu> To: standards@FreeBSD.org Subject: [Andrew Josey: Press Release] 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 ------- start of forwarded message (RFC 934 encapsulation) ------- Message-Id: <1020130053434.ZM4703@skye.rdg.opengroup.org> Reply-To: ajosey@opengroup.org (Andrew Josey) X-Mailer: Z-Mail (5.0.0 30July97) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: austin-group-l:archive/latest/3604 X-Loop: austin-group-l@opengroup.org Precedence: list Resent-Date: 30 Jan 2002 05:36:28 -0000 Resent-Message-ID: Resent-To: austin-group-l@opengroup.org Resent-From: austin-group-l@opengroup.org Resent-Sender: austin-group-l-request@opengroup.org From: Andrew Josey To: austin-group-l@opengroup.org Subject: Press Release Date: Wed, 30 Jan 2002 05:34:35 GMT All The press release announcement from The Open Group regarding completion of the joint revision and the availability of the html version of the specification are now online at http://www.unix-systems.org/version3/ best regards Andrew - ----- Andrew Josey The Open Group Austin Group Chair Apex Plaza,Forbury Road, Email: a.josey@opengroup.org Reading,Berks.RG1 1AX,England Tel: +44 118 9508311 ext 2250 Fax: +44 118 9500110 ------- end ------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 17:27:12 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 8CED737B423 for ; Wed, 30 Jan 2002 17:26:56 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g0V1QlJ13824; Wed, 30 Jan 2002 20:26:47 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu> References: <20020130094110.16065.qmail@web14606.mail.yahoo.com> <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu> Date: Wed, 30 Jan 2002 20:26:45 -0500 To: Garrett Wollman , Aviast@yahoo.com From: Garance A Drosihn Subject: Re: casting functions to (void) Cc: freebsd-standards@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 5:16 PM -0500 1/30/02, Garrett Wollman wrote: >< said: > >> On another point: what is the general consensus on casting >> functions to void? > >I am of the opinion that it is silly. Other reasonable people >disagree. (I happen to think that their reasons for disagreement >are the result of inadequate tools, and the appropriate response >is to fix the tool, not kluge up the source code.) Speaking only to my own preference, I think it's worth doing in the case where the function is returning some error indication, and I "mean to" add code to check that error value at some point in the (indefinite) future. Later, if I'm trying to track down some mysterious bug in that code, the (void) will stand out as a good place to add more sanity-checks. I think it's nuts on things like strcpy(), where I know the function is returning a value, but that value is not needed by anything the code is doing. In that case, the (void) seems like noise which just clutters up the code. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 17:49:44 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id F194237B402 for ; Wed, 30 Jan 2002 17:49:41 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g0V1neJ117462; Wed, 30 Jan 2002 20:49:40 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <200201302218.g0UMI5Y64383@khavrinen.lcs.mit.edu> References: <200201302218.g0UMI5Y64383@khavrinen.lcs.mit.edu> Date: Wed, 30 Jan 2002 20:49:39 -0500 To: Garrett Wollman , standards@FreeBSD.ORG From: Garance A Drosihn Subject: Re: [Andrew Josey: Press Release] Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 5:18 PM -0500 1/30/02, Garrett Wollman passed along the useful info: > The press release announcement from The Open Group regarding > completion of the joint revision and the availability of the > html version of the specification are now online > at http://www.unix-systems.org/version3/ They list a CD-ROM "Document Number T950X" for $243. But they also mention an upcoming book called "Authorized Guide to Version 3 of the Single Unix Specification", which they say should be out in late February -- and which includes a CD with the full-set of documentation. This second one sounds a lot like a new version of what I have as "Go Solo 2", and I'm pretty sure I paid a lot less than $243 for that book+cd. Do you know if there something in the CD-Set which isn't in the upcoming Authorized-Guide book+cd? In my case, I like copying the html to my local hard disk (under MacOS 10), and referencing it thru my web browser. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Jan 30 22:45:48 2002 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id F2F3637B41D for ; Wed, 30 Jan 2002 22:45:43 -0800 (PST) Received: from relay2.kornet.net ([211.48.62.162]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id g0V6jZY68318 for ; Thu, 31 Jan 2002 01:45:41 -0500 (EST) (envelope-from webmaster@label.co.kr) Received: from pc0 (61.73.128.3) by relay2.kornet.net; 31 Jan 2002 15:45:24 +0900 Message-ID: <3c58e8043c6e2ba5@relay2.kornet.net> (added by relay2.kornet.net) From: =?ks_c_5601-1987?B?v8DHx726x8G288Da?= To: freebsd-standards@bostonradio.org Subject: =?ks_c_5601-1987?B?W7GksO1dIENEufjIo7rOMjAwMiDA/LG5xscgvsizuw==?= Date: Thu, 31 Jan 2002 15:45:20 +0900 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0157_01C0F45A.93A20C00" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 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 This is a multi-part message in MIME format. ------=_NextPart_000_0157_01C0F45A.93A20C00 Content-Type: text/plain; charset="ks_c_5601-1987" Content-Transfer-Encoding: base64 ICAgIA0KIL7Is+fHz7y8v+QhICAgICAgIA0KIERNL1RNLCDDor73yKu6uCwgv7W+97+hIMDW vu68rSCywCDHyr/kx9EgW8D8sbnGxyBDRLn4yKO6ziAyMDAyXbimILzSsLPH2CC15biztM+0 2S4NCiDAzMGmIMD8sbnAxyCx4r73w7wgudcgwfa/qrqwILDtsLQowM647SnAuyC/qbevutDA xyCw7bC0wLi3ziC4uLXpvu4guri8vL/kLiAgICAgICAgICAgICAgICANCg0KICAxLiBDRLn4 yKO6zjIwMDIgwabHsCDBvrf5KDKwocH2Kb7Is7sNCiCo5yBbu/PIoy++98G+xu1dIDogMjAw MbPiIDExv/kgNcDPIMPivcMNCiAgICAtIMD8sbkgNDAwuLggu/PIoy++98G+ILWlwMzFuCC8 9rfPDQogqOggW8DOuO3G7V0gOiAyMDAxs+IgMTG/+SAxMMDPIMPivcMNCiAgICAtIMD8sbkg MSwyMDC4uCDAzrjtILWlwMzFuCC89rfPDQogDQogW0NEufjIo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O XSAgDQogICAgICAgICANCiAgICA= ------=_NextPart_000_0157_01C0F45A.93A20C00 Content-Type: text/html; charset="ks_c_5601-1987" Content-Transfer-Encoding: base64 PGh0bWw+DQo8aGVhZD4NCjx0aXRsZT48L3RpdGxlPg0KPG1ldGEgaHR0cC1lcXVpdj0iQ29u dGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9ZXVjLWtyIj4NCjxzdHls ZSB0eXBlPSJ0ZXh0L2NzcyI+DQo8IS0tDQogICAgQTpsaW5rIHsgY29sb3I6ICM0MDQyNTY7 IHRleHQtZGVjb3JhdGlvbjogbm9uZX0NCiAgICBBOnZpc2l0ZWQgeyBjb2xvcjogIzQwNDI1 NjsgdGV4dC1kZWNvcmF0aW9uOiBub25lfQ0KICAgIEE6aG92ZXIgeyBjb2xvcjpyZWQ7IHRl eHQtZGVjb3JhdGlvbjogbm9uZX0NCg0KYm9keSB7ICBmb250LXNpemU6IDlwdDsgbGluZS1o ZWlnaHQ6IDE4cHg7IGNvbG9yOiAjMDAwMDAwfQ0KdGQgeyAgZm9udC1zaXplOiA5cHQ7IGNv bG9yOiAjMDAwMDAwOyBsaW5lLWhlaWdodDogMThweDt9DQouYm94IHsgIGJvcmRlcjogMXB4 ICMwMDAwNjYgc29saWR9DQotLT4NCjwvc3R5bGU+DQo8L2hlYWQ+DQoNCjxib2R5IGJnY29s b3I9IiNGRkZGRkYiPg0KPHRhYmxlIHdpZHRoPSI1NTAiIGJvcmRlcj0iMCIgY2VsbHNwYWNp bmc9IjAiIGNlbGxwYWRkaW5nPSIwIiBhbGlnbj0iY2VudGVyIiBiYWNrZ3JvdW5kPSJodHRw Oi8vd3d3LmxhYmVsLmNvLmtyL21haWwvSU1BR0UvbWFpbGJnLmdpZiIgY2xhc3M9ImJveCI+ DQogIDx0cj4gDQogICAgPHRkIHdpZHRoPSIzMCI+Jm5ic3A7PC90ZD4NCiAgICA8dGQgd2lk dGg9IjUwMCI+PGJyPg0K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L/kLjwvZm9udD48YnI+DQogICAgICAg IFs8QSBIUkVGPSJodHRwOi8vd3d3LmNydXNhZGUuY28ua3IvcmVqZWN0L3JlamVjdC5waHA/ aWQ9MjEzNSZhdXRoPTlhNDlhMjVkODQ1YTQ4M2ZhZTRiZTdlMzQxMzY4ZTM2Jm1haWw9ZnJl ZWJzZC1zdGFuZGFyZHNAYm9zdG9ucmFkaW8ub3JnJm1vZGU9d3JpdGUiPrz2vcWwxbrOPC9h Pl0gDQogICAgICA8L2Rpdj4NCiAgICA8L3RkPg0KICAgIDx0ZCB3aWR0aD0iMjAiPiZuYnNw OzwvdGQ+DQogIDwvdHI+DQogIDx0cj4gDQogICAgPHRkIHdpZHRoPSIzMCI+Jm5ic3A7PC90 ZD4NCiAgICA8dGQgd2lkdGg9IjUwMCI+IA0KICAgICAgPGRpdiBhbGlnbj0iY2VudGVyIj48 YSBocmVmPSJodHRwOi8vd3d3LmxhYmVsLmNvLmtyIj48aW1nIHNyYz0iaHR0cDovL3d3dy5s YWJlbC5jby5rci9tYWlsL0lNQUdFL09mZmljZS5naWYiIHdpZHRoPSIxMzIiIGhlaWdodD0i MzYiIGJvcmRlcj0iMCI+PC9hPjwvZGl2Pg0KICAgIDwvdGQ+DQogICAgPHRkIHdpZHRoPSIy MCI+Jm5ic3A7PC90ZD4NCiAgPC90cj4NCjwvdGFibGU+DQo8L2JvZHk+DQo8L2h0bWw+ ------=_NextPart_000_0157_01C0F45A.93A20C00-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Jan 31 15:23:31 2002 Delivered-To: freebsd-standards@freebsd.org Received: from opus.sandiegoca.ncr.com (tan7.ncr.com [192.127.94.7]) by hub.freebsd.org (Postfix) with ESMTP id 8850D37B43A for ; Thu, 31 Jan 2002 15:23:16 -0800 (PST) Received: from localhost (chuckr@localhost) by opus.sandiegoca.ncr.com (8.11.6/8.11.6) with ESMTP id g0VNRHu96373; Thu, 31 Jan 2002 15:27:17 -0800 (PST) (envelope-from chuckr@opus.sandiegoca.ncr.com) Date: Thu, 31 Jan 2002 15:27:16 -0800 (PST) From: chuck rouillard To: Garrett Wollman Cc: Subject: RE: pathchk In-Reply-To: <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu> Message-ID: <20020131135842.A96280-100000@opus.sandiegoca.ncr.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Wed, 30 Jan 2002, Garrett Wollman wrote: > < said: > > > Are you proposing replacing "sizeof(char)" with "1"? > > Surely the former is more clear? > > It makes it more clear that the author does not understand the C > language, perhaps. Grandiloquent nonsense. > > On another point: what is the general consensus on casting > > functions to void? > > I am of the opinion that it is silly. Other reasonable people > disagree. (I happen to think that their reasons for disagreement are > the result of inadequate tools, and the appropriate response is to fix > the tool, not kluge up the source code.) Agreed, but given the number such casts currently peppered about in the source tree, and maybe some of the recent arguments for __P() on -arch, should this practice be continued? I wouldn't mind hearing additional comments on this topic since I have other things I'd like contribute. .cr > -GAWollman > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-standards" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Jan 31 17:17:55 2002 Delivered-To: freebsd-standards@freebsd.org Received: from gw.nectar.cc (gw.nectar.cc [208.42.49.153]) by hub.freebsd.org (Postfix) with ESMTP id AA98137B400 for ; Thu, 31 Jan 2002 17:17:51 -0800 (PST) Received: from madman.nectar.cc (madman.nectar.cc [10.0.1.111]) by gw.nectar.cc (Postfix) with ESMTP id 142F242; Thu, 31 Jan 2002 19:17:51 -0600 (CST) Received: (from nectar@localhost) by madman.nectar.cc (8.11.6/8.11.6) id g111HoA91421; Thu, 31 Jan 2002 19:17:50 -0600 (CST) (envelope-from nectar) Date: Thu, 31 Jan 2002 19:17:50 -0600 From: "Jacques A. Vidrine" To: chuck rouillard Cc: Garrett Wollman , freebsd-standards@FreeBSD.ORG Subject: Re: pathchk Message-ID: <20020201011750.GB91199@madman.nectar.cc> Mail-Followup-To: "Jacques A. Vidrine" , chuck rouillard , Garrett Wollman , freebsd-standards@FreeBSD.ORG References: <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu> <20020131135842.A96280-100000@opus.sandiegoca.ncr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020131135842.A96280-100000@opus.sandiegoca.ncr.com> User-Agent: Mutt/1.3.27i X-Url: http://www.nectar.cc/ 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 31, 2002 at 03:27:16PM -0800, chuck rouillard wrote: > On Wed, 30 Jan 2002, Garrett Wollman wrote: > > I am of the opinion that it is silly. Other reasonable people > > disagree. (I happen to think that their reasons for disagreement are > > the result of inadequate tools, and the appropriate response is to fix > > the tool, not kluge up the source code.) > > Agreed, but given the number such casts currently > peppered about in the source tree, and maybe some > of the recent arguments for __P() on -arch, should > this practice be continued? > > I wouldn't mind hearing additional comments on > this topic since I have other things I'd like > contribute. Just a personal opinion, but: If a function returns a value that is useful, but you consciously choose to ignore it, I find the `(void)' cast a welcome indicator of that conscious decision. For example, whenever I see code using snprintf(), I always examine what is being done with the return value --- the return value is typically used to detect truncation or advance an offset within a buffer. The difference between these two pieces of code: snprintf(buf, "%x%y%z%z%y\a\a\n", foo, bar, baz, baz, bar); and (void)snprintf(buf, "%x%y%z%z%y\a\a\n", foo, bar, baz, baz, bar); is that I don't have to wonder whether truncation was considered, particularly if I wrote the code in question :-) I don't mind the cast on functions where the return value is usually useless (i.e. fprintf), but I don't generally use them myself. Cheers, -- Jacques A. Vidrine http://www.nectar.cc/ NTT/Verio SME . FreeBSD UNIX . Heimdal Kerberos jvidrine@verio.net . nectar@FreeBSD.org . nectar@kth.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 31 18:16:38 2002 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 8FD5637B404 for ; Thu, 31 Jan 2002 18:16:29 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g112CIZ36385; Thu, 31 Jan 2002 21:12:18 -0500 (EST) (envelope-from mike) Date: Thu, 31 Jan 2002 21:12:18 -0500 From: Mike Barcroft To: "Tim J. Robbins" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: split(1) -a option patch Message-ID: <20020131211218.I10222@espresso.q9media.com> References: <20020124210956.A13091@descent.robbins.dropbear.id.au> <20020125132739.B92720@espresso.q9media.com> <20020126170422.A8594@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020126170422.A8594@descent.robbins.dropbear.id.au>; from tim@robbins.dropbear.id.au on Sat, Jan 26, 2002 at 05:04:22PM +1100 Organization: The FreeBSD Project 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 Tim J. Robbins writes: > Is this simpler? > tfnum = fnum; > i = sufflen - 1; > do { > fpnt[i] = tfnum % 26 + 'a'; > tfnum /= 26; > } while (i >= 0); Yes, but I think it's missing the i--. Could you update your patch to use this version? > Patch against -CURRENT is attached. Thanks. I found a couple more errors when I tested it. > Index: split/split.1 > =================================================================== > RCS file: /home/ncvs/src/usr.bin/split/split.1,v > retrieving revision 1.6 > diff -u -r1.6 split.1 > --- split/split.1 2001/07/15 08:01:34 1.6 > +++ split/split.1 2002/01/26 05:55:45 > @@ -40,6 +40,7 @@ > .Nd split a file into pieces > .Sh SYNOPSIS > .Nm > +.Op Fl a Ar suffix_length > .Op Fl b Ar byte_count[k|m] > .Op Fl l Ar line_count > .Op Fl p Ar pattern > @@ -54,6 +55,12 @@ > .Pp > The options are as follows: > .Bl -tag -width Ds > +.It Fl a > +Use > +.Ar suffix_length > +letters to form the suffix of the file name. If > +.Fl a > +is not specified, two letters are used as the suffix. > .It Fl b > Create smaller files > .Ar byte_count > @@ -89,22 +96,18 @@ > If a second additional argument is specified, it is used as a prefix > for the names of the files into which the file is split. > In this case, each file into which the file is split is named by the > -prefix followed by a lexically ordered suffix in the range of > -.Dq Li aa-zz . > +prefix followed by a lexically ordered suffix using > +.Ar suffix_length > +characters in the range > +.Dq Li a-z . Please mention that the default is 2. > .Pp > If the > .Ar name > argument is not specified, the file is split into lexically ordered > -files named in the range of > -.Dq Li xaa-zzz . > +files named with prefixes in the range of > +.Dq Li x-z > +and with suffixes as above. > .Sh BUGS > -For historical reasons, if you specify > -.Ar name , > -.Nm > -can only create 676 separate > -files. > -The default naming convention allows 2028 separate files. > -.Pp These are still bugs; -a is the workaround. > The maximum line length for matching patterns is 65536. > .Sh SEE ALSO > .Xr re_format 7 > Index: split/split.c > =================================================================== > RCS file: /home/ncvs/src/usr.bin/split/split.c,v > retrieving revision 1.8 > diff -u -r1.8 split.c > --- split/split.c 2001/12/12 23:09:07 1.8 > +++ split/split.c 2002/01/26 05:55:46 > @@ -67,6 +67,7 @@ > char fname[MAXPATHLEN]; /* File name prefix. */ > regex_t rgx; > int pflag; > +long sufflen = 2; /* File name suffix length. */ > > void newfile __P((void)); > void split1 __P((void)); > @@ -81,7 +82,7 @@ > int ch; > char *ep, *p; > > - while ((ch = getopt(argc, argv, "-0123456789b:l:p:")) != -1) > + while ((ch = getopt(argc, argv, "-0123456789a:b:l:p:")) != -1) > switch (ch) { > case '0': case '1': case '2': case '3': case '4': > case '5': case '6': case '7': case '8': case '9': > @@ -106,6 +107,11 @@ > usage(); > ifd = 0; > break; > + case 'a': /* Suffix length */ > + if ((sufflen = strtol(optarg, &ep, 10)) <= 0 || *ep) > + err(EX_USAGE, > + "%s: illegal suffix length", optarg); This should be errx(). > + break; > case 'b': /* Byte count. */ > if ((bytecnt = strtoq(optarg, &ep, 10)) <= 0 || > (*ep != '\0' && *ep != 'k' && *ep != 'm')) > @@ -145,6 +151,8 @@ > if (*argv != NULL) > usage(); > > + if (strlen(fname) + (unsigned long)sufflen >= sizeof(fname)) > + err(EX_USAGE, "suffix is too long"); This should be errx(). > if (pflag && (numlines != 0 || bytecnt != 0)) > usage(); > > @@ -273,6 +281,7 @@ > void > newfile() > { > + long i, maxfiles, tfnum; > static long fnum; > static int defname; > static char *fpnt; > @@ -288,19 +297,25 @@ > } > ofd = fileno(stdout); > } > + > + /* maxfiles = 26^sufflen, but don't use libm. */ > + for (maxfiles = 1, i = 0; i < sufflen; i++) > + if ((maxfiles *= 26) <= 0) > + errx(EX_USAGE, "suffix is too long (max %ld)", i); > + > /* > * Hack to increase max files; original code wandered through > - * magic characters. Maximum files is 3 * 26 * 26 == 2028 > + * magic characters. > */ > -#define MAXFILES 676 > - if (fnum == MAXFILES) { > + if (fnum == maxfiles) { > if (!defname || fname[0] == 'z') > errx(EX_DATAERR, "too many files"); > ++fname[0]; > fnum = 0; > } > - fpnt[0] = fnum / 26 + 'a'; > - fpnt[1] = fnum % 26 + 'a'; > + for (tfnum = fnum, i = sufflen; i != 0; i--, tfnum /= 26) > + fpnt[i - 1] = tfnum % 26 + 'a'; > + fpnt[sufflen] = '\0'; (see above) > ++fnum; > if (!freopen(fname, "w", stdout)) > err(EX_IOERR, "%s", fname); > @@ -311,6 +326,7 @@ > usage() > { > (void)fprintf(stderr, > -"usage: split [-b byte_count] [-l line_count] [-p pattern] [file [prefix]]\n"); > +"usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]\n"); > + (void)fprintf(stderr, "\t\t[file [prefix]]\n"); `\t\t' should be ` ' (7 spaces). See pax(1) for an example. > exit(EX_USAGE); > } I should be able to commit this after you fix these problems. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Jan 31 19:36:29 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (228.a.010.mel.iprimus.net.au [210.50.200.228]) by hub.freebsd.org (Postfix) with ESMTP id 4313937B400; Thu, 31 Jan 2002 19:36:16 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g113XXD02188; Fri, 1 Feb 2002 14:33:33 +1100 (EST) (envelope-from tim) Date: Fri, 1 Feb 2002 14:33:32 +1100 From: "Tim J. Robbins" To: Mike Barcroft Cc: freebsd-standards@FreeBSD.ORG Subject: Re: split(1) -a option patch Message-ID: <20020201143332.A2001@descent.robbins.dropbear.id.au> References: <20020124210956.A13091@descent.robbins.dropbear.id.au> <20020125132739.B92720@espresso.q9media.com> <20020126170422.A8594@descent.robbins.dropbear.id.au> <20020131211218.I10222@espresso.q9media.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="liOOAslEiF7prFVr" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020131211218.I10222@espresso.q9media.com>; from mike@FreeBSD.ORG on Thu, Jan 31, 2002 at 09:12:18PM -0500 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 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I agree with all your suggestions. Here is a new patch. Tim --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="split2.diff" Index: split/split.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/split/split.1,v retrieving revision 1.6 diff -u -r1.6 split.1 --- split/split.1 2001/07/15 08:01:34 1.6 +++ split/split.1 2002/02/01 03:33:11 @@ -40,6 +40,7 @@ .Nd split a file into pieces .Sh SYNOPSIS .Nm +.Op Fl a Ar suffix_length .Op Fl b Ar byte_count[k|m] .Op Fl l Ar line_count .Op Fl p Ar pattern @@ -54,6 +55,10 @@ .Pp The options are as follows: .Bl -tag -width Ds +.It Fl a +Use +.Ar suffix_length +letters to form the suffix of the file name. .It Fl b Create smaller files .Ar byte_count @@ -89,14 +94,20 @@ If a second additional argument is specified, it is used as a prefix for the names of the files into which the file is split. In this case, each file into which the file is split is named by the -prefix followed by a lexically ordered suffix in the range of -.Dq Li aa-zz . +prefix followed by a lexically ordered suffix using +.Ar suffix_length +characters in the range +.Dq Li a-z . +If +.Fl a +is not specified, two letters are used as the suffix. .Pp If the .Ar name argument is not specified, the file is split into lexically ordered -files named in the range of -.Dq Li xaa-zzz . +files named with prefixes in the range of +.Dq Li x-z +and with suffixes as above. .Sh BUGS For historical reasons, if you specify .Ar name , @@ -104,6 +115,9 @@ can only create 676 separate files. The default naming convention allows 2028 separate files. +The +.Fl a +option can be used to work around this limit. .Pp The maximum line length for matching patterns is 65536. .Sh SEE ALSO Index: split/split.c =================================================================== RCS file: /home/ncvs/src/usr.bin/split/split.c,v retrieving revision 1.8 diff -u -r1.8 split.c --- split/split.c 2001/12/12 23:09:07 1.8 +++ split/split.c 2002/02/01 03:33:13 @@ -67,6 +67,7 @@ char fname[MAXPATHLEN]; /* File name prefix. */ regex_t rgx; int pflag; +long sufflen = 2; /* File name suffix length. */ void newfile __P((void)); void split1 __P((void)); @@ -81,7 +82,7 @@ int ch; char *ep, *p; - while ((ch = getopt(argc, argv, "-0123456789b:l:p:")) != -1) + while ((ch = getopt(argc, argv, "-0123456789a:b:l:p:")) != -1) switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -106,6 +107,11 @@ usage(); ifd = 0; break; + case 'a': /* Suffix length */ + if ((sufflen = strtol(optarg, &ep, 10)) <= 0 || *ep) + errx(EX_USAGE, + "%s: illegal suffix length", optarg); + break; case 'b': /* Byte count. */ if ((bytecnt = strtoq(optarg, &ep, 10)) <= 0 || (*ep != '\0' && *ep != 'k' && *ep != 'm')) @@ -145,6 +151,8 @@ if (*argv != NULL) usage(); + if (strlen(fname) + (unsigned long)sufflen >= sizeof(fname)) + errx(EX_USAGE, "suffix is too long"); if (pflag && (numlines != 0 || bytecnt != 0)) usage(); @@ -273,6 +281,7 @@ void newfile() { + long i, maxfiles, tfnum; static long fnum; static int defname; static char *fpnt; @@ -288,19 +297,32 @@ } ofd = fileno(stdout); } + + /* maxfiles = 26^sufflen, but don't use libm. */ + for (maxfiles = 1, i = 0; i < sufflen; i++) + if ((maxfiles *= 26) <= 0) + errx(EX_USAGE, "suffix is too long (max %ld)", i); + /* * Hack to increase max files; original code wandered through - * magic characters. Maximum files is 3 * 26 * 26 == 2028 + * magic characters. */ -#define MAXFILES 676 - if (fnum == MAXFILES) { + if (fnum == maxfiles) { if (!defname || fname[0] == 'z') errx(EX_DATAERR, "too many files"); ++fname[0]; fnum = 0; } - fpnt[0] = fnum / 26 + 'a'; - fpnt[1] = fnum % 26 + 'a'; + + /* Generate suffix of sufflen letters */ + tfnum = fnum; + i = sufflen - 1; + do { + fpnt[i] = tfnum % 26 + 'a'; + tfnum /= 26; + } while (i-- > 0); + fpnt[sufflen] = '\0'; + ++fnum; if (!freopen(fname, "w", stdout)) err(EX_IOERR, "%s", fname); @@ -310,7 +332,9 @@ static void usage() { + (void)fprintf(stderr, +"usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]\n"); (void)fprintf(stderr, -"usage: split [-b byte_count] [-l line_count] [-p pattern] [file [prefix]]\n"); +" [file [prefix]]\n"); exit(EX_USAGE); } --liOOAslEiF7prFVr-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Jan 31 22:56:40 2002 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 8944F37B41D for ; Thu, 31 Jan 2002 22:56:36 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g116qwE72075; Fri, 1 Feb 2002 01:52:58 -0500 (EST) (envelope-from mike) Date: Fri, 1 Feb 2002 01:52:58 -0500 From: Mike Barcroft To: "Tim J. Robbins" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: split(1) -a option patch Message-ID: <20020201015258.J10222@espresso.q9media.com> References: <20020124210956.A13091@descent.robbins.dropbear.id.au> <20020125132739.B92720@espresso.q9media.com> <20020126170422.A8594@descent.robbins.dropbear.id.au> <20020131211218.I10222@espresso.q9media.com> <20020201143332.A2001@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020201143332.A2001@descent.robbins.dropbear.id.au>; from tim@robbins.dropbear.id.au on Fri, Feb 01, 2002 at 02:33:32PM +1100 Organization: The FreeBSD Project 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 Tim J. Robbins writes: > I agree with all your suggestions. Here is a new patch. Committed, thanks! Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Feb 2 0:33:14 2002 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id B8A9637B400 for ; Sat, 2 Feb 2002 00:33:05 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g128THS02472; Sat, 2 Feb 2002 03:29:17 -0500 (EST) (envelope-from mike) Date: Sat, 2 Feb 2002 03:29:17 -0500 From: Mike Barcroft To: "Tim J. Robbins" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: pwd -L option Message-ID: <20020202032917.K10222@espresso.q9media.com> References: <20020130181638.A8510@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020130181638.A8510@descent.robbins.dropbear.id.au>; from tim@robbins.dropbear.id.au on Wed, Jan 30, 2002 at 06:16:38PM +1100 Organization: The FreeBSD Project 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 Tim J. Robbins writes: > This patch adds the -L option to pwd; most of the source changes were taken > from NetBSD, but adapted so as not to break FreeBSD's realpath utility. > I added an info line in usage() for realpath while I was at it. > > It uses the PWD environment variable that sh, ksh93, etc. export and checks > to make sure it "points" to the physical CWD. Good approach. Warner made some modifications to this utility, so you will have to merge his changes in. > Index: pwd/pwd.1 > =================================================================== > RCS file: /home/ncvs/src/bin/pwd/pwd.1,v > retrieving revision 1.15 > diff -u -r1.15 pwd.1 > --- pwd/pwd.1 2001/08/15 09:09:36 1.15 > +++ pwd/pwd.1 2002/01/30 07:18:10 > @@ -43,6 +43,7 @@ > .Nd return working directory name > .Sh SYNOPSIS > .Nm > +.Op Fl LP > .Sh DESCRIPTION > .Nm Pwd > writes the absolute pathname of the current working directory to > @@ -54,17 +55,28 @@ > Consult the > .Xr builtin 1 > manual page. > +.Pp > +The options are as follows: > +.Bl -tag -width indent > +.It Fl L > +Display the logical current working directory. > +.It Fl P > +Display the physical current working directory (all symbolic links resolved) > +(default). Having two sections enclosed in parens is kind of strange. Can you break the default part out into its own sentence? > .Sh DIAGNOSTICS > .Ex -std > +.Sh ENVIRONMENT This section belongs above DIAGNOSTICS; see mdoc(7) for details. > +Environment variables used by > +.Nm : > +.Bl -tag -width PWD > +.It Ev PWD > +Logical current working directory. > .Sh STANDARDS > The > .Nm > utility is expected to be > .St -p1003.2 > compatible. Please update this part. We are working on `.St -p1003.1-2001'. > -The > -.Fl L > -flag is not supported. > .Sh SEE ALSO > .Xr builtin 1 , > .Xr cd 1 , > @@ -80,3 +92,9 @@ > However, it can give a different answer in the rare case > that the current directory or a containing directory was moved after > the shell descended into it. > +.Pp > +The > +.Fl L > +option does not work unless the > +.Ev PWD > +variable is exported by the shell. > Index: pwd/pwd.c > =================================================================== > RCS file: /home/ncvs/src/bin/pwd/pwd.c,v > retrieving revision 1.13 > diff -u -r1.13 pwd.c > --- pwd/pwd.c 2001/05/30 03:28:29 1.13 > +++ pwd/pwd.c 2002/01/30 07:18:11 > @@ -45,13 +45,18 @@ > "$FreeBSD: src/bin/pwd/pwd.c,v 1.13 2001/05/30 03:28:29 imp Exp $"; > #endif /* not lint */ > > +#include > +#include > + > #include > +#include > #include > #include > #include > #include > #include > > +static char *getcwd_logical __P((char *, size_t)); > int main __P((int, char *[])); > void usage __P((void)); > > @@ -63,16 +68,15 @@ > int ch; > char *p; > char buf[PATH_MAX]; > + int lflag = 0; Style bug: initialization in the declaration. This variable should be called `Lflag'. > > - /* > - * Flags for pwd are a bit strange. The POSIX 1003.2B/D9 document > - * has an optional -P flag for physical, which is what this program > - * will produce by default. The logical flag, -L, should fail, as > - * there's no way to display a logical path after forking. > - */ > - while ((ch = getopt(argc, argv, "P")) != -1) > + while ((ch = getopt(argc, argv, "LP")) != -1) Old bug: realpath(1) silently ignored the -P option. New bug: realpath(1) accepts the -L option. > switch (ch) { > + case 'L': > + lflag = 1; > + break; > case 'P': > + lflag = 0; One option shouldn't override another. I recommend you add a `Pflag' and make sure both are not specified at the end of the while loop. If they are, usage() is the correct place to go. > break; > case '?': > default: > @@ -87,7 +91,8 @@ > err(1, "%s", argv[0]); > (void)printf("%s\n", p); > } else if (argc == 0) { > - p = getcwd(NULL, (size_t)0); > + p = lflag ? getcwd_logical(NULL, (size_t)0) : > + getcwd(NULL, (size_t)0); Style bug: continuation of a line only adds 4 spaces not a tab. The cast to size_t was and still is bogus here. Please remove it/them. > if (p == NULL) > err(1, "."); > (void)printf("%s\n", p); > @@ -98,10 +103,51 @@ > exit(0); > } > > +static char * > +getcwd_logical(char *pt, size_t size) Style bug: ANSI-style prototypes. This is a problem because the rest of the file uses K&R-style. Neither of these arguments are needed. > +{ > + char *pwd; > + size_t pwdlen; > + dev_t dev; > + ino_t ino; > + struct stat s; Style bug: variable types should be sorted in order of size. > + > + /* Check $PWD -- if it's right, it's fast. */ This is a silly comment. It suggests that the alternative is slow. There is no alternative. > + if ((pwd = getenv("PWD")) != NULL && pwd[0] == '/') { > + if (stat(pwd, &s) != -1) { > + dev = s.st_dev; > + ino = s.st_ino; > + if (stat(".", &s) != -1 && dev == s.st_dev && > + ino == s.st_ino) { > + pwdlen = strlen(pwd); > + if (pt) { > + if (!size) { > + errno = EINVAL; > + return (NULL); > + } > + if (pwdlen + 1 > size) { > + errno = ERANGE; > + return (NULL); > + } This code path isn't needed. It might be if this were being considered for libc. > + } else if ((pt = malloc(pwdlen + 1)) == NULL) > + return (NULL); > + (void)memmove(pt, pwd, pwdlen); > + pt[pwdlen] = '\0'; This part doesn't make much sense. We already trust the environment variable to be NUL terminated (see strlen() above). I recommend this be changed to use strdup(3). > + return (pt); > + } > + } > + } else > + errno = ENOENT; > + > + return (NULL); > +} > + > + Style bug: one line too many. > void > usage() > { > > - (void)fprintf(stderr, "usage: pwd\n"); > + (void)fprintf(stderr, "usage: pwd [-LP]\n"); > + (void)fprintf(stderr, " realpath [file ...]\n"); > exit(1); > } An alternative might be to display different usages based on the program executed. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Feb 2 2: 3:50 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (049.b.004.mel.iprimus.net.au [210.50.37.49]) by hub.freebsd.org (Postfix) with ESMTP id F216837B417; Sat, 2 Feb 2002 02:03:20 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g12A2fS02655; Sat, 2 Feb 2002 21:02:41 +1100 (EST) (envelope-from tim) Date: Sat, 2 Feb 2002 21:02:37 +1100 From: "Tim J. Robbins" To: Mike Barcroft Cc: freebsd-standards@FreeBSD.ORG Subject: Re: pwd -L option Message-ID: <20020202210237.A2326@descent.robbins.dropbear.id.au> References: <20020130181638.A8510@descent.robbins.dropbear.id.au> <20020202032917.K10222@espresso.q9media.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020202032917.K10222@espresso.q9media.com>; from mike@FreeBSD.ORG on Sat, Feb 02, 2002 at 03:29:17AM -0500 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 --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here's a new patch that I hope solves the problems you found with my previous one. I have just a few comments, though... On Sat, Feb 02, 2002 at 03:29:17AM -0500, Mike Barcroft wrote: > Style bug: ANSI-style prototypes. This is a problem because the rest > of the file uses K&R-style. usage()'s prototype is also incorrect, then. It is: void usage(void); It used to have a __P() around its argument list in 4.4BSD. Even then, the 1st ed. K&R book says nothing about "void", which is usage()'s return type. Is the so-called K&R style that is supposed to be maintained documented anywhere? > Neither of these arguments are needed. It turns out a lot of this function was not needed. It was taken straight from NetBSD. I've trimmed it down substantially. > > + } else if ((pt = malloc(pwdlen + 1)) == NULL) > > + return (NULL); > > + (void)memmove(pt, pwd, pwdlen); > > + pt[pwdlen] = '\0'; > > This part doesn't make much sense. We already trust the environment > variable to be NUL terminated (see strlen() above). I recommend this > be changed to use strdup(3). Agreed. I don't see why dynamic allocation is needed here at all, so I've changed it to return the value of PWD straight from the environment. Tim --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pwd.diff" Index: pwd/pwd.1 =================================================================== RCS file: /home/ncvs/src/bin/pwd/pwd.1,v retrieving revision 1.15 diff -u -r1.15 pwd.1 --- pwd/pwd.1 2001/08/15 09:09:36 1.15 +++ pwd/pwd.1 2002/02/02 10:02:31 @@ -43,6 +43,7 @@ .Nd return working directory name .Sh SYNOPSIS .Nm +.Op Fl LP .Sh DESCRIPTION .Nm Pwd writes the absolute pathname of the current working directory to @@ -54,17 +55,35 @@ Consult the .Xr builtin 1 manual page. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl L +Display the logical current working directory. +.It Fl P +Display the physical current working directory (all symbolic links resolved). +This is the default. +.Pp +.El +Only one of +.Fl L +and +.Fl P +may be specified. +.Sh ENVIRONMENT +Environment variables used by +.Nm : +.Bl -tag -width PWD +.It Ev PWD +Logical current working directory. .Sh DIAGNOSTICS .Ex -std .Sh STANDARDS The .Nm utility is expected to be -.St -p1003.2 +.St -p1003.1-2001 compatible. -The -.Fl L -flag is not supported. .Sh SEE ALSO .Xr builtin 1 , .Xr cd 1 , @@ -80,3 +99,9 @@ However, it can give a different answer in the rare case that the current directory or a containing directory was moved after the shell descended into it. +.Pp +The +.Fl L +option does not work unless the +.Ev PWD +variable is exported by the shell. Index: pwd/pwd.c =================================================================== RCS file: /home/ncvs/src/bin/pwd/pwd.c,v retrieving revision 1.14 diff -u -r1.14 pwd.c --- pwd/pwd.c 2002/02/02 06:48:10 1.14 +++ pwd/pwd.c 2002/02/02 10:02:31 @@ -45,31 +45,38 @@ "$FreeBSD: src/bin/pwd/pwd.c,v 1.14 2002/02/02 06:48:10 imp Exp $"; #endif /* not lint */ +#include +#include + #include +#include #include #include #include #include #include +extern char *__progname; + +static char *getcwd_logical(void); void usage(void); int main(int argc, char *argv[]) { + int Lflag, Pflag; int ch; char *p; char buf[PATH_MAX]; - /* - * Flags for pwd are a bit strange. The POSIX 1003.2B/D9 document - * has an optional -P flag for physical, which is what this program - * will produce by default. The logical flag, -L, should fail, as - * there's no way to display a logical path after forking. - */ - while ((ch = getopt(argc, argv, "P")) != -1) + Lflag = Pflag = 0; + while ((ch = getopt(argc, argv, "LP")) != -1) switch (ch) { + case 'L': + ++Lflag; + break; case 'P': + ++Pflag; break; case '?': default: @@ -78,27 +85,52 @@ argc -= optind; argv += optind; - if (argc == 1) { + if (strcmp(__progname, "realpath") == 0) { + if (argc != 1 || Lflag || Pflag) + usage(); p = realpath(argv[0], buf); if (p == NULL) err(1, "%s", argv[0]); (void)printf("%s\n", p); - } else if (argc == 0) { - p = getcwd(NULL, (size_t)0); + } else { + if (argc != 0 || (Lflag && Pflag)) + usage(); + p = Lflag ? getcwd_logical() : getcwd(NULL, 0); if (p == NULL) err(1, "."); (void)printf("%s\n", p); - } else { - usage(); } exit(0); } void -usage(void) +usage() +{ + if (strcmp (__progname, "realpath") == 0) + (void)fprintf(stderr, "usage: realpath [file ...]\n"); + else + (void)fprintf(stderr, "usage: pwd [-LP]\n"); + exit(1); +} + +static char * +getcwd_logical() { + struct stat log, phy; + char *pwd; + + /* + * Check that $PWD is an absolute logical pathname referring to + * the current working directory. + */ + if ((pwd = getenv("PWD")) != NULL && *pwd == '/') { + if (stat(pwd, &log) == -1 || stat(".", &phy) == -1) + return (NULL); + if (log.st_dev == phy.st_dev && log.st_ino == phy.st_ino) + return (pwd); + } - (void)fprintf(stderr, "usage: pwd\n"); - exit(1); + errno = ENOENT; + return (NULL); } --bp/iNruPH9dso1Pn-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Feb 2 17:10: 2 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 4B10437B419; Sat, 2 Feb 2002 17:09:58 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g13199F59450; Sat, 2 Feb 2002 20:09:10 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20020202210237.A2326@descent.robbins.dropbear.id.au> References: <20020130181638.A8510@descent.robbins.dropbear.id.au> <20020202032917.K10222@espresso.q9media.com> <20020202210237.A2326@descent.robbins.dropbear.id.au> Date: Sat, 2 Feb 2002 20:09:08 -0500 To: "Tim J. Robbins" , Mike Barcroft From: Garance A Drosihn Subject: Re: pwd -L option Cc: freebsd-standards@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 9:02 PM +1100 2/2/02, Tim J. Robbins wrote: >Here's a new patch that I hope solves the problems you found with my >previous one. I have just a few comments, though... > > >On Sat, Feb 02, 2002 at 03:29:17AM -0500, Mike Barcroft wrote: > >> Style bug: ANSI-style prototypes. This is a problem because the rest >> of the file uses K&R-style. > >usage()'s prototype is also incorrect, then. It is: >void usage(void); > >It used to have a __P() around its argument list in 4.4BSD. Even then, >the 1st ed. K&R book says nothing about "void", which is usage()'s >return type. Is the so-called K&R style that is supposed to be >maintained documented anywhere? Actually, the freebsd project has decided to move away from K&R and are now writing updates to explicitly change source to ANSI. Some changes were just committed to the -current branch for many programs in /usr/bin, for instance. (just committed in the past 24 hours...) So, what would probably be the most appropriate here would be to have one update which ANSI-fies the source (just as far as the prototypes and routine-declarations are concerned), based on the rules in the most recent version of 'man 9 style' (which has also been changed over the last two weeks). Then have the update to add the new features and improvements. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Feb 2 18:15:46 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 49CEA37B416 for ; Sat, 2 Feb 2002 18:15:44 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g132F5F102598; Sat, 2 Feb 2002 21:15:05 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: <20020130181638.A8510@descent.robbins.dropbear.id.au> <20020202032917.K10222@espresso.q9media.com> <20020202210237.A2326@descent.robbins.dropbear.id.au> Date: Sat, 2 Feb 2002 21:15:04 -0500 To: "Tim J. Robbins" From: Garance A Drosihn Subject: Re: pwd -L option Cc: freebsd-standards@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 8:09 PM -0500 2/2/02, Garance A Drosihn wrote: >Actually, the freebsd project has decided to move away from K&R and are >now writing updates to explicitly change source to ANSI. Some changes >were just committed to the -current branch for many programs in /usr/bin, >for instance. (just committed in the past 24 hours...) > >So, what would probably be the most appropriate here would be to have >one update which ANSI-fies the source Uh, if I was a little more observant, I would have mentioned that 'pwd' was one of the programs in bin which did just get updated to ANSI. So, you'd want to work with the up-to-the-minute version of 'pwd' from the current branch... (no need to write your own ANSI-fication update) -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message