147 "Id: %-3s %s", i->id, (i->desc ? i->desc : "")); |
147 "Id: %-3s %s", i->id, (i->desc ? i->desc : "")); |
148 } |
148 } |
149 scr_LogPrint(LPRINT_LOGNORM, "End of events list."); |
149 scr_LogPrint(LPRINT_LOGNORM, "End of events list."); |
150 } |
150 } |
151 |
151 |
152 // evs_geteventscomplist() |
152 // evs_geteventslist(bool comp) |
153 // Return a singly-linked-list of events ids, for the completion system. |
153 // Return a singly-linked-list of events ids, for the completion system. |
|
154 // If comp is true, the string "list" is added (it's a completion argument). |
154 // Note: the caller should free the list (and data) after use. |
155 // Note: the caller should free the list (and data) after use. |
155 GSList *evs_geteventscomplist(void) |
156 GSList *evs_geteventslist(int compl) |
156 { |
157 { |
157 GSList *evidlist = NULL, *p; |
158 GSList *evidlist = NULL, *p; |
158 eviqs *i; |
159 eviqs *i; |
159 |
160 |
160 for (p = evs_list; p; p = g_slist_next(p)) { |
161 for (p = evs_list; p; p = g_slist_next(p)) { |
161 i = p->data; |
162 i = p->data; |
162 evidlist = g_slist_append(evidlist, g_strdup(i->id)); |
163 evidlist = g_slist_append(evidlist, g_strdup(i->id)); |
163 } |
164 } |
164 |
165 |
165 // Last item is the "list" subcommand. |
166 if (compl) { |
166 evidlist = g_slist_append(evidlist, g_strdup("list")); |
167 // Last item is the "list" subcommand. |
|
168 evidlist = g_slist_append(evidlist, g_strdup("list")); |
|
169 } |
167 return evidlist; |
170 return evidlist; |
168 } |
171 } |
169 |
172 |
170 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |
173 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |