Commit Graph

3464 Commits

Author SHA1 Message Date
Thomas Moestl
6c788325fa Use the macros from machine/fsr.h; some minor cleanups. 2002-09-14 18:07:03 +00:00
Thomas Moestl
8579151e4b Add implementations of fpgetmask(), fpgetround(), fpgetsticky(),
fpsetround(), fpsetsticky(), obtained from NetBSD and tweaked a little
to use definitions from machine/fsr.h instead of magic numbers.
2002-09-14 18:06:21 +00:00
Hajimu UMEMOTO
08c89c65eb Limit UDP payload size for EDNS0 to 0xffff, not use lower 16bit value.
Obtained from:	KAME
2002-09-14 17:28:40 +00:00
Jacques Vidrine
2e4dbbaa93 When using res_send/res_query/res_search, the caller must either
insure enough space is available for the response, or be prepared
to resize the buffer and retry as necessary.

Do the conservative thing and make sure enough space is available.

Reviewed by:	silence on freebsd-audit
2002-09-13 20:31:29 +00:00
Thomas Moestl
f085ae60c0 Add an implementation of fabs() (which is quite trivial).
When it is called directly, gcc is smart enough to generate inline
code for it, which is why it wasn't noticed before that it was missing.

fabs() would probably better fit into libm, but it has traditionally been
in libc on FreeBSD, so there is probably software around that makes
assumptions about this by now.
2002-09-13 16:01:26 +00:00
Tim J. Robbins
3a67d8efd0 Correct type of second argument: it is wchar_t ** restrict,
not wchar_t * restrict.
2002-09-12 09:25:27 +00:00
Archie Cobbs
0990061258 Update to reflect reality.
Reviewed by:	mini
MFC after:	3 days
2002-09-11 21:40:02 +00:00
Archie Cobbs
a892767bc4 Add man pages for getcontext()/setcontext(), makecontext()/swapcontext(),
and ucontext_t.

Reviewed by:	mini
MFC after:	3 days
2002-09-11 21:39:21 +00:00
Tim J. Robbins
47794211c8 Add an implementation of wcsftime() (wide character version of strftime()). 2002-09-11 08:57:11 +00:00
Mike Barcroft
a4a96c8166 Add `restrict' type-qualifier. 2002-09-11 05:05:48 +00:00
Archie Cobbs
a9f615db06 Adjust to reflect reality, which is that sigaltstack() takes stack_t *'s.
MFC after:	3 days
2002-09-10 21:06:51 +00:00
Garrett Wollman
eca67d5104 Implement C99's _Exit() interface.
Implement a version of qsort that provides a thunk to the comparison function.

Update manual pages.
2002-09-10 02:04:49 +00:00
Tim J. Robbins
5fd1762445 Add wcstol() and wcstoul(), based on strtol() and strtoul(). 2002-09-08 13:27:26 +00:00
Tim J. Robbins
8e4365cf75 Replace a stray reference to strtok() with one to wcstok(). 2002-09-08 11:09:24 +00:00
Garrett Wollman
f882c94f2b Fix a syntax error which causes an annoying warning. 2002-09-08 04:43:28 +00:00
Tim J. Robbins
9ad391340e Add an implementation of wcstok(), based on strtok_r(). 2002-09-07 08:16:57 +00:00
Juli Mallett
1bd5f7392d Two arrays were born from the same seeds, both grew into complementary sets
of pointers to strings.  These two arrays were fixed to the same size, but one
had an implicit zeroed trailer element, which was unused because the size was
used up by the ones before said zeroed trailer element.  So the unused limb was
chopped off the over-sized-but-not-over-sized array, and everyone lived happily
ever after.
2002-09-07 08:14:19 +00:00
Tim J. Robbins
85adcfc150 Sync prototypes with <wchar.h> with respect to the restrict qualifier. 2002-09-07 04:07:00 +00:00
Tim J. Robbins
9c261371ec Add restrict qualifiers where C99 permits them. All of these already had
restrict qualifiers on their prototypes in <wchar.h>.
2002-09-07 04:03:28 +00:00
Tim J. Robbins
91bd11ad84 Call strtok_r() via a libc private name from within strtok(). 2002-09-07 02:53:19 +00:00
Garrett Wollman
2c5db8c62d Include some verbage about not calling exit() from functions registered
by atexit().
2002-09-06 19:23:28 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Jake Burkholder
89172e2e25 Install the userland signal trampoline when sigaction is first called,
instead of on startup.  This fixes binary compatibility of dynamically
linked binaries from before the signal code move.

Suggested by:	wollman (a long time ago)
2002-09-03 14:55:29 +00:00
Peter Wemm
b331ec93c0 Fix a nasty bug exposed by mktime() when time_t is significantly bigger
than 32 bits.  It was trying to figure out things like the day of week
of when time_t is roughly 2^62 etc.  Make a better guess for the starting
point for the binary search that works on both 32 and 64 bit types.  I have
been using this for a while now.
2002-09-03 04:34:10 +00:00
Tim J. Robbins
f0c6c306f9 Set errno to EILSEQ when invalid multibyte sequences are detected
(XSI extension to 1003.1-2001).
2002-09-03 01:09:47 +00:00
Jake Burkholder
ae162f3f31 Use FOO(a) for macros with variadic args, instead of FOO(a,) or FOO(a, ).
Submitted by:	gcc3.2
2002-09-02 02:30:20 +00:00
Robert Drehmel
bc0ad8e7a1 - Let their manual pages show the reader that the bzero(3) and
bcopy(3) functions are prototyped in <strings.h> and not in
   <string.h> anymore.
 - Add a sentence about that to the respective HISTORY sections.
In the C source files:
 - Include <string.h> or <strings.h> depending on what function
   is to be compiled.
 - Use ANSI-C function definitions.
2002-09-01 21:53:46 +00:00
Tim J. Robbins
d384a6795d Typo: refer to MB_LEN_MAX instead of MB_CHAR_MAX (which does not exist). 2002-09-01 07:21:58 +00:00
Tim J. Robbins
9771f1e24e Add restrict qualifiers to the arguments of mbstowcs, mbtowc() and
wcstombs().
2002-09-01 07:08:22 +00:00
Mike Barcroft
800563c573 Fix a memory leak. 2002-09-01 01:49:27 +00:00
Tim J. Robbins
a5f76f1911 Implement the XSI extension which allows the destination string to be
NULL, and returns the number of bytes that would be required to store
the result of the conversion without storing anything.

PR:		17694
2002-08-31 14:16:12 +00:00
Tim J. Robbins
7438fc3aa8 Split ansi.c into a separate source file for each function. 2002-08-31 11:26:55 +00:00
Andrey A. Chernov
c14170612e Use ntohl() to read cnains number in new format 2002-08-31 01:05:39 +00:00
Robert Drehmel
2f4772b37f Add the 'restrict' type qualifier to the function prototype
of the swab(3) function in its manual page to match the
standardization by POSIX.1-2001.
2002-08-30 21:18:39 +00:00
Robert Drehmel
9abf5797a0 - Update the manual page of bcmp(3) by replacing
.In string.h
   with
     .In strings.h
   and adding a sentence to the HISTORY section.
 - Use an ANSI-C function definition.
 - Include <strings.h> instead of <string.h>.
 - Apply style(9): Put a space after return keywords.
2002-08-30 21:07:40 +00:00
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