added some comments and formated code
authorArun Persaud <arun@nubati.net>
Fri, 9 Oct 2009 06:51:06 +0000 (23:51 -0700)
committerArun Persaud <arun@nubati.net>
Fri, 9 Oct 2009 07:14:14 +0000 (00:14 -0700)
xboard.c

index 1e0e7a8..79b61a2 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -2419,25 +2419,35 @@ main(argc, argv)
       XtAppInitialize(&appContext, "XBoard", shellOptions,
                      XtNumber(shellOptions),
                      &argc, argv, xboardResources, NULL, 0);
-    if (argc > 1) {
+    if (argc > 1) 
+      { /* left over command line arguments, print out help and exit.
+        * Use two columns to print help
+        */
        fprintf(stderr, _("%s: unrecognized argument %s\n"),
                programName, argv[1]);
+
        fprintf(stderr, "Recognized options:\n");
-       for(i = 0; i < XtNumber(shellOptions); i++) {
+       for(i = 0; i < XtNumber(shellOptions); i++) 
+         {
+           /* print first column */
            j = fprintf(stderr, "  %s%s", shellOptions[i].option,
                        (shellOptions[i].argKind == XrmoptionSepArg
                         ? " ARG" : ""));
-           if (++i < XtNumber(shellOptions)) {         
+           /* print second column and end line */
+           if (++i < XtNumber(shellOptions)) 
+             {         
                fprintf(stderr, "%*c%s%s\n", 40 - j, ' ',
                        shellOptions[i].option,
                        (shellOptions[i].argKind == XrmoptionSepArg
                         ? " ARG" : ""));
-           } else {
+             } 
+           else 
+             {
                fprintf(stderr, "\n");
-           }
-       }
+             };
+         };
        exit(2);
-    }
+      };
 
     p = getenv("HOME");
     if (p == NULL) p = "/tmp";