Added global variables in sitefiles to allow for https support
This commit is contained in:
27
src/util.c
27
src/util.c
@@ -15,12 +15,39 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <util.h>
|
||||
|
||||
static FILE *logs;
|
||||
|
||||
int initLogging(char *path) {
|
||||
logs = fopen(path, "a");
|
||||
return logs == NULL;
|
||||
}
|
||||
|
||||
int createLog(char *msg) {
|
||||
time_t currenttime;
|
||||
time(¤ttime);
|
||||
struct tm *timeinfo = gmtime(¤ttime);
|
||||
if (timeinfo == NULL)
|
||||
return 1;
|
||||
fprintf(logs, "[%d-%02d-%02dT%02d:%02d:%02dZ] %s\n",
|
||||
timeinfo->tm_year + 1900,
|
||||
timeinfo->tm_mon + 1,
|
||||
timeinfo->tm_mday,
|
||||
timeinfo->tm_hour,
|
||||
timeinfo->tm_min,
|
||||
timeinfo->tm_sec,
|
||||
msg);
|
||||
fflush(logs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int istrcmp(char *s1, char *s2) {
|
||||
for (int i = 0;; i++) {
|
||||
char c1 = tolower(s1[i]);
|
||||
|
||||
Reference in New Issue
Block a user