#ifdef __cplusplus extern "C" { #endif /* @(#) ant.h 1.1 92/08/06 SwRI ant.h -- header for ant library */ #ifndef ANT_H #define ANT_H #include #include /* for pid_t */ #include "StrHier.h" #include "LinkList.h" #include "Time_t.h" /* compare_times */ /* takes two time structures and returns: -1 - time one is less than time two 1 - time one is greater than time two 0 - times are equal */ int compare_times (Time_t, Time_t); /* Challoc will allocate an array of strings */ /* the first value is the number of rows (i.e. strings to allocate) */ /* the second value is the maximum length of each string */ /* Ch_Free will free an array previously allocated by Challoc */ /* the first value is the array, the second value is the number of items */ char **Challoc (int, int); void Ch_Free (char **, int); /* functions */ /* BaseFilename -- returns filename portion of pathname */ const char * BasenameOf( const char *fullname) ; /* DefListCreate */ LinkList DefListCreate( char* path, char* ext, LinkFilter fun) ; char *EnvDirPrefix(const char*,char*);/* prefix string with environment dir string */ /* EnvFopen -- fopen file relative to dir found in environment */ FILE * EnvFopen(char *EnvName,char *filename,char *type) ; /* EnvExpand.c -- expand environment variables in string */ void EnvExpand( char* src, char* des) ; char *EnvPrefix(char*,char*); /* prefix string with environment string */ /* execvp_env -- exec from vector using PATH, expand environment args */ int execvp_env (const char *file, char *const argv[]) ; char *mfgets(char*,int,FILE*); /* mangling fgets, removes new line */ char *strlast(char *s); /* returns ptr to last char in string */ int strnull(char *str); /* returns 0 unless null string or NULL ptr */ char *untok(char *line); /* retract last token marker */ /* DirCombine -- combine Dir and DirPart in Dir */ void DirCombine( char *Dir, char *DirPart) ; /* DirFilesByExt -- read dir and list files w/given extension */ LinkList DirFilesByExt( char *pathname, char *ext) ; LinkList DirToList(char*); /* PastWhite -- returns ptr to first char past white space in string */ char * PastWhite(char *str) ; /* PathFopen -- open first matching file in path*/ FILE * PathFopen( char *path, char *filename, char *mode) ; /* putenvFromArgs -- set environment from arguments */ int putenvFromArgs( int argc, /* how many arguments */ char **argv, /* command line arguments */ char *ArgName, /* argument of interest */ char *EnvName) /* environment var to set */ ; /* TokLine */ void * TokLine( char *line, char *separators) ; /* TokLineEasy -- strtok line using default separators */ void * TokLineEasy( char *line) ; /* TrimEndNumber -- trim # and preceding blanks from end of string returns ptr to # trimmed off string STRING MUST HAVE # at end of it or attrocities occur */ char * TrimEndNumber(char *desc) ; /******************************************************************************/ /* */ /* GetUserName - this function will return the user name of the user running */ /* the program. */ /* */ /* returns a pointer to the user name */ /* */ /******************************************************************************/ #if defined (__MINGW32__) || defined (__MSVCRT__) char *SDDAS_GetUserName (); #ifdef GetUserName #undef GetUserName #endif #define GetUserName SDDAS_GetUserName #else char *GetUserName (); #endif /******************************************************************************/ /* */ /* GetTempFilename - this function will return a temp filename in the */ /* environment variable TEMP or /tmp. */ /* */ /* returns a pointer to the a static temp directory */ /* */ /******************************************************************************/ char *GetTempFilename (char *tmpName, int len); /******************************************************************************/ /* */ /* GetTempDirectory - this function will return the temp directory in the */ /* environment variable TEMP or /tmp. */ /* */ /* returns a pointer to the a static temp directory */ /* */ /******************************************************************************/ char *GetTempDirectory (); char *GetTempDirectory_r (); /*******************************************************************************/ /* */ /* GetHomeDirectory - this function will return the home directory of the user */ /* Check HOME first! */ /* */ /* returns a pointer to the home directory */ /* */ /*******************************************************************************/ char *GetHomeDirectory (); /*******************************************************************************/ /* */ /* GetEnv - just like getenv, however, it will also check the config file if */ /* the environment is not set. */ /* */ /*******************************************************************************/ void InitSDDASCfg (const char *); /* do not call directly - used by CfgInit */ void FreeSDDASCfg (); /* do not call directly - used by CfgInit */ char *GetEnv (const char *); void sigchild(void) ; /* CheckVersionArg -- if found, print version and exit */ void CheckVersionArg( int argc, char** argv) ; /* StrIndex -- returns index of string in array of strings or -1 */ int StrIndex( char **strp, /* array of strings */ char *str) /* string to find */ ; /* no_zombie - prevents the creation of zombies when spawning processes */ void no_zombie (void); /* all exec functions defined in exec_funcs.c */ pid_t system_bg(const char *cmd); /* unlinkWildCard - removes a wildcard of file (e.g. *.gif) */ void unlinkWildCard (const char *wildcard); /* FileMove - moves a file from source to dest */ /* FileCopy - copies a file from source to dest */ int FileMove (const char *source, const char *dest); int FileCopy (const char *source, const char *dest); int make_directory_for_filename (const char *filename); #endif #ifdef __cplusplus } #endif