compat/snprintf.c: handle snprintf's that always return the # chars transmitted
[gitweb.git] / ws.c
diff --git a/ws.c b/ws.c
index 24d3e3de078c699ca6bb0dfd524c097bf220b4b2..7a7ff130a34942506e6068105ac5946c9404bf18 100644 (file)
--- a/ws.c
+++ b/ws.c
@@ -225,6 +225,21 @@ unsigned ws_check(const char *line, int len, unsigned ws_rule)
        return ws_check_emit_1(line, len, ws_rule, NULL, NULL, NULL, NULL);
 }
 
+int ws_blank_line(const char *line, int len, unsigned ws_rule)
+{
+       /*
+        * We _might_ want to treat CR differently from other
+        * whitespace characters when ws_rule has WS_CR_AT_EOL, but
+        * for now we just use this stupid definition.
+        */
+       while (len-- > 0) {
+               if (!isspace(*line))
+                       return 0;
+               line++;
+       }
+       return 1;
+}
+
 /* Copy the line to the buffer while fixing whitespaces */
 int ws_fix_copy(char *dst, const char *src, int len, unsigned ws_rule, int *error_count)
 {