|
Packit Service |
603f59 |
/*
|
|
Packit Service |
603f59 |
* dutil.c - AIX utility functions whose compilation conflicts with the
|
|
Packit Service |
603f59 |
* general header file tree defined by lsof.h and dlsof.h -- e.g.,
|
|
Packit Service |
603f59 |
* the conflict between <time.h> and <sys/time.h> for the time(2)
|
|
Packit Service |
603f59 |
* and localtime(3) functions
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* V. Abell
|
|
Packit Service |
603f59 |
* Purdue University
|
|
Packit Service |
603f59 |
*/
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
/*
|
|
Packit Service |
603f59 |
* Copyright 2008 Purdue Research Foundation, West Lafayette, Indiana
|
|
Packit Service |
603f59 |
* 47907. All rights reserved.
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* Written by Victor A. Abell
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* This software is not subject to any license of the American Telephone
|
|
Packit Service |
603f59 |
* and Telegraph Company or the Regents of the University of California.
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* Permission is granted to anyone to use this software for any purpose on
|
|
Packit Service |
603f59 |
* any computer system, and to alter it and redistribute it freely, subject
|
|
Packit Service |
603f59 |
* to the following restrictions:
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* 1. Neither the authors nor Purdue University are responsible for any
|
|
Packit Service |
603f59 |
* consequences of the use of this software.
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* 2. The origin of this software must not be misrepresented, either by
|
|
Packit Service |
603f59 |
* explicit claim or by omission. Credit to the authors and Purdue
|
|
Packit Service |
603f59 |
* University must appear in documentation and sources.
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* 3. Altered versions must be plainly marked as such, and must not be
|
|
Packit Service |
603f59 |
* misrepresented as being the original software.
|
|
Packit Service |
603f59 |
*
|
|
Packit Service |
603f59 |
* 4. This notice may not be removed or altered.
|
|
Packit Service |
603f59 |
*/
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
#ifndef lint
|
|
Packit Service |
603f59 |
static char copyright[] =
|
|
Packit Service |
603f59 |
"@(#) Copyright 2008 Purdue Research Foundation.\nAll rights reserved.\n";
|
|
Packit Service |
603f59 |
static char *rcsid = "$Id: util.c,v 1.1 2008/04/01 11:56:53 abe Exp $";
|
|
Packit Service |
603f59 |
#endif
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
#if defined(HAS_STRFTIME)
|
|
Packit Service |
603f59 |
#include <time.h>
|
|
Packit Service |
603f59 |
#endif /* defined(HAS_STRFTIME) */
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
/*
|
|
Packit Service |
603f59 |
* util_strftime() -- utility function to call strftime(3) without header
|
|
Packit Service |
603f59 |
* file distractions
|
|
Packit Service |
603f59 |
*/
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
int
|
|
Packit Service |
603f59 |
util_strftime(fmtr, fmtl, fmt)
|
|
Packit Service |
603f59 |
char *fmtr; /* format output receiver */
|
|
Packit Service |
603f59 |
int fmtl; /* sizeof(*fmtr) */
|
|
Packit Service |
603f59 |
char *fmt; /* format */
|
|
Packit Service |
603f59 |
{
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
#if defined(HAS_STRFTIME)
|
|
Packit Service |
603f59 |
struct tm *lt;
|
|
Packit Service |
603f59 |
time_t tm;
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
tm = time((time_t *)NULL);
|
|
Packit Service |
603f59 |
lt = localtime(&tm;;
|
|
Packit Service |
603f59 |
return(strftime(fmtr, fmtl, fmt, lt));
|
|
Packit Service |
603f59 |
#else /* !defined(HAS_STRFTIME) */
|
|
Packit Service |
603f59 |
return(0);
|
|
Packit Service |
603f59 |
#endif /* defined(HAS_STRFTIME) */
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
}
|