jdolecek
8e730a41f8
this builds with WARNS=2
2003-03-20 16:15:28 +00:00
jdolecek
8cf8af1c13
get rid of one memmove() (not very significant)
...
remove ()'s from error messages
move some error checks immediatelly after appropriate realloc() calls
2003-03-20 16:13:03 +00:00
wiz
990562bfef
.Nm does not need a dummy argument ("") before punctuation or
...
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
perry
8a49ec08e4
"Utilize" has exactly the same meaning as "use," but it is more
...
difficult to read and understand. Most manuals of English style
therefore say that you should use "use".
2003-02-04 23:07:28 +00:00
wiz
c053751628
compatibility, not compatiblity.
2003-01-06 13:26:24 +00:00
jdolecek
63ae9a5e5f
make function merge() static in msort.c
...
cosmetic change to how local variable is incremented (moved to for(;;))
2002-12-25 21:19:15 +00:00
jdolecek
642aec9a6f
improve previous slightly - need >= (not just >) in CHECKFSTACK()
2002-12-24 15:15:01 +00:00
jdolecek
0f5341a33d
max_o in struct tempfile needs to be off_t
...
use fseeko() rather than fseek() when changing file offset using max_o
2002-12-24 15:09:27 +00:00
jdolecek
fed8f4c4a6
put contents of extern.h directly to sort.h, and g/c extern.h
...
de-__P()
2002-12-24 15:02:46 +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
b0a6f61876
make sure we don't attempt to write past end of fstack[], error out instead
...
this fixes second part ('tmpdir get smashed') of bin/18614 by Michael Graff
2002-12-24 14:43:37 +00:00
jdolecek
9208bb6e3a
add extern definition for ncols and clist[] to sort.h, eliminate extra
...
definitions in init.c and field.c
g/c MAXMERGE
2002-12-24 13:20:25 +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
jdolecek
b1eda372a4
simplify a bit (no need for separate 'char *path')
2002-12-23 20:14:26 +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
26eb814987
g/c extern reference to toutpath
2002-10-10 22:41:52 +00:00
enami
d945092654
Use the right file to output merge result.
2002-09-30 05:09:25 +00:00
ross
2a76afae02
Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
2002-02-08 01:36:18 +00:00
thorpej
2aa37f4ab3
Change some:
...
foo += sscanf(++foo, ...);
constructs to:
++foo;
foo += sscanf(foo, ...);
to avoid the following warning from gcc 3.1:
warning: operation on `pos' may be undefined
2001-12-31 18:45:04 +00:00
wiz
f2058cf3e4
Punctuation nits, sort SEE ALSO.
2001-12-08 19:16:07 +00:00
jdolecek
7fb961dd60
Only try to copy the extra incomplete record data if there is anything
...
actually read already. Albeit it's not damaging to copy zero data
for bufend == crec->data case, the buffer end could also be between
memory position 'crec' and 'crec->data'. Thus, we could end up with
negative 'bufend - crec->data' value, and obvious havoc.
This change fixes lib/12673, though the problem was masked and no longer
repeatable with the provided example after the recent buffer size bump.
The change was tested with the buffer size change backed off, and really
fixes the problem in the PR.
2001-05-15 11:49:25 +00:00
jdolecek
147b62f6bf
fsort(): rearrange the push code to reduce one level of intendation,
...
free keylist, buffer on end of work; no functional changes
2001-05-15 11:19:45 +00:00
jdolecek
266fc04d19
Make compilable with -Wshadow
2001-05-15 11:18:23 +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
jdolecek
231887cbb4
Bump the initial record buffer size to 1MB and allow it to grow to 8MB,
...
if needed and record count is within bounds (<MAXNUM), rather than
sorting the input by 64KB chunks. This cuts the number of needed
temporary files considerably (and improves performance, too).
Slighly adjust some #defines, mostly to power of 2 values.
This addresses bin/12673 and bin/12614, as well as complains from other
people.
2001-05-14 21:45:19 +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
fair
5f086f4804
Add cross references for qsort(3), and radixsort(3), per PR 10567
2001-03-16 07:37:58 +00:00
jdolecek
d906805397
Use MAXPATHLEN (which is 1024) instead of _POSIX_PATH_MAX (which is only 255).
...
This change tracks change in rev 1.25 of sort.c by Christos Zoulas.
While here, improve error messages slighly.
2001-02-23 08:59:49 +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
9c52662e24
fsort(): don't call append() with zero nelem
...
This fixes the 'sort -f /dev/null' coredump reported on current-users.
2001-02-20 18:33:09 +00:00
jdolecek
025b45e604
Pull in various cosmetic changes from OpenBSD version of this manpage - mostly
...
whitespace changes, which don't influence the layout of result manpage at all,
but also add -H to SYNOPSIS and state sort(1) appeared in v5, not v6 of
AT&T Unix.
2001-02-19 21:06:57 +00:00
jdolecek
affba8f2e9
Pull up various cosmetic (mostly whitespace) changes from OpenBSD.
...
This is primarily to ease syncing the two versions.
2001-02-19 20:50:17 +00:00
jdolecek
21928fdd78
enterfield(): test the buffer size BEFORE assignment also for the other code
...
branch, since we might get called with tablepos == endkey for some special
input files (where an record would happen to fit exactly to the input
buffer) - BTW, this bug looks like it has been here ~forever ...
This seems to fix the sort crash for 'make british' build of ispell package,
as reported by Mark White at current-users@.
2001-02-19 19:52:27 +00:00
jdolecek
c499b18924
enterkey():
...
* move the test for keybuf size before keypos[-1] assignment, "just in case"
* move the keypos assignment to improve readability
2001-02-19 19:41:31 +00:00
jdolecek
e1a2c672d7
oops - wrong file, backoff local test change
2001-02-19 19:39:53 +00:00
jdolecek
552af1f3f4
enterkey():
...
* move the test for keybuf size before keypos[-1] assignment, "just in case"
* move the keypos assignment to improve readability
2001-02-19 19:36:59 +00:00
jdolecek
7f547730fd
cosmetic changes - make keylist[] static and remove extern definition
...
in fsort.h, move macro SALIGN() from sort.h to fsort.c
2001-02-19 19:31:29 +00:00
jdolecek
0fbdf074b5
put tmp.c back to Makefile, too
2001-02-19 17:45:24 +00:00
jdolecek
32138e0376
document -T and TMPDIR handling
...
resurrect ENVIRONMENT and FILES, adjust to be more correct
slighly adjust SYNOPSIS line, so that it looks little nicer :)
2001-02-19 16:27:04 +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
1370376fed
move sections so that the order is more like the one specified by
...
mdoc.samples(7)
2001-02-07 21:13:36 +00:00
jdolecek
4f8a23e8ac
use -R instead -w, to be compatible with OpenBSD
2001-02-07 21:00:05 +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
eb6e724e72
s/-T/-w/
2001-02-07 20:32:57 +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