| | |
| | | |
| | | static void getLogFname(char* logpath) { |
| | | #ifdef __unix__ |
| | | char const *folder = getenv("TMPDIR"); |
| | | const char *folder = getenv("TMPDIR"); |
| | | if (folder == 0) { |
| | | folder = "/tmp"; |
| | | } |
| | | strncpy(logpath, folder, MAX_PATH); |
| | | strncat(logpath, "/open-license.log", MAX_PATH - strlen(logpath)); |
| | | #else |
| | | int plen = GetTempPath(MAX_PATH, logpath); |
| | | const int plen = GetTempPath(MAX_PATH, logpath); |
| | | if(plen == 0) { |
| | | fprintf(stderr, "Error getting temporary directory path"); |
| | | } |
| | |
| | | #endif |
| | | } |
| | | |
| | | void _log(char* format, ...) { |
| | | char logpath[MAX_PATH]; |
| | | void _log(const char* format, ...) { |
| | | va_list args; |
| | | char * buffer; |
| | | if (logFile == NULL) { |
| | | char logpath[MAX_PATH]; |
| | | getLogFname(logpath); |
| | | logFile = fopen(logpath, "a"); |
| | | if (logFile == NULL) { |