Commit Graph

27 Commits

Author SHA1 Message Date
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