mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
some more work on the cli
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@24 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
382e7aefd4
commit
56f8c953dd
13 changed files with 458 additions and 58 deletions
12
src/strbuf.c
12
src/strbuf.c
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
struct chunk {
|
||||
struct chunk *next;
|
||||
size_t length;
|
||||
char text[];
|
||||
};
|
||||
|
||||
|
|
@ -43,12 +44,13 @@ char *strbuf_tostring(struct strbuf *sb) {
|
|||
assert(t);
|
||||
|
||||
e = t;
|
||||
*e = 0;
|
||||
for (c = sb->head; c; c = c->next) {
|
||||
strcpy(e, c->text);
|
||||
e = strchr(e, 0);
|
||||
memcpy(e, c->text, c->length);
|
||||
e += c->length;
|
||||
}
|
||||
|
||||
*e = 0;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +72,8 @@ void strbuf_puts(struct strbuf *sb, const char *t) {
|
|||
assert(c);
|
||||
|
||||
c->next = NULL;
|
||||
strcpy(c->text, t);
|
||||
c->length = l;
|
||||
memcpy(c->text, t, l);
|
||||
|
||||
if (sb->tail) {
|
||||
assert(sb->head);
|
||||
|
|
@ -101,6 +104,7 @@ int strbuf_printf(struct strbuf *sb, const char *format, ...) {
|
|||
va_end(ap);
|
||||
|
||||
if (r > -1 && r < size) {
|
||||
c->length = r;
|
||||
c->next = NULL;
|
||||
|
||||
if (sb->tail) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue