path= and injectauth params
[pam_pcsc_cr.git] / test_serial.c
index c2a59e60171fe77cc3a9cdc3d8b7557e277dce13..32e3ed3af15b23b0338ee9547a0c0daa4fe3b953 100644 (file)
@@ -30,17 +30,13 @@ int main(int argc, char *argv[])
        printf("serialized size=%d\n", serial_size(&srl));
        serial_init(&srl, buffer, sizeof(buffer));
        for (i = 0; i < 4; i++) {
-               char item[32];
-               memset(item, 0, sizeof(item));
-               int size = serial_get(&srl, item, sizeof(item));
-               if (size > sizeof(item)) {
-                       printf("serial_get(..., item, %d) = %d\n",
-                               (int)sizeof(item), size);
+               char *item;
+               int size;
+               if (serial_get(&srl, (void**)&item, &size)) {
+                       printf("serial_get failed for item %d\n", i);
                        rc = 1;
-               } else if (size == 0) {
-                       printf("serial_get(...) = 0\n");
                } else {
-                       printf("serial_get(...) = %d: \"%s\"\n", size, item);
+                       printf("serial_get(...) = %d: \"%.*s\"\n", size, size, item);
                        if (memcmp(in[i], item, size)) {
                                printf("\"%s\" != \"%s\" (%d)\n",
                                        in[i], item, size);