Commit Graph

99 Commits

Author SHA1 Message Date
Warner Losh
46251dde8f o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
2002-02-02 06:48:10 +00:00
Josef Karthauser
ac639e9072 LSCOLOURS should be spelt LSCOLORS.
Submitted by:	Jordan DeLong <fracture@allusion.net
2001-12-29 10:13:43 +00:00
Josef Karthauser
5dda5d0df0 Restore these files to shiny KNF. 2001-12-29 00:18:16 +00:00
Josef Karthauser
b95a83b308 Convert some spaces into tabs that I missed first time around. 2001-12-28 21:55:23 +00:00
Josef Karthauser
7b3360c0e2 Revert most of rev 1.42, to restore KNF style.
Requested by:	bde
2001-12-28 21:47:33 +00:00
Josef Karthauser
0e8d1551e0 Add a new flag, -h which when combined with the -l option causes
file sizes to be displayed with unit suffixes; Byte, Kilobyte,
Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the
number of digits to three or less.

Submitted by:	nik
2001-12-28 20:50:12 +00:00
Josef Karthauser
130d15dc43 Make it clearer what changed to a user using the old format of LSCOLORS. 2001-12-28 19:27:30 +00:00
Josef Karthauser
6bd042dfe9 Mop up some warnings. 2001-12-28 19:26:06 +00:00
Josef Karthauser
b0bc91e955 Make the style more consistent throughout the file. 2001-12-28 18:43:32 +00:00
Josef Karthauser
0d72516e58 Use the default colour instead if a bad colour specification is given. 2001-12-28 18:20:23 +00:00
Josef Karthauser
c1499cf6cf Revamp the colour support to allow for bold characters. Colours
are now defined using the characters a-h and A-H for the bold
variants.  The old way using 0-7 for the colours still works, but
prints a message asking the user to switch.

PR:		bin/27374
2001-12-28 18:14:50 +00:00
Brian Feldman
7304f61f9e Add LOMAC options (the "Z" flag in both cases) to display extra information
in ls(1) and ps(1).

Sponsored by:	DARPA, NAI Labs
2001-11-26 22:21:15 +00:00
Andrey A. Chernov
8234eb2519 Silence minor cc warning 2001-03-21 15:14:47 +00:00
Andrey A. Chernov
28fd017a11 Use nl_langinfo instead of %Ef 2001-03-21 13:21:20 +00:00
Assar Westerlund
ee579ffbea make sure we do not write out non-printable characters in file names
and symbolic links (by default)

PR:		bin/19354
Reviewed by:	silence on -current
2000-07-04 23:09:23 +00:00
Josef Karthauser
1e715e3437 I broke locale sensitive ordering of date and month in
the long -l output format with the last commit.  Fix it
by replacing the "%b %e" strftime format with "%Ef".

Make a note in the manual page that the LANG environment
variable affects the running of ls.

Reviewed by:	ache
2000-06-21 21:49:57 +00:00
Josef Karthauser
97e4e97bd1 Don't assume that the output of strftime for "%c" ("national
representation of time and date") won't change in time.  Instead
of hard coding the locations of the time elements and hoping that
they don't move use strftime to generate the desired formats in
the first place.

PR:	bin/7826
2000-06-18 22:18:04 +00:00
Andrey A. Chernov
22ff3e9e29 Greately simplify oxtabs fix by simple setting f_notabs for f_color 2000-06-06 12:44:29 +00:00
Andrey A. Chernov
322b47fd88 Honor f_notabs flag even in COLORLS 2000-06-06 12:25:17 +00:00
Andrey A. Chernov
6cd5adff75 Back out spaces to TABs replace removing for COLORLS
Rewrite corresponding comment to say what happens in reality with oxtabs
and current terminal column.
2000-06-06 12:10:07 +00:00
Andrey A. Chernov
82dd3eab13 Don't replace TABs with spaces for COLORLS because "some terminals get confused"
as comment says. I know no terminal confused by this. If even such terminal
exists, it must be termcap flag for this, not hardcoded in ls.
2000-06-06 07:32:20 +00:00
Andrey A. Chernov
1bf1478a9f Staticize more functions 2000-06-06 07:19:50 +00:00
Andrey A. Chernov
38782c258d Make signal handler safe - don't use stdio (pointed by bde)
Staticize some color functions
Add yet one tolower() call which is forgotten after check
Don't check for OOPS - not really needed
2000-06-06 06:52:03 +00:00
Andrey A. Chernov
c85e2c8e57 Get rid of curses completely - use tgoto instead of tparm 2000-06-05 20:54:46 +00:00
Andrey A. Chernov
faebfe2e07 Kill yourself in ^C handler, not exit(1) to allow script to sense signal 2000-06-05 20:08:50 +00:00
Andrey A. Chernov
47bb6b11f3 Cosmetique of prev. optimization - don't use global variable 2000-06-05 19:56:52 +00:00
Andrey A. Chernov
cf0feaeee9 Don't use curses includes, include termcap.h instead
Don't use curses functions, use tputs instead
Add ^C reaction - reset colors
Optimization - don't turn off colors after EACH file printed.
Fix wrong ctype macro arg type in LSCOLORS parsing
2000-06-05 19:39:39 +00:00
Josef Karthauser
5a890e22bf Don't look up the ANSI sequences each time a colour is changed,
this is extremely inefficient, instead write them all down at the
beginning.

The correct sequence to switch colours off is to first use 'op' if
it exists, otherwise use 'oc'.  If neither of these exist then we
shouldn't be doing colour with this terminal.

Reviewed by:	ache
2000-06-05 03:51:29 +00:00
Josef Karthauser
74985094ef * Re-implement colour support using termcap's AF and AB capabilities
to manage the ANSI colour sequences.  Colour support is disabled
  unless the TERM environment variable references a valid termcap.

* Allow optional compilation of the colour support in the Makefile,
  defaulting to yes.  This allows us to switch it off for fixit
  floppies and other mediums where space is an issue and the extra
  bloat of statically linking with ncurses isn't acceptable.

* Display a warning if colour is requested with '-G' but support
  for it isn't compiled in.
2000-06-05 02:14:01 +00:00
Josef Karthauser
3885812c8c Add colour support to /bin/ls (at a cost of 1056 bytes on my system).
It is not switched on by default and must be enabled with the -G
flag.  When using ls -G the output behaviour is modified with ANSI
colour sequences wrapped around filenames to help distinguish file
types.  (Colours can be redefined in the LSCOLORS environment
variable as described in the manual page.)

Colour support is silently disabled (if switched on) if stdout
isn't a tty.

Based on:	asami's colorls port.
PR:		bin/18900 && ports/18616.
2000-06-02 14:53:42 +00:00
Bruce Evans
029b2bd09e Print negative minor numbers in hex. Negative minor numbers are
essentially large unsigned ones, and we already print minor
numbers > 255 in hex.
2000-01-06 14:40:10 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Tim Vanderhoek
545f583c55 Allow env. variable LS_COLWIDTHS to specify minimum column widths,
effectively overriding the dynamically-sized-column feature.  This
is mostly useful for non-interactive use, where it may be necessary
to ensure that listings taken at different times have columns that
line-up correctly.  I have been assured that at least one large,
well-known program will soon be taking advantage of this.  :-)

PR:		bin/7011
Submitted by:	Joel Ray Holveck <joelh@gnu.org>
1998-07-29 00:46:13 +00:00
Dag-Erling Smørgrav
0d86878ce0 o Renamed '-b' (show unprintables in octal) to '-B'
o Added a new '-b' which behaves as in AT&T Unices (show unprintables in
  octal, using C escape codes when possible)

o Added '?' to the getopt() string, since the code in the switch considers
  it as a valid option.
1998-04-24 07:49:51 +00:00
Dag-Erling Smørgrav
7ea3064820 Added -b option to display unprintables in octal.
PR: 1315
1998-04-21 22:02:01 +00:00
Steve Price
febad2fcf4 Observe precedence set by Phillippe Charnier in adding an
rcsid.
1997-08-07 22:28:25 +00:00
Steve Price
d46c1a60d3 Remove #if(n)def BSD_4_4_LITE cruft and sccsid -> rcsid. 1997-08-07 15:33:50 +00:00
Peter Wemm
b97fa2ef50 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Mike Pritchard
f173abd010 Make ls include the year when displaying times that are more than
6 months into the future.  Closes PR# 1657.

Submitted by:	Sakari Jalowaara <sja.home.tekla.fi>
1997-01-11 19:15:53 +00:00
Steve Price
fb5cb2083a Merge Lite2 mods, and -Wall cleaning. undelete(2) cruft
not yet implemented is protected by a define (BSD4_4_LITE)
that should be removed when this call is supported by the
kernel.
1996-12-14 06:03:29 +00:00
Mike Pritchard
8564f3402c Remove unused include of utmp.h from print.c. Closes PR# 486.
Submitted by:	Tom Samplonius <tom@haven.uniserve.com>
1996-01-20 10:31:14 +00:00
Joerg Wunsch
df2fbf15a2 Print dev minor #'s > 255 in hex.
Reviewed by:	jkh, kuku, phk
1995-12-30 18:15:30 +00:00
Andrey A. Chernov
fc4a9baf50 Change ctime to strftime %c to use national date/time representation 1995-08-08 00:03:04 +00:00
Garrett Wollman
656dcd4316 Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.
1995-08-07 19:17:46 +00:00
Rodney W. Grimes
2162b2d226 Remove trailing whitespace.
Reviewed by:	phk
1995-05-30 00:07:29 +00:00
Joerg Wunsch
0fd510b71a You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup.  /bin/sh will still
need *allot* of work, however.

Submitted by:	charnier@lirmm.fr (Philippe Charnier)
1995-03-19 13:29:28 +00:00
David Greenman
89730b290a Added $Id$ 1994-09-24 02:59:15 +00:00
Rodney W. Grimes
4b88c807ea BSD 4.4 Lite bin Sources 1994-05-26 06:18:55 +00:00