Commit f0a70414 authored by Cedric Roux's avatar Cedric Roux

add get_format to database

parent 8e7ee86c
...@@ -409,3 +409,20 @@ void on_off(void *_d, char *item, int *a, int onoff) ...@@ -409,3 +409,20 @@ void on_off(void *_d, char *item, int *a, int onoff)
exit(1); exit(1);
} }
} }
database_event_format get_format(void *_database, int event_id)
{
database *d = _database;
database_event_format ret;
if (event_id < 0 || event_id >= d->isize) {
printf("%s:%d: bad event ID (%d)\n", __FILE__, __LINE__, event_id);
abort();
}
ret.type = d->i[event_id].arg_type;
ret.name = d->i[event_id].arg_name;
ret.count = d->i[event_id].asize;
return ret;
}
...@@ -8,4 +8,16 @@ void list_ids(void *database); ...@@ -8,4 +8,16 @@ void list_ids(void *database);
void list_groups(void *database); void list_groups(void *database);
void on_off(void *d, char *item, int *a, int onoff); void on_off(void *d, char *item, int *a, int onoff);
/****************************************************************************/
/* get format of an event */
/****************************************************************************/
typedef struct {
char **type;
char **name;
int count;
} database_event_format;
database_event_format get_format(void *database, int event_id);
#endif /* _DATABASE_H_ */ #endif /* _DATABASE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment