Implement examples/unpack.c
This commit is contained in:
parent
448937b6fb
commit
272d9fe38c
2 changed files with 3 additions and 3 deletions
|
@ -7,7 +7,7 @@ INCLUDE_PATH = ../include
|
||||||
CFLAGS += -I$(INCLUDE_PATH)
|
CFLAGS += -I$(INCLUDE_PATH)
|
||||||
LDFLAGS = -L../src -lskipstone
|
LDFLAGS = -L../src -lskipstone
|
||||||
|
|
||||||
EXAMPLES = read map test queue pack
|
EXAMPLES = read map test queue pack unpack
|
||||||
|
|
||||||
RM = /bin/rm
|
RM = /bin/rm
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
#include <skipstone/message.h>
|
#include <skipstone/message.h>
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
uint8_t buf[6] = "\x5KMFDM",
|
uint8_t buf[7] = "\x5KMFDM",
|
||||||
str[SKIPSTONE_MESSAGE_MAX_STRLEN];
|
str[SKIPSTONE_MESSAGE_MAX_STRLEN];
|
||||||
|
|
||||||
if (skipstone_message_unpack(buf, sizeof(buf), "z", str) < 0) {
|
if (skipstone_message_unpack(buf, sizeof(buf), "z", str) < 0) {
|
||||||
fprintf(stderr, "%s: %s: %s\n",
|
fprintf(stderr, "%s: %s: %s\n",
|
||||||
argv[0], "skipstone_message_unpack()", strerror(errno));
|
argv[0], "skipstone_message_unpack()", strerror(errno));
|
||||||
|
|
||||||
goto message_unpack;
|
goto error_message_unpack;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s\n", str);
|
printf("%s\n", str);
|
||||||
|
|
Loading…
Add table
Reference in a new issue