}
Config *cf = getconfig();
+ if (cf == NULL) {
+#if defined (_WIN32)
+ const char *cnfpath = "type nul > \\AppData\\Local\\076\\sp\\sp.conf";
+#elif defined (__HAIKU__)
+ const char *cnfpath = "touch /boot/home/config/settings/sp/sp.conf";
+#else
+ const char *cnfpath = "touch ~/config/sp.conf";
+#endif
+ printf("コンフィグファイルを見つけられません。"
+ "「%s」を実効して下さい。\n", cnfpath);
+ return -1;
+
+ }
lang = getlang(cf);
if (strcmp(argv[1], "-g") == 0) {
#include <stdio.h>
#include <string.h>
+#if defined(__MUSL__)
+#include <ctype>
+#endif
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
int otpTimeFromCnf;
Config *cnf;
+#if defined(__MUSL__)
+char *strcasestr(const char *haystack, const char *needle) {
+ size_t len = strlen(needle);
+ for (const char *p = haystack; *p; p++) {
+ if (strncasecmp(p, needle, len) == 0) return (char *)p;
+ }
+
+ return NULL;
+}
+#endif
+
Config *getconfig() {
const char *configpath = getconfigpath();
if (!configpath) {
cnf->passtimeout = 45;
cnf->otptimeout = 30;
strncpy(cnf->language, "ja", sizeof(cnf->language) - 1);
+ cnf->language[sizeof(cnf->language) - 1] = '\0';
cnf->syncname[sizeof(cnf->syncname) - 1] = '\0';
cnf->syncpass[sizeof(cnf->syncpass) - 1] = '\0';
cnf->syncinstance[sizeof(cnf->syncinstance) - 1] = '\0';
- cnf->language[sizeof(cnf->language) - 1] = '\0';
FILE *fp = fopen(configpath, "r");
if (!fp) {
char language[3];
} Config;
+char *strcasestr(const char *haystack, const char *needle);
Config *getconfig();
const char *getconfigpath();
char *getbasedir(int trailing);