mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-21 21:05:05 +00:00
Unified error strings.
This commit is contained in:
parent
1ad66e5166
commit
368cf465fc
1 changed files with 18 additions and 15 deletions
33
snac.c
33
snac.c
|
@ -78,7 +78,7 @@ int srv_open(char *basedir)
|
|||
cfg_file = xs_fmt("%s/server.json", basedir);
|
||||
|
||||
if ((f = fopen(cfg_file, "r")) == NULL)
|
||||
srv_log(xs_fmt("cannot open %s", cfg_file));
|
||||
srv_log(xs_fmt("error opening '%s'", cfg_file));
|
||||
else {
|
||||
xs *cfg_data;
|
||||
|
||||
|
@ -89,7 +89,7 @@ int srv_open(char *basedir)
|
|||
srv_config = xs_json_loads(cfg_data);
|
||||
|
||||
if (srv_config == NULL)
|
||||
srv_log(xs_fmt("cannot parse %s", cfg_file));
|
||||
srv_log(xs_fmt("cannot parse '%s'", cfg_file));
|
||||
else {
|
||||
char *host;
|
||||
char *prefix;
|
||||
|
@ -134,6 +134,17 @@ int validate_uid(char *uid)
|
|||
}
|
||||
|
||||
|
||||
void snac_free(snac *snac)
|
||||
/* frees a user snac */
|
||||
{
|
||||
free(snac->uid);
|
||||
free(snac->basedir);
|
||||
free(snac->config);
|
||||
free(snac->key);
|
||||
free(snac->actor);
|
||||
}
|
||||
|
||||
|
||||
int snac_open(snac *snac, char *uid)
|
||||
/* opens a user */
|
||||
{
|
||||
|
@ -172,13 +183,13 @@ int snac_open(snac *snac, char *uid)
|
|||
ret = 1;
|
||||
}
|
||||
else
|
||||
srv_log(xs_fmt("cannot parse %s", key_file));
|
||||
srv_log(xs_fmt("cannot parse '%s'", key_file));
|
||||
}
|
||||
else
|
||||
srv_log(xs_fmt("error opening '%s'", key_file));
|
||||
}
|
||||
else
|
||||
srv_log(xs_fmt("cannot parse %s", cfg_file));
|
||||
srv_log(xs_fmt("cannot parse '%s'", cfg_file));
|
||||
}
|
||||
else
|
||||
srv_log(xs_fmt("error opening '%s'", cfg_file));
|
||||
|
@ -186,21 +197,13 @@ int snac_open(snac *snac, char *uid)
|
|||
else
|
||||
srv_log(xs_fmt("invalid user '%s'", uid));
|
||||
|
||||
if (!ret)
|
||||
snac_free(snac);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void snac_free(snac *snac)
|
||||
/* frees a user snac */
|
||||
{
|
||||
free(snac->uid);
|
||||
free(snac->basedir);
|
||||
free(snac->config);
|
||||
free(snac->key);
|
||||
free(snac->actor);
|
||||
}
|
||||
|
||||
|
||||
void snac_debug(snac *snac, int level, d_char *str)
|
||||
/* prints a user debugging information */
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue