Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if NOTFORINCLUSION
- #include <stdio.h>
- /*
- * streams stdin, stdout, stderr are open at program start
- */
- FILE * fopen(const char *filename, const char * mode);
- /* opens filename returning file pointer or NULL
- * mode = "r" open text file for reading
- * = "w" create text file for writing, overwrite existing
- * = "a" append
- * = "r+" open text for reading and writing ( update )
- * = "w+" create text for update, overwrite existing
- * = "a+" open text for update, writing at end.
- *
- * = "rb"
- * = "r+b" etc, indicates a binary file.
- *
- * Update mode reading and writing the same file, but fflush or seek must be
- * called in between. Filenames are limited to FILENAME_MAX character.
- * Only FOPEN_MAX files may be opened at once.
- */
- FILE * freopen(const char * filename, const char * mode, FILE * stream);
- /* reassociates a stream */
- int fflush(FILE *stream);
- /* Causes unwritten data to be written , returns EOF for a write error, or zero
- * fflush(NULL) flushes all output streams.
- */
- int fclose( FILE * stream );
- /* flushes output and discards waiting,
- * It returns EOF if any errors occurred, and zero otherwise.
- */
- int remove( const char * filename);
- /* returns non-zero if the attempt fails. */
- int rename( const char *oldname, const char * newname );
- /* returns non-zero if the attempt fails. */
- FILE * tmpfile(void);
- /* creates a file of mode "wb+" that will removed automatically when closed
- * or when the program terminates normally.
- */
- char * tmpname(char s[L_tmpname]);
- /* creates a strings that is not the name of an existing file, can create
- * at most TMP_MAX different names
- */
- int setvbuf( FILE * stream, char * buf, int mode, size_t size);
- /* must be called after fopen, before any other operation
- * mode of _IOFBF causes full buffering, _IOLBF line buffering of text files
- * and _IONBF no buffering. If buf is NULL a buffer with be allocated
- * retuns non-zero for any error.
- */
- void setbuf ( FILE * stream, char * buf );
- /* if buf is NULL, buffering is turned off for the stream. Otherwise, is
- * setvbuf(stream, buf, _IOFBF, BUFSIZ)
- */
- int fprintf( FILE * stream, const char * format, ... );
- /* Flags:
- * %- left adjustment
- * %+ numbers will always be printed with a sign
- * % if no sign, a space will be prefixed
- * %0 leading zeros
- * %# alternate output. o first digit will be zero. For x or X
- * 0x or 0X will be prefixed for a non-zero result. For e, E, f,
- * g, and G, will always have a decimal point, for g and G trailing
- * zeroes will not be removed.
- * %NN printed at least this wide, and if wider if necessary
- * padding with space or 0
- * %NN.PP Precision, maxnumber of characters to be printed from a string
- * number of digits after decimal point for e, E, or f conversions,
- * number of significant digits for g or G conversion,
- * minimum number of digits to be printed for an integer, 0 padded
- *
- * width or precision maybe *, which is taken from next arg, which must be int
- *
- * Argument Type Conversions:
- * %d int; signed decimal
- * %i int; signed decimal
- * %o unsigned int; unsigned octal
- * %x unsigned int; unsigned hexadecimal, using abcdef
- * %X unsigned int; unsigned hexadecimal, using ABCDEF
- * %u unsigned int; unsigned decimal notation
- * %c int; single character after conversion to unsigned char
- * %s string
- * %f double; decimal notation of mmm.ddd d=precision default is 6
- * %e double; decimal notation of m.dddde+xx
- * %E double; decimal notation of m.ddddE+xx
- * %g double; either %f or %e if less than e-4, or >= precision
- * %G double; either %f or %e if less than e-4, or >= precision
- * %p void *; print as pointer
- * %n int *; number of characters written so far by, into argument
- * %% prints a %
- *
- * %hd short; signed decimal
- * %hi short; signed decimal
- * %ho unsigned short; unsigned octal
- * %hx unsigned short; unsigned hexadecimal
- * %hX unsigned short; unsigned hexadecimal with ABCDEF
- * %hu unsigned short; unsigned decimal
- *
- * %ld long; signed decimal
- * %li long; signed decimal
- * %lo unsigned long; unsigned octal
- * %lx unsigned long; unsigned hexadecimal
- * %lX unsigned long; unsigned hexadecimal with ABCDEF
- * %lu unsigned long; unsigned decimal
- *
- * %Lf long double; mmm.ddd
- * %Le long double; exponential
- * %Lg long double; see %g
- * %LG long double; see %G
- * returns number of characters written or negative if error
- */
- int printf( const char * format, ...);
- /* same as fprintf(stdout, ... ); */
- int sprintf( char * s, const * format, ... );
- /* output is written to s, terminated with '\0' , return does not include '\0'
- */
- int vprintf( const char * format, va_list arg );
- int vfprintf( FILE * stream, const char * format, va_list arg );
- int vsprintf( char * s, const char * format, va_list arg);
- /* similiar to printf, etc, except variable argument list, see stdarg.h */
- int fscanf( FILE * stream, const char * format, ... );
- /* returns EOF on end of file, or error, or otherwise returns number of
- * conversions done.
- *
- * %d decimal integer; int *
- * %i integer; int * ( leading 0 as octal, and 0X, 0x as hex )
- * %o octal integer; unsigned int * ( leading 0 optional )
- * %u unsigned decimal integer; unsigned int *
- * %x hex integer; unsigned int *; ( leading 0x optional )
- * %c characters; char *; No '\0' is added. Skip over whitespace surpressed
- * %s string; char *;
- * %e floating point; float *
- * %f floating point; float *
- * %g floating point; float *
- *
- * %[...] match longest input of set of chars in brackets
- * %[^...] match longest input of set of chars not in brackets
- *
- * %NNNN maximum width
- * %h, %l, %L width of the target type
- * %* supress assignment
- *
- * format string, blanks or tabs which are NOT ignored, chars that must match
- * next non whitespace
- *
- */
- int scanf(const char * format, ...); /* same as fscanf(stdin ...) */
- int sscanf(const char *s, const * format ...); /* chars taken from string s */
- int fgetc(FILE * stream );
- /* returns the next character of stream converted to int, or EOF */
- char * fgets( char *s, int n, FILE *stream);
- /* reads at most n-1 characters into the array s, stopping after newline,
- * which is included. s is null terminated.
- */
- int fputc( int c, FILE * stream );
- /* writes c converted to unsigned char, it returns the character written,
- * or EOF
- */
- int fputs(const char *s, FILE * stream);
- /* returns EOF on error, nonnegative on success */
- int getc(FILE *stream); /* macro , same as fgetc */
- int getchar(void); /* same as getc(stdin) */
- char * gets(char * s);
- /* reads the next input line into s, which is null terminated,
- * newline is trimmed.
- */
- int putc(int c, FILE *stream); /* macro form of fputc */
- int puts(const char *s);
- /* writes s and newline to stdout. returns non-negative on success, or EOF
- * on error.
- */
- int ungetc(int c, FILE * stream);
- /* push c, back into the stream, where it will be returned on the next read
- * EOF may not be pushed back, only 1 char per stream guaranteed, can't push
- * EOF, returns EOF on error, or c.
- */
- size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream);
- /* reads into the array ptr at most nobj of size. Returns the number of
- * objects read; this may be less than requested. feof and ferror must be
- * used to determine status.
- */
- size_t fwrite(const void *ptr, size_t size, size_t nobj, FILE *stream);
- /* writes from the array ptr, nobj objects of size size on stream.
- * It returns the number of objects written, which is less than nobj on error.
- */
- int fseek(FILE *stream, long offset, int origin);
- /* sets the file position for stream; a subsequent read or write will
- * access data at the new position. fseek returns non-zero on error.
- * For a binary file, the position is set to offset characters from origin,
- * which may be SEEK_SET (beginning), SEEK_CUR (current position),
- * or SEEK_END (end of file). For a text stream, offset must be zero,
- * or a value returned by ftell (inwhich case origin must be SEEK_SET).
- */
- long ftell(FILE *stream);
- /* ftell returns the current file position for stream, or -1 on error. */
- void rewind(FILE *stream);
- /* rewind(fp) is equivalent to fseek(fp, 0L, SEEK_SET); clearerr(fp). */
- int fgetpos(FILE *stream, fpos_t *ptr);
- /* fgetpos records the current position in stream in *ptr, for subsequent use
- * by fsetpos. The type fpos_t is suitable for recording such values.
- * fgetpos returns non-zero on error.
- */
- int fsetpos(FILE *stream, const fpos_t *ptr);
- /* fsetpos positions stream at the position recorded by fgetpos in *ptr.
- * returns non-zero on error.
- */
- void clearerr(FILE *stream);
- /* clears the end of file and error indicators for stream. */
- int feof(FILE *stream);
- /* feof returns non-zero if the end of file indicator for stream is set. */
- int ferror(FILE *stream);
- /* ferror returns non-zero if the error indicator for stream is set. */
- void perror(const char *s);
- /* perror(s) prints s and an implementation-defined error message
- * corresponding to the integer in errno, as if by
- * fprintf(stderr, "%s: %s\n", s, "error message");
- */
- #include <errno.h>
- /* integer expression errno contains an error number that gives further
- * information about the most recent error.
- * EDOM set when an argument is outside the domain of function
- * ERANGE set when result cannot be represented by a double.
- * then returns either 0 or HUGE_VAL ( appropriatel signed ).y
- */
- #include <ctype.h>
- /* c is either EOF or an unsigned char */
- isalnum(c) isalpha(c) or isdigit(c) is true
- isprint(c) printing character including space
- isspace(c) space, formfeed, newline, carriage return, tab,vertical tab
- isgraph(c) printing except space
- ispunct(c) printing character except space or letter or digit
- isalpha(c) isupper(c) or islower(c) is true
- isupper(c) upper-case letter
- islower(c) lower-case letter
- iscntrl(c) control character
- isdigit(c) decimal digit
- isxdigit(c) hexadecimal digit
- /* return is non-zero if true, or zero if false */
- /* in 7-bit ASCII printing chars are 0x20 to 0x7E ( ' ' to '~' )
- * Control chars are 0 to 0x1F and 7F
- */
- int tolower(c) ; /* converts c to lowercase if uppercase, or returns c */
- int toupper(c) ; /* converts c to uppercase if lowercase, or returns c */
- #include <string.h>
- char * strcpy(char * s,const char * ct);
- /* copy string ct to string s, including '\0'; return s. */
- char * strncpy(char *s,const char *ct, size_t n);
- /* copy at most n characters of string ct to s; return s.
- * Pad with '\0''s if ct has fewer than n characters.
- */
- char * strcat(char * s,const char * ct);
- /* concatenate string ct to end of string s; return s. */
- char * strncat(char *s,const char * ct,size_t n);
- /* concatenate at most n characters of string ct to string s,
- *terminate s with '\0'; return s.
- */
- int strcmp(const char * cs, const char * ct);
- /* compare string cs to string ct, return <0 if cs<ct, 0 if cs==ct,
- *or >0 if cs>ct.
- */
- int strncmp(const char * cs,const char * ct,size_t n);
- /* compare at most n characters of string cs to string ct; return <0 if cs<ct,
- * if cs==ct, or >0 if cs>ct.
- */
- char *strchr(const char *cs, int c);
- /* return pointer to first occurrence of c in cs or NULL if not present.
- */
- char *strrchr(const char *cs, int c);
- /* return pointer to last occurrence of c in cs or NULL if not present.
- */
- size_t strspn(const char *cs, const char * ct);
- /* return length of prefix of cs consisting of characters in ct. */
- size_t strcspn(const char *cs, const char * ct);
- /* return length of prefix of cs consisting of characters not in ct. */
- char *strpbrk(const char * cs, const char *ct);
- /* return pointer to first occurrence in string cs of any character string ct,
- * or NULL if not present.
- */
- char * strstr(const char * cs,const char *ct);
- /* return pointer to first occurrence of string ct in cs,
- * or NULL if not present.
- */
- size_t strlen(const char * cs);
- /*return length of cs. */
- char * strerror(size_t n);
- /* return pointer to implementation-defined string corresponding to error n. */
- char * strtok(char *s, const char * ct);
- /* A sequence of calls of strtok(s,ct) splits s into tokens, each delimited
- * by a character from ct. The first call in a sequence has a non-NULL s,
- * it finds the first token in s consisting of characters not in ct; it
- * terminates that by overwriting the next character of s with '\0' and
- * returns a pointer to the token. Each subsequent call, indicated by a NULL
- * value of s, returns the next such token, searching from just past the end
- * of the previous one. strtok returns NULL when no further token is found.
- * The string ct may be different on each call.
- */
- void * memcpy(void * s, const void * ct, size_t n);
- /* copy n characters from ct to s, and return s */
- void * memmove(void * s, const void * ct, size_t n);
- /* same as memcpy except that it works even if the objects overlap
- * -- the only function in the lib that does
- */
- int memcmp(const void * cs, const void * ct, size_t n);
- /* compare the first n characters of cs with cs; return as with strcmp */
- void * memchr(const void * cs, int c, size_t n);
- /* return pointer to first occurance of character c in cs, or NULL if not
- * present among the first n chracters.
- */
- void * memset(void * s, int c, size_t n);
- /* place character c into the first n characters of s return s; */
- #include <math.h>
- /* Angles for trigonometric functions are expressed radians. */
- double sin (double x); /* sine of x */
- double cos(double x); /* cosine of x */
- double tan(double x); /* tangent of x */
- double asin(double x); /* arcsin(x) in range [-pi/2,pi/2], x in [-1,1] */
- double acos(double x); /* cos-1(x) in range [0,pi], x in [-1,1] */
- double atan(double x); /* arctan(x) in range [-pi/2,pi/2] */
- double atan2(double y, double x); /* arctan(y/x) in range [-pi,pi] */
- double sinh(double x); /* hyperbolic sine of x */
- double cosh(double x); /* hyperbolic cosine of x */
- double tanh(double x); /* hyperbolic tangent of x */
- double exp(double x); /* exponential function ex */
- double log(double x); /* natural logarithm ln(x), x>0. */
- double log10(double x); /* base 10 logarithm log10(x), x>0 */
- double pow(double x, double y); /* x to the y */
- /* A domain error occurs if x=0 and y<= or if x<0 and y is not an integer */
- double sqrt(double x); /* sqare root of x, x>=0 */
- double ceil(double x); /* smallest integer not less than x, as a double. */
- double floor(double x); /* largest integer not greater than x, as a double. */
- double fabs(double x); /* absolute value |x| */
- double ldexp(double x,int n); /* x*(2^n) , x times 2 to the nth */
- double frexp(double x, int *exp);
- /* splits x into a normalized fraction in the interval [1/2,1) which is
- * returned, and a power of 2, which is stored in *exp. If x is zero,
- *both parts of the result are zero. */
- double modf(double x, double *ip);
- /* splits x into integral and fractional parts, each with the same sign as x.
- * It stores the integral part in *ip, and returns the fractional part.
- */
- double fmod(double x, double y);
- /* floating-point remainder of x/y, with the same sign as x.
- * If y is zero, the result is implementation-defined.
- */
- #include <stdlib.h>
- double atof(const char *s);
- /* atof converts s to double; it is equivalent to strtod(s, (char**)NULL) */
- int atoi(const char *s);
- /* converts s to int; it is equivalent to (int)strtol(s, (char**)NULL, 10) */
- long atol(const char *s);
- /* converts s to long; it is equivalent to strtol(s, (char**)NULL, 10) */
- double strtod(const char *s, char **endp);
- /* strtod converts s to double, ignoring leading white space, it stores a
- * pointer to any unconverted characters in *endp unless endp is NULL.
- * On overflow, returns HUGE_VAL is returned with the proper sign.
- * On undeflow, returns zero. In either case errno is set to ERANGE.
- */
- long strtol(const char *s, char **endp, int base);
- /* strtol converts s to long, ignoring leading white space; it stores a
- * pointer to any unconverted characters in *endp unless endp is NULL. base
- * is between 2 and 36, conversion is done assuming that the input is written
- * in that base. If base is zero, the base is 8, 10, or 16; leading 0 implies
- * octal and leading 0x or 0X hexadecimal. Letters in either case represent
- * digits from 10 to base-1; a leading 0x or 0X is permitted in base 16. If
- * the answer would overflow, LONG_MAX or LONG_MIN is returned, depending on
- * the sign of the result, and errno is set to ERANGE.
- */
- unsigned long strtoul(const char *s, char **endp, int base);
- /* strtoul is the same as strtol except that the result is unsigned long and
- * the error value is ULONG_MAX.
- */
- int rand(void);
- /* rand returns a pseudo-random integer in the range 0 to RAND_MAX, which is
- * at least 32767.
- */
- void srand(unsigned int seed);
- /* srand uses seed as the seed for a new sequence of pseudo-random numbers.
- * The initial seed is 1.
- */
- void *calloc(size_t num, size_t size);
- /* calloc returns a pointer to space for an array of num objects, each of
- * size size, or NULL if the request cannot be satisfied. The space is
- * initialized to zero bytes.
- */
- void *malloc(size_t size);
- /* malloc returns a pointer to space for an object of size size, or NULL if
- * the request cannot be satisfied. The space is uninitialized.
- */
- void *realloc(void *p, size_t size);
- /* realloc changes the size of the object pointed to by p to size. The
- * contents will be unchanged up to the minimum of the old and new sizes.
- * If the new size is larger, the new space is uninitialized. realloc returns
- * a pointer to the new space, or NULL if the request cannot be satisfied,
- * in which case *p is unchanged.
- */
- void free(void *p);
- /* free deallocates the space pointed to by p; it does nothing if p is NULL.
- * p must be a pointer to space previously allocated by calloc, malloc,
- * or realloc.
- */
- void abort(void);
- /* abort causes the program to terminate abnormally,
- * as if by raise(SIGABRT).
- */
- void exit(int status);
- /* exit causes normal program termination. atexit functions are called in
- * reverse order of registration, open files are flushed, open streams are
- * closed, and control is returned to the environment. How status is returned
- * to the environment is implementation-dependent, but zero is taken as
- * successful termination. The values EXIT_SUCCESS and EXIT_FAILURE may
- * also be used.
- */
- int atexit( void (*fcn)(void) );
- /* atexit registers the function fcn to be called when the program terminates
- * normally; it returns non-zero if the registration cannot be made.
- */
- int system(const char *s);
- /* system passes the string s to the environment for execution. If s is NULL,
- * system returns non-zero if there is a command processor. If s is not NULL,
- * the return value is implementation-dependent.
- */
- char *getenv(const char *name);
- /* getenv returns the environment string associated with name, or NULL if no
- * string exists. Details are implementation-dependent.
- */
- void *bsearch(const void *key, const void *base,
- size_t n, size_t size,
- int (*cmp)(const void *keyval, const void *datum) );
- /* bsearch searches base[0]...base[n-1] for an item that matches *key. The
- * function cmp must return negative if its first argument (the search key) is
- * less than its second (a table entry), zero if equal, and positive if
- * greater. Items in the array base must be in ascending order. bsearch
- * returns a pointer to a matching item, or NULL if none exists.
- */
- void qsort(void *base, size_t n, size_t size,
- int (*cmp)(const void *, const void *) );
- /* qsort sorts into ascending order an array base[0]...base[n-1] of objects
- * of size size. The comparison function cmp is as in bsearch.
- */
- int abs(int n); /* abs returns the absolute value of its int argument. */
- long labs(long n); /* labs returns the absolute value of its long argument. */
- div_t div(int num, int denom);
- /* div computes the quotient and remainder of num/denom. The results are
- * stored in the int members quot and rem of a structure of type div_t.
- */
- ldiv_t ldiv(long num, long denom);
- /* ldiv computes the quotient and remainder of num/denom. The results are
- * stored in the long members quot and rem of a structure of type ldiv_t
- */
- #include <assert.h>
- /* Defines assert macro, which, unless NDEBUG is defined before #include
- * will print on stderr a message, such as
- * Assertion failed: expression, file filename, line nnn
- *
- * It then calls abort to terminate execution. The source filename and
- * line number come from the preprocessor macros __FILE__ and __LINE__.
- *
- * if expression is 0;
- * assert(expression);
- *
- */
- #include <stdarg.h>
- /* facilities for stepping through a list of function arguments of unknown
- * number and type. Suppose lastarg is the last named parameter of a function
- * f with a variable number of arguments. Then declare within f a variable of
- * type va_list that will point to each argument in turn.
- *
- * va_list ap;
- * ap must be initialized once with the macro va_start before any unnamed
- * argument is accessed.
- * va_start(va_list ap, lastarg);
- *
- * Afterwards, each execution of the macro va_arg will produce a value that
- * has the type and value of the next unnamed argument, and will also modify
- * ap so the next use of va_arg returns the next argument:
- *
- * type va_arg(va_list ap, type);
- *
- * void va_end(va_list ap);
- * Macro which must be called once after the arguments have been processed
- * but before f is exited.
- */
- #include <setjmp.h>
- int setjmp(jmp_buf env);
- /* The macro setjmp saves state information in env for use by longjmp.
- * The return is zero from a direct call of setjmp, and non-zero from a
- * subsequent call of longjmp. A call to setjmp can only occur in certain
- * contexts, basically the test of if, switch, and loops, and only in simple
- * relational expressions.
- * if (setjmp(env) == 0)
- * --get here on direct call--
- * else
- * --get here by calling longjmp--
- */
- void longjmp(jmp_buf env, int val);
- /* longjmp restores the state saved by the most recent call to setjmp, using
- * the information saved in env, and execution resumes as if the setjmp
- * function had just executed and returned the non-zero value val. The
- * function containing the setjmp must not have terminated. Accessible objects
- * have the values they had at the time longjmp was called, except that
- * non-volatile automatic variables in the function calling setjmp become
- * undefined if they were changed after the setjmp call.
- */
- #include <signal.h>
- void (*signal (int sig, void (*handler)(int)))(int);
- /* signal determines how subsequent signals will be handled. If handler is
- * SIG_DFL, the implementation-defined default behavior is used, if it is
- * SIG_IGN, the signal is ignored; otherwise, the function pointed to by
- * handler will be called, with the argument of the type of signal. Valid
- * signals include
- * SIGABRT abnormal termination, (from abort)
- * SIGFPE arithmetic error, (zero divide or overflow)
- * SIGILL illegal function image, (illegal instruction)
- * SIGINT interactive attention, (interrupt)
- * SIGSEGV illegal storage access, (access outside memory limits)
- * SIGTERM ermination request sent to this program
- *
- * signal returns the previous value of handler for the specific signal, or
- * SIG_ERR if an error occurs.
- *
- * The initial state of signals is implementation-defined.
- */
- int raise(int sig);
- /* raise sends the signal sig to the program; it returns non-zero if
- * unsuccessful.
- */
- #include <time.h>
- struct tm {
- int tm_sec; /* seconds after the minute (0,61) */
- int tm_min; /* minutes after the hour (0,59) */
- int tm_hour; /* hours since midnight (0,23) */
- int tm_mday; /* day of the month (1,31) */
- int tm_mon; /* months since January (0,11) */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday (0,6) */
- int tm_yday; /* days since January 1 (0,365) */
- int tm_isdst; /* Daylight Saving Time flag */
- /* tm_isdst is positive if Daylight Saving Time is in effect, zero if not,
- * and negative if the information is not available.
- */
- };
- clock_t clock(void);
- /* clock returns the processor time used by the program since the beginning of
- * execution, or -1 if unavailable. clock()/CLOCKS_PER_SEC is a time in
- * seconds.
- */
- time_t time(time_t *tp);
- /* time returns the current calendar time or -1 if the time is not available.
- * If tp is not NULL, the return value is also assigned to *tp.
- */
- double difftime(time_t time2, time_t time1);
- /* difftime returns time2-time1 expressed in seconds. */
- time_t mktime(struct tm *tp);
- /* mktime converts the local time in the structure *tp into calendar time in
- * the same representation used by time. The components will have values in
- * the ranges shown. mktime returns the calendar time or -1 if it cannot be
- * represented. The next four functions return pointers to static objects
- * that may be overwritten by other calls.
- */
- char *asctime(const struct tm *tp);
- /* converts tp into a string of the form "Sun Jan 3 15:14:13 1988\n\0" */
- char *ctime(const time_t *tp);
- /* ctime converts the calendar time *tp to local time; it is equivalent to
- * asctime(localtime(tp))
- */
- struct tm *gmtime(const time_t *tp);
- /* gmtime converts the calendar time *tp into Coordinated Universal Time (UTC)
- * It returns NULL if UTC is not available. The name gmtime has historical
- * significance.
- */
- struct tm *localtime(const time_t *tp);
- /* localtime converts the calendar time *tp into local time. */
- size_t strftime(char *s, size_t smax, const char *fmt, const struct tm *tp);
- /* strftime formats date and time information from *tp into s according to fmt,
- * which is analogous to a printf format. Ordinary characters (including the
- * terminating '\0') are copied into s. Each %c is replaced as described below,
- * using values appropriate for the local environment. No more than smax
- * characters are placed into s. strftime returns the number of characters,
- * excluding the '\0', or zero if more than smax characters were produced.
- * %a abbreviated weekday name.
- * %A full weekday name.
- * %b abbreviated month name.
- * %B full month name.
- * %c local date and time representation.
- * %d day of the month (01-31).
- * %H hour (24-hour clock) (00-23).
- * %I hour (12-hour clock) (01-12).
- * %j day of the year (001-366).
- * %m month (01-12).
- * %M minute (00-59).
- * %p local equivalent of AM or PM.
- * %S second (00-61).
- * %U week number of the year (Sunday as 1st day of week) (00-53).
- * %w weekday (0-6, Sunday is 0).
- * %W week number of the year (Monday as 1st day of week) (00-53).
- * %x local date representation.
- * %X local time representation.
- * %y year without century (00-99).
- * %Y year with century.
- * %Z time zone name, if any.
- * %% %
- */
- #include <limits.h>
- /* minimum values, can be larger ( in magnitude ) */
- #define CHAR_BIT 8 /* bits in a char */
- #define CHAR_MAX is either UCHAR_MAX or SCHAR_MAX
- #define INT_MAX at least +32767
- #define INT_MIN at most -32767
- #define LONG_MAX at least +2147483647
- #define LONG_MIN at most -2147483647
- #define SCHAR_MAX at least +127
- #define SCHAR_MIN at most -127
- #define SHRT_MAX at least +32767
- #define SHRT_MIN at most -32767
- #define UCHAR_MAX at least 255
- #define UINT_MAX at least 65535
- #define ULONG_MAX at least 4294967295
- #define USHRT_MAX at least 65535
- #include <float.h>
- /* minimum values, can be larger ( in magnitude ) */
- #define FLT_RADIX 2 /* radix of exponent representation */
- #define FLT_ROUNDS ? /* floating-point rounding mode for addition */
- #define FLT_DIG 6 /* decimal digits of precision */
- #define FLT_EPSILON 1E-5 /* smallest number such that 1.0 + x != 1.0 */
- #define FLT_MANT_DIG ? /* number of digits in mantissa (in FLT_RADIX) */
- #define FLT_MAX 1E+37 /* maximum floating point number */
- #define FLT_MAX_EXP ? /* maximum n such that (FLT_RADIX^(n-1)) */
- #define FLT_MIN 1E-37 /* min normalized floating point */
- #define FLT_MIN_EXP ? /* min n such that 10^n is normalized */
- #define DBL_DIG 10 /* decimal digits of precision */
- #define DBL_EPSILON 1E-9 /* smallest number such that 1.0 + X != 1.0 */
- #define DBL_MANT_DIG ? /* number of digits in mantissa */
- #define DBL_MAX 1E+37 /* max double */
- #define DBL_MIN 1E-37 /* min double */
- #define DBL_MAX_EXP ? /* maximum n such that (FLT_RADIX^(n-1)) */
- #define DBL_MIN_EXP ? /* min n such that 10^n is normalized */
- #include <stddef.h>
- /* defines:
- * ptr_diff_t
- * size_t
- * wchar_t
- * NULL
- * offsetof(type, member)
- * register_t
- * and c99/types?
- * int8_t, u_int8_t, int16_t, u_int32_t, int64t, u_int64_t
- * intptr_t, uintptr_t
- */
- /* ***************************************************************** */
- /*
- Character Constants:
- newline NL (LF) \n backslash \ \\
- horizontal tab HT \t question mark ? \?
- veritical tab VT \v single qoute ' \'
- backspace BS \b double qoute " \"
- carriage return CR \r octal number ooo \ooo
- formfeed FF \f hex number hh \xhh
- audible alert BEL \a
- null character NUL \0
- wide char constants L'x' of type wchar_t
- Trigraphs:
- ??= # ??( [ ??< {
- ??/ \ ??) ] ??> }
- ??' ^ ??! | ??- ~
- Trigraph replacement occurs before anything else.
- Predefined Names:
- __LINE__ decimal constant containing source line number
- __FILE__ string literal containing file being compiled
- __DATE__ string lit. "Mmm dd yyyy" date of compilation
- __TIME__ string lit. "hh:mm:ss" times of compilation
- __STDC__ Constant is 1 in standard-conforming implementations
- ========================== Precedence and Associativity ===============
- () [] -> . left to right
- ! ~ ++ -- - * & (type) sizeof right to left
- * / % left to right
- + - left to right
- << >> left to right
- < <= > >= left to right
- == != left to right
- & left to right
- ^ left to right
- | left to right
- && left to right
- || left to right
- ?: right to left
- = += -= *= /= %= &= ^= |= != <<= >>= right to left
- , left to right
- =======================================================================
- Unary +, -, and * have higher precedence that binary forms
- Identifiers:
- Sequence of letters and digits. First character must be a letter
- ( or underscore ) At least 31 characters are significant. Preprocessor
- identifiers etc, can be as small as 6.
- Keywords:
- auto, break, case, char, const, continue, default, do
- double, else, enum, extern, float, for, goto, if
- int, long, register, return, short, signed, sizeof, static
- struct, switch, typedef, union, unsigned, void, volatile, while,
- ( fortran, asm )
- Integer Constant:
- Octal begin with 0 01 02 03 04 05 06 07
- Hexadecimal start with 0x, or 0X 0x1 0x9 0xA 0xB 0xC 0xd 0xe 0xf
- Decimal otherwise
- Suffixes:
- unsigned u U
- long l L
- Floating Constants:
- Consists of integer part, a decimal point, a fraction part, an e or E
- and integer exponent. Either integer part or fraction may be missing.
- Either the E or the decimal point may be missing.
- Suffixes:
- float f F
- long double l L
- double (default)
- Enumeration Constants are ints.
- */
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement