From owner-freebsd-standards Sun Mar 3 23:30:51 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (204.a.010.mel.iprimus.net.au [210.50.200.204]) by hub.freebsd.org (Postfix) with ESMTP id 7118937B400 for ; Sun, 3 Mar 2002 23:30:24 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g247SCE29760 for freebsd-standards@FreeBSD.ORG; Mon, 4 Mar 2002 18:28:12 +1100 (EST) (envelope-from tim) Date: Mon, 4 Mar 2002 18:28:11 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: iconv utility and Message-ID: <20020304182811.A29732@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="9amGYk9869ThD9tj" 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 --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, Here's an implementation of the iconv utility as well as the header file and functions. For ease of testing, the iconv*() libc functions aren't actually added to the library, they are just compiled with the utility. A script in the tarball, unicode.pl, converts Unicode Consortium mapping files into POSIX CHARMAP files. Some useful maps can be made from: http://www.unicode.org/Public/MAPPINGS/ I think the licence on these files is liberal enough to allow them to be included in FreeBSD. There is also a UTF-8 CHARMAP file here: http://www-124.ibm.com/developerworks/oss/cvs/locale/ul/src/cmap/charmap.utf8?sortby=rev The licence on this file apparently isn't fit for src/ in general, but maybe the src/gnu tree. This charmap file is *huge* and consumes a lot of memory due to malloc() overhead and fixed-size buffers in the structures. Using an arena allocator and string pooling would bring memory consumption closer to the size of the file (~2.7MB). Comments? Tim --9amGYk9869ThD9tj Content-Type: application/x-tar-gz Content-Disposition: attachment; filename="iconv.tar.gz" Content-Transfer-Encoding: base64 H4sIAIobgzwAA+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Y54UAFCQDVeYJA5aSX+3TE13JEJ8ojRwkAHjSCE0lh1I9odaRWSSo1 0ehKrpFUayTz2oiWgbNEBKSEN2JOYiEzV/AqTA3QNE6C3SQ572ppVQrOnMCS6AaVKIHaNJDg azTQN0JhNUHXsL88lpkuLOw1lW1IeoTzTX1rPcKbX5PNemz3CPmNUrNsGgjsE3UgUQk6Yl8G wq88j8ukPc0JXVti10Fz0ATcNLRfRsyKlhvGHeGepQrEnSgF16LAQ8/rtPmen+MkmGQ5lEge htYN6q+TJthxBlLGkCFDhgwZMmTIkCFDhgwZMmTIkCFDhgwZMmTI0P+a/gKRmmpCAKAAAA== --9amGYk9869ThD9tj-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Mar 4 0:33:12 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (204.a.010.mel.iprimus.net.au [210.50.200.204]) by hub.freebsd.org (Postfix) with ESMTP id C7AAF37B405 for ; Mon, 4 Mar 2002 00:33:08 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g248VF229852 for freebsd-standards@FreeBSD.ORG; Mon, 4 Mar 2002 19:31:15 +1100 (EST) (envelope-from tim) Date: Mon, 4 Mar 2002 19:31:14 +1100 From: "Tim J. Robbins" To: freebsd-standards@FreeBSD.ORG Subject: Re: iconv utility and Message-ID: <20020304193114.A29841@descent.robbins.dropbear.id.au> References: <20020304182811.A29732@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 In-Reply-To: <20020304182811.A29732@descent.robbins.dropbear.id.au>; from tim@robbins.dropbear.id.au on Mon, Mar 04, 2002 at 06:28:11PM +1100 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, Mar 04, 2002 at 06:28:11PM +1100, Tim J. Robbins wrote: > A script in the tarball, unicode.pl, converts Unicode Consortium mapping > files into POSIX CHARMAP files. Some useful maps can be made from: > http://www.unicode.org/Public/MAPPINGS/ > I think the licence on these files is liberal enough to allow them to be > included in FreeBSD. I've just noticed src/share/colldef; the map.* files contain the data we need for basic codeset conversion in an annoyingly similar format to the one we require. All that's needed is "CHARMAP" at beginning of file and "END CHARMAP" at end, and angle brackets around the first column (symbolic name). Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Mar 4 0:44:55 2002 Delivered-To: freebsd-standards@freebsd.org Received: from columbus.cris.net (columbus.cris.net [212.110.128.65]) by hub.freebsd.org (Postfix) with ESMTP id 6F80837B402 for ; Mon, 4 Mar 2002 00:44:34 -0800 (PST) Received: from ark.cris.net (ns2.cris.net [212.110.128.68]) by columbus.cris.net (8.9.3/8.9.3) with ESMTP id KAA90047; Mon, 4 Mar 2002 10:44:10 +0200 (EET) Received: (from phantom@localhost) by ark.cris.net (8.11.1/8.11.1) id g248he776411; Mon, 4 Mar 2002 10:43:40 +0200 (EET) Date: Mon, 4 Mar 2002 10:43:40 +0200 From: Alexey Zelkin To: "Tim J. Robbins" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: iconv utility and Message-ID: <20020304104340.A71605@ark.cris.net> References: <20020304182811.A29732@descent.robbins.dropbear.id.au> <20020304193114.A29841@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20020304193114.A29841@descent.robbins.dropbear.id.au>; from tim@robbins.dropbear.id.au on Mon, Mar 04, 2002 at 07:31:14PM +1100 X-Operating-System: FreeBSD 3.5-STABLE i386 Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG hi, Provide patches against src/share/colldef/map.* and src/usr.bin/colldef then. Also submit notes about these patches to i18n@FreeBSD.org also. This list is also very close to iconv* topic. On Mon, Mar 04, 2002 at 07:31:14PM +1100, Tim J. Robbins wrote: > On Mon, Mar 04, 2002 at 06:28:11PM +1100, Tim J. Robbins wrote: > > > A script in the tarball, unicode.pl, converts Unicode Consortium mapping > > files into POSIX CHARMAP files. Some useful maps can be made from: > > http://www.unicode.org/Public/MAPPINGS/ > > I think the licence on these files is liberal enough to allow them to be > > included in FreeBSD. > > I've just noticed src/share/colldef; the map.* files contain the data > we need for basic codeset conversion in an annoyingly similar format to > the one we require. All that's needed is "CHARMAP" at beginning of file > and "END CHARMAP" at end, and angle brackets around the first column > (symbolic name). > > > 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 Mar 4 0:53:28 2002 Delivered-To: freebsd-standards@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 5273F37B400 for ; Mon, 4 Mar 2002 00:53:26 -0800 (PST) Received: from pobrecita.freebsd.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.12.2/8.12.2) with ESMTP id g248r2Yl051480; Mon, 4 Mar 2002 11:53:22 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.2/8.12.2/Submit) id g248r1Kp051479; Mon, 4 Mar 2002 11:53:01 +0300 (MSK) Date: Mon, 4 Mar 2002 11:53:00 +0300 From: "Andrey A. Chernov" To: "Tim J. Robbins" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: iconv utility and Message-ID: <20020304085300.GA51200@nagual.pp.ru> References: <20020304182811.A29732@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020304182811.A29732@descent.robbins.dropbear.id.au> User-Agent: Mutt/1.3.27i 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, Mar 04, 2002 at 18:28:11 +1100, Tim J. Robbins wrote: > > There is also a UTF-8 CHARMAP file here: > http://www-124.ibm.com/developerworks/oss/cvs/locale/ul/src/cmap/charmap.utf8?sortby=rev > The licence on this file apparently isn't fit for src/ in general, > but maybe the src/gnu tree. This charmap file is *huge* and consumes a lot > of memory due to malloc() overhead and fixed-size buffers in the structures. > Using an arena allocator and string pooling would bring memory consumption > closer to the size of the file (~2.7MB). Loading whole charmap is unacceptable in any case, try to use loadable modules instead or something like that. You may also look at another free iconv implementation (currently semi-broken and unsupported) at /usr/ports/converters/iconv. Search i18n@freebsd.org archives for more info about iconv efforts (BTW, your message will fit better in that mailing list). -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Mar 4 19:56:13 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (125.c.004.mel.iprimus.net.au [210.50.38.125]) by hub.freebsd.org (Postfix) with ESMTP id 3ACF037B41A for ; Mon, 4 Mar 2002 19:56:09 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g253tiH30274; Tue, 5 Mar 2002 14:55:44 +1100 (EST) (envelope-from tim) Date: Tue, 5 Mar 2002 14:55:43 +1100 From: "Tim J. Robbins" To: "Andrey A. Chernov" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: iconv utility and Message-ID: <20020305145542.A30070@descent.robbins.dropbear.id.au> References: <20020304182811.A29732@descent.robbins.dropbear.id.au> <20020304085300.GA51200@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020304085300.GA51200@nagual.pp.ru>; from ache@nagual.pp.ru on Mon, Mar 04, 2002 at 11:53:00AM +0300 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, Mar 04, 2002 at 11:53:00AM +0300, Andrey A. Chernov wrote: > Loading whole charmap is unacceptable in any case, try to use loadable > modules instead or something like that. You may also look at another free > iconv implementation (currently semi-broken and unsupported) at > /usr/ports/converters/iconv. Search i18n@freebsd.org archives for more > info about iconv efforts (BTW, your message will fit better in that > mailing list). It's not the best way to do it, no. The standard doesn't require that all character maps be stored as files in this format, but it does require that iconv be able to load this type of file. POSIX character map files handle the ISO8859 series easily; it's only on huge maps like UTF-8 that it suffers. Neither GNU iconv nor the other port you pointed me at support POSIX character map files. GNU iconv seems horrendously bloated and unnecessarily complicated. Sigh. Back to the drawing board. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Mar 4 21:31:15 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 7722737B41B for ; Mon, 4 Mar 2002 21:31:13 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id g255VBdh104514 for ; Tue, 5 Mar 2002 00:31:12 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: Date: Tue, 5 Mar 2002 00:31:11 -0500 To: freebsd-standards@FreeBSD.org From: Garance A Drosihn Subject: netinet/in.h vs arpa/inet.h 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 Now that I've finally got myself switched over to 5.0-current, I'm getting back to some lpr changes. I notice that if I compile lpr with -Wredundant-decls, I get a few warnings from source files which have: #include #include Eg: /usr/include/arpa/inet.h:127: warning: redundant redeclaration of `__htonl' in same scope /usr/include/machine/endian.h:67: warning: previous declaration of `__htonl' (plus similar warnings for __htons __ntohl __ntohs) Now, I find I can just comment out the include for arpa/inet.h, and everything compiles OK (on both current and stable, if I've tested correctly..). On the other hand, I do not get these warnings even if I compile with -Wredundant-decls on -stable. Should I just remove the arpa/inet.h, or does this indicate that something isn't quite perfect with the recent changes to various include files under -current? -- 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 Mon Mar 4 21:41:37 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 5250637B400 for ; Mon, 4 Mar 2002 21:41:35 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g255ZvV96442; Tue, 5 Mar 2002 00:35:57 -0500 (EST) (envelope-from mike) Date: Tue, 5 Mar 2002 00:35:57 -0500 From: Mike Barcroft To: Garance A Drosihn Cc: freebsd-standards@FreeBSD.org Subject: Re: netinet/in.h vs arpa/inet.h Message-ID: <20020305003557.C33110@espresso.q9media.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ; from drosih@rpi.edu on Tue, Mar 05, 2002 at 12:31:11AM -0500 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 Garance A Drosihn writes: > Now that I've finally got myself switched over to 5.0-current, > I'm getting back to some lpr changes. I notice that if I > compile lpr with -Wredundant-decls, I get a few warnings from > source files which have: > > #include > #include > > Eg: > /usr/include/arpa/inet.h:127: warning: redundant redeclaration of > `__htonl' in same scope > /usr/include/machine/endian.h:67: warning: previous declaration of `__htonl' > > (plus similar warnings for __htons __ntohl __ntohs) > > Now, I find I can just comment out the include for arpa/inet.h, > and everything compiles OK (on both current and stable, if I've > tested correctly..). On the other hand, I do not get these > warnings even if I compile with -Wredundant-decls on -stable. > > Should I just remove the arpa/inet.h, or does this indicate that > something isn't quite perfect with the recent changes to various > include files under -current? This should be fixed shortly. The problem mainly stems from POSIX's requirements for the ntohl() family of functions to be defined in multiple headers. 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 Mon Mar 4 21:51:50 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 116E437B416; Mon, 4 Mar 2002 21:51:36 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id g255pYdh079184; Tue, 5 Mar 2002 00:51:34 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20020305003557.C33110@espresso.q9media.com> References: <20020305003557.C33110@espresso.q9media.com> Date: Tue, 5 Mar 2002 00:51:33 -0500 To: Mike Barcroft From: Garance A Drosihn Subject: Re: netinet/in.h vs arpa/inet.h 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 12:35 AM -0500 3/5/02, Mike Barcroft wrote: >Garance A Drosihn writes: > > Should I just remove the arpa/inet.h, or does this indicate that >> something isn't quite perfect with the recent changes to various >> include files under -current? > >This should be fixed shortly. The problem mainly stems from POSIX's >requirements for the ntohl() family of functions to be defined in >multiple headers. Okay, I'll just ignore it for now. Thanks! (I like ignoring stuff... :-) -- 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 Tue Mar 5 1: 7:12 2002 Delivered-To: freebsd-standards@freebsd.org Received: from marvin.idsi.net (66-168-58-99.jvl.wi.charter.com [66.168.58.99]) by hub.freebsd.org (Postfix) with ESMTP id 2211A37B402 for ; Tue, 5 Mar 2002 01:06:57 -0800 (PST) Received: from marvin.idsi.net (localhost [127.0.0.1]) by marvin.idsi.net (8.12.2/8.12.2) with ESMTP id g2596W92010046 for ; Tue, 5 Mar 2002 03:06:33 -0600 (CST) (envelope-from mkm@marvin.idsi.net) Received: (from mkm@localhost) by marvin.idsi.net (8.12.2/8.12.2/Submit) id g2596WEb010044 for freebsd-standards@freebsd.org; Tue, 5 Mar 2002 03:06:32 -0600 (CST) Date: Tue, 5 Mar 2002 03:06:32 -0600 From: Kyle Martin To: freebsd-standards@freebsd.org Subject: ls(1) patch for review Message-ID: <20020305030632.A1990@marvin.idsi.net> 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 heres the ls(1) patch, the -m, -p, and -x options have been added. ive tried to be as thoughrough as possible, if im overlooking anything let me know. thanks. diff -r -U 5 ./extern.h.old ./extern.h --- extern.h.old Sun Feb 3 13:11:32 2002 +++ extern.h Sun Mar 3 22:26:01 2002 @@ -44,10 +44,11 @@ int revstatcmp(const FTSENT *, const FTSENT *); void printcol(DISPLAY *); void printlong(DISPLAY *); void printscol(DISPLAY *); +void printstream(DISPLAY *); void usage(void); size_t len_octal(const char *, int); int prn_octal(const char *); int prn_printable(const char *); #ifdef COLORLS diff -r -U 5 ./ls.1.old ./ls.1 --- ls.1.old Wed Jan 9 07:29:39 2002 +++ ls.1 Tue Mar 5 02:39:25 2002 @@ -186,19 +186,25 @@ .Dq ell . ) List in long format. (See below.) If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing. +.It Fl m +Stream output format; list files across the page, separated by commas. .It Fl n Display user and group IDs numerically rather than converting to a user or group name in a long .Pq Fl l output. .It Fl o Include the file flags in a long .Pq Fl l output. +.It Fl p +Write a slash +.Pq Pa \&\ +after each filename if that file is a directory. .It Fl q Force printing of non-graphic characters in file names as the character .Ql \&? ; this is the default when output is to a terminal. @@ -226,10 +232,12 @@ .Pq Fl l . .It Fl w Force raw printing of non-printable characters. This is the default when output is not to a terminal. +.It Fl x +The same as -C, except that the multi-text-column output is produced with entries sorted across, rather tahn down, the columns. .It Fl 1 (The numeric digit .Dq one . ) Force output to be one entry per line. diff -r -U 5 ./ls.c.old ./ls.c --- ls.c.old Mon Feb 18 18:05:50 2002 +++ ls.c Tue Mar 5 02:43:22 2002 @@ -111,11 +111,14 @@ static int f_recursive; /* ls subdirectories also */ static int f_reversesort; /* reverse whatever sort is used */ int f_sectime; /* print the real time for all files */ static int f_singlecol; /* use single column output */ int f_size; /* list size in short listing */ + int f_slash; /* similar to f_type, but only for dirs */ + int f_sortacross; /* sort across rows, not down columns */ int f_statustime; /* use time of last mode change */ + int f_stream; /* stream the output, seperate with commas */ static int f_timesort; /* sort by time vice name */ int f_type; /* add type character for non-regular files */ static int f_whiteout; /* show whiteout entries */ int f_lomac; /* show LOMAC attributes */ #ifdef COLORLS @@ -165,19 +168,21 @@ /* Root is -A automatically. */ if (!getuid()) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklnoqrstuw")) != -1) { + while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklmnopqrstuwx")) + != -1) { switch (ch) { /* * The -1, -C and -l options all override each other so shell * aliasing works right. */ case '1': f_singlecol = 1; f_longform = 0; + f_stream = 0; break; case 'B': f_nonprint = 0; f_octal = 1; f_octal_escape = 0; @@ -186,10 +191,11 @@ f_longform = f_singlecol = 0; break; case 'l': f_longform = 1; f_singlecol = 0; + f_stream = 0; break; /* The -c and -u options override each other. */ case 'c': f_statustime = 1; f_accesstime = 0; @@ -198,10 +204,11 @@ f_accesstime = 1; f_statustime = 0; break; case 'F': f_type = 1; + f_slash = 0; break; case 'H': fts_options |= FTS_COMFOLLOW; break; case 'G': @@ -242,16 +249,25 @@ f_inode = 1; break; case 'k': f_kblocks = 1; break; + case 'm': + f_stream = 1; + f_singlecol = 0; + f_longform = 0; + break; case 'n': f_numericonly = 1; break; case 'o': f_flags = 1; break; + case 'p': + f_slash = 1; + f_type = 1; + break; case 'q': f_nonprint = 1; f_octal = 0; f_octal_escape = 0; break; @@ -281,10 +297,13 @@ f_octal_escape = 0; break; case 'Z': f_lomac = 1; break; + case 'x': + f_sortacross = 1; + break; default: case '?': usage(); } } @@ -388,10 +407,12 @@ /* Select a print function. */ if (f_singlecol) printfcn = printscol; else if (f_longform) printfcn = printlong; + else if (f_stream) + printfcn = printstream; else printfcn = printcol; if (argc) traverse(argc, argv, fts_options); diff -r -U 5 ./ls.h.old ./ls.h --- ls.h.old Sun Feb 3 13:11:32 2002 +++ ls.h Tue Mar 5 01:25:55 2002 @@ -51,10 +51,12 @@ extern int f_octal; /* print unprintables in octal */ extern int f_octal_escape; /* like f_octal but use C escapes if possible */ extern int f_nonprint; /* show unprintables as ? */ extern int f_sectime; /* print the real time for all files */ extern int f_size; /* list size in short listing */ +extern int f_slash; /* append a '/' if the file is a directory */ +extern int f_sortacross; /* sort across rows, not down columns */ extern int f_statustime; /* use time of last mode change */ extern int f_notabs; /* don't use tab-separated multi-col output */ extern int f_type; /* add type character for non-regular files */ #ifdef COLORLS extern int f_color; /* add type in color for non-regular files */ diff -r -U 5 ./print.c.old ./print.c --- print.c.old Sun Feb 24 19:36:59 2002 +++ print.c Tue Mar 5 02:32:04 2002 @@ -221,10 +221,25 @@ (void)putchar('\n'); } } void +printstream(DISPLAY *dp) +{ + FTSENT *p; + + for (p = dp->list; p; p = p->fts_link) { + if (p->fts_number != NO_PRINT) { + (void)printaname(p, dp->s_inode, dp->s_block); + if (p->fts_link) + (void)printf(", "); + } + } + (void)putchar('\n'); +} + +void printcol(DISPLAY *dp) { extern int termwidth; static FTSENT **array; static int lastentries = -1; @@ -280,25 +295,47 @@ if (num % numcols) ++numrows; if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size)) (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); - for (row = 0; row < numrows; ++row) { - endcol = colwidth; - for (base = row, chcnt = col = 0; col < numcols; ++col) { - chcnt += printaname(array[base], dp->s_inode, - dp->s_block); - if ((base += numrows) >= num) - break; - while ((cnt = ((chcnt + tabwidth) & ~(tabwidth - 1))) - <= endcol) { - (void)putchar(f_notabs ? ' ' : '\t'); - chcnt = cnt; + + if (f_sortacross) { + for (row = 0, base = 0; row < numrows; ++row) { + endcol = colwidth; + for (col = 0, chcnt = 0; col < numcols; ++col) { + chcnt += printaname(array[base], + dp->s_inode, dp->s_block); + if (++base >= num) + break; + while ((cnt = ((chcnt + tabwidth) & + ~(tabwidth - 1))) <= endcol) { + (void)putchar(f_notabs ? ' ' : '\t'); + chcnt = cnt; + } + endcol += colwidth; } - endcol += colwidth; + (void)putchar('\n'); + } + } + else { + for (row = 0; row < numrows; ++row) { + endcol = colwidth; + for (base = row, chcnt = col = 0; + col < numcols; ++col) { + chcnt += printaname(array[base], + dp->s_inode, dp->s_block); + if ((base += numrows) >= num) + break; + while ((cnt = ((chcnt + tabwidth) & + ~(tabwidth - 1))) <= endcol) { + (void)putchar(f_notabs ? ' ' : '\t'); + chcnt = cnt; + } + endcol += colwidth; + } + (void)putchar('\n'); } - (void)putchar('\n'); } } /* * print [inode] [size] name @@ -362,33 +399,44 @@ } static int printtype(u_int mode) { - switch (mode & S_IFMT) { - case S_IFDIR: - (void)putchar('/'); - return (1); - case S_IFIFO: - (void)putchar('|'); - return (1); - case S_IFLNK: - (void)putchar('@'); - return (1); - case S_IFSOCK: - (void)putchar('='); - return (1); - case S_IFWHT: - (void)putchar('%'); - return (1); - default: - } - if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { - (void)putchar('*'); - return (1); + if (f_slash) { + if ((mode & S_IFMT) == S_IFDIR) { + (void)putchar('/'); + return (1); + } + else + return (0); + } + + else { + switch (mode & S_IFMT) { + case S_IFDIR: + (void)putchar('/'); + return (1); + case S_IFIFO: + (void)putchar('|'); + return (1); + case S_IFLNK: + (void)putchar('@'); + return (1); + case S_IFSOCK: + (void)putchar('='); + return (1); + case S_IFWHT: + (void)putchar('%'); + return (1); + default: + } + if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { + (void)putchar('*'); + return (1); + } + return (0); } - return (0); } #ifdef COLORLS static int putch(int c) -- Kyle Martin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Mar 5 1:57:38 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (250.a.006.mel.iprimus.net.au [210.50.44.250]) by hub.freebsd.org (Postfix) with ESMTP id 2142B37B402 for ; Tue, 5 Mar 2002 01:57:29 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g259vYI31205; Tue, 5 Mar 2002 20:57:34 +1100 (EST) (envelope-from tim) Date: Tue, 5 Mar 2002 20:57:33 +1100 From: "Tim J. Robbins" To: Kyle Martin Cc: freebsd-standards@FreeBSD.ORG Subject: Re: ls(1) patch for review Message-ID: <20020305205733.A31150@descent.robbins.dropbear.id.au> References: <20020305030632.A1990@marvin.idsi.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020305030632.A1990@marvin.idsi.net>; from mkm@ieee.org on Tue, Mar 05, 2002 at 03:06:32AM -0600 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, Mar 05, 2002 at 03:06:32AM -0600, Kyle Martin wrote: > +.It Fl p > +Write a slash > +.Pq Pa \&\ > +after each filename if that file is a directory. It writes a /, and the \ confuses groff. How about this: .It Fl p Write a slash .Pq Ql / after each filename if that file is a directory. > +.It Fl x > +The same as -C, except that the multi-text-column output is produced with entries sorted across, rather tahn down, the columns. This line should be wrapped at 80 columns or less. > void > +printstream(DISPLAY *dp) > +{ > + FTSENT *p; > + > + for (p = dp->list; p; p = p->fts_link) { > + if (p->fts_number != NO_PRINT) { > + (void)printaname(p, dp->s_inode, dp->s_block); > + if (p->fts_link) > + (void)printf(", "); > + } > + } > + (void)putchar('\n'); > +} The lines output by the stream format must not exceed the width of the terminal. See GNU ls for an example. > + > +void > printcol(DISPLAY *dp) > { > extern int termwidth; > static FTSENT **array; > static int lastentries = -1; > @@ -280,25 +295,47 @@ > if (num % numcols) > ++numrows; > > if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size)) > (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); > - for (row = 0; row < numrows; ++row) { > - endcol = colwidth; > - for (base = row, chcnt = col = 0; col < numcols; ++col) { > - chcnt += printaname(array[base], dp->s_inode, > - dp->s_block); > - if ((base += numrows) >= num) > - break; > - while ((cnt = ((chcnt + tabwidth) & ~(tabwidth - 1))) > - <= endcol) { > - (void)putchar(f_notabs ? ' ' : '\t'); > - chcnt = cnt; > + > + if (f_sortacross) { *snip* Wouldn't it be better to have a separate function for each of these two output functions instead of having one big `if' and almost nothing in common between the two? I think there is also a problem with -x outputting tabs before newlines (\t\n) but I can't quite track it down. Different terminals handle this differently, it makes the output ugly on some. > * print [inode] [size] name > @@ -362,33 +399,44 @@ > } > > static int > printtype(u_int mode) > { > - switch (mode & S_IFMT) { > - case S_IFDIR: > - (void)putchar('/'); > - return (1); > - case S_IFIFO: > - (void)putchar('|'); > - return (1); > - case S_IFLNK: > - (void)putchar('@'); > - return (1); > - case S_IFSOCK: > - (void)putchar('='); > - return (1); > - case S_IFWHT: > - (void)putchar('%'); > - return (1); > - default: > - } > - if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { > - (void)putchar('*'); > - return (1); > + if (f_slash) { > + if ((mode & S_IFMT) == S_IFDIR) { > + (void)putchar('/'); > + return (1); > + } > + else > + return (0); > + } > + > + else { else needs to go on the line with the closing brace. > + switch (mode & S_IFMT) { > + case S_IFDIR: > + (void)putchar('/'); > + return (1); > + case S_IFIFO: > + (void)putchar('|'); > + return (1); > + case S_IFLNK: > + (void)putchar('@'); > + return (1); > + case S_IFSOCK: > + (void)putchar('='); > + return (1); > + case S_IFWHT: > + (void)putchar('%'); > + return (1); > + default: This default: is not needed and is possibily illegal. This wasn't added by your change, but should be fixed: "warning: ANSI C forbids label at end of compound statement" Wouldn't it be better to have the -p and -F functionality split off into separate functions? Keep up the good work. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Mar 5 2:56: 0 2002 Delivered-To: freebsd-standards@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 1B95C37B402 for ; Tue, 5 Mar 2002 02:55:57 -0800 (PST) Received: from pobrecita.freebsd.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.12.2/8.12.2) with ESMTP id g25AtbYl077792; Tue, 5 Mar 2002 13:55:48 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.2/8.12.2/Submit) id g25AtW18077791; Tue, 5 Mar 2002 13:55:32 +0300 (MSK) Date: Tue, 5 Mar 2002 13:55:30 +0300 From: "Andrey A. Chernov" To: "Tim J. Robbins" Cc: freebsd-standards@FreeBSD.ORG Subject: Re: iconv utility and Message-ID: <20020305105527.GB77673@nagual.pp.ru> References: <20020304182811.A29732@descent.robbins.dropbear.id.au> <20020304085300.GA51200@nagual.pp.ru> <20020305145542.A30070@descent.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020305145542.A30070@descent.robbins.dropbear.id.au> User-Agent: Mutt/1.3.27i 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, Mar 05, 2002 at 14:55:43 +1100, Tim J. Robbins wrote: > It's not the best way to do it, no. The standard doesn't require that all > character maps be stored as files in this format, but it does require that > iconv be able to load this type of file. Currently we are not compatible with POSIX on locale data formats in whole locale-related stuff, only on function calls, so primary goal at this moment is to make function calls compatibility. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Mar 5 20:49:36 2002 Delivered-To: freebsd-standards@freebsd.org Received: from marvin.idsi.net (66-168-58-99.jvl.wi.charter.com [66.168.58.99]) by hub.freebsd.org (Postfix) with ESMTP id 62E6C37B402 for ; Tue, 5 Mar 2002 20:49:18 -0800 (PST) Received: from marvin.idsi.net (localhost [127.0.0.1]) by marvin.idsi.net (8.12.2/8.12.2) with ESMTP id g264mw29001548; Tue, 5 Mar 2002 22:49:01 -0600 (CST) (envelope-from mkm@marvin.idsi.net) Received: (from mkm@localhost) by marvin.idsi.net (8.12.2/8.12.2/Submit) id g264muwJ001547; Tue, 5 Mar 2002 22:48:56 -0600 (CST) Date: Tue, 5 Mar 2002 22:48:56 -0600 From: Kyle Martin To: "Tim J. Robbins" Cc: freebsd-standards@freebsd.org Subject: Re: ls(1) patch for review Message-ID: <20020305224856.A1397@marvin.idsi.net> References: <20020305030632.A1990@marvin.idsi.net> <20020305205733.A31150@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 In-Reply-To: <20020305205733.A31150@descent.robbins.dropbear.id.au>; from tim@robbins.dropbear.id.au on Tue, Mar 05, 2002 at 08:57:33PM +1100 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, Mar 05, 2002 at 08:57:33PM +1100, Tim J. Robbins wrote: > It writes a /, and the \ confuses groff. How about this: fixed. > This line should be wrapped at 80 columns or less. yeah, i should have proofread the manpage better. fixed. > The lines output by the stream format must not exceed the width of > the terminal. See GNU ls for an example. ok, i had misunderstood the context, fixed. > Wouldn't it be better to have a separate function for each of these two > output functions instead of having one big `if' and almost nothing > in common between the two? i opted not to being that they have alot in common, including the use of several variables within the scope of this function. > I think there is also a problem with -x outputting tabs before newlines > (\t\n) but I can't quite track it down. Different terminals handle this > differently, it makes the output ugly on some. hrmm, ive looked into this, havent seen what your experiencing on any of my terminals, it uses the same algorithm as without -x so there should be _no_ difference. given that -x does look worse that without -x, it seems all semantically correct as far as i can tell. > else needs to go on the line with the closing brace. cleaned it up. > This default: is not needed and is possibily illegal. This wasn't added > by your change, but should be fixed: > "warning: ANSI C forbids label at end of compound statement" fixed. > Wouldn't it be better to have the -p and -F functionality split off > into separate functions? i suppose it could be done that way, but functionality wise i see -p as a subset of of -F *shrug* > Keep up the good work. thanks diff -r -U 5 /usr/src/bin/ls/extern.h ./extern.h --- ls/extern.h.old Sun Feb 3 13:11:32 2002 +++ ls/extern.h Tue Mar 5 04:01:36 2002 @@ -44,10 +44,11 @@ int revstatcmp(const FTSENT *, const FTSENT *); void printcol(DISPLAY *); void printlong(DISPLAY *); void printscol(DISPLAY *); +void printstream(DISPLAY *); void usage(void); size_t len_octal(const char *, int); int prn_octal(const char *); int prn_printable(const char *); #ifdef COLORLS diff -r -U 5 /usr/src/bin/ls/ls.1 ./ls.1 --- ls/ls.1.old Wed Jan 9 07:29:39 2002 +++ ls/ls.1 Tue Mar 5 04:04:27 2002 @@ -186,19 +186,25 @@ .Dq ell . ) List in long format. (See below.) If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing. +.It Fl m +Stream output format; list files across the page, separated by commas. .It Fl n Display user and group IDs numerically rather than converting to a user or group name in a long .Pq Fl l output. .It Fl o Include the file flags in a long .Pq Fl l output. +.It Fl p +Write a slash +.Pq Ql / +after each filename if that file is a directory. .It Fl q Force printing of non-graphic characters in file names as the character .Ql \&? ; this is the default when output is to a terminal. @@ -226,10 +232,13 @@ .Pq Fl l . .It Fl w Force raw printing of non-printable characters. This is the default when output is not to a terminal. +.It Fl x +The same as -C, except that the multi-text-column output is produced with +entries sorted across, rather tahn down, the columns. .It Fl 1 (The numeric digit .Dq one . ) Force output to be one entry per line. diff -r -U 5 /usr/src/bin/ls/ls.c ./ls.c --- ls/ls.c.old Mon Feb 18 18:05:50 2002 +++ ls/ls.c Tue Mar 5 04:01:36 2002 @@ -111,11 +111,14 @@ static int f_recursive; /* ls subdirectories also */ static int f_reversesort; /* reverse whatever sort is used */ int f_sectime; /* print the real time for all files */ static int f_singlecol; /* use single column output */ int f_size; /* list size in short listing */ + int f_slash; /* similar to f_type, but only for dirs */ + int f_sortacross; /* sort across rows, not down columns */ int f_statustime; /* use time of last mode change */ + int f_stream; /* stream the output, seperate with commas */ static int f_timesort; /* sort by time vice name */ int f_type; /* add type character for non-regular files */ static int f_whiteout; /* show whiteout entries */ int f_lomac; /* show LOMAC attributes */ #ifdef COLORLS @@ -165,19 +168,21 @@ /* Root is -A automatically. */ if (!getuid()) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklnoqrstuw")) != -1) { + while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklmnopqrstuwx")) + != -1) { switch (ch) { /* * The -1, -C and -l options all override each other so shell * aliasing works right. */ case '1': f_singlecol = 1; f_longform = 0; + f_stream = 0; break; case 'B': f_nonprint = 0; f_octal = 1; f_octal_escape = 0; @@ -186,10 +191,11 @@ f_longform = f_singlecol = 0; break; case 'l': f_longform = 1; f_singlecol = 0; + f_stream = 0; break; /* The -c and -u options override each other. */ case 'c': f_statustime = 1; f_accesstime = 0; @@ -198,10 +204,11 @@ f_accesstime = 1; f_statustime = 0; break; case 'F': f_type = 1; + f_slash = 0; break; case 'H': fts_options |= FTS_COMFOLLOW; break; case 'G': @@ -242,16 +249,25 @@ f_inode = 1; break; case 'k': f_kblocks = 1; break; + case 'm': + f_stream = 1; + f_singlecol = 0; + f_longform = 0; + break; case 'n': f_numericonly = 1; break; case 'o': f_flags = 1; break; + case 'p': + f_slash = 1; + f_type = 1; + break; case 'q': f_nonprint = 1; f_octal = 0; f_octal_escape = 0; break; @@ -281,10 +297,13 @@ f_octal_escape = 0; break; case 'Z': f_lomac = 1; break; + case 'x': + f_sortacross = 1; + break; default: case '?': usage(); } } @@ -388,10 +407,12 @@ /* Select a print function. */ if (f_singlecol) printfcn = printscol; else if (f_longform) printfcn = printlong; + else if (f_stream) + printfcn = printstream; else printfcn = printcol; if (argc) traverse(argc, argv, fts_options); diff -r -U 5 /usr/src/bin/ls/ls.h ./ls.h --- ls/ls.h.old Sun Feb 3 13:11:32 2002 +++ ls/ls.h Tue Mar 5 04:01:36 2002 @@ -51,10 +51,12 @@ extern int f_octal; /* print unprintables in octal */ extern int f_octal_escape; /* like f_octal but use C escapes if possible */ extern int f_nonprint; /* show unprintables as ? */ extern int f_sectime; /* print the real time for all files */ extern int f_size; /* list size in short listing */ +extern int f_slash; /* append a '/' if the file is a directory */ +extern int f_sortacross; /* sort across rows, not down columns */ extern int f_statustime; /* use time of last mode change */ extern int f_notabs; /* don't use tab-separated multi-col output */ extern int f_type; /* add type character for non-regular files */ #ifdef COLORLS extern int f_color; /* add type in color for non-regular files */ diff -r -U 5 /usr/src/bin/ls/print.c ./print.c --- ls/print.c.old Sun Feb 24 19:36:59 2002 +++ ls/print.c Tue Mar 5 22:21:02 2002 @@ -221,10 +221,34 @@ (void)putchar('\n'); } } void +printstream(DISPLAY *dp) +{ + FTSENT *p; + extern int termwidth; + int chcnt; + + for (p = dp->list, chcnt = 0; p; p = p->fts_link) { + if (p->fts_number != NO_PRINT) { + if (strlen(p->fts_name) + chcnt + (p->fts_link ? 2 : 0) >= + termwidth) { + (void)putchar('\n'); + chcnt = 0; + } + chcnt += printaname(p, dp->s_inode, dp->s_block); + if (p->fts_link) { + (void)printf(", "); + chcnt += 2; + } + } + } + (void)putchar('\n'); +} + +void printcol(DISPLAY *dp) { extern int termwidth; static FTSENT **array; static int lastentries = -1; @@ -280,25 +304,46 @@ if (num % numcols) ++numrows; if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size)) (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); - for (row = 0; row < numrows; ++row) { - endcol = colwidth; - for (base = row, chcnt = col = 0; col < numcols; ++col) { - chcnt += printaname(array[base], dp->s_inode, - dp->s_block); - if ((base += numrows) >= num) - break; - while ((cnt = ((chcnt + tabwidth) & ~(tabwidth - 1))) - <= endcol) { - (void)putchar(f_notabs ? ' ' : '\t'); - chcnt = cnt; + + if (f_sortacross) { + for (row = 0, base = 0; row < numrows; ++row) { + endcol = colwidth; + for (col = 0, chcnt = 0; col < numcols; ++col) { + chcnt += printaname(array[base], + dp->s_inode, dp->s_block); + if (++base >= num) + break; + while ((cnt = ((chcnt + tabwidth) & + ~(tabwidth - 1))) <= endcol) { + (void)putchar(f_notabs ? ' ' : '\t'); + chcnt = cnt; + } + endcol += colwidth; } - endcol += colwidth; + (void)putchar('\n'); + } + } else { + for (row = 0; row < numrows; ++row) { + endcol = colwidth; + for (base = row, chcnt = col = 0; + col < numcols; ++col) { + chcnt += printaname(array[base], + dp->s_inode, dp->s_block); + if ((base += numrows) >= num) + break; + while ((cnt = ((chcnt + tabwidth) & + ~(tabwidth - 1))) <= endcol) { + (void)putchar(f_notabs ? ' ' : '\t'); + chcnt = cnt; + } + endcol += colwidth; + } + (void)putchar('\n'); } - (void)putchar('\n'); } } /* * print [inode] [size] name @@ -362,33 +407,41 @@ } static int printtype(u_int mode) { - switch (mode & S_IFMT) { - case S_IFDIR: - (void)putchar('/'); - return (1); - case S_IFIFO: - (void)putchar('|'); - return (1); - case S_IFLNK: - (void)putchar('@'); - return (1); - case S_IFSOCK: - (void)putchar('='); - return (1); - case S_IFWHT: - (void)putchar('%'); - return (1); - default: - } - if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { - (void)putchar('*'); - return (1); + if (f_slash) { + if ((mode & S_IFMT) == S_IFDIR) { + (void)putchar('/'); + return (1); + } else + return (0); + } else { + switch (mode & S_IFMT) { + case S_IFDIR: + (void)putchar('/'); + return (1); + case S_IFIFO: + (void)putchar('|'); + return (1); + case S_IFLNK: + (void)putchar('@'); + return (1); + case S_IFSOCK: + (void)putchar('='); + return (1); + case S_IFWHT: + (void)putchar('%'); + return (1); + default: + if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { + (void)putchar('*'); + return (1); + } + } + return (0); } - return (0); } #ifdef COLORLS static int putch(int c) -- Kyle Martin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Mar 5 21:52:56 2002 Delivered-To: freebsd-standards@freebsd.org Received: from descent.robbins.dropbear.id.au (170.b.008.mel.iprimus.net.au [210.50.87.170]) by hub.freebsd.org (Postfix) with ESMTP id 4166D37B400 for ; Tue, 5 Mar 2002 21:52:51 -0800 (PST) Received: (from tim@localhost) by descent.robbins.dropbear.id.au (8.11.6/8.11.6) id g265k6B31855; Wed, 6 Mar 2002 16:46:06 +1100 (EST) (envelope-from tim) Date: Wed, 6 Mar 2002 16:46:01 +1100 From: "Tim J. Robbins" To: Kyle Martin Cc: freebsd-standards@FreeBSD.ORG Subject: Re: ls(1) patch for review Message-ID: <20020306164601.A31721@descent.robbins.dropbear.id.au> References: <20020305030632.A1990@marvin.idsi.net> <20020305205733.A31150@descent.robbins.dropbear.id.au> <20020305224856.A1397@marvin.idsi.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020305224856.A1397@marvin.idsi.net>; from mkm@ieee.org on Tue, Mar 05, 2002 at 10:48:56PM -0600 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, Mar 05, 2002 at 10:48:56PM -0600, Kyle Martin wrote: > + case 'x': > + f_sortacross = 1; > + break; I think you should also have: f_column = f_longform = f_singlecol = 0; There might be other issues with options taking precedence over others. Compare the output of these two: ls -Cq | more ls -xq | more (ie. output is not tty) Also in printstream(), you should probably try to avoid printing empty lines by not always doing the final putchar('\n'). Apart from the \t\n thing I mentioned in the previous email, I can't see anything else wrong with it.. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Mar 7 1:50:22 2002 Delivered-To: freebsd-standards@freebsd.org Received: from theshell.com (arsenic.theshell.com [63.236.138.5]) by hub.freebsd.org (Postfix) with SMTP id 7AD4A37B41D for ; Thu, 7 Mar 2002 01:50:04 -0800 (PST) Received: (qmail 25706 invoked from network); 7 Mar 2002 09:50:04 -0000 Received: from oxygen.theshell.com (root@63.236.138.8) by arsenic.theshell.com with SMTP; 7 Mar 2002 09:50:04 -0000 Received: (from pavalos@localhost) by oxygen.theshell.com (8.11.6/8.11.6) id g279o3911956; Thu, 7 Mar 2002 01:50:03 -0800 (PST) (envelope-from pavalos) Date: Thu, 7 Mar 2002 01:50:03 -0800 From: Peter Avalos To: mike@freebsd.org Cc: freebsd-standards@freebsd.org Subject: renice(8) Message-ID: <20020307095003.GA11192@theshell.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline User-Agent: Mutt/1.3.27i 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 --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Please review the following patch to make renice(8) IEEE Std 1003.1-2001 compliant. This may also be accessed at http://www.theshell.com/~pavalos/renice.diff o Accept the -n option. o Make usage() and SYNOPSIS style(9) compliant. o Accept only one -g, -p, or -u option, and clarify how they affect the interpretation of the following IDs. o Update the EXAMPLES section to match this new behavior. o Note that it is IEEE Std 1003.1-2001 compliant, but we still accept a nice value for POLA. o Use __FBSDID. o Remove __P() usage. o Use static for local functions. o Change K&R declarations. o Remove register. o int main(int argc, char *argv[]) o style(9) variable declaration. o Allow user to specify both user names and user ids. o Use sysexits when appropriate. --Pete Index: renice.8 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/fbsd/src/usr.bin/renice/renice.8,v retrieving revision 1.9 diff -u -r1.9 renice.8 --- renice.8 5 Aug 2001 22:07:27 -0000 1.9 +++ renice.8 7 Mar 2002 09:26:45 -0000 @@ -40,90 +40,103 @@ .Nd alter priority of running processes .Sh SYNOPSIS .Nm -.Ar priority +.Ar nice_value .Oo -.Op Fl p -.Ar pid ... +.Fl g | +.Fl p +| +.Fl u .Oc +.Ar ID ... +.Nm +.Fl n Ar increment .Oo -.Op Fl g -.Ar pgrp ... -.Oc -.Oo -.Op Fl u -.Ar user ... +.Fl g | +.Fl p +| +.Fl u .Oc +.Ar ID ... .Sh DESCRIPTION .Nm Renice alters the scheduling priority of one or more running processes. -The following -.Ar who -parameters are interpreted as process ID's, process group -ID's, or user names. -.Nm Renice Ns 'ing +By default, the processes to be affected are specified by +their process ID's. +Specifying a process group causes all processes in the process group to have their scheduling priority altered. -.Nm Renice Ns 'ing +Specifying a user causes all processes owned by the user to have their scheduling priority altered. -By default, the processes to be affected are specified by -their process ID's. +.Pp +If the requested priority or increment would exceed PRIO_MIN (\-20) +or PRIO_MAX (20), the limit that was exceeded is used. +Only the superuser may affect the scheduling priority of processes +owned by another user. +Only the superuser may increase the scheduling priority of a process +(decrease the nice_value). .Pp Options supported by .Nm : .Bl -tag -width Ds +.It Fl n Ar increment +Increment the scheduling priority of the specified process. +Positive values will decrease the scheduling priority, and negative +values will increase the scheduling priority. +Only the superuser may specify a negative value. .It Fl g -Force -.Ar who -parameters to be interpreted as process group ID's. -.It Fl u -Force the -.Ar who -parameters to be interpreted as user names. +Interpret all +.Ar ID +arguments as unsigned decimal integer process group ID's. .It Fl p -Resets the -.Ar who -interpretation to be (the default) process ID's. +Interpret all +.Ar ID +arguments as unsigned decimal integer process ID's. +This is the default if no options are specified. +.It Fl u +Interpret all +.Ar ID +arguments as users. +The +.Ar ID +may be a valid user name or an unsigned decimal integer user ID. .El .Pp -For example, -.Bd -literal -offset -renice +1 987 -u daemon root -p 32 -.Ed -.Pp -would change the priority of process ID's 987 and 32, and -all processes owned by users daemon and root. -.Pp -Users other than the super-user may only alter the priority of -processes they own, -and can only monotonically increase their ``nice value'' -within the range 0 to -.Dv PRIO_MAX -(20). -(This prevents overriding administrative fiats.) -The super-user -may alter the priority of any process -and set the priority to any value in the range -.Dv PRIO_MIN -(\-20) -to -.Dv PRIO_MAX . -Useful priorities are: +Useful nice_values are: 20 (the affected processes will run only when nothing else in the system wants to), 0 (the ``base'' scheduling priority), anything negative (to make things go very fast). -.Sh FILES -.Bl -tag -width /etc/passwd -compact -.It Pa /etc/passwd -to map user names to user ID's -.El +.Sh EXAMPLES +Adjust the system scheduling priority so group +ID's 69 and 77 have a lower priority: +.Pp +.Dl % renice -n 5 -g 69 77 +.Pp +Adjust the system scheduling priority so process +ID's 2987 and 85723 have the lowest priority: +.Pp +.Dl % renice 20 2987 85723 +.Pp +Adjust the system scheduling priority so user +foo and user ID 2000 have higher priority: +.Pp +.Dl # renice -n -5 -u foo 2000 +.Pp .Sh SEE ALSO .Xr nice 1 , .Xr rtprio 1 , .Xr getpriority 2 , .Xr setpriority 2 +.Sh STANDARDS +The +.Nm +utility conforms to +.St -p1003.1-2001 +Note: Specifying +.Ar nice_value +is deprecated, but it is accepted due to its historical significance. .Sh BUGS Non super-users cannot increase scheduling priorities of their own process= es, even if they were the ones that decreased the priorities in the first plac= e. Index: renice.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/fbsd/src/usr.bin/renice/renice.c,v retrieving revision 1.7 diff -u -r1.7 renice.c --- renice.c 3 Dec 2001 21:18:12 -0000 1.7 +++ renice.c 7 Mar 2002 09:22:23 -0000 @@ -31,19 +31,20 @@ * SUCH DAMAGE. */ =20 +#if 0 #ifndef lint -static const char copyright[] =3D +static char copyright[] =3D "@(#) Copyright (c) 1983, 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ =20 #ifndef lint -#if 0 static char sccsid[] =3D "@(#)renice.c 8.1 (Berkeley) 6/9/93"; -#endif -static const char rcsid[] =3D - "$FreeBSD: src/usr.bin/renice/renice.c,v 1.7 2001/12/03 21:18:12 dwmalon= e Exp $"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); =20 #include #include @@ -51,13 +52,15 @@ =20 #include #include +#include +#include #include #include #include -#include +#include =20 -int donice __P((int, int, int)); -static void usage __P((void)); +static int donice(int, int, int, int); +static void usage(void); =20 /* * Change the priority (nice) of processes @@ -65,66 +68,79 @@ * running. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { - int which =3D PRIO_PROCESS; - int who =3D 0, prio, errs =3D 0; + struct passwd *pwd; + char *endptr; + int errs, nflag, prio, which, who; + + which =3D PRIO_PROCESS; + errs =3D 0, nflag =3D 0, who =3D 0; =20 argc--, argv++; if (argc < 2) usage(); - prio =3D atoi(*argv); + + /* Parse priority or -n increment. */ + if (strcmp(*argv, "-n") =3D=3D 0) { + nflag =3D 1; + argc--, argv++; + if (argc < 2) + usage(); + } + prio =3D strtol(*argv, &endptr, 10); + if (*endptr || + ((prio =3D=3D LONG_MAX || prio =3D=3D LONG_MIN) && errno =3D=3D ERANG= E)) + errx(EX_DATAERR, "Invalid input: %s", *argv); argc--, argv++; - if (prio > PRIO_MAX) - prio =3D PRIO_MAX; - if (prio < PRIO_MIN) - prio =3D PRIO_MIN; + + /* + * Accept -g, -p, -u, or a number. If it's a number, default + * to -p (PRIO_PROCESS). + */ + if (strcmp(*argv, "-g") =3D=3D 0) { + which =3D PRIO_PGRP; + argc--, argv++; + } else if (strcmp(*argv, "-u") =3D=3D 0) { + which =3D PRIO_USER; + argc--, argv++; + } else if (strcmp(*argv, "-p") =3D=3D 0) + argc--, argv++; + for (; argc > 0; argc--, argv++) { - if (strcmp(*argv, "-g") =3D=3D 0) { - which =3D PRIO_PGRP; - continue; - } - if (strcmp(*argv, "-u") =3D=3D 0) { - which =3D PRIO_USER; - continue; - } - if (strcmp(*argv, "-p") =3D=3D 0) { - which =3D PRIO_PROCESS; + who =3D strtoul(*argv, &endptr, 10); + + /* If argv is not a number, then we should be PRIO_USER. */ + if ((*endptr && which !=3D PRIO_USER) || + ((who =3D=3D LONG_MAX || who =3D=3D LONG_MIN) && errno =3D=3D ERANGE= )) { + warnx("Invalid input: %s", *argv); continue; } - if (which =3D=3D PRIO_USER) { - register struct passwd *pwd =3D getpwnam(*argv); + if (which =3D=3D PRIO_USER && *endptr) { + pwd =3D getpwnam(*argv); =20 if (pwd =3D=3D NULL) { warnx("%s: unknown user", *argv); continue; } who =3D pwd->pw_uid; - } else { - who =3D atoi(*argv); - if (who < 0) { - warnx("%s: bad value", *argv); - continue; - } } - errs +=3D donice(which, who, prio); + errs +=3D donice(which, who, prio, nflag); } - exit(errs !=3D 0); + exit(errs); } =20 static void -usage() +usage(void) { - fprintf(stderr, -"usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\= n"); - exit(1); + + fprintf(stderr, "usage: renice nice_value [-g | -p | -u] ID ...\n"); + fprintf(stderr, " renice -n increment [-g | -p | -u] ID ...\n"); + exit(EX_USAGE); } =20 -int -donice(which, who, prio) - int which, who, prio; +static int +donice(int which, int who, int prio, int nflag) { int oldprio; =20 @@ -133,10 +149,12 @@ warn("%d: getpriority", who); return (1); } + if (nflag) + prio +=3D oldprio; /* Possible over/underflow here. */ if (setpriority(which, who, prio) < 0) { warn("%d: setpriority", who); return (1); } - printf("%d: old priority %d, new priority %d\n", who, oldprio, prio); + printf("%d: old nice_value %d, new nice_value %d\n", who, oldprio, prio); return (0); } --WIyZ46R2i8wDzkSu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE8hzfK7ogfS9uZ4RsRAgkxAKDTOEX4bBdVzcSePKxbLtPzUyKvVwCg0Pgu +cd+or3WjzsaV78osNcrRvM= =0iPJ -----END PGP SIGNATURE----- --WIyZ46R2i8wDzkSu-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Mar 7 2:14:37 2002 Delivered-To: freebsd-standards@freebsd.org Received: from ns1.infowest.com (ns1.infowest.com [204.17.177.10]) by hub.freebsd.org (Postfix) with ESMTP id 582CC37B417; Thu, 7 Mar 2002 02:14:15 -0800 (PST) Received: from there (208.186.107.222.dsl.infowest.net [208.186.107.222]) by ns1.infowest.com (Postfix) with SMTP id BC50221C82; Thu, 7 Mar 2002 03:14:07 -0700 (MST) Content-Type: text/plain; charset="iso-8859-1" From: Samuel J.Greear Organization: GetMegabits, Inc. To: Peter Avalos , mike@freebsd.org Subject: Re: renice(8) Date: Fri, 8 Mar 2002 03:08:04 -0700 X-Mailer: KMail [version 1.3] Cc: freebsd-standards@freebsd.org References: <20020307095003.GA11192@theshell.com> In-Reply-To: <20020307095003.GA11192@theshell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20020307101407.BC50221C82@ns1.infowest.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 "%d: old nice_value %d, new nice_value %d\n" That crap has got to go. Sam On Thursday 07 March 2002 02:50 am, Peter Avalos wrote: > Please review the following patch to make renice(8) > IEEE Std 1003.1-2001 compliant. This may also be accessed at > http://www.theshell.com/~pavalos/renice.diff > > o Accept the -n option. > > o Make usage() and SYNOPSIS style(9) compliant. > > o Accept only one -g, -p, or -u option, and clarify how they affect > the interpretation of the following IDs. > > o Update the EXAMPLES section to match this new behavior. > > o Note that it is IEEE Std 1003.1-2001 compliant, but we still accept > a nice value for POLA. > > o Use __FBSDID. > > o Remove __P() usage. > > o Use static for local functions. > > o Change K&R declarations. > > o Remove register. > > o int main(int argc, char *argv[]) > > o style(9) variable declaration. > > o Allow user to specify both user names and user ids. > > o Use sysexits when appropriate. > > > --Pete To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Mar 8 20:27:49 2002 Delivered-To: freebsd-standards@freebsd.org Received: from marvin.idsi.net (66-168-58-99.jvl.wi.charter.com [66.168.58.99]) by hub.freebsd.org (Postfix) with ESMTP id 3DAE937B400 for ; Fri, 8 Mar 2002 20:27:33 -0800 (PST) Received: from marvin.idsi.net (localhost [127.0.0.1]) by marvin.idsi.net (8.12.2/8.12.2) with ESMTP id g294R2bC000712 for ; Fri, 8 Mar 2002 22:27:06 -0600 (CST) (envelope-from mkm@marvin.idsi.net) Received: (from mkm@localhost) by marvin.idsi.net (8.12.2/8.12.2/Submit) id g294R2EH000711 for freebsd-standards@freebsd.org; Fri, 8 Mar 2002 22:27:02 -0600 (CST) Date: Fri, 8 Mar 2002 22:27:02 -0600 From: Kyle Martin To: freebsd-standards@freebsd.org Subject: ls(1) again Message-ID: <20020308222702.A524@marvin.idsi.net> 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 its me again with a new and improved ls 8) diff -r -U 5 /usr/src/bin/ls/extern.h ls/extern.h --- /usr/src/bin/ls/extern.h Sun Feb 3 13:11:32 2002 +++ ls/extern.h Fri Mar 8 01:58:42 2002 @@ -44,10 +44,11 @@ int revstatcmp(const FTSENT *, const FTSENT *); void printcol(DISPLAY *); void printlong(DISPLAY *); void printscol(DISPLAY *); +void printstream(DISPLAY *); void usage(void); size_t len_octal(const char *, int); int prn_octal(const char *); int prn_printable(const char *); #ifdef COLORLS diff -r -U 5 /usr/src/bin/ls/ls.1 ls/ls.1 --- /usr/src/bin/ls/ls.1 Wed Jan 9 07:29:39 2002 +++ ls/ls.1 Fri Mar 8 01:58:42 2002 @@ -186,19 +186,25 @@ .Dq ell . ) List in long format. (See below.) If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing. +.It Fl m +Stream output format; list files across the page, separated by commas. .It Fl n Display user and group IDs numerically rather than converting to a user or group name in a long .Pq Fl l output. .It Fl o Include the file flags in a long .Pq Fl l output. +.It Fl p +Write a slash +.Pq Ql / +after each filename if that file is a directory. .It Fl q Force printing of non-graphic characters in file names as the character .Ql \&? ; this is the default when output is to a terminal. @@ -226,10 +232,13 @@ .Pq Fl l . .It Fl w Force raw printing of non-printable characters. This is the default when output is not to a terminal. +.It Fl x +The same as -C, except that the multi-text-column output is produced with +entries sorted across, rather tahn down, the columns. .It Fl 1 (The numeric digit .Dq one . ) Force output to be one entry per line. diff -r -U 5 /usr/src/bin/ls/ls.c ls/ls.c --- /usr/src/bin/ls/ls.c Mon Feb 18 18:05:50 2002 +++ ls/ls.c Fri Mar 8 22:10:36 2002 @@ -111,11 +111,14 @@ static int f_recursive; /* ls subdirectories also */ static int f_reversesort; /* reverse whatever sort is used */ int f_sectime; /* print the real time for all files */ static int f_singlecol; /* use single column output */ int f_size; /* list size in short listing */ + int f_slash; /* similar to f_type, but only for dirs */ + int f_sortacross; /* sort across rows, not down columns */ int f_statustime; /* use time of last mode change */ + int f_stream; /* stream the output, seperate with commas */ static int f_timesort; /* sort by time vice name */ int f_type; /* add type character for non-regular files */ static int f_whiteout; /* show whiteout entries */ int f_lomac; /* show LOMAC attributes */ #ifdef COLORLS @@ -165,19 +168,21 @@ /* Root is -A automatically. */ if (!getuid()) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklnoqrstuw")) != -1) { + while ((ch = getopt(argc, argv, "1ABCFGHLPRTWZabcdfghiklmnopqrstuwx")) + != -1) { switch (ch) { /* * The -1, -C and -l options all override each other so shell * aliasing works right. */ case '1': f_singlecol = 1; f_longform = 0; + f_stream = 0; break; case 'B': f_nonprint = 0; f_octal = 1; f_octal_escape = 0; @@ -186,10 +191,11 @@ f_longform = f_singlecol = 0; break; case 'l': f_longform = 1; f_singlecol = 0; + f_stream = 0; break; /* The -c and -u options override each other. */ case 'c': f_statustime = 1; f_accesstime = 0; @@ -198,10 +204,11 @@ f_accesstime = 1; f_statustime = 0; break; case 'F': f_type = 1; + f_slash = 0; break; case 'H': fts_options |= FTS_COMFOLLOW; break; case 'G': @@ -242,16 +249,25 @@ f_inode = 1; break; case 'k': f_kblocks = 1; break; + case 'm': + f_stream = 1; + f_singlecol = 0; + f_longform = 0; + break; case 'n': f_numericonly = 1; break; case 'o': f_flags = 1; break; + case 'p': + f_slash = 1; + f_type = 1; + break; case 'q': f_nonprint = 1; f_octal = 0; f_octal_escape = 0; break; @@ -281,10 +297,14 @@ f_octal_escape = 0; break; case 'Z': f_lomac = 1; break; + case 'x': + f_sortacross = 1; + f_longform = f_singlecol = 0; + break; default: case '?': usage(); } } @@ -388,10 +408,12 @@ /* Select a print function. */ if (f_singlecol) printfcn = printscol; else if (f_longform) printfcn = printlong; + else if (f_stream) + printfcn = printstream; else printfcn = printcol; if (argc) traverse(argc, argv, fts_options); diff -r -U 5 /usr/src/bin/ls/ls.h ls/ls.h --- /usr/src/bin/ls/ls.h Sun Feb 3 13:11:32 2002 +++ ls/ls.h Fri Mar 8 01:58:43 2002 @@ -51,10 +51,12 @@ extern int f_octal; /* print unprintables in octal */ extern int f_octal_escape; /* like f_octal but use C escapes if possible */ extern int f_nonprint; /* show unprintables as ? */ extern int f_sectime; /* print the real time for all files */ extern int f_size; /* list size in short listing */ +extern int f_slash; /* append a '/' if the file is a directory */ +extern int f_sortacross; /* sort across rows, not down columns */ extern int f_statustime; /* use time of last mode change */ extern int f_notabs; /* don't use tab-separated multi-col output */ extern int f_type; /* add type character for non-regular files */ #ifdef COLORLS extern int f_color; /* add type in color for non-regular files */ diff -r -U 5 /usr/src/bin/ls/print.c ls/print.c --- /usr/src/bin/ls/print.c Sun Feb 24 19:36:59 2002 +++ ls/print.c Fri Mar 8 22:21:44 2002 @@ -221,10 +221,35 @@ (void)putchar('\n'); } } void +printstream(DISPLAY *dp) +{ + FTSENT *p; + extern int termwidth; + int chcnt; + + for (p = dp->list, chcnt = 0; p; p = p->fts_link) { + if (p->fts_number != NO_PRINT) { + if (strlen(p->fts_name) + chcnt + (p->fts_link ? 2 : 0) >= + termwidth) { + (void)putchar('\n'); + chcnt = 0; + } + chcnt += printaname(p, dp->s_inode, dp->s_block); + if (p->fts_link) { + (void)printf(", "); + chcnt += 2; + } + } + } + if (chcnt) + (void)putchar('\n'); +} + +void printcol(DISPLAY *dp) { extern int termwidth; static FTSENT **array; static int lastentries = -1; @@ -280,25 +305,46 @@ if (num % numcols) ++numrows; if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size)) (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); - for (row = 0; row < numrows; ++row) { - endcol = colwidth; - for (base = row, chcnt = col = 0; col < numcols; ++col) { - chcnt += printaname(array[base], dp->s_inode, - dp->s_block); - if ((base += numrows) >= num) - break; - while ((cnt = ((chcnt + tabwidth) & ~(tabwidth - 1))) - <= endcol) { - (void)putchar(f_notabs ? ' ' : '\t'); - chcnt = cnt; + + if (f_sortacross) { + for (row = 0, base = 0; row < numrows; ++row) { + endcol = colwidth; + for (col = 0, chcnt = 0; col < numcols; ++col) { + chcnt += printaname(array[base], + dp->s_inode, dp->s_block); + if (++base >= num) + break; + while (((cnt = ((chcnt + tabwidth) & + ~(tabwidth - 1))) <= endcol) && (col + 1 < numcols )) { + (void)putchar(f_notabs ? ' ' : '\t'); + chcnt = cnt; + } + endcol += colwidth; } - endcol += colwidth; + (void)putchar('\n'); + } + } else { + for (row = 0; row < numrows; ++row) { + endcol = colwidth; + for (base = row, chcnt = col = 0; + col < numcols; ++col) { + chcnt += printaname(array[base], + dp->s_inode, dp->s_block); + if ((base += numrows) >= num) + break; + while ((cnt = ((chcnt + tabwidth) & + ~(tabwidth - 1))) <= endcol) { + (void)putchar(f_notabs ? ' ' : '\t'); + chcnt = cnt; + } + endcol += colwidth; + } + (void)putchar('\n'); } - (void)putchar('\n'); } } /* * print [inode] [size] name @@ -362,33 +408,41 @@ } static int printtype(u_int mode) { - switch (mode & S_IFMT) { - case S_IFDIR: - (void)putchar('/'); - return (1); - case S_IFIFO: - (void)putchar('|'); - return (1); - case S_IFLNK: - (void)putchar('@'); - return (1); - case S_IFSOCK: - (void)putchar('='); - return (1); - case S_IFWHT: - (void)putchar('%'); - return (1); - default: - } - if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { - (void)putchar('*'); - return (1); + if (f_slash) { + if ((mode & S_IFMT) == S_IFDIR) { + (void)putchar('/'); + return (1); + } else + return (0); + } else { + switch (mode & S_IFMT) { + case S_IFDIR: + (void)putchar('/'); + return (1); + case S_IFIFO: + (void)putchar('|'); + return (1); + case S_IFLNK: + (void)putchar('@'); + return (1); + case S_IFSOCK: + (void)putchar('='); + return (1); + case S_IFWHT: + (void)putchar('%'); + return (1); + default: + if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { + (void)putchar('*'); + return (1); + } + } + return (0); } - return (0); } #ifdef COLORLS static int putch(int c) cheers, -- Kyle Martin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message