Fix printf errors.

The compiler will help find mismatches between printf formats and
arguments if you let it.  This patch adds the necessary attributes to
declarations in include/common.h, then begins to correct the resulting
compiler warnings.  Some of these were bugs, e.g., "$d" instead of
"%d" and incorrect arguments.  Others were just annoying, like
int-long mismatches on a system where both are 32 bits.  It's worth
fixing the annoying errors to catch the real ones.

Signed-off-by: Andrew Klossner <andrew@cesa.opbu.xerox.com>
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 97b9dd7..d3b19dd 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -451,14 +451,14 @@
 		if (err == -FDT_ERR_BADVERSION) {
 			if (fdt_version(working_fdt) <
 			    FDT_FIRST_SUPPORTED_VERSION) {
-				printf (" - too old, fdt $d < %d",
+				printf (" - too old, fdt %d < %d",
 					fdt_version(working_fdt),
 					FDT_FIRST_SUPPORTED_VERSION);
 				working_fdt = NULL;
 			}
 			if (fdt_last_comp_version(working_fdt) >
 			    FDT_LAST_SUPPORTED_VERSION) {
-				printf (" - too new, fdt $d > %d",
+				printf (" - too new, fdt %d > %d",
 					fdt_version(working_fdt),
 					FDT_LAST_SUPPORTED_VERSION);
 				working_fdt = NULL;
@@ -546,7 +546,7 @@
 				newp = newval[++stridx];
 		}
 		if (*newp != ']') {
-			printf("Unexpected character '%c'\n", *newval);
+			printf("Unexpected character '%c'\n", *newp);
 			return 1;
 		}
 	} else {
@@ -763,7 +763,7 @@
 			}
 			break;
 		case FDT_NOP:
-			printf("/* NOP */\n", &tabs[MAX_LEVEL - level]);
+			printf("%s/* NOP */\n", &tabs[MAX_LEVEL - level]);
 			break;
 		case FDT_END:
 			return 1;
diff --git a/common/main.c b/common/main.c
index 046da6f..79ad291 100644
--- a/common/main.c
+++ b/common/main.c
@@ -509,7 +509,7 @@
  */
 
 #define putnstr(str,n)	do {			\
-		printf ("%.*s", n, str);	\
+		printf ("%.*s", (int)n, str);	\
 	} while (0)
 
 #define CTL_CH(c)		((c) - 'a' + 1)