Commit Graph

142 Commits

Author SHA1 Message Date
hubertf f2799c52e5 <ctype.h> is unused. What's still needed is <sys/cdefs.h> (which is
usually included at that place anyways).

From Slava Semushin <slava.semushin@gmail.com>.
2007-02-21 20:15:17 +00:00
jdolecek d1de60425b fix check for field order to allow .0 form in "-k 1.2,1.0"
fix provided in PR bin/25572 by Ross Patterson
2006-10-23 20:36:17 +00:00
jdolecek a2e8970e19 when using -o into file which already exists, copy the permissions
of the original file to the new (sorted) file

adresses PR bin/26860 by Michael van Elst
2006-10-23 19:53:25 +00:00
jdolecek bfa086e40a replace access(2) + /dev/ prefix check with lstat(2) and S_ISCHR()/S_ISBLK()
part of PR bin/26860 by Michael van Elst

while here, put output file fopen() inside the code block of the
only code path where it's actually needed, to make the logic more obvious;
and in the "stdout" case, initialize toutpath to empty string rather
then /dev/stdout, to make it clear /dev/stdout is not actually used
2006-10-23 19:39:54 +00:00
jdolecek 165c6691e1 use F_OK instead of 0 for second parameter of access(2)
part of PR bin/26860 by Michael van Elst
2006-10-23 19:11:46 +00:00
mrg f066626ffb char -> u_char in a couple of places to match other variables. 2006-05-11 19:16:42 +00:00
jmc e71965e518 Init some variables the compiler is complaining about and mark w. XXGCC as it
affects only m68k compilers.
2005-06-10 16:07:45 +00:00
he 90d4762740 Initialize a local variable to appease -Wuninitialized.
Marked with XXXGCC for pmppc (found while compiling for it).

Reviewed by lukem.
2005-06-07 09:51:34 +00:00
dsl e219d781d7 Add (unsigned char) cast to ctype functions 2004-11-03 20:10:08 +00:00
wiz 1919d4e949 Sync usage with man page. From Kouichirou Hiratsuka in PR 26278. 2004-07-23 13:26:11 +00:00
wiz 2389facffb Sort options in SYNOPSIS. From Kouichirou Hiratsuka in PR 26278. 2004-07-23 13:20:36 +00:00
heas 2a3d05aa4e Do not step over the edge of the buffer (check for '\0'). This just happens
to not lose on i386 because another buffer appears immediately following.
Regress tests all passed.
2004-03-14 21:12:14 +00:00
heas c68b80b9a5 remove double initialisation of SINGL_FLD & SEP_FLAG 2004-03-14 21:09:30 +00:00
jdolecek de243242be insertcol() may insert up to two items to clist, so allocate memory accordingly
this fixes sort regression test 28A and 28B
2004-02-18 20:44:36 +00:00
jdolecek c8e0ab671d fix parsing of some +POS -POS variants, as pointed out by sort regression
tests
2004-02-17 20:17:38 +00:00
jdolecek bf96399c09 initialize malloc()ated memory 2004-02-17 19:09:36 +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 909cd63c63 safer realloc idiom
minor knf
2004-02-17 02:31:33 +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 87c48f115e rewrite fixit() to duplicate less code, and comment the contents better;
also removes compile-time dependancy on ND constant
2004-02-15 14:19:22 +00:00
jdolecek 002b9278dc make sure zero is recognized as regular number in number(), and thus sorted
properly with -n
fixes PR bin/20259 by Giles Lean, PR bin/20542 by Peter Seebach, and
part of PR bin/24316 by MLH
2004-02-15 12:41:25 +00:00
jdolecek afac62bca7 g/c redundant setfield() prototype
clear setcolumn() somewhat - use strtol() instead of sscanf(), and
simplify flag setting code
2004-02-15 12:35:26 +00:00
jdolecek 95b7d83c21 fix -Wunitialized warnings 2004-02-15 11:54:17 +00:00
jdolecek 33f354551b fix some cases of use of unitialized variables 2004-02-15 11:52:12 +00:00
itojun ba02466ff9 KNF (mostly whitespace) 2003-10-18 03:03:20 +00:00
enami d182626b85 Test the value returned by realloc() rather than anything else. 2003-10-17 22:59:35 +00:00
itojun 50847da5c5 safer use of realloc 2003-10-16 06:56:17 +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
wiz 9e48dea8c5 Pa Ar -> Ar. 2003-06-27 09:15:55 +00:00
jdolecek f0f862a9f6 rename local macro blancmange() to SKIP_BLANKS(), to clarify what
it does and to better signal it might modify it's arguments
fixes PR bin/20546 by Peter Seebach
2003-04-09 09:30:40 +00:00
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