#include "config.h" int sat_config_write_example(FILE *stream) { if(stream == NULL) return -1; char buff[70]; time_t curr = time(NULL); struct tm dt = *localtime(&curr); strftime(buff, sizeof buff, "%F %T", &dt); fprintf(stream, "# Satori configuration\r\n"); fprintf(stream, "# Created on %s\r\n", buff); fprintf(stream, "\r\n"); fprintf(stream, "# Sock Chat connection settings\r\n"); fprintf(stream, "sockchat:host ws://example.com/sockchat\r\n"); fprintf(stream, "sockchat:token AAAAAAAAAAAAAAAAAAAAAAAAA\r\n"); fprintf(stream, "\r\n"); fprintf(stream, "# Prefix character for commands, only the first character will be used\r\n"); fprintf(stream, "commands:prefix !\r\n"); fprintf(stream, "\r\n"); fprintf(stream, "# Booru settings\r\n"); fprintf(stream, "booru:prefix ~\r\n"); fprintf(stream, ";booru:danbooru:token username:token\r\n"); fprintf(stream, "\r\n"); fprintf(stream, "# Worknik API token\r\n"); fprintf(stream, ";wordnik:token tokengoeshere\r\n"); fprintf(stream, "\r\n"); fprintf(stream, "# Uiharu URL lookup settings\r\n"); fprintf(stream, "uiharu:enable true\r\n"); fprintf(stream, "\r\n"); fprintf(stream, "# Flashii broadcast settings\r\n"); fprintf(stream, "flashii:broadcasts:enable true\r\n"); fprintf(stream, "\r\n"); fprintf(stream, "# This option is here to ensure you actually did the configuration.\r\n"); fprintf(stream, "# You must remove it entirely, or set it to false if you're a fuckhead, or the program won't start.\r\n"); fprintf(stream, "exampleCfg:unedited true\r\n"); return 0; } int sat_config_write_example_file(char *path) { if(path == NULL) return -2; FILE *stream = fopen(path, "wb"); int err = sat_config_write_example(stream); if(err) { if(stream) fclose(stream); return err; } fflush(stream); fclose(stream); return 0; }