#include <stdio.h>
#include <string.h>
#include <syscall.h>
-
-char expected[] = {
- "Amazing Electronic Fact: If you scuffed your feet long enough without\n"
- "touching anything, you would build up so many electrons that your\n"
- "finger would explode! But this is nothing to worry about unless you\n"
- "have carpeting.\n"
-};
-
-
+#include "sample.inc"
static char *
mk_boundary_string (const char *src)
int byte_cnt;
char *actual_p;
- actual_p = mk_boundary_string (expected);
+ actual_p = mk_boundary_string (sample);
printf ("(read-boundary) begin\n");
if (handle < 2)
printf ("(read-boundary) fail: open() returned %d\n", handle);
- byte_cnt = read (handle, actual_p, sizeof expected - 1);
- if (byte_cnt != sizeof expected - 1)
- printf ("(read-boundary) fail: read() returned %d instead of %d\n",
- byte_cnt, sizeof expected - 1);
- else if (strcmp (expected, actual_p))
+ byte_cnt = read (handle, actual_p, sizeof sample - 1);
+ if (byte_cnt != sizeof sample - 1)
+ printf ("(read-boundary) fail: read() returned %d instead of %zu\n",
+ byte_cnt, sizeof sample - 1);
+ else if (strcmp (sample, actual_p))
printf ("(read-boundary) fail: expected text differs from actual:\n%s",
actual_p);