Commit Graph

41 Commits

Author SHA1 Message Date
wiz 1919d4e949 Sync usage with man page. From Kouichirou Hiratsuka in PR 26278. 2004-07-23 13:26:11 +00:00
heas c68b80b9a5 remove double initialisation of SINGL_FLD & SEP_FLAG 2004-03-14 21:09:30 +00:00
jdolecek 3b6344c769 ftpos pointer was not updated when fldtab was reallocated; drop completely
in favour of an index counter
fixes bin/24449 by Jun-ichiro itojun
2004-02-17 18:59:13 +00:00
jdolecek d8c927fdbf fldtab[] needs to have one extra element - this marks end of array
adresses part of PR bin/24449 by Jun-ichiro itojun
2004-02-17 13:52:56 +00:00
itojun aa7ee5b5c7 use safer realloc idiom
memset new region got by realloc
2004-02-17 02:38:47 +00:00
itojun 0795537158 initialize fldtab 2004-02-17 02:28:29 +00:00
jdolecek 9f77432368 remove compile-time limit on number of -k options, allocate necessary
structures as-needed
2004-02-15 14:22:55 +00:00
jdolecek f84513a754 add TNF copyright 2003-08-07 11:32:34 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
jdolecek 8852da41eb g/c many_files(), too 2002-12-24 14:58:57 +00:00
jdolecek e296a59c79 bump 'soft' limit for number of files to hard limit on startup; we
want to be able to open as many temporary files as possible
2002-12-24 14:55:46 +00:00
jdolecek 77d4ae97df move fltab outside main and make it static, eliminate two memset()s
g/c superfluous extern definition for clist[] and ncols
make toutpath[] static
2002-12-24 13:09:38 +00:00
tron 21f56aa969 Remove the statically initialized "sigaction" structure completely because
such usage is broken. Problem pointed out by Klaus Klein on
"sources-changes@netbsd.org".
2002-11-27 16:47:13 +00:00
tron f58cb59ba6 Add braces in a statically initialized "sigaction" structure to fix a
build problem after siginfo(2) has been added.
2002-11-27 14:44:46 +00:00
jdolecek b4f19b2d56 disable the code which maxes nofiles limit, it should not be normally
needed now
2001-05-14 21:52:21 +00:00
ross 1959d24b79 XXX
For some reason this program wants to open _hundreds_ of temporary files.
Make it setrlimit(RLIMIT_NOFILE, ...), so this rather dubious strategy at
least works well enough to ctag(1) our own kernel.
XXX
2001-04-30 00:25:09 +00:00
christos e56e039c8c - use MAXPATHLEN (1024) instead of _POSIX_PATH_MAX (255) for the temporary
path buffer
- provide better error messages about why the temp file creation is failing
- explicitly compare syscall return to -1 instead of < 0 and fdopen return
  to NULL instead of 0.
2001-02-22 22:45:49 +00:00
christos faf9e3e459 Fix problem when using sort >> foo
If no output file was specified sort fopened("/dev/stdout", "w").
This is *wrong* because "/dev/stdout" will truncate the output file,
thus undoing the append effect the shell had set up. The simple fix
here is to just arrange for outfp = stdout and don't play with /dev/stdout.

While I am here:
	- KNF
	- make pattern for mkstemp have 6 X's.
2001-02-21 19:24:30 +00:00
jdolecek aa9a452a75 full -T support 2001-02-19 15:53:07 +00:00
jdolecek 5347005ed0 resurrect old ftmp() - it supports alternative directory for temporary
file, which is needed for -T support
2001-02-19 15:45:45 +00:00
jdolecek f6b0d130db use -R instead of -w, since that's what OpenBSD is using and there is no reason
to be different
2001-02-07 20:58:09 +00:00
jdolecek 14b38a0855 Since -T is used to select directory for temporary files in other sort
implementations, we should avoid using it for something else.
Use (new) flag -w for setting record delimiter, make -T noop.
2001-02-07 20:31:44 +00:00
jdolecek 44f2c62649 use errx(), not err() within section for '-t' flag 2001-02-07 19:47:44 +00:00
soren ec09544572 And make usage() test for NULL explicitly.. 2001-01-13 20:21:56 +00:00
soren 7b5f324dcc usage() expects a NULL when there is no specific error message. 2001-01-13 20:20:47 +00:00
jdolecek 769f751499 save couple of cycles and bytes by static initialization of sigaction act
and sigtable[]
2001-01-13 11:19:41 +00:00
jdolecek 341955c93c alltable[], itable[], dtable[] were moved to init.c, g/c from sort.[ch]
put extern declaration for gweights[] to sort.h
add -s/-S to usage(), couple of formating nits
2001-01-12 19:41:12 +00:00
jdolecek 4a22141e02 the g/c in rev 1.12 was too aggressive - put back code
to change file '-' to '/dev/stdin'
2001-01-11 15:10:46 +00:00
jdolecek 1c216f18ea general cleanup of file list passing:
* get rid of union f_handle, replace by passing explicit int parameter
  and (new) struct filelist
* add new typedefs gen_func_t and put_func_t and use where appropriate
2001-01-11 14:05:24 +00:00
jdolecek d3a4171066 make ftmp() wrapper aroung tmpfile(), there is no need to reimplement it
move ftmp() from tmp.c to files.c
g/c no longer needed stuff
2001-01-08 19:16:49 +00:00
jdolecek 09bc2d58e8 call setlocale() on startup
reformat the switch contents in main() a little, sort flags by alphabet
where possible
2001-01-08 18:58:56 +00:00
jdolecek af3472c08c constify a bit, small cleanups 2001-01-08 18:35:49 +00:00
jdolecek e4de90b20d by default, use stable sort
add -S flag to switch to non-stable sort; for GNU sort compatibility,
provide -s flag too
2001-01-08 18:00:31 +00:00
jdolecek c468ddd4ad include a bit more information in error messages, constify
put temporary files in _PATH_TMP by default
2000-10-16 21:48:14 +00:00
thorpej 8035db5770 Format string fixes. 2000-10-11 19:16:39 +00:00
bjh21 2c3ef48b5d OpenBSD revision 1.5:
Normalize treatment of -n option.  Don't know why it was ever special-cased
(since it was broken that way).
2000-10-07 21:46:39 +00:00
bjh21 2594b10381 OpenBSD revision 1.3:
for implied stdin, do not corrupt argv[0]
2000-10-07 21:13:56 +00:00
bjh21 e8234e185c Part of OpenBSD revision 1.2:
Fix err(3) usage.
2000-10-07 21:12:19 +00:00
bjh21 e5218d1719 Two classes of changes from the initial OpenBSD commit of this sort(1):
FILE * variables are called "fp" rather than "fd".
Better (safer) temporary-file handling.
2000-10-07 20:37:06 +00:00
bjh21 6029888a3a Hit sort(1) with a hammer till it compiles.
Also add RCSIDs.
2000-10-07 18:37:09 +00:00
bjh21 1d5d9b5b60 4.4BSD-Lite2 contrib/sort 2000-10-07 16:39:34 +00:00