bug fixing
This commit is contained in:
parent
9905e9fada
commit
cbbbf68db0
2 changed files with 20 additions and 19 deletions
|
@ -86,12 +86,14 @@ int main(int argc, char **argv) {
|
|||
size_t lists_len = 0;
|
||||
klist_list **lists = NULL;
|
||||
if (list_ctx->name) {
|
||||
klist_list *list = klist_list_get_by_user_and_name(ctx, user->id, list_ctx->name);
|
||||
klist_list *list =
|
||||
klist_list_get_by_user_and_name(ctx, user->id, list_ctx->name);
|
||||
if (list) {
|
||||
lists_len = 1;
|
||||
lists = &list;
|
||||
};
|
||||
} else lists = klist_list_get_all_by_user(ctx, user->id, &lists_len);
|
||||
} else
|
||||
lists = klist_list_get_all_by_user(ctx, user->id, &lists_len);
|
||||
if (lists) {
|
||||
i = 0;
|
||||
for (; i < lists_len; i++) {
|
||||
|
@ -106,8 +108,7 @@ int main(int argc, char **argv) {
|
|||
klist_task_deinit(tasks[i]);
|
||||
free(tasks);
|
||||
}
|
||||
} else
|
||||
if (list_ctx->name)
|
||||
} else if (list_ctx->name)
|
||||
fprintf(stderr, "List '%s' not found.\n", list_ctx->name);
|
||||
else
|
||||
fprintf(stderr, "No lists found.\n");
|
||||
|
@ -294,7 +295,6 @@ void setup(klist *ctx, int argc, char **argv) {
|
|||
ctx->cmd_ctx = list_ctx;
|
||||
if (argc < 3) {
|
||||
list_ctx->cmd = LIST_GET;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -320,8 +320,7 @@ void setup(klist *ctx, int argc, char **argv) {
|
|||
break;
|
||||
default:
|
||||
print_help(argv);
|
||||
fprintf(
|
||||
stderr,
|
||||
fprintf(stderr,
|
||||
""
|
||||
"list options:\n"
|
||||
"-a\t\tadd a list\n"
|
||||
|
@ -329,7 +328,8 @@ void setup(klist *ctx, int argc, char **argv) {
|
|||
"-d\t\tdelete a list\n"
|
||||
"-p <preset>\tdefine as preset or use existing one with name "
|
||||
"<preset>\n"
|
||||
"Not providing a parameter prints all lists and existing presets.\n\n");
|
||||
"Not providing a parameter prints all lists and existing "
|
||||
"presets.\n\n");
|
||||
}
|
||||
break;
|
||||
case TASK:
|
||||
|
|
|
@ -56,7 +56,8 @@ const char *klist_sql_get(const enum KLIST_SQL sql) {
|
|||
return "select users.*, user_logins.local_id from users inner join "
|
||||
"user_logins on user_logins.user_id = users.id where users.id = ?1";
|
||||
case GET_USER_BY_LOCAL:
|
||||
return "select * from users inner join user_logins on user_logins.user_id = users.id where user_logins.local_id = ?1";
|
||||
return "select * from users inner join user_logins on user_logins.user_id "
|
||||
"= users.id where user_logins.local_id = ?1";
|
||||
case GET_USERS:
|
||||
return "select * from users";
|
||||
case MOD_USER_NAME:
|
||||
|
|
Loading…
Add table
Reference in a new issue