/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Advanced Software Technology Library
* AT&T Research
*
* std + posix + ast
*/
#ifndef _AST_H
#define _AST_H
#ifndef _AST_STD_H
#include <ast_std.h>
#endif
#ifndef _SFIO_H
#include <sfio.h>
#endif
#ifndef ast
#endif
#ifndef PATH_MAX
#endif
/*
* workaround botched headers that assume <stdio.h>
*/
#ifndef FILE
#ifndef _SFIO_H
struct _sfio_s;
#endif
#ifndef __FILE_typedef
#endif
#ifndef _FILEDEFED
#endif
#endif
/*
* exit() support -- this matches shell exit codes
*/
/*
* NOTE: for compatibility the following work for EXIT_BITS={7,8}
*/
#define EXITED_CORE(x) (((x)&((1<<EXIT_BITS)|(1<<(EXIT_BITS-1))))==((1<<EXIT_BITS)|(1<<(EXIT_BITS-1)))||((x)&((1<<(EXIT_BITS-1))|(1<<(EXIT_BITS-2))))==((1<<(EXIT_BITS-1))|(1<<(EXIT_BITS-2))))
/*
* astconflist() flags
*/
/*
* pathcanon() flags
*/
/*
* pathaccess() flags
*/
/*
* touch() flags
*/
/*
* pathcheck() info
*/
typedef struct
{
unsigned long date;
char* feature;
char* host;
char* user;
} Pathcheck_t;
/*
* strgrpmatch() flags
*/
/*
* fmtquote() flags
*/
/*
* chrexp() flags
*/
/*
* multibyte macros
*/
#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++)))
#define mbnchar(p,n) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),n))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++)))
/*
* common macros
*/
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
#define integralof(x) (((char*)(x))-((char*)0))
#define newof(p,t,n,x) ((p)?(t*)realloc((char*)(p),sizeof(t)*(n)+(x)):(t*)calloc(1,sizeof(t)*(n)+(x)))
#define oldof(p,t,n,x) ((p)?(t*)realloc((char*)(p),sizeof(t)*(n)+(x)):(t*)malloc(sizeof(t)*(n)+(x)))
#define pointerof(x) ((void*)((char*)0+(x)))
#define ssizeof(x) ((int)sizeof(x))
#define NiL 0
#define NoP(x) (void)(x)
#else
#define NiL ((char*)0)
#endif
#if !defined(NoF)
#if !defined(_DATA_)
#define _DATA_
#endif
#endif
#if !defined(NoN)
#if !defined(_STUB_)
#define _STUB_
#endif
#endif
typedef int (*Error_f)(void*, void*, int, ...);
typedef int (*Ast_confdisc_f)(const char*, const char*, const char*);
typedef int (*Strcmp_context_f)(const char*, const char*, void*);
typedef int (*Strcmp_f)(const char*, const char*);
#if _BLD_ast && defined(__EXPORT__)
#define extern __EXPORT__
#endif
extern char* astgetconf(const char*, const char*, const char*, int, Error_f);
extern char* astconf(const char*, const char*, const char*);
extern void astconflist(Sfio_t*, const char*, int, const char*);
extern int astlicense(char*, int, char*, char*, int, int, int);
extern int astquery(int, const char*, ...);
extern void astwinsize(int, int*, int*);
extern int chresc(const char*, char**);
extern int chrexp(const char*, char**, int*, int);
extern int chrtoi(const char*);
extern char* conformance(const char*, size_t);
extern int eaccess(const char*, int);
extern char* fmtelapsed(unsigned long, int);
extern char* fmterror(int);
extern char* fmtesc(const char*);
extern char* fmtesq(const char*, const char*);
extern char* fmtident(const char*);
extern char* fmtfmt(const char*);
extern char* fmtgid(int);
extern char* fmtmatch(const char*);
extern char* fmtmode(int, int);
extern char* fmtnum(unsigned long, int);
extern char* fmtperm(int);
extern char* fmtre(const char*);
extern char* fmtsignal(int);
extern char* fmtuid(int);
extern char* fmtversion(unsigned long);
extern void memfatal(void);
extern unsigned int memhash(const void*, int);
extern unsigned long memsum(const void*, int, unsigned long);
extern char* pathaccess(char*, const char*, const char*, const char*, int);
extern char* pathaccess_20100601(const char*, const char*, const char*, int, char*, size_t);
extern char* pathbin(void);
extern char* pathcanon(char*, int);
extern char* pathcanon_20100601(char*, size_t, int);
extern char* pathcat(char*, const char*, int, const char*, const char*);
extern char* pathcat_20100601(const char*, int, const char*, const char*, char*, size_t);
extern int pathcd(const char*, const char*);
extern int pathcheck(const char*, const char*, Pathcheck_t*);
extern int pathexists(char*, int);
extern int pathgetlink(const char*, char*, int);
extern int pathinclude(const char*);
extern char* pathkey(char*, char*, const char*, const char*, const char*);
extern char* pathpath(char*, const char*, const char*, int);
extern char* pathpath_20100601(const char*, const char*, int, char*, size_t);
extern char* pathprobe(char*, char*, const char*, const char*, const char*, int);
extern char* pathprobe_20100601(const char*, const char*, const char*, int, char*, size_t, char*, size_t);
extern char* pathrepl(char*, const char*, const char*);
extern char* pathrepl_20100601(char*, size_t, const char*, const char*);
extern int pathsetlink(const char*, const char*);
extern char* pathshell(void);
extern char* pathtmp(char*, const char*, const char*, int*);
extern char* setenviron(const char*);
extern int stracmp(const char*, const char*);
extern char* strcopy(char*, const char*);
extern unsigned long strelapsed(const char*, char**, int);
extern int stresc(char*);
extern int strexp(char*, int);
extern long streval(const char*, char**, long(*)(const char*, char**));
extern long strexpr(const char*, char**, long(*)(const char*, char**, void*), void*);
extern int strgid(const char*);
extern int strgrpmatch(const char*, const char*, int*, int, int);
extern int strgrpmatch_20120528(const char*, const char*, ssize_t*, int, int);
extern unsigned int strhash(const char*);
extern int strmatch(const char*, const char*);
extern int strmode(const char*);
extern int stropt(const char*, const void*, int, int(*)(void*, const void*, int, const char*), void*);
extern int strpcmp(const char*, const char*);
extern int strperm(const char*, char**, int);
extern void strsort(char**, int, int(*)(const char*, const char*));
extern char* strsubmatch(const char*, const char*, int);
extern unsigned long strsum(const char*, unsigned long);
extern char* strtape(const char*, char**);
extern long strton(const char*, char**, char*, int);
extern int struid(const char*);
extern int struniq(char**, int);
extern int strvcmp(const char*, const char*);
#undef extern
/*
* C library global data symbols not prototyped by <unistd.h>
*/
#if !defined(environ) && defined(__DYNAMIC__)
#else
extern char** environ;
#endif
/*
* really handy malloc()/free() (__FILE__,__LINE__,__FUNCTION__) tracing
* make with VMDEBUG==1 or debug=1 or CCFLAGS=$(CC.DEBUG)
* VMDEBUG==0 disables
* at runtime export VMALLOC_OPTIONS per vmalloc.3
* to list originating call locations
*/
#include <vmalloc.h>
#endif
#include <ast_api.h>
#if defined(__EXPORT__)
#define extern __EXPORT__
#endif
extern unsigned long plugin_version(void);
#undef extern
#endif