/* Sitespec.c Functions that return site specific files and locations. */ #include #include #include "util.h" #include "techrep.h" #include "sitespec.h" /* function protos */ static char urlPrefix[STRING_SIZE]; static char errorLogFile[STRING_SIZE]; static char reportDirPath[STRING_SIZE]; static char citationDataFilePath[STRING_SIZE]; static char indexHeaderPath[STRING_SIZE]; static char semaphoreFilePath[STRING_SIZE]; static char compressPath[STRING_SIZE]; static char genHtmlPath[STRING_SIZE]; /*static char readmeHtmlPath[STRING_SIZE];*/ void fatalError (char *message); /* * This function must be called *first* to set all of the * appropriate statics. Right now we are not using environment variables. */ void initEnvironment() { /* init */ strcpy (reportDirPath, TR_REPORT_DIR); if (reportDirPath[strlen(reportDirPath)-1] != '/') { strcat (reportDirPath, "/"); } strcpy (urlPrefix, TR_URL_PREFIX); if (urlPrefix[strlen(urlPrefix)-1] != '/') { strcat (urlPrefix, "/"); } strcpy (citationDataFilePath, TR_CITATION_DATA_FILE); strcpy (indexHeaderPath, TR_INDEX_HEADER_FILE); strcpy (semaphoreFilePath, TR_SEMAPHORE_FILE); strcpy (compressPath, TR_COMPRESS_CMD); strcpy (errorLogFile, TR_ERROR_LOG_FILE); strcpy (genHtmlPath, GENHTML_PATH); /* strcpy (readmeHtmlPath, READMEHTML_PATH);*/ } char * getReportDirectoryPath() { return (reportDirPath); } char * getUrlPrefix() { return (urlPrefix); } char * getCitationDataFilePath() { return (citationDataFilePath); } char * getIndexHeaderPath() { return (indexHeaderPath); } char * getSemaphoreFilePath() { return (semaphoreFilePath); } char * getCompressPath() { return (compressPath); } char * getErrorLogFile() { return (errorLogFile); } char * getGenHtmlPath() { return (genHtmlPath); } /*char * getReadmeHtmlPath()*/ /*{*/ /* return (readmeHtmlPath);*/ /*}*/ void fatalError (char *message) { fprintf (stderr, "%s\n", message); exit (1); } #ifdef STANDALONE_TEST int main() { initEnvironment (); printf ("Report directory is %s\n", getReportDirectoryPath()); printf ("Citation file is %s\n", getCitationDataFilePath()); printf ("Index header is %s\n", getIndexHeaderPath()); printf ("Semaphore file is %s\n", getSemaphoreFilePath()); printf ("Compress command is %s\n", getCompressPath()); } #endif