Archived
1
0
Fork 0

docs for strbuf and some small changes.

This commit is contained in:
H Hautakoski 2010-08-06 11:31:04 +02:00 committed by Henrik Hautakoski
parent d6537b235c
commit f1dbd880a7
6 changed files with 79 additions and 6 deletions

View file

@ -102,8 +102,8 @@ int main(int argc, char **argv) {
"Root Directory - Path to indexroot. All subdirectories will be indexed.\n"
"Db host - Database host\n"
"Db user - Database user\n"
"Db pass - Database password\n"
"Db name - Database to use for indexing\n"
"Db pass - Database password\n"
"Db name - Database to use for indexing\n"
"Db tbl - Database tablename", argv[0]);
return EXIT_FAILURE;

View file

@ -59,8 +59,8 @@ int arch_db_init(char *host, char *username, char *password, char *database, cha
fprintf(stderr, "Mysql init: %li\n", dbthread_id);
#endif
/* setup database */
db_setup();
/* setup database */
db_setup();
return 1;
}
@ -83,7 +83,7 @@ void arch_db_close() {
}
/*
* Truncate database table
* Database setup
*/
int db_setup() {

View file

@ -47,6 +47,15 @@ void strbuf_append(strbuf_t *s, char *str, size_t len) {
s->buf[s->len] = '\0';
}
void strbuf_reduce(strbuf_t *s, size_t len) {
if (len > s->len)
len = s->len;
s->len -= len;
s->buf[s->len] = '\0';
}
void strbuf_trim(strbuf_t *s) {
strbuf_rtrim(s);

View file

@ -25,6 +25,8 @@ void strbuf_init(strbuf_t *s);
void strbuf_append(strbuf_t *s, char *str, size_t len);
void strbuf_reduce(strbuf_t *s, size_t len);
void strbuf_trim(strbuf_t *s);
void strbuf_rtrim(strbuf_t *s);