Commit Graph

3429 Commits

Author SHA1 Message Date
Andrey A. Chernov
cbc98d0541 Style fix 2002-08-30 20:39:53 +00:00
Robert Drehmel
c9ab23eea5 - Convert the function definition to declare its arguments
in the ANSI-C format.
 - Change the code a bit to hopefully save some cycles.
   I.e. (simplified) change

     a = b + 1;
     while (--b & 0x7)
	/* ... */
   to
     a = b;
     for (; b & 0x7; b--)
	/* ... */
   and
     while (--a >= 0)
	/* ... */
   to
     for (; a > 0; a--)
	/* ... */
 - Equip two function arguments of swab() with the 'restrict'
   type qualifier in form of the '__restrict' macro.  This is
   specified by POSIX.1-2001.
2002-08-30 20:33:05 +00:00
Andrey A. Chernov
8e52da4dfc Prepare for switching to unlimited chains format.
Optimize chains lookup a bit.
2002-08-30 20:26:02 +00:00
Robert Drehmel
425289a9db - Update the manual pages of index() and rindex() to show
<strings.h> as the associated header file.
   The prototypes have been moved there from <string.h> because
   POSIX.1-2001 said so.
 - Conditionally include either <strings.h> or <string.h> based
   on whether the [r]index() or str[r]chr() functions are
   compiled, respectively.
 - Style(9) tells us to
    - put a space after the return keyword
    - to check for a NUL character without using the ! operator.
    - use NULL instead of (type *)NULL where the compiler knows
      the type.
   Apply these rules.
 - Rather use ANSI-C function definitions than K&R ones.
 - For index(3), correct second function argument's type; it was
   declared to be a `const char' before and is now an `int'.
2002-08-30 19:42:07 +00:00
Robert Drehmel
554331bbb9 - Update the manual page to show that the associated header file
is <strings.h> and not <string.h> anymore.
 - Tell the reader about this change in the HISTORY section.
 - Switch to use an ANSI-C function definition.
 - Include <strings.h> instead of <string.h> in the source file.
2002-08-30 19:08:53 +00:00
Robert Drehmel
c271a3613c - Update strcasecmp(3)/strncasecmp(3) to reflect the fact that
the prototypes for both functions are now in the <strings.h>
   header, as required by IEEE Std 1003.1-2001.
 - Add one sentence about that in the HISTORY section.
 - Include <strings.h> in the source file to have the prototypes
   in scope when the _ANSI_SOURCE macro is defined.
2002-08-30 15:40:01 +00:00
Jens Schweikhardt
3dd657600a Print a '-' sign for negative zero. Tested with
#include <stdio.h>
	int main(void)
	{
		printf("%+f\n", -0.0);
		printf("%+f\n", +0.0);
		printf("%+f\n",  0.0);
		return 0;
	}

to output
-0.000000
+0.000000
+0.000000

PR:		bin/41823
Submitted by:	GOTO Kentaro <gotoken@notwork.org>
Liked by:	bde
MFC after:	3 weeks
2002-08-27 20:11:08 +00:00
Philippe Charnier
7fed38d0a0 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
John Polstra
c97c8f4a3c Fix a bug in __ivaliduser_sa() which caused some rsh/rlogin attempts
to fail needlessly if a reverse DNS lookup of the IP address didn't
come up with a hostname.  As a comment in the code clearly stated,
the "damn hostname" was looked up only for the purpose of netgroup
matching.  But if that lookup failed, the function bailed out
immediately even though in many cases netgroup matching would not
be used.

This change marks the hostname as unknown but continues.  Where
netgroup matching is performed, an unknown hostname is handled
conservatively.  I.e., for "+@netgroup" (accept) entries an unknown
hostname never matches, and for "-@netgroup" (reject) entries an
unknown hostname always matches.

In the lines affected (only), I also fixed a few bogus casts.  There
are others, and in fact this entire file would be a good candidate
for a cleanup sweep.

Reviewed by:	imp (wearing his flourescent yellow Security Team cap)
MFC after:	2 days
2002-08-24 17:37:42 +00:00
Mike Barcroft
7ab2cd8c38 Note that <sys/types.h> in no longer a prerequisite for <utime.h> and
<sys/mman.h>.
2002-08-24 00:39:43 +00:00
Marcel Moolenaar
31582c4e81 We cannot use an alloc with only inputs and/or locals. The kernel
assumes that the parameters are passed in output registers. Remove
the alloc entirely, but don't depend on the kernel not trashing
our registers.
2002-08-23 03:47:50 +00:00
Jim Pirzyk
69b0a4b6ac Fixed getaddrinfo to honor sortlist in /etc/resolv.conf
PR:		bin/27939
Reviewed by:	ru, sheldonh (about a year ago)
Obtained from:	ume (via KAME, I think)
MFC after:	1 month
2002-08-21 19:57:53 +00:00
Poul-Henning Kamp
bb7d71b99f s/EDOFUS/EDOOFUS/
Persuaded by:	Google
2002-08-21 17:11:00 +00:00
Mike Barcroft
abbd890233 o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +00:00
Tim J. Robbins
7d77551c77 Add a manual page for wcwidth(). 2002-08-20 03:42:21 +00:00
Tim J. Robbins
c8e804757d Add a manual page for wcswidth(). 2002-08-20 03:40:45 +00:00
Andrey A. Chernov
353450fbbe Move just committed version of wcswidth.c here (from "locale"),
a bit optimized now.
2002-08-20 02:06:28 +00:00
Andrey A. Chernov
c1a0a78d00 Remove wcswidth.c from here (and move it to "string") 2002-08-20 01:59:26 +00:00
Andrey A. Chernov
8077fafd28 Remove space at the end of continuation line in prev. commit 2002-08-20 01:16:06 +00:00
Bruce Evans
80ee2492c5 xdr.3 is added to MAN in ../xdr/Makefile.inc where it belongs, so don't
add it here.
2002-08-19 23:06:00 +00:00
Andrey A. Chernov
f999b4ba69 Implement wcswidth() 2002-08-19 20:46:10 +00:00
Andrey A. Chernov
1da6b56aca Use modern-style arguments declaration 2002-08-19 20:32:27 +00:00
Andrey A. Chernov
853c779d87 Write null wide-character as L'\0' like in other places 2002-08-19 20:12:38 +00:00
Andrey A. Chernov
1e2cd54448 According to SUSv2, always return 0 for null wide-character code 2002-08-19 18:06:18 +00:00
Juli Mallett
a10a751f68 s/trailing NULL/trailing NUL/ 2002-08-19 17:14:58 +00:00
Andrey A. Chernov
9424df445a Move internal defines from ctype.h here 2002-08-19 09:02:49 +00:00
Juli Mallett
6879bea818 Leave room for a trailing NUL not a NULL, that's not an ASCII character. 2002-08-19 03:52:36 +00:00
Tim J. Robbins
e92a3d83fc Implement the ISO C90 Amd.1 restartable wide and multibyte character
manipulation functions mbrlen(), mbrtowc(), mbsinit(), mbsrtowcs(),
wcrtomb(), wcsrtombs().
2002-08-18 06:30:10 +00:00
Andrey A. Chernov
d8d0cebecd Move wcwidth() to separate file, it doesn't belong to iswctype.c at all 2002-08-17 20:30:34 +00:00
Andrey A. Chernov
1c15ec1eab According to SUSv2, wcwidth() should return -1 for non-printing characters 2002-08-17 20:11:31 +00:00
Andrey A. Chernov
88c669d2ea Cosmetic - remove unneded brackets and #undef 2002-08-17 20:03:44 +00:00
Andrey A. Chernov
c87e6b26b0 wcwidth: fix espression to work correctly with SWIDTH0 2002-08-17 14:16:14 +00:00
Bosko Milekic
b8606fe660 Fix libc build breakage by defining FSTYPENAMES before including
disklabel.h; broken originally by 1.87 of sys/disklabel.h, which
made the split between DKTYPENAMES and FSTYPENAMES.
Someone who knows disklabel.c: do we still need DKTYPENAMES to be
defined here now?
2002-08-16 15:33:20 +00:00
Michael C . Wu
dff784192b Add iswctype wcwidth function code
Submitted by:	clkao@clkao.org
Reviewed by:	keichii
Obtained from:	NetBSD
MFC after:	1 month
2002-08-16 13:45:23 +00:00
Robert Drehmel
085f131a15 - Fix a bug that wrote one char behind the end of the
supplied buffer in case the size of it was equal to
   the number of characters the converted address consumed.
   The bug occurred when converting an AF_INET address.
 - Remove the SPRINTF macro and use sprintf instead.
 - Do not do string formatting using sprintf(3) and a
   temporary buffer which is copied when the supplied
   buffer provides enough space.  Instead, use snprintf(3)
   and the real destination buffer, thus avoid the copy.

Reported by:	Stefan Farfeleder <e0026813@stud3.tuwien.ac.at> (1)
PR:		misc/41289
2002-08-15 21:19:31 +00:00
Robert Drehmel
7cfcd02787 Put each function argument on its own line to keep lines shorter
than 80 columns.
2002-08-15 20:33:44 +00:00
Robert Drehmel
2caa6a5afe Use one line for each function argument to keep the line
width smaller than 80 columns.

Thanks to Ruslan for an explanation of multiple ways to
achieve this.
2002-08-15 18:57:57 +00:00
Bruce Evans
ea1df4b7bb Removed duplicated MLINKS which make(1) recently started warning about. 2002-08-15 12:31:01 +00:00
Robert Drehmel
b78411b153 Include <stdlib.h> to have abort() and exit() declared. 2002-08-15 11:58:24 +00:00
Robert Drehmel
f8418db73e - For compliance with IEEE Std 1003.1-2001, add the 'restrict'
qualifier to function prototypes and definitions where
   appropriate using the '__restrict' macro.
 - Update the manual page.
2002-08-15 10:28:52 +00:00
Robert Drehmel
71a00a449f - Introduce the 'restrict' qualifier to function prototypes and
definitions to comply with IEEE Std 1003.1-2001.
 - Update the manual pages.
2002-08-15 09:47:10 +00:00
Robert Drehmel
5618f72405 - Add the 'restrict' qualifier to the function prototypes and
definitions of the functions that convert strings to numbers
   and are defined by IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions for all of the functions
   mentioned above plus strtouq and strtoq.
 - Update the prototypes in the manual pages.
2002-08-15 09:25:04 +00:00
Robert Drehmel
3248d0a517 - Add the 'restrict' qualifier to the function definitions and
public prototypes of setbuf(3) and setvbuf(3) using the
   '__restrict' macro from <sys/cdefs.h> to be compliant with
   IEEE Std 1003.1-2001.
 - Replace the K&R with ANSI-C function definitions.
 - Bring the manual page up-to-date.
2002-08-14 23:45:42 +00:00
Robert Drehmel
620035ef89 - Add the 'restrict' qualifier to the function definition of
strftime(3) for IEEE Std 1003.1-2001 compliance and remove
   excessive usage of the 'const' qualifier that was neither
   present in the prototype in the publice header, nor in the
   local prototype just above the function definition.
 - Replace the K&R function definition with a ANSI-C one.
 - Update the prototype of strftime(3) in its manual page.
2002-08-14 23:20:48 +00:00
Robert Drehmel
ad90696815 - Add the 'restrict' qualifier to the definitions of the string
concatenation and copy functions using the '__restrict' macro.
   This is to satisfy IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions.
 - Add the 'restrict' keyword to the manual pages, too.
2002-08-14 22:59:22 +00:00
Robert Drehmel
d542f511a0 - Add the C99 'restrict' qualifier using the '__restrict' macro to
function prototype and definition of strptime(3).
 - Update the manual page.
2002-08-14 22:36:22 +00:00
Robert Drehmel
840b798c83 - Add the 'restrict' qualifier to match the IEEE Std 1003.1-2001
prototype of the tdelete(3) function.
 - Remove duplicated space.
 - Use an ANSI-C function definition for tdelete(3).
 - Update the manual page.
2002-08-14 21:16:41 +00:00
Robert Drehmel
33f9b60eee - Add the 'restrict' qualifier required by IEEE Std 1003.1-2001
to the function definition of strxfrm(3) in form of our
   '__restrict' macro.
 - Use an ANSI-C function definition for strxfrm(3).
 - Change the manual page accordingly.
2002-08-14 21:01:04 +00:00
Robert Drehmel
b7dbaf7b46 -Add the restrict required by IEEE Std 1003.1-2001 in form
of our __restrict macro to the prototypes and function
   definitions of inet_pton and inet_ntop.
 - Use ANSI-C function argument lists.
 - Adjust the prototypes in the manual page.
2002-08-14 20:40:35 +00:00
Poul-Henning Kamp
209c34ba95 Unbreak one of the most confusing breaks of the tree I've seen.
The last commit cannot possibly have been tested.
2002-08-13 18:55:51 +00:00