Index: head/lib/libc/Makefile =================================================================== --- head/lib/libc/Makefile (revision 2740) +++ head/lib/libc/Makefile (revision 2741) @@ -1,60 +1,61 @@ # @(#)Makefile 8.2 (Berkeley) 2/3/94 # # All library objects contain sccsid strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS # from CFLAGS below. To remove these strings from just the system call # stubs, remove just -DSYSLIBC_SCCS from CFLAGS. LIB=c CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS AINC= -I${.CURDIR}/${MACHINE} CLEANFILES+=tags INSTALL_PIC_ARCHIVE= yes PRECIOUSLIB= yes .include "${.CURDIR}/db/Makefile.inc" .include "${.CURDIR}/compat-43/Makefile.inc" .include "${.CURDIR}/gen/Makefile.inc" .include "${.CURDIR}/gmon/Makefile.inc" .include "${.CURDIR}/locale/Makefile.inc" .include "${.CURDIR}/net/Makefile.inc" .include "${.CURDIR}/quad/Makefile.inc" .include "${.CURDIR}/regex/Makefile.inc" .include "${.CURDIR}/stdio/Makefile.inc" .include "${.CURDIR}/stdlib/Makefile.inc" +.include "${.CURDIR}/stdtime/Makefile.inc" .include "${.CURDIR}/string/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/rpc/Makefile.inc" .include "${.CURDIR}/xdr/Makefile.inc" .if !defined(NO_YP_LIBC) CFLAGS+= -DYP .include "${.CURDIR}/yp/Makefile.inc" .endif .include "${.CURDIR}/${MACHINE}/sys/Makefile.inc" KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c KSRCS= bcmp.c ffs.c index.c mcount.c rindex.c strcat.c strcmp.c strcpy.c \ strlen.c strncpy.c libkern: libkern.gen libkern.${MACHINE} libkern.gen: ${KQSRCS} ${KSRCS} cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} /sys/libkern libkern.${MACHINE}:: ${KMSRCS} .if defined(KMSRCS) && !empty(KMSRCS) cp -p ${.ALLSRC} /sys/libkern/${MACHINE} .endif #beforeinstall: tags # install -c -o bin -g bin -m 444 tags /var/db/libc.tags tags: ${SRCS} ctags ${.ALLSRC:M*.c} egrep -o "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" ${.ALLSRC:M*.s} | \ sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ >> tags; sort -o tags tags .include Index: head/lib/libc/gen/Makefile.inc =================================================================== --- head/lib/libc/gen/Makefile.inc (revision 2740) +++ head/lib/libc/gen/Makefile.inc (revision 2741) @@ -1,96 +1,94 @@ # @(#)Makefile.inc 8.3 (Berkeley) 4/16/94 # machine-independent gen sources .PATH: ${.CURDIR}/${MACHINE}/gen ${.CURDIR}/gen SRCS+= alarm.c assert.c clock.c closedir.c confstr.c crypt.c ctermid.c \ - ctime.c daemon.c devname.c difftime.c disklabel.c err.c errlst.c \ + daemon.c devname.c disklabel.c err.c errlst.c \ exec.c fnmatch.c frexp.c fstab.c fts.c getbsize.c getcap.c getcwd.c \ getdomainname.c getgrent.c getgrouplist.c gethostname.c getloadavg.c \ getlogin.c getmntinfo.c getnetgrent.c getosreldate.c getpagesize.c \ getpass.c getpwent.c getttyent.c getusershell.c glob.c initgroups.c \ isatty.c nice.c nlist.c opendir.c pause.c popen.c psignal.c pwcache.c \ raise.c readdir.c rewinddir.c scandir.c seekdir.c setdomainname.c \ sethostname.c setjmperr.c setmode.c siginterrupt.c siglist.c signal.c \ sigsetjmp.c sigsetops.c sleep.c sysconf.c sysctl.c syslog.c telldir.c \ termios.c time.c times.c timezone.c ttyname.c ttyslot.c ualarm.c \ uname.c unvis.c usleep.c utime.c valloc.c vis.c wait.c wait3.c \ waitpid.c msgctl.c msgget.c msgrcv.c msgsnd.c semconfig.c semctl.c \ semget.c semop.c shmat.c shmctl.c shmdt.c shmget.c # machine-dependent gen sources .include "${.CURDIR}/${MACHINE}/gen/Makefile.inc" .if (${MACHINE} == "tahoe" || ${MACHINE} == "vax") errlst.o errlst.po: ${CC} -S ${CFLAGS} ${.IMPSRC} ed - < ${.CURDIR}/${MACHINE}/:errfix errlst.s ${AS} -o ${.TARGET} errlst.s rm -f errlst.s .endif MAN3+= gen/alarm.3 gen/clock.3 gen/confstr.3 gen/crypt.3 gen/ctermid.3 \ - gen/ctime.3 gen/daemon.3 gen/devname.3 gen/directory.3 gen/err.3 \ + gen/daemon.3 gen/devname.3 gen/directory.3 gen/err.3 \ gen/exec.3 gen/fnmatch.3 gen/frexp.3 gen/fts.3 gen/getbsize.3 \ gen/getcap.3 gen/getcwd.3 gen/getdiskbyname.3 gen/getfsent.3 \ gen/getgrent.3 gen/getgrouplist.3 gen/gethostname.3 gen/getloadavg.3 \ gen/getmntinfo.3 gen/getnetgrent.3 gen/getpagesize.3 gen/getpass.3 \ gen/getpwent.3 gen/getttyent.3 gen/getusershell.3 gen/glob.3 \ gen/initgroups.3 gen/isinf.3 gen/ldexp.3 gen/modf.3 gen/nice.3 \ gen/nlist.3 gen/pause.3 gen/popen.3 gen/psignal.3 gen/pwcache.3 \ gen/raise.3 gen/scandir.3 gen/setjmp.3 gen/setmode.3 \ gen/siginterrupt.3 gen/signal.3 gen/sigsetops.3 gen/sleep.3 \ gen/sysconf.3 gen/sysctl.3 gen/syslog.3 gen/tcgetpgrp.3 \ gen/tcsendbreak.3 gen/tcsetattr.3 gen/tcsetpgrp.3 gen/time.3 \ gen/times.3 gen/timezone.3 gen/ttyname.3 gen/tzset.3 gen/ualarm.3 \ gen/uname.3 gen/unvis.3 gen/usleep.3 gen/utime.3 gen/valloc.3 gen/vis.3 MLINKS+=crypt.3 encrypt.3 crypt.3 setkey.3 -MLINKS+=ctime.3 asctime.3 ctime.3 difftime.3 ctime.3 gmtime.3 \ - ctime.3 localtime.3 ctime.3 mktime.3 MLINKS+=directory.3 closedir.3 directory.3 dirfd.3 directory.3 opendir.3 \ directory.3 readdir.3 directory.3 rewinddir.3 directory.3 seekdir.3 \ directory.3 telldir.3 MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 execv.3 \ exec.3 execvp.3 MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \ err.3 warnx.3 err.3 vwarnx.3 MLINKS+=isinf.3 isnan.3 MLINKS+=getcap.3 cgetcap.3 getcap.3 cgetclose.3 getcap.3 cgetent.3 \ getcap.3 cgetfirst.3 getcap.3 cgetmatch.3 getcap.3 cgetnext.3 \ getcap.3 cgetnum.3 getcap.3 cgetset.3 getcap.3 cgetstr.3 \ getcap.3 cgetustr.3 MLINKS+=getcwd.3 getwd.3 MLINKS+=getfsent.3 endfsent.3 getfsent.3 getfsfile.3 getfsent.3 getfsspec.3 \ getfsent.3 getfstype.3 getfsent.3 setfsent.3 MLINKS+=getgrent.3 endgrent.3 getgrent.3 setgroupent.3 getgrent.3 getgrgid.3 \ getgrent.3 getgrnam.3 getgrent.3 setgrent.3 getgrent.3 setgrfile.3 MLINKS+=gethostname.3 sethostname.3 MLINKS+=getnetgrent.3 endnetgrent.3 getnetgrent.3 setnetgrent.3 \ getnetgrent.3 innetgr.3 MLINKS+=getpwent.3 endpwent.3 getpwent.3 setpassent.3 getpwent.3 getpwnam.3 \ getpwent.3 getpwuid.3 getpwent.3 setpwent.3 getpwent.3 setpwfile.3 MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 getttyent.3 setttyent.3 MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3 MLINKS+=glob.3 globfree.3 MLINKS+=popen.3 pclose.3 MLINKS+=psignal.3 sys_siglist.3 MLINKS+=pwcache.3 user_from_uid.3 pwcache.3 group_from_gid.3 MLINKS+=scandir.3 alphasort.3 MLINKS+=setjmp.3 _longjmp.3 setjmp.3 _setjmp.3 setjmp.3 longjmp.3 \ setjmp.3 longjmperr.3 setjmp.3 longjmperror.3 \ setjmp.3 sigsetjmp.3 setjmp.3 siglongjmp.3 MLINKS+=setmode.3 getmode.3 MLINKS+=sigsetops.3 sigemptyset.3 sigsetops.3 sigfillset.3 \ sigsetops.3 sigaddset.3 sigsetops.3 sigdelset.3 \ sigsetops.3 sigismember.3 MLINKS+=syslog.3 closelog.3 syslog.3 openlog.3 syslog.3 setlogmask.3 \ syslog.3 vsyslog.3 MLINKS+=tcsendbreak.3 tcdrain.3 tcsendbreak.3 tcflush.3 tcsendbreak.3 tcflow.3 MLINKS+=tcsetattr.3 tcgetattr.3 tcsetattr.3 cfsetospeed.3 \ tcsetattr.3 cfgetospeed.3 tcsetattr.3 cfgetispeed.3 \ tcsetattr.3 cfsetispeed.3 tcsetattr.3 cfsetspeed.3 \ tcsetattr.3 cfmakeraw.3 MLINKS+=ttyname.3 isatty.3 ttyname.3 ttyslot.3 MLINKS+=tzset.3 tzsetwall.3 MLINKS+=vis.3 strvis.3 vis.3 strvisx.3 Index: head/lib/libc/stdtime/Makefile.inc =================================================================== --- head/lib/libc/stdtime/Makefile.inc (revision 2740) +++ head/lib/libc/stdtime/Makefile.inc (revision 2741) @@ -1,9 +1,10 @@ -# $Id$ +# $Id: Makefile.inc,v 1.1 1994/09/13 03:50:55 wollman Exp $ -SRCS+= stdtime/asctime.c stdtime/localtime.c stdtime/strftime.c \ - stdtime/difftime.c -MAN5+= tzfile.5 +.PATH: ${.CURDIR}/stdtime -CFLAGS+= -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DSTD_INSPIRED -DPCTS -CFLAGS+= -DHAVE_LONG_DOUBLE -DTZDIR=\"/usr/share/zoneinfo\" +SRCS+= asctime.c localtime.c strftime.c difftime.c +MAN5+= stdtime/tzfile.5 +MAN3+= stdtime/ctime.3 stdtime/strftime.3 stdtime/time2posix.3 +MLINKS+=ctime.3 asctime.3 ctime.3 difftime.3 ctime.3 gmtime.3 \ + ctime.3 localtime.3 ctime.3 mktime.3 Index: head/lib/libc/stdtime/ctime.3 =================================================================== --- head/lib/libc/stdtime/ctime.3 (nonexistent) +++ head/lib/libc/stdtime/ctime.3 (revision 2741) @@ -0,0 +1,258 @@ +.\" Copyright (c) 1989, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" Arthur Olson. +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)ctime.3 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 4, 1993 +.Dt CTIME 3 +.Os BSD 4.3 +.Sh NAME +.Nm asctime , +.Nm ctime , +.Nm difftime , +.Nm gmtime , +.Nm localtime , +.Nm mktime +.Nd transform binary date and time value to +.Tn ASCII +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Vt extern char *tzname[2]; +.Ft char * +.Fn ctime "const time_t *clock" +.Ft double +.Fn difftime "time_t time1" "time_t time0" +.Ft char * +.Fn asctime "const struct tm *tm" +.Ft struct tm * +.Fn localtime "const time_t *clock" +.Ft struct tm * +.Fn gmtime "const time_t *clock" +.Ft time_t +.Fn mktime "struct tm *tm" +.Sh DESCRIPTION +The functions +.Fn ctime , +.Fn gmtime +and +.Fn localtime +all take as an argument a time value representing the time in seconds since +the Epoch (00:00:00 +.Tn UTC , +January 1, 1970; see +.Xr time 3 ) . +.Pp +The function +.Fn localtime +converts the time value pointed at by +.Fa clock , +and returns a pointer to a +.Dq Fa struct tm +(described below) which contains +the broken-out time information for the value after adjusting for the current +time zone (and any other factors such as Daylight Saving Time). +Time zone adjustments are performed as specified by the +.Ev TZ +environmental variable (see +.Xr tzset 3 ) . +The function +.Fn localtime +uses +.Xr tzset +to initialize time conversion information if +.Xr tzset +has not already been called by the process. +.Pp +After filling in the tm structure, +.Fn localtime +sets the +.Fa tm_isdst Ns 'th +element of +.Fa tzname +to a pointer to an +.Tn ASCII +string that's the time zone abbreviation to be +used with +.Fn localtime Ns 's +return value. +.Pp +The function +.Fn gmtime +similarly converts the time value, but without any time zone adjustment, +and returns a pointer to a tm structure (described below). +.Pp +The +.Fn ctime +function +adjusts the time value for the current time zone in the same manner as +.Fn localtime , +and returns a pointer to a 26-character string of the form: +.Bd -literal -offset indent +Thu Nov 24 18:22:48 1986\en\e0 +.Ed +.Pp +All the fields have constant width. +.Pp +The +.Fn asctime +function +converts the broken down time in the structure +.Fa tm +pointed at by +.Fa *tm +to the form +shown in the example above. +.Pp +The function +.Fn mktime +converts the broken-down time, expressed as local time, in the structure +pointed to by tm into a time value with the same encoding as that of the +values returned by the +.Xr time 3 +function, that is, seconds from the Epoch, +.Tn UTC . +.Pp +The original values of the +.Fa tm_wday +and +.Fa tm_yday +components of the structure are ignored, and the original values of the +other components are not restricted to their normal ranges. +(A positive or zero value for +.Fa tm_isdst +causes +.Fn mktime +to presume initially that summer time (for example, Daylight Saving Time) +is or is not in effect for the specified time, respectively. +A negative value for +.Fa tm_isdst +causes the +.Fn mktime +function to attempt to divine whether summer time is in effect for the +specified time.) +.Pp +On successful completion, the values of the +.Fa tm_wday +and +.Fa tm_yday +components of the structure are set appropriately, and the other components +are set to represent the specified calendar time, but with their values +forced to their normal ranges; the final value of +.Fa tm_mday +is not set until +.Fa tm_mon +and +.Fa tm_year +are determined. +.Fn Mktime +returns the specified calendar time; if the calendar time cannot be +represented, it returns \-1; +.Pp +The +.Fn difftime +function +returns the difference between two calendar times, +.Pf ( Fa time1 +- +.Fa time0 ) , +expressed in seconds. +.Pp +External declarations as well as the tm structure definition are in the +.Aq Pa time.h +include file. +The tm structure includes at least the following fields: +.Bd -literal -offset indent +int tm_sec; /\(** seconds (0 - 60) \(**/ +int tm_min; /\(** minutes (0 - 59) \(**/ +int tm_hour; /\(** hours (0 - 23) \(**/ +int tm_mday; /\(** day of month (1 - 31) \(**/ +int tm_mon; /\(** month of year (0 - 11) \(**/ +int tm_year; /\(** year \- 1900 \(**/ +int tm_wday; /\(** day of week (Sunday = 0) \(**/ +int tm_yday; /\(** day of year (0 - 365) \(**/ +int tm_isdst; /\(** is summer time in effect? \(**/ +char \(**tm_zone; /\(** abbreviation of timezone name \(**/ +long tm_gmtoff; /\(** offset from UTC in seconds \(**/ +.Ed +.Pp +The +field +.Fa tm_isdst +is non-zero if summer time is in effect. +.Pp +The field +.Fa tm_gmtoff +is the offset (in seconds) of the time represented from +.Tn UTC , +with positive +values indicating east of the Prime Meridian. +.Sh SEE ALSO +.Xr date 1 , +.Xr gettimeofday 2 , +.Xr getenv 3 , +.Xr time 3 , +.Xr tzset 3 , +.Xr tzfile 5 +.Sh HISTORY +This manual page is derived from +the time package contributed to Berkeley by +Arthur Olsen and which appeared in +.Bx 4.3 . +.Sh BUGS +Except for +.Fn difftime +and +.Fn mktime , +these functions leaves their result in an internal static object and return +a pointer to that object. Subsequent calls to these +function will modify the same object. +.Pp +The +.Fa tm_zone +field of a returned tm structure points to a static array of characters, +which will also be overwritten by any subsequent calls (as well as by +subsequent calls to +.Xr tzset 3 +and +.Xr tzsetwall 3 ) . +.Pp +Use of the external variable +.Fa tzname +is discouraged; the +.Fa tm_zone +entry in the tm structure is preferred. +.Pp +Avoid using out-of-range values with +.Fn mktime +when setting up lunch with promptness sticklers in Riyadh. Property changes on: head/lib/libc/stdtime/ctime.3 ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/lib/libc/stdtime/private.h =================================================================== --- head/lib/libc/stdtime/private.h (revision 2740) +++ head/lib/libc/stdtime/private.h (revision 2741) @@ -1,185 +1,195 @@ #ifndef PRIVATE_H #define PRIVATE_H +/* Stuff moved from Makefile.inc to reduce clutter */ +#ifndef TM_GMTOFF +#define TM_GMTOFF tm_gmtoff +#define TM_ZONE tm_zone +#define STD_INSPIRED 1 +#define PCTS 1 +#define HAVE_LONG_DOUBLE 1 +#define TZDIR "/usr/share/zoneinfo" +#endif /* ndef TM_GMTOFF */ + /* ** This header is for use ONLY with the time conversion code. ** There is no guarantee that it will remain unchanged, ** or that it will remain at all. ** Do NOT copy it to any system include directory. ** Thank you! */ /* ** ID */ #ifndef lint #ifndef NOID static char privatehid[] = "@(#)private.h 7.5"; #endif /* !defined NOID */ #endif /* !defined lint */ /* ** const */ #ifndef const #ifndef __STDC__ #define const #endif /* !defined __STDC__ */ #endif /* !defined const */ /* ** void */ #ifndef void #ifndef __STDC__ #ifndef vax #ifndef sun #define void char #endif /* !defined sun */ #endif /* !defined vax */ #endif /* !defined __STDC__ */ #endif /* !defined void */ /* ** P((args)) */ #ifndef P #ifdef __STDC__ #define P(x) x #endif /* defined __STDC__ */ #ifndef __STDC__ #define ASTERISK * #define P(x) ( /ASTERISK x ASTERISK/ ) #endif /* !defined __STDC__ */ #endif /* !defined P */ /* ** genericptr_t */ #ifdef __STDC__ typedef void * genericptr_t; #endif /* defined __STDC__ */ #ifndef __STDC__ typedef char * genericptr_t; #endif /* !defined __STDC__ */ #include "sys/types.h" /* for time_t */ #include "stdio.h" #include "ctype.h" #include "errno.h" #include "string.h" #include "limits.h" /* for CHAR_BIT */ #ifndef _TIME_ #include "time.h" #endif /* !defined _TIME_ */ #ifndef remove extern int unlink P((const char * filename)); #define remove unlink #endif /* !defined remove */ #ifndef FILENAME_MAX #ifndef MAXPATHLEN #ifdef unix #include "sys/param.h" #endif /* defined unix */ #endif /* !defined MAXPATHLEN */ #ifdef MAXPATHLEN #define FILENAME_MAX MAXPATHLEN #endif /* defined MAXPATHLEN */ #ifndef MAXPATHLEN #define FILENAME_MAX 1024 /* Pure guesswork */ #endif /* !defined MAXPATHLEN */ #endif /* !defined FILENAME_MAX */ #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif /* !defined EXIT_SUCCESS */ #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif /* !defined EXIT_FAILURE */ #ifdef __STDC__ #define alloc_size_t size_t #define qsort_size_t size_t #define fwrite_size_t size_t #endif /* defined __STDC__ */ #ifndef __STDC__ #ifndef alloc_size_t #define alloc_size_t unsigned #endif /* !defined alloc_size_t */ #ifndef qsort_size_t #ifdef USG #define qsort_size_t unsigned #endif /* defined USG */ #ifndef USG #define qsort_size_t int #endif /* !defined USG */ #endif /* !defined qsort_size_t */ #ifndef fwrite_size_t #define fwrite_size_t int #endif /* !defined fwrite_size_t */ #ifndef USG extern char * sprintf P((char * buf, const char * format, ...)); #endif /* !defined USG */ #endif /* !defined __STDC__ */ /* ** Ensure that these are declared--redundantly declaring them shouldn't hurt. */ extern char * getenv P((const char * name)); extern genericptr_t malloc P((alloc_size_t size)); extern genericptr_t calloc P((alloc_size_t nelem, alloc_size_t elsize)); extern genericptr_t realloc P((genericptr_t oldptr, alloc_size_t newsize)); #ifdef USG extern void exit P((int s)); extern void qsort P((genericptr_t base, qsort_size_t nelem, qsort_size_t elsize, int (*comp)())); extern void perror P((const char * string)); extern void free P((char * buf)); #endif /* defined USG */ #ifndef TRUE #define TRUE 1 #endif /* !defined TRUE */ #ifndef FALSE #define FALSE 0 #endif /* !defined FALSE */ #ifndef INT_STRLEN_MAXIMUM /* ** 302 / 1000 is log10(2.0) rounded up. ** Subtract one for the sign bit; ** add one for integer division truncation; ** add one more for a minus sign. */ #define INT_STRLEN_MAXIMUM(type) \ ((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2) #endif /* !defined INT_STRLEN_MAXIMUM */ /* ** UNIX is a registered trademark of AT&T. ** VAX is a trademark of Digital Equipment Corporation. */ #endif /* !defined PRIVATE_H */ Index: head/lib/libc/stdtime/strftime.3 =================================================================== --- head/lib/libc/stdtime/strftime.3 (nonexistent) +++ head/lib/libc/stdtime/strftime.3 (revision 2741) @@ -0,0 +1,186 @@ +.\" Copyright (c) 1989, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" the American National Standards Committee X3, on Information +.\" Processing Systems. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)strftime.3 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 4, 1993 +.Dt STRFTIME 3 +.Os +.Sh NAME +.Nm strftime +.Nd format date and time +.Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include +.Ft size_t +.Fn strftime "char *buf" "size_t maxsize" "const char *format" "const struct tm *timeptr" +.Sh DESCRIPTION +The +.Fn strftime +function formats the information from +.Fa timeptr +into the buffer +.Fa buf +according to the string pointed to by +.Fa format . +.Pp +The +.Fa format +string consists of zero or more conversion specifications and +ordinary characters. +All ordinary characters are copied directly into the buffer. +A conversion specification consists of a percent sign +.Dq Ql % +and one other character. +.Pp +No more than +.Fa maxsize +characters will be placed into the array. +If the total number of resulting characters, including the terminating +null character, is not more than +.Fa maxsize , +.Fn strftime +returns the number of characters in the array, not counting the +terminating null. +Otherwise, zero is returned. +.Pp +Each conversion specification is replaced by the characters as +follows which are then copied into the buffer. +.Bl -tag -width "xxxx" +.It Cm \&%A +is replaced by the full weekday name. +.It Cm %a +is replaced by the abbreviated weekday name, where the abbreviation +is the first three characters. +.It Cm \&%B +is replaced by the full month name. +.It Cm %b or %h +is replaced by the abbreviated month name, where the abbreviation is +the first three characters. +.It Cm \&%C +is equivalent to +.Dq Li %a %b %e %H:%M:%S %Y +(the format produced by +.Xr asctime 3 . +.It Cm %c +is equivalent to +.Dq Li %m/%d/%y . +.It Cm \&%D +is replaced by the date in the format +.Dq Ql mm/dd/yy . +.It Cm %d +is replaced by the day of the month as a decimal number (01-31). +.It Cm %e +is replaced by the day of month as a decimal number (1-31); single +digits are preceded by a blank. +.It Cm \&%H +is replaced by the hour (24-hour clock) as a decimal number (00-23). +.It Cm \&%I +is replaced by the hour (12-hour clock) as a decimal number (01-12). +.It Cm %j +is replaced by the day of the year as a decimal number (001-366). +.It Cm %k +is replaced by the hour (24-hour clock) as a decimal number (0-23); +single digits are preceded by a blank. +.It Cm %l +is replaced by the hour (12-hour clock) as a decimal number (1-12); +single digits are preceded by a blank. +.It Cm \&%M +is replaced by the minute as a decimal number (00-59). +.It Cm %m +is replaced by the month as a decimal number (01-12). +.It Cm %n +is replaced by a newline. +.It Cm %p +is replaced by either +.Dq Tn AM +or +.Dq Tn PM +as appropriate. +.It Cm \&%R +is equivalent to +.Dq Li %H:%M +.It Cm %r +is equivalent to +.Dq Li %I:%M:%S %p . +.It Cm %t +is replaced by a tab. +.It Cm \&%S +is replaced by the second as a decimal number (00-60). +.It Cm %s +is replaced by the number of seconds since the Epoch, UCT (see +.Xr mktime 3 ) . +.It Cm \&%T No or Cm \&%X +is equivalent to +.Dq Li %H:%M:%S . +.It Cm \&%U +is replaced by the week number of the year (Sunday as the first day of +the week) as a decimal number (00-53). +.It Cm \&%W +is replaced by the week number of the year (Monday as the first day of +the week) as a decimal number (00-53). +.It Cm %w +is replaced by the weekday (Sunday as the first day of the week) +as a decimal number (0-6). +.It Cm %x +is equivalent to +.Dq Li %m/%d/%y %H:%M:%S . +.It Cm \&%Y +is replaced by the year with century as a decimal number. +.It Cm %y +is replaced by the year without century as a decimal number (00-99). +.It Cm \&%Z +is replaced by the time zone name. +.It Cm %% +is replaced by +.Ql % . +.El +.Sh SEE ALSO +.Xr date 1 , +.Xr ctime 3 , +.Xr printf 1 , +.Xr printf 3 +.Sh STANDARDS +The +.Fn strftime +function +conforms to +.St -ansiC . +The +.Ql %s +conversion specification is an extension. +.Sh BUGS +There is no conversion specification for the phase of the moon. Property changes on: head/lib/libc/stdtime/strftime.3 ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/lib/libc/stdtime/tzfile.5 =================================================================== --- head/lib/libc/stdtime/tzfile.5 (revision 2740) +++ head/lib/libc/stdtime/tzfile.5 (revision 2741) @@ -1,123 +1,122 @@ -.TH TZFILE 5 -.SH NAME -tzfile \- time zone information -.SH SYNOPSIS -.B -#include -.SH DESCRIPTION +.Dd September 13, 1994 +.Dt TZFILE 5 +.Os FreeBSD 2.0 +.Sh NAME +.Nm tzfile +.Nd time zone information +.Sh SYNOPSIS +.Fd #include +.Sh DESCRIPTION The time zone information files used by -.IR tzset (3) +.Xr tzset 3 begin with bytes reserved for future use, followed by four four-byte values of type -.BR long , +.Fa long , written in a ``standard'' byte order (the high-order byte of the value is written first). These values are, in order: -.TP -.I tzh_ttisstdcnt +.Pp +.Bl -tag -compact -width tzh_ttisstdcnt +.It Li tzh_ttisstdcnt The number of standard/wall indicators stored in the file. -.TP -.I tzh_leapcnt +.It Li tzh_leapcnt The number of leap seconds for which data is stored in the file. -.TP -.I tzh_timecnt -The number of "transition times" for which data is stored +.It Li tzh_timecnt +The number of ``transition times'' for which data is stored in the file. -.TP -.I tzh_typecnt -The number of "local time types" for which data is stored +.It Li tzh_typecnt +The number of ``local time types'' for which data is stored in the file (must not be zero). -.TP -.I tzh_charcnt -The number of characters of "time zone abbreviation strings" +.It Li tzh_charcnt +The number of characters of ``time zone abbreviation strings'' stored in the file. -.PP +.El +.Pp The above header is followed by -.I tzh_timecnt +.Li tzh_timecnt four-byte values of type -.BR long , +.Fa long , sorted in ascending order. These values are written in ``standard'' byte order. Each is used as a transition time (as returned by -.IR time (2)) +.Xr time 2 ) at which the rules for computing local time change. Next come -.I tzh_timecnt +.Li tzh_timecnt one-byte values of type -.BR "unsigned char" ; +.Fa "unsigned char" ; each one tells which of the different types of ``local time'' types described in the file is associated with the same-indexed transition time. These values serve as indices into an array of -.I ttinfo +.Fa ttinfo structures that appears next in the file; these structures are defined as follows: -.in +.5i -.sp -.nf -.ta .5i +\w'unsigned int\0\0'u +.Pp +.Bd -literal -offset indent struct ttinfo { long tt_gmtoff; int tt_isdst; unsigned int tt_abbrind; }; -.in -.5i -.fi -.sp +.Ed +.Pp Each structure is written as a four-byte value for -.I tt_gmtoff +.Li tt_gmtoff of type -.BR long , +.Fa long , in a standard byte order, followed by a one-byte value for -.I tt_isdst +.Li tt_isdst and a one-byte value for -.IR tt_abbrind . +.Li tt_abbrind . In each structure, -.I tt_gmtoff +.Li tt_gmtoff gives the number of seconds to be added to GMT, -.I tt_isdst +.Li tt_isdst tells whether -.I tm_isdst +.Li tm_isdst should be set by -.I localtime (3) +.Xr localtime 3 and -.I tt_abbrind +.Li tt_abbrind serves as an index into the array of time zone abbreviation characters that follow the -.I ttinfo +.Li ttinfo structure(s) in the file. -.PP +.Pp Then there are -.I tzh_leapcnt +.Li tzh_leapcnt pairs of four-byte values, written in standard byte order; the first value of each pair gives the time (as returned by -.IR time(2)) +.Xr time 2 ) at which a leap second occurs; the second gives the -.I total +.Em total number of leap seconds to be applied after the given time. The pairs of values are sorted in ascending order by time. -.PP +.Pp Finally there are -.I tzh_ttisstdcnt +.Li tzh_ttisstdcnt standard/wall indicators, each stored as a one-byte value; they tell whether the transition times associated with local time types were specified as standard time or wall clock time, and are used when a time zone file is used in handling POSIX-style time zone environment variables. -.PP -.I Localtime +.Pp +.Nm localtime uses the first standard-time -.I ttinfo +.Li ttinfo structure in the file (or simply the first -.I ttinfo +.Li ttinfo structure in the absence of a standard-time structure) if either -.I tzh_timecnt +.Li tzh_timecnt is zero or the time argument is less than the first transition time recorded in the file. -.SH SEE ALSO -newctime(3) +.Sh SEE ALSO +.Xr ctime 3 , +.Xr time2posix 3 , +.Xr zic 8 .\" @(#)tzfile.5 7.2 Index: head/lib/libc/string/Makefile.inc =================================================================== --- head/lib/libc/string/Makefile.inc (revision 2740) +++ head/lib/libc/string/Makefile.inc (revision 2741) @@ -1,96 +1,96 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 .PATH: ${.CURDIR}/${MACHINE}/string ${.CURDIR}/string # machine-independent string sources SRCS+= memccpy.c strcasecmp.c strcoll.c strdup.c strerror.c \ - strftime.c strmode.c strtok.c strxfrm.c swab.c + strmode.c strtok.c strxfrm.c swab.c # machine-dependent string sources .include "${.CURDIR}/${MACHINE}/string/Makefile.inc" # If no machine specific bzero(3), build one out of memset(3). .if empty(SRCS:Mbzero.S) OBJS+= bzero.o bzero.o: memset.c ${CC} -DBZERO ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} @${LD} -x -r ${.TARGET} @mv a.out ${.TARGET} bzero.po: memset.c ${CC} -DBZERO ${CFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} .endif # If no machine specific memmove(3), build one out of bcopy(3). .if empty(SRCS:Mmemmove.S) OBJS+= memmove.o memmove.o: bcopy.c ${CC} -DMEMMOVE ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} @${LD} -x -r ${.TARGET} @mv a.out ${.TARGET} memmove.po: bcopy.c ${CC} -DMEMMOVE ${CFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} .endif # If no machine specific memcpy(3), build one out of bcopy(3). .if empty(SRCS:Mmemmove.S) OBJS+= memcpy.o memcpy.o: bcopy.c ${CC} -DMEMCOPY ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} @${LD} -x -r ${.TARGET} @mv a.out ${.TARGET} memcpy.po: bcopy.c ${CC} -DMEMCOPY ${CFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} .endif # If no machine specific strchr(3), build one out of index(3). .if empty(SRCS:Mstrchr.S) OBJS+= strchr.o strchr.o: index.c ${CC} -DSTRCHR ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} @${LD} -x -r ${.TARGET} @mv a.out ${.TARGET} strchr.po: index.c ${CC} -DSTRCHR ${CFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} .endif # If no machine specific strrchr(3), build one out of rindex(3). .if empty(SRCS:Mstrrchr.S) OBJS+= strrchr.o strrchr.o: rindex.c ${CC} -DSTRRCHR ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} @${LD} -x -r ${.TARGET} @mv a.out ${.TARGET} strrchr.po: rindex.c ${CC} -DSTRRCHR ${CFLAGS} -c -p ${.ALLSRC} -o ${.TARGET} @${LD} -X -r ${.TARGET} @mv a.out ${.TARGET} .endif # MAN3+= string/bcmp.3 string/bcopy.3 string/bstring.3 string/bzero.3 \ string/ffs.3 string/index.3 string/memccpy.3 string/memchr.3 \ string/memcmp.3 string/memcpy.3 string/memmove.3 string/memset.3 \ string/rindex.3 string/strcasecmp.3 string/strcat.3 string/strchr.3 \ string/strcmp.3 string/strcoll.3 string/strcpy.3 string/strcspn.3 \ - string/strftime.3 string/string.3 string/strlen.3 string/strmode.3 \ + string/string.3 string/strlen.3 string/strmode.3 \ string/strdup.3 string/strerror.3 string/strpbrk.3 string/strrchr.3 \ string/strsep.3 string/strspn.3 string/strstr.3 string/strtok.3 \ string/strxfrm.3 string/swab.3 # MLINKS+=strcasecmp.3 strncasecmp.3 MLINKS+=strcat.3 strncat.3 MLINKS+=strcmp.3 strncmp.3 MLINKS+=strcpy.3 strncpy.3 MLINKS+=strerror.3 perror.3