Imported Upstream version 7.50.2
[platform/upstream/curl.git] / docs / examples / htmltidy.c
index 01b1e68..687e3f3 100644 (file)
@@ -37,27 +37,27 @@ uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
 {
   uint r;
   r = size * nmemb;
-  tidyBufAppend( out, in, r );
+  tidyBufAppend(out, in, r);
   return r;
 }
 
 /* Traverse the document tree */
-void dumpNode(TidyDoc doc, TidyNode tnod, int indent )
+void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
 {
   TidyNode child;
   for(child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) {
-    ctmbstr name = tidyNodeGetName( child );
+    ctmbstr name = tidyNodeGetName(child);
     if(name) {
       /* if it has a name, then it's an HTML tag ... */
       TidyAttr attr;
-      printf( "%*.*s%s ", indent, indent, "<", name);
+      printf("%*.*s%s ", indent, indent, "<", name);
       /* walk the attribute list */
       for(attr=tidyAttrFirst(child); attr; attr=tidyAttrNext(attr) ) {
         printf(tidyAttrName(attr));
         tidyAttrValue(attr)?printf("=\"%s\" ",
                                    tidyAttrValue(attr)):printf(" ");
       }
-      printf( ">\n");
+      printf(">\n");
     }
     else {
       /* if it doesn't have a name, then it's probably text, cdata, etc... */
@@ -67,12 +67,12 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent )
       printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:"");
       tidyBufFree(&buf);
     }
-    dumpNode( doc, child, indent + 4 ); /* recursive */
+    dumpNode(doc, child, indent + 4); /* recursive */
   }
 }
 
 
-int main(int argc, char **argv )
+int main(int argc, char **argv)
 {
   CURL *curl;
   char curl_errbuf[CURL_ERROR_SIZE];
@@ -91,7 +91,7 @@ int main(int argc, char **argv )
     tdoc = tidyCreate();
     tidyOptSetBool(tdoc, TidyForceOutput, yes); /* try harder */
     tidyOptSetInt(tdoc, TidyWrapLen, 4096);
-    tidySetErrorBuffer( tdoc, &tidy_errbuf );
+    tidySetErrorBuffer(tdoc, &tidy_errbuf);
     tidyBufInit(&docbuf);
 
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf);
@@ -103,7 +103,7 @@ int main(int argc, char **argv )
         if(err >= 0) {
           err = tidyRunDiagnostics(tdoc); /* load tidy error buffer */
           if(err >= 0) {
-            dumpNode( tdoc, tidyGetRoot(tdoc), 0 ); /* walk the tree */
+            dumpNode(tdoc, tidyGetRoot(tdoc), 0); /* walk the tree */
             fprintf(stderr, "%s\n", tidy_errbuf.bp); /* show errors */
           }
         }
@@ -121,7 +121,7 @@ int main(int argc, char **argv )
 
   }
   else
-    printf( "usage: %s <url>\n", argv[0] );
+    printf("usage: %s <url>\n", argv[0]);
 
   return 0;
 }