Commit Graph

194 Commits

Author SHA1 Message Date
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
David E. O'Brien
8fb3f3f682 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
Alexey Zelkin
bcbeac34ae * style(9)'fy
* declare prototype for __time_load_locale() in timelocal.h
2002-01-24 15:07:44 +00:00
Matthew Dillon
170ac683f2 I've been meaning to do this for a while. Add an underscore to the
time_to_xxx() and xxx_to_time() functions.  e.g. _time_to_xxx()
instead of time_to_xxx(), to make it more obvious that these are
stopgap functions & placemarkers and not meant to create a defacto
standard.  They will eventually be replaced when a real standard
comes out of committee.
2002-01-19 23:20:02 +00:00
Alexey Zelkin
52d6b43026 Add my e-mail to copyrights 2001-12-11 16:00:47 +00:00
Matthew Dillon
e8627df69d Add time_to_int(), int_to_time(), time_to_long(), long_to_time(). 2001-10-28 20:13:16 +00:00
Matthew Dillon
237c4e3a9e Add routines to convert time_t to/from fixed-bit fields. These routines
serve two purposes: (1) so we can maintain backwards compatibility with
protocols (rwhod, dump, etc...) that either assume time_t is 32 bits or
assume sizeof(time_t) == sizeof(int), or make other similar assumptions.
(2) To tag such routines (by the presence of these calls) for future
cleanup/extension work.

The 32->64 routine, time32_to_time() (when time_t is 64 bits, that is),
is defined specifically to implement temporal locality to properly set the
msb bits of a 64 bit time_t quantity, using the 50 year rule.  The locality
code has not been implemented yet (and doesn't need to be for a while),
but that is the intent.   This will allow us to maintain backwards protocol
compatibility past 2038.

These routines are intended to be platform and time_t agnostic.

MFC after:	1 week
2001-10-28 19:54:49 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov
c4d9468ea0 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Dima Dorfman
427fc5ed6f Recognize the %s format.
Submitted by:	Thomas Zenker <thz@lennartz-electronic.de> and
		    Maxim Konovalov <maxim@macomnet.ru>, respectively
Reviewed by:	-audit
2001-07-13 13:59:24 +00:00
Ruslan Ermilov
a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Dima Dorfman
70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Ruslan Ermilov
10ae6ece36 Document "normalizing" behavior of mktime(3).
PR:		bin/28313
Reviewed by:	bde, wollman
MFC after:	1 week
2001-06-23 08:57:40 +00:00
Garrett Wollman
80d444c883 Don't mung the user's tm_sec field if we don't need to. (Belt-and-suspenders
version.)

PR:		bin/27630
Submitted by:	Arthur David Olson <ado@nci.nih.gov>
Obtained from:	Timezone mailing-list <tz@elsie.nci.nih.gov>
MFC after:	1 month
2001-06-05 20:13:28 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Andrey A. Chernov
58dae109b5 Get rid of non-standard %E[Ff] formats, userland apps already fixed 2001-03-21 14:52:12 +00:00
Andrey A. Chernov
50b4c62c47 Oops, back out prev. change - POSIX require %y in d_fmt
Cosmetique - use exact POSIX string for %c
2001-03-21 14:12:37 +00:00
Andrey A. Chernov
e81765cbbc Replace %y with %Y 2001-03-21 13:55:09 +00:00
Andrey A. Chernov
16a7ebb62d Fix typo in the comment 2001-03-18 12:20:38 +00:00
Andrey A. Chernov
faeb1b822a Relax local FreeBSD restrictions on 3 chars abbrev. name length and %c format
since they not allows POSIXly legal locale data. Currently, if relaxed form
POSIXly legal locale data will be used right now, some programs will be broken,
but it means that either locale data or programs must be fixed, not the library.

Introduce non-standard md_order (month/day order) locale field to be used later
via nl_langinfo(). Currently %EF and %Ef emulated using this field, but they
planned for remove in future in favour of nl_langinfo() test field.

Implement %F per POSIX
2001-03-18 11:58:15 +00:00
Andrey A. Chernov
f7c5bca2ef Make 'A' and 'a', 'B' and 'b' the same, per POSIX 2001-03-18 08:41:06 +00:00
Andrey A. Chernov
50bab1e6fb Implement ampm_fmt (%r) per POSIX 2001-03-02 22:10:04 +00:00
Ruslan Ermilov
589a5e341f /^\.St/ s/-iso9945-1/-p1003.1-96/ 2001-02-26 14:48:38 +00:00
Ruslan Ermilov
588a200ce1 .St -ansiC -> .St -isoC 2001-02-26 13:23:47 +00:00
Kris Kennaway
d7422f2f19 Back out snprintf -> sprintf change until I have time to look at it. 2001-02-18 04:07:50 +00:00
Tor Egge
9f52fa8615 Don't depend on lcl_mutex being a recursive mutex.
Reviewed by:	deischen
2001-02-15 22:17:04 +00:00
Alexey Zelkin
39d2c772eb catch up to __part_load_locale() interface change 2001-02-13 15:32:21 +00:00
Alexey Zelkin
4e86238071 Rewrite __time_load_locale() using ldpart.c::__part_load_locale()
Reviewed by:	ache
2001-02-12 08:53:33 +00:00
Andrey A. Chernov
740972dc72 Hardcode c_fmt in a different way since used in nl_langinfo now 2001-02-08 20:55:38 +00:00
Alexey Zelkin
930cd71107 Catch up to latest chanage in timelocal structures exporting. 2001-02-08 17:08:13 +00:00
Alexey Zelkin
18f3e1e400 Export internal data structures in same manner as numeric/monetary/messages
structures exported.
Protect timelocal.h from multiple inclusions.
2001-02-08 17:06:37 +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
b77b3c00be mdoc(7) police: Ft/Vt now accept punctuation-type arguments. 2001-01-12 15:46:56 +00:00
Ruslan Ermilov
4263595653 Prepare for mdoc(7)NG. 2000-12-29 14:08:20 +00:00
Ruslan Ermilov
ed40311694 mdoc(7) police: removed history info from the .Os FreeBSD call. 2000-12-14 11:52:05 +00:00
Kris Kennaway
4b5e6561d3 sprintf -> snprintf 2000-11-26 09:05:40 +00:00
Nik Clayton
d4c5a1f678 Create the links for the reentrant time functions.
PR:		 docs/22644
Submitted by:	 andrew@ugh.net.au
2000-11-12 16:17:53 +00:00
Ruslan Ermilov
726b61ab5f Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
Andrey A. Chernov
a91655018d For %c replace reference to asctime(3) with ctime(3) from which %c genetically
originates
2000-10-26 22:11:11 +00:00
Andrey A. Chernov
aabf7d45a4 Treat c_fmt field as compatibility placeholder 2000-10-26 16:20:57 +00:00
Andrey A. Chernov
c877745700 Force "%c" to be ctime-compatible
Submitted by:	ru
2000-10-26 16:07:04 +00:00
Andrey A. Chernov
f0b22c7b6a Force %c to be "%a %Ef %T %Y" to eliminate problems with bad c_fmt
Submitted by:	ru
2000-10-26 14:22:41 +00:00
Andrey A. Chernov
a2e0cef1d5 Describe %c better
Submitted by:	ru (with modifications)
2000-10-24 15:37:48 +00:00
Kris Kennaway
dec5f6ac42 Correct factor-of-10 error in INT_STRLEN_MAXIMUM() calculation. 2000-08-04 11:03:20 +00:00
Andrey A. Chernov
849c64f5ff Fix assigning alt_month in compatibility code 2000-06-29 17:21:45 +00:00
Alexey Zelkin
25bb73e063 Introduce ".Lb" macro to libc manpages.
More libraries manpages updates following.
2000-04-21 09:42:15 +00:00
Martin Cracauer
6686e4fafb Temporary cosmetic change to prevent gcc-2.95.2 from doing an
optimization that generates code our current as doesn't understand.

The result is bad code that damages dynamic symbol locations at
runtime. Ouch. See PR bin/16862 and discussion in -current.

This change will be backed out when gcc and gas are back in sync.

PR:		Fixes bin/16862, but not the underlying problem.
Submitted by:	bde
Approved by:	jdk
2000-03-08 12:46:25 +00:00
Sheldon Hearn
c6ff3a1bf7 Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-02 09:14:21 +00:00
Joerg Wunsch
208b582201 There were so far only 42 different conversion specifications in
strftime(3), add another one. :)  %z yields the local timezone's offset
in hours and minutes, as used in RFC822 headers.  There's a precedence
for this in Lunux' libc, and Internet software (like Perl scripts)
start using it.

OKed by (wrt. the code freeze): jkh
2000-01-28 17:40:42 +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
4720c83e4d Make the quotes in the #include line visible. 2000-01-19 13:27:03 +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
Sheldon Hearn
ababc297fa Remove discussion of %C in the BUGS section. The limitations on valid
centuries are much more serious than those mentioned and this is not the
place to discuss the limitations of time_t.
1999-12-09 07:58:28 +00:00
Sheldon Hearn
398592ffe1 Prevent digit-gobbling for all but %l and %e, which can't be fixed.
Discuss in the BUGS section of the manpage, problems involved with
the use of %C, %e, %l, %p, %U and %W.

PR:		13901
Reported by:	scott@chronis.pobox.com
1999-12-08 15:49:10 +00:00
Sheldon Hearn
882f32c169 Accept 12 for %l, because it's logical to expect "%l:%M" to work for
"12:00" and because strftime(3) does the same.
1999-12-08 11:11:40 +00:00
Andrey A. Chernov
c63a4303ab %Ex -> %Ef to not conflict with POSIX
Add %EF (long months name / day order)
Check that O and E not intermixed
Add missing POSIX extension to example
1999-11-30 19:24:07 +00:00
Andrey A. Chernov
a36840a71a Document %Ex and %OB 1999-11-30 18:37:36 +00:00
Andrey A. Chernov
7ecd80de13 Stricter checking %A vs %a 1999-11-30 08:11:13 +00:00
Andrey A. Chernov
1d6c99412b Fix %C handling
Use locale for %c
Add %+
Add %Ex and %OB
1999-11-30 08:05:09 +00:00
Andrey A. Chernov
11cd0d3241 Add %Ex extension to determine "%e %b" or "%b %e" order
Separate alternative for O and E cases
1999-11-30 07:33:37 +00:00
Sheldon Hearn
33dbb0a630 Decremement by 1 the value taken for %j before assigning it to tm_yday,
which is zero-based.

Correct the range checking for the value taken for %S.

Add %w for the day of the week (0-6).

Accept (but do nothing with) %U and %W.  The comment for this change was
taken from NetBSD.

These changes were made after several failed attempts to contact the
author of our strptime.c .

PR:		10131
Submitted by:	tadf@kt.rim.or.jp (Tadayoshi Funaba)
1999-11-10 14:40:59 +00:00
Andrey A. Chernov
3c7ffaa1fe Add unsigned char cast to isupper 1999-11-04 04:40:56 +00:00
Dmitrij Tejblum
da3785ef12 Implement new format specifier for strftime: %OB, alternative national
representation of the full month name. In the Russian locale, this alternative
will be "nominative case", useful when the date designate month as a whole.
E.g. month heading in a calendar. I hope it can be useful for some other
locales too.

Discussed with:	wollman, ache
1999-09-11 21:35:21 +00:00
Alexey Zelkin
2c6dd93a11 Spelling and grammar error fix.
mdoc(7)'fy.

PR:		docs/13406
Submitted by:	Garret Woolman <woolman@khavrinen.lcs.mit.edu>
Reviewed by:	mpp
1999-09-04 15:56:51 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Chris Costello
ab9120cd42 Add $Id$ tag. 1999-08-14 07:59:58 +00:00
Chris Costello
823e5a6438 Bad reference time(2) changed to time(3) 1999-08-14 07:57:52 +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
David E. O'Brien
cb7a4779cb Make the new %Z addition thread-safe. 1999-07-06 05:05:39 +00:00
David E. O'Brien
b47f20df89 Actually impliment the documented %Z specifier. 1999-07-04 08:54:26 +00:00
Steve Price
7fb94d9a7c Spell the .St macro correctly.
PR:		11704
1999-06-07 03:59:56 +00:00
Wes Peters
aba0410b29 Re-fixed to start at 1969 per the actual Posix requirement. Also
fixed a typo on the man page.
1999-04-25 07:28:39 +00:00
Wes Peters
a00b1d8f7a Bring two-digit years up-to-date with POSIX requirements.
70-00 are intepreted in the 20th century; 01-69 in the
21st century.  (Yes, 2000 is the last year of the 20th
century, not the first year of the 21st.)

Submitted by:	Sergey Babkin <babkin@bellatlantic.net>
1999-04-25 01:42:18 +00:00
Garrett Wollman
6efae010ca Merge from vendor branch: timezone file structure changes and doco.
Fix localtime.c to deal with new magic number field.

Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode1999a.tar.gz
1999-01-21 17:22:59 +00:00
Dmitrij Tejblum
de16000123 Make ctime_r, asctime_r, gmtime_r, and localtime_r available in libc. 1999-01-04 20:45:20 +00:00
Garrett Wollman
600c04ff93 Add STANDARDS section.
s/bytes/characters/g to be consistent with Standard C terminology.
Update date and add RCS Id.
1999-01-03 01:07:41 +00:00
Garrett Wollman
5b9e6e493e Fix grammar in the description of timegm() by totally rewriting it. Remove
a potentally inflammatory comment from BUGS, and add a more useful comment
about the lack of reentrancy in the timezone-setting interface.
1999-01-03 00:35:31 +00:00
Wes Peters
a8e94191e8 Added documenation for the existing implementation of asctime_r,
ctime_r, gmtime_r, and localtime_r.
1998-12-20 06:22:06 +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
Dmitrij Tejblum
f0cefaccae Change return type of strptime from const char* to char*.
const char* was wrong and nonstandard.
1998-09-12 21:13:29 +00:00
Bruce Evans
c6966b0c4a Fixed printf format errors. Don't assume so many things about time_t.
Obtained from:	partial merge of ADO version tzcode96h (was fully merged
                in 1.10 but backed out in 1.11; the FreeBSD code for %s
		was earlier, prettier but buggier).
1998-06-30 16:49:47 +00:00
Daniel O'Callaghan
9b0662e646 Fix grammar, "null" -> "NUL" 1998-06-10 12:37:45 +00:00
John Birrell
cc4473c104 Remove 'of type long' from a sentence talking about four 4-byte values
because that is wrong on alpha.
1998-05-10 21:21:01 +00:00
Andrey A. Chernov
1e0b4d8238 Make asctime_r static if !_THREAD_SAFE to prevent namespace pollution and
prototype mismatch
1998-04-25 00:00:57 +00:00
Poul-Henning Kamp
4f6eb9ceed Add a #ifdef _THREAD_SAFE around ctime_r 1998-04-20 10:09:37 +00:00
Andrey A. Chernov
53b8d408ff Describe timegm() 1998-04-20 00:52:32 +00:00
Poul-Henning Kamp
3f643d87bb ctime_r and asctime_r are not implemented.
prototypes in time.h do not match POSIX.

PR:		6345
Reviewed by:	phk
Submitted by:	Dmitry Khrustalev <dima@xyzzy.machaon.ru>
1998-04-19 06:47:25 +00:00
John Birrell
5a2f1fed77 Change in name of the static initializer define. 1998-04-04 11:03:07 +00:00
Julian Elischer
39a9295edc Submitted by: Jeremy Allison (jallison@whistle.com)
fix a slight confusion about which draft of threads we are supporting.
this allows something as big and ugly as samba to be compiled with libc_r
and still work!  our user-level pthreads seems amazingly robust!
1998-02-18 01:20:33 +00:00
Wolfgang Helbig
60152ec531 Typo. 1997-10-26 10:37:35 +00:00
Bruce Evans
b966cc2394 Sorted lists. 1997-10-21 08:41:15 +00:00
Bruce Evans
2bc3b4d735 Removed the subdirectory paths from the definitions of MAN[1-9]. They
were a workaround for limitations in bsd.man.mk that were fixed about
2 years ago.
1997-10-15 16:16:41 +00:00
Wolfgang Helbig
b9b51fb731 Merged in better support of ISO 8601 from elsie.nci.nih.gov.
Added the conversion specifiers %g and %G, that are replaced
by the year which contains the greater part of the week in question.
1997-10-03 19:06:57 +00:00
Philippe Charnier
34384756cd environmental -> environment. 1997-09-18 06:55:21 +00:00
Andrey A. Chernov
f38ea584f5 Add unsigned char cast to all ctype calls 1997-08-13 13:11:53 +00:00
Joerg Wunsch
37486f035f Import strptime(3) into libc. We've got permission by Kevin Ruddy to
modify the original `no modifications' copyright message, and i've
included his mail into the source file.

The common localization functions between strptime(3) and strftime(3)
have been broken out into timelocal.[ch].
1997-08-09 15:43:59 +00:00
Joerg Wunsch
d76419833c Clean import of strptime(3) onto a vendor branch.
Submitted by:	Powerdog Industries <kevin.ruddy@powerdog.com>
1997-08-09 15:38:14 +00:00
Eivind Eklund
6ad98044a1 it's'' -> its'' where appropriate and typo fixes in time2posix.3.
Closes PR docs/3612.

Submitted by:	Josh Gilliam <soil@quick.net>
1997-05-19 16:33:27 +00:00
John Birrell
870039320f Changed all paths to be relative to src/lib instead of src/lib/libc
so that all these makefiles can be used to build libc_r too.

Added .if ${LIB} == "c" tests to restrict man page builds to libc
to avoid needlessly building them with libc_r too.

Split libc Makefile into Makefile and Makefile.inc to allow the
libc_r Makefile to include Makefile.inc too.
1997-05-03 03:50:06 +00:00