diff src/c/static.c @ 1498:8c32c7191bf0

Make 'static' protocol handle unlimited retry
author Adam Chlipala <adam@chlipala.net>
date Fri, 15 Jul 2011 18:55:58 -0400
parents 9cb923efea4d
children 2f9b7382dd1d
line wrap: on
line diff
--- a/src/c/static.c	Fri Jul 15 18:45:03 2011 -0400
+++ b/src/c/static.c	Fri Jul 15 18:55:58 2011 -0400
@@ -25,15 +25,18 @@
  
   ctx = uw_init(0, NULL, log_debug);
   uw_set_app(ctx, &uw_application);
-  fk = uw_begin(ctx, argv[1]);
 
-  if (fk == SUCCESS) {
-    uw_print(ctx, 1);
-    puts("");
-    return 0;
-  } else {
-    fprintf(stderr, "Error!\n");
-    return 1;
+  while (1) {
+    fk = uw_begin(ctx, argv[1]);
+
+    if (fk == SUCCESS) {
+      uw_print(ctx, 1);
+      puts("");
+      return 0;
+    } else if (fk != UNLIMITED_RETRY) {
+      fprintf(stderr, "Error: %s\n", uw_error_message(ctx));
+      return 1;
+    }
   }
 }