Commit Graph

9329 Commits

Author SHA1 Message Date
Konstantin Belousov
4176dd5267 Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.

Remove requirement for "sys/types.h" include for functions from manpage.

POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.

Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.

PR:	standards/142255
MFC after:	2 weeks
2010-01-04 15:40:17 +00:00
David E. O'Brien
bfc4c0cf08 Report lines that ought to contain a ':' operator but start with a '.'
as "Unknown directive" sinze they are more likely to be .elseif (etc).
(NetBSD PR 37222).

Obtained from:	NetBSD
2010-01-04 00:49:04 +00:00
David E. O'Brien
6100e6c2c9 Add check for subversion "original" marker. 2010-01-04 00:32:22 +00:00
Gavin Atkinson
9dfc434d60 Fix return code in the case of successful file transfer, broken in
tftp.c 1.13

PR:		bin/117452
Submitted by:	Spencer Minear  minear securecomputing.com
Approved by:	ed (mentor)
MFC after:	2 weeks
2010-01-03 13:48:58 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Ed Schouten
01cc221b4c Mute some warnings on uninitialized variables.
The code does the right thing, but the compiler is unable to figure it
out. All paths that use that variable use the same invariant.
2010-01-02 10:14:35 +00:00
Ed Schouten
d93708c3e6 Remove a warning by adding extra parentheses.
GCC generates warnings when using "if (foo = bar)". In this case its use
is valid.
2010-01-02 10:13:21 +00:00
Ed Schouten
b3c73ef101 Add missing #include for string routines. 2010-01-02 10:12:12 +00:00
Ed Schouten
ef636796f6 ANSIfy various tools in usr.bin/.
Most of these tools properly build at WARNS=6, except for their K&R
function declarations. Fix this, so we can bump WARNS as well.
2010-01-02 10:09:20 +00:00
Brooks Davis
a6fffd6cb0 The devices that supported EVFILT_NETDEV kqueue filters were removed in
r195175.  Remove all definitions, documentation, and usage.

fifo_misc.c:
	Remove all kqueue tests as fifo_io.c performs all those that
	would have remained.

Reviewed by:	rwatson
MFC after:	3 weeks
X-MFC note:	don't change vlan_link_state() function signature
2009-12-31 20:29:58 +00:00
Ruslan Ermilov
8181961a73 Treat an empty argument as an error, instead of fetching the
contents of the root directory.

MFC after:	1 week
2009-12-30 23:01:49 +00:00
Ed Schouten
a6c287f615 Let both yacc and lex generate code that passes -Wold-style-definition.
Both these tools emit code where several functions have no `void'
keyword placed in the arugment list when the function has no arguments.
2009-12-30 22:46:08 +00:00
Ed Schouten
10bc3a7f42 ANSIfy almost all applications that use WARNS=6.
I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.
2009-12-29 22:53:27 +00:00
Ed Schouten
8a036b7c03 Add missing `void' keyword. 2009-12-29 22:33:07 +00:00
Ed Schouten
645e7f1b9d Add missing `void' keyword. 2009-12-29 22:32:43 +00:00
Ed Schouten
0970727f4f Add missing `void' keyword for function without arguments. 2009-12-29 08:54:03 +00:00
Tim Kientzle
dc7c0661df ar only needs to support ar format. 2009-12-29 05:58:40 +00:00
Ed Schouten
70ad88f354 Migrate finger(1) away from <utmp.h>.
Unfortunately it also uses lastlog, which means we must resort to local
extensions of the utmpx-interface. Because the user name and TTY name
are now nul-terminated, there is no need to copy around strings as
often.
2009-12-28 20:54:34 +00:00
Ed Schouten
444999a314 Several refinements to libulog's API.
- Only set the fields in the ulog_utmpx structure that are valid for the
  command in question. This means that strings like "shutdown" or "~"
  are not visible to the user anymore.
- Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
  the `antique' filename. If we ever get rid of utmp, it makes little
  sense calling it by its old name.
2009-12-26 22:36:05 +00:00
Xin LI
e8406463e8 Fix grammar and reduce ambiguity.
Submitted by:	b. f. <bf1783 googlemail com>
2009-12-26 00:46:05 +00:00
Ed Schouten
b1625b09d9 Let the width of the username column depend on the rwho file format.
Right now the code uses UT_NAMESIZE, but this makes little sense,
because rwho(1) parses files generated by rwhod(8). Not utmp(5) files.
2009-12-25 20:07:48 +00:00
Xin LI
893d013cf6 Document the difference between FreeBSD and traditional System V killall
commands.

MFC after:	1 month
2009-12-25 10:01:35 +00:00
Ed Schouten
2b6d81c176 Allow proper tracing of posix_openpt(2). 2009-12-23 15:22:50 +00:00
Jaakko Heinonen
a49365ac09 Don't print the archive name with -p and -q options.
PR:		bin/141280
Approved by:	des, trasz (mentor)
2009-12-22 15:13:16 +00:00
Xin LI
13cf266e82 Plug a memory leak.
PR:		bin/141836
Submitted by:	Henning Petersen <henning.petersen at t-online.de>
MFC after:	2 weeks
2009-12-21 19:15:30 +00:00
Jaakko Heinonen
55a8d2bb22 Cast time_t values to intmax_t and use %jd with printf.
OK'ed by:	delphij
Approved by:	trasz (mentor)
2009-12-21 17:41:57 +00:00
Jaakko Heinonen
c059fa2e24 Remove non-working special case for pipe(2) from amd64-fbsd32.c and
i386-fbsd.c. Add pipe(2) to syscall table to decode it's pointer
argument properly and re-add special handling for pipe(2) return value
to print_syscall_ret().

PR:		bin/120870
Approved by:	trasz (mentor)
2009-12-21 17:38:13 +00:00
Dag-Erling Smørgrav
fcdb43ba01 Note that sockstat(1) does not display kernel-owned sockets.
Submitted by:	infofarmer@
MFC after:	2 weeks
2009-12-21 17:23:04 +00:00
Jaakko Heinonen
ecbb6d348f Avoid sharing the file descriptor of the output file with traced
processes by setting the FD_CLOEXEC flag for the output file.

PR:		bin/140493
Submitted by:	Erik Lax
OK'ed by:	delphij
Approved by:	trasz (mentor)
2009-12-20 11:00:53 +00:00
Jaakko Heinonen
76de696d6a Add fork(2), getegid(2), geteuid(2), getgid(2), getpid(2), getpgid(2),
getpgrp(2), getppid(2), getsid(2) and getuid(2) to syscall table to
decode their arguments correctly.

OK'ed by:	delphij
Approved by:	trasz (mentor)
2009-12-20 10:58:34 +00:00
Edwin Groothuis
d14ec16633 Nationalise Easter -> Pasen
MFC after:	1 week
2009-12-17 20:41:59 +00:00
Jaakko Heinonen
a8092021a0 Sync getline() with comm(1):
- Prevent overflowing of the buffer length variable in getline() by
   limiting its maximum value.
 - Exit if reallocf(3) fails in getline(). Failure was silently
   considered as end-of-file.

Reviewed by:	ghelmer
Approved by:	trasz (mentor)
2009-12-17 17:03:47 +00:00
Jaakko Heinonen
698f926389 The input line length limit mentioned on the manual page was removed by
r176119.

Approved by:	trasz (mentor)
2009-12-17 16:59:19 +00:00
Stanislav Sedov
4ee23f5ee8 - Partially revert r200417. config.h brings several definitions,
that appears to be actually used.  Without config.h included
  cross-build of world failed (at least for ARM).
2009-12-17 12:42:45 +00:00
Ralf S. Engelschall
a752c19301 rewind(3) is already declared to return 'void', so no need for an explicit cast 2009-12-17 08:42:44 +00:00
Ralf S. Engelschall
1e3249cb9b DEBUG is either defined or not defined for the 'calender' sources, so use #ifdef and not just #if -- both to be semantically correct and also to be aligned with the rest of the 'calendar' sources 2009-12-17 08:41:06 +00:00
Ralf S. Engelschall
9ed01df370 remove external reference to not (or at least no longer) existing variable 'myname' 2009-12-17 08:37:02 +00:00
Edwin Groothuis
58fe9c40b1 Add Australian, New Zealand and Ukraian calendars to the "all" target".
MFC after:	1 week
2009-12-17 07:18:06 +00:00
Jaakko Heinonen
e8861840c8 - Prevent overflowing of the buffer length variable in getline() by
limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
  considered as end-of-file.

Reviewed by:	ghelmer
Approved by:	trasz (mentor)
2009-12-16 14:34:48 +00:00
Xin LI
49ecc22cc7 Style improvements:
- Sort function prototypes;
 - Apply static on all function bodies.  To quote bde@:

> It is a good obfuscation to declare functions as static only in the
> prototype, so that you can't see the static for the actual function.
> The reverse obfuscation (with static only in the function definition)
> would make more sense, but is a constraint error.

Reviewed by:	bde
2009-12-14 16:54:39 +00:00
Xin LI
d993d09a6c - Remove times.h from C programs that does not manipulate with time at
all.
 - Remove pathnames.h from all but io.c since it's the only module that
   used these definations.
2009-12-13 04:50:11 +00:00
Xin LI
3cd983c5b9 egetopt.c does not use any stdlib.h definations, nor it referenced any
symbol from other module, so remove reference of stdlib.h and extern.h.

Verified with:	md5(1)
2009-12-13 04:34:51 +00:00
Xin LI
f449446e45 Use ANSI prototype for foldit(). 2009-12-13 04:14:55 +00:00
Xin LI
b4d09565cf xinstall.c does not require ctype functions, so ctype.h is not
necessary here.

Note: this would change the md5 checksum due to change caused
by different register layout.
2009-12-13 03:53:15 +00:00
Xin LI
820aa90f57 Staticify internal functions and make usage() a prototype. 2009-12-13 03:34:19 +00:00
Xin LI
7d0d4ebc83 Use prototype for usage(). 2009-12-13 03:18:37 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Jaakko Heinonen
d8eba599f5 Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.

Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.

Add regression tests for the cases. [1]

PR:		bin/140976
Submitted by:	D'Arcy Cain (original version) [1]
Approved by:	trasz (mentor)
2009-12-12 18:18:46 +00:00
Jaakko Heinonen
28c3507d53 The input line length limit mentioned on the manual page was removed by
r179374.

Approved by:	trasz (mentor)
2009-12-12 18:04:50 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00