Commit Graph

144 Commits

Author SHA1 Message Date
Andrey A. Chernov
96be743f80 According to Garrett, POSIX widely use -1 to indicate CHAR_MAX, so back out
all my "-1" -> "something" fixes and replace -1 with CHAR_MAX directly in
strtol() in cnv()
2001-02-10 03:31:23 +00:00
Andrey A. Chernov
d2712eafa7 Use __XSTRING(CHAR_MAX) instead of "127" and strtol() base 0 to parse it (0x7f) 2001-02-10 02:00:56 +00:00
Andrey A. Chernov
1506a668dc Correct myself a bit: situation is broken not for _all_ numeric LC_MONETARY,
LC_NUMERIC fields, but only for *grouping fields - other fields are converted
to a chars in localeconv(), so final change is:

"-1" -> "127"

127 here is because CHAR_MAX supposed, which is _positive_ (SUSv2 requirement),
not negative as 255. It is still a bit of hack. To find real CHAR_MAX will be
better to sprintf() it once somewhere in static buffer. *grouping parsing
still broken and missing and needs to be implemented.
2001-02-10 01:38:18 +00:00
Andrey A. Chernov
051f867fe1 NOTE: according to SUSV2 and other implementations, numeric elements in
LC_MONETARY, LC_NUMERIC are byte-arrays, not ASCII strings!

Fix "C" locale, change "-1" to {CHAR_MAX, '\0'} according to standards.

This is only partial fix - locale loading procedure remains broken as before
and load too big values for all locales.  All numeric strings there should be
converted with something like atoi() and placed into bytes.  Maybe I do it
later, if someone will not fix it faster.
2001-02-10 00:43:32 +00:00
Andrey A. Chernov
d0e2083fdd Implement CODESET 2001-02-09 22:43:39 +00:00
Andrey A. Chernov
634c946524 Back out attempt to implement CRNCYSTR - require additional prefixes according
to SUSV2. Add comment explaining it instead.
2001-02-09 18:39:17 +00:00
Andrey A. Chernov
218bcbcb4d Explicitly mark deprecated entries.
Return currency_symbol for CRNCYSTR
Return "%r" for T_FMT_AMPM
Remove obsoleted comment about c_fmt
Return "" for {YES,NO}STR
2001-02-09 18:16:12 +00:00
Alexey Zelkin
747a8b55e8 add lmonetary.?, lnumeric.?, ldpart.?, lmessages.?, nl_langinfo.c
remove lconv.c
2001-02-08 17:13:24 +00:00
Alexey Zelkin
60e1d74ff8 Add SUSv2 compatible nl_langinfo() function. It still need some work, but
this is already usable one.
2001-02-08 17:12:03 +00:00
Alexey Zelkin
e690a5563f Make localeconv() actual function. Now it will use LC_MONETARY/LC_NUMERIC
information to fill return structure. Remove unused anymore stub.
2001-02-08 17:03:01 +00:00
Alexey Zelkin
90423ececf Make FreeBSD locale support complete: add support for rest locale categories
LC_MONETARY, LC_NUMERIC and LC_MESSAGES. Remove stub functions since they
don't need anymore.

Reviewed by:	silence on -i18n
2001-02-08 16:58:53 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Daniel Eischen
d201fe46e3 Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
2001-01-24 13:01:12 +00:00
Ruslan Ermilov
4263595653 Prepare for mdoc(7)NG. 2000-12-29 14:08:20 +00:00
Ruslan Ermilov
c23155a43a mdoc(7) police: Er macro usage cleanup. 2000-11-22 16:02:00 +00:00
Kris Kennaway
b777873ec1 Disallow '/' characters in LC_* environment variables which might
be used to point to a bad locale file. This is only believed to be a
minor security risk - the only risk is if some program uses the result
of a localized string as a format specifier in a vulnerable function
like sprintf(). No such code is believed to exist in the FreeBSD base
system, although it is possible that badly written third party code
would do that.

Submitted by:	imp
Approved by:	ache
2000-09-08 07:29:48 +00:00
Warner Losh
12b92015dd The comparison against 0 should be against LC_ALL. category isn't a
boolean and it is LC_ALL that's special.

Someone submitted this to me a long time ago, but I can't find the
mail now.
2000-09-04 03:43:24 +00:00
Andrey A. Chernov
6ea9889255 fix comment 2000-07-07 08:24:50 +00:00
Andrey A. Chernov
3bc7ba9057 Describe agrument range correctly, according to multibyte(3)
Remove unneded comment
2000-07-03 13:03:15 +00:00
Andrey A. Chernov
8b96e6c916 Megre XPG4 code into libc 2000-06-03 12:24:08 +00:00
Alexey Zelkin
314c685440 mdoc related fixes:
. synchronize NAME and SYNOPSIS sections
. replace .Ev macros with .Dv / .Er / .Em macros  as mdoc(7)
  specification declare
2000-05-12 10:22:50 +00:00
Alexey Zelkin
25bb73e063 Introduce ".Lb" macro to libc manpages.
More libraries manpages updates following.
2000-04-21 09:42:15 +00:00
Andrey A. Chernov
70c1e1b6d9 Add comment after locales
Use .Li for type

Suggested-by: sheldonh
2000-04-12 18:38:30 +00:00
Andrey A. Chernov
199b1670eb Better wording according to multibyte(3)
Better man formatting
Add reference to multibyte(3)
2000-04-11 14:41:37 +00:00
Andrey A. Chernov
1c0a1964ab Back out valid argument domain change - sneak to this function by error.
Reword test condition better. Previous variant was true for negative
characters too.
2000-03-28 11:46:40 +00:00
Andrey A. Chernov
4c48fdaf53 Describe valid argument domain for 8-bit wide locales to prevent common error
calling ctype functions with signed char as an argument.
2000-03-28 11:36:31 +00:00
David E. O'Brien
f506ed7467 There is a problem in that one cannot use ctype.h at the same time as parts
of the C++ stdlib.  Our ctype.h uses symbols of the form _<X> to denote the
various character classes.  Our ctype.h also extends the usual ctype.h
offering by adding the "_T" (special) class.  Problem is parts of the STL
also use the symbol "_T" as its parameterized type.  These two uses are
incompatible.

Thus change the form of the symbols used in ctype to something that fixes
the current problem and is less likely to cause conflicts in the future.

Requested by:	Tomoaki NISHIYAMA <tomoaki@biol.s.u-tokyo.ac.jp>
Ok'ed by:	JKH
2000-02-08 07:43:26 +00:00
Jason Evans
9233c4d942 Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo().  In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate.  In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by:	deischen
2000-01-27 23:07:25 +00:00
Sheldon Hearn
99d751fbe3 Although it should be obvious that the 3-digit numeric values of the
characters shown are octal, state this explicitly for the easily
misled.
2000-01-19 16:21:05 +00:00
Jason Evans
929273386f Add three-tier symbol naming in support of POSIX thread cancellation
points.  For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep().  The arrows represent weak aliases.  For
system calls, the pattern is _read() <-- _libc_read() <-- read().
2000-01-12 09:23:48 +00:00
Tim Vanderhoek
b91cc296c8 Add .Xrefs to tolower.3 and toupper.3, respectively. 1999-12-28 14:10:21 +00:00
Alexey Zelkin
94da96bf18 Back up following macros by functions: ishexnumber, isideogram, isnumber,
isphonogram, isrune, isspecial. Fix ordering.

Reviewed by: bde
1999-12-17 15:12:21 +00:00
Alexey Zelkin
2835cc3b12 Correct "standard compilance" notes
Reminded by: bde
1999-12-14 10:35:09 +00:00
Andrey A. Chernov
5d1706df0d Fix dead loop if locale contains / and not all categories specified
PR:		14742
Submitted by:	peter@wahoo.com.tw
1999-11-09 11:09:16 +00:00
Alexey Zelkin
96648c2dc8 mdoc(7)'fy 1999-09-23 13:45:43 +00:00
Dmitrij Tejblum
e755fb7671 __collate_substitute() do something non-trivial only for German. For everyone
else, it is equivalent to strdup(). So, we will check if  the substitution
tables are trivial at the load time, and possibly save 2 calls to
__collate_substitute() in strcoll().

Still, __collate_substitute() should not exist.
1999-09-12 21:15:28 +00:00
Dmitrij Tejblum
03a7efc234 Reduce time of __collate_substitute() from O(strlen(s)^2) to O(strlen(s)).
Other minor optimizations. I got ~30% speedup in strcoll() for 50 char strings,
~40% speedup for 100 char strings, and unmeasurable speedup for 1M strings.

Collates are still terribly slow. To make them reasonable fast,
__collate_substitute() should be killed.
1999-09-12 19:42:38 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Nik Clayton
fbc400a67a Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:50:10 +00:00
Joseph Koshy
c6b8c5fe4b Correct troff sequence for backslashes in manual page.
PR:		docs/12322
Submitted by:   Marc Ramirez <mrami@gbtb.com>
1999-06-21 09:37:38 +00:00
Foxfair Hu
85484fbd41 PR: 10918
Submitted by:	Yung-Jen Hung <winard@u3717a.dorm.ccu.edu.tw>
Reviewed by:	bearscorp.bbs@bbs.life.nthu.edu.tw
_BIG5_sgetrune() in libc doesn't work well, this commit will fix it.
1999-05-07 13:24:58 +00:00
Guy Helmer
1e1d43cd38 Document ishexnumber, isideogram, isnumber, isphonogram, isrune,
and isspecial.

PR:		docs/9854
1999-04-29 21:54:20 +00:00
Warner Losh
dcb0ae4ed8 More egcs warning fixes:
o use braces to avoid potentially ambiguous else
	o don't default to type int (and also remove a useless register
	  modifier).
	o Use parens around assignment values used as truth values.
	o Remove unused function.

Reviewed by: obrien and chuckr
1999-04-25 22:29:30 +00:00
John Polstra
07963c8cbf Fix a macro name typo that made a word disappear. 1999-04-03 22:47:25 +00:00
Bruce Evans
ea28904cd5 Fixed tab lossage in previous commit. 1999-02-25 11:27:52 +00:00
Andrey A. Chernov
7a129df7d0 remove ctype.c - unused and confusing 1999-02-23 15:13:51 +00:00
Andrey A. Chernov
a4beee718b fix unsigned overflow
PR: 8437
1998-10-25 05:06:42 +00:00
Warner Losh
e8420087b0 Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x).  Per ANSI-C, this is
guaranteed to be the same thing.

I've been running these on my system here w/o ill effects for some
time.  However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes.  Shouldn't impact anything, but...
1998-09-16 04:17:47 +00:00
Wolfram Schneider
acd8019083 Sort cross references. 1998-08-31 16:41:09 +00:00
Poul-Henning Kamp
38a0ff129f Add missing #include of <sys.types.h> 1998-08-15 20:53:34 +00:00