Get rid of unnecessary barrier. Improve comment.
[pintos-anon] / grading / userprog / read-normal.c
index 4bb7679ad39486a305079551a9a957515fde7868..9a63083b890f16cb8c40fecf45b085e42b650da3 100644 (file)
@@ -1,15 +1,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <syscall.h>
+#include "sample.inc"
 
-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" 
-};
-
-char actual[sizeof expected];
+char actual[sizeof sample];
 
 int
 main (void) 
@@ -23,9 +17,9 @@ main (void)
 
   byte_cnt = read (handle, actual, sizeof actual - 1);
   if (byte_cnt != sizeof actual - 1)
-    printf ("(read-normal) fail: read() returned %d instead of %d\n",
+    printf ("(read-normal) fail: read() returned %d instead of %zu\n",
             byte_cnt, sizeof actual - 1);
-  else if (strcmp (expected, actual))
+  else if (strcmp (sample, actual))
     printf ("(read-normal) fail: expected text differs from actual:\n%s",
             actual);