Back to index

php5  5.3.10
Defines | Functions
print.c File Reference
#include "php.h"
#include "main/snprintf.h"
#include "file.h"
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>

Go to the source code of this file.

Defines

#define SZOF(a)   (sizeof(a) / sizeof(a[0]))

Functions

protected void file_magwarn (struct magic_set *ms, const char *f,...)
protected const char * file_fmttime (uint32_t v, int local)

Define Documentation

#define SZOF (   a)    (sizeof(a) / sizeof(a[0]))

Definition at line 49 of file print.c.


Function Documentation

protected const char* file_fmttime ( uint32_t  v,
int  local 
)

Definition at line 69 of file print.c.

{
       char *pp;
       time_t t = (time_t)v;
       struct tm *tm;

       if (local) {
              pp = ctime(&t);
       } else {
#ifndef HAVE_DAYLIGHT
              private int daylight = 0;
#ifdef HAVE_TM_ISDST
              private time_t now = (time_t)0;

              if (now == (time_t)0) {
                     struct tm *tm1;
                     (void)time(&now);
                     tm1 = localtime(&now);
                     if (tm1 == NULL)
                            return "*Invalid time*";
                     daylight = tm1->tm_isdst;
              }
#endif /* HAVE_TM_ISDST */
#endif /* HAVE_DAYLIGHT */
              if (daylight)
                     t += 3600;
              tm = gmtime(&t);
              if (tm == NULL)
                     return "*Invalid time*";
              pp = asctime(tm);
       }

       pp[strcspn(pp, "\n")] = '\0';
       return pp;
}

Here is the caller graph for this function:

protected void file_magwarn ( struct magic_set ms,
const char *  f,
  ... 
)

Definition at line 53 of file print.c.

{
       va_list va;
       char *expanded_format;
       TSRMLS_FETCH();

       va_start(va, f);
       vasprintf(&expanded_format, f, va);
       va_end(va);
       
       php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);

       free(expanded_format);
}

Here is the caller graph for this function: