Fix assorted documentation, frontend and printing bugs

Change the command line interface to make file names positional.
Add more sanity checks to the command line parser.

Corresponding to flashrom svn r998.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
diff --git a/Makefile b/Makefile
index 31fc858..147d385 100644
--- a/Makefile
+++ b/Makefile
@@ -71,7 +71,7 @@
 # of the checked out flashrom files.
 # Note to packagers: Any tree exported with "make export" or "make tarball"
 # will not require subversion. The downloadable snapshots are already exported.
-SVNVERSION := $(shell LC_ALL=C svnversion -cn . | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/" | grep "[0-9]" || LC_ALL=C svn info . | grep ^Revision | sed "s/.*[[:blank:]]\+\([0-9]*\)[^0-9]*/\1/" | grep "[0-9]" || echo unknown)
+SVNVERSION := $(shell LC_ALL=C svnversion -cn . 2>/dev/null | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/" | grep "[0-9]" || LC_ALL=C svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep "[0-9]" || LC_ALL=C git svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep "[0-9]" || echo unknown)
 
 RELEASE := 0.9.1
 VERSION := $(RELEASE)-r$(SVNVERSION)
diff --git a/cli_classic.c b/cli_classic.c
index 24762fe..6e8f098 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -37,33 +37,53 @@
 	int remaining = 0;
 	enum programmer p;
 
-	printf("Usage: %s [-VfLzhR] [-E|-r file|-w file|-v file] [-c chipname]\n"
-              "       [-m [vendor:]part] [-l file] [-i image] [-p programmer]\n\n", name);
-
-	printf("Please note that the command line interface for flashrom will "
-		"change before\nflashrom 1.0. Do not use flashrom in scripts "
-		"or other automated tools without\nchecking that your flashrom"
-		" version won't interpret options in a different way.\n\n");
-
-	printf
-	    ("   -r | --read:                      read flash and save into file\n"
-	     "   -w | --write:                     write file into flash\n"
-	     "   -v | --verify:                    verify flash against file\n"
-	     "   -n | --noverify:                  don't verify flash against file\n"
-	     "   -E | --erase:                     erase flash device\n"
-	     "   -V | --verbose:                   more verbose output\n"
-	     "   -c | --chip <chipname>:           probe only for specified flash chip\n"
-#if INTERNAL_SUPPORT == 1
-	     "   -m | --mainboard <[vendor:]part>: override mainboard settings\n"
-#endif
-	     "   -f | --force:                     force write without checking image\n"
-	     "   -l | --layout <file.layout>:      read ROM layout from file\n"
-	     "   -i | --image <name>:              only flash image name from flash layout\n"
-	     "   -L | --list-supported:            print supported devices\n"
+	printf("Usage: %s [-n] [-V] [-f] [-h|-R|-L|"
 #if PRINT_WIKI_SUPPORT == 1
-	     "   -z | --list-supported-wiki:       print supported devices in wiki syntax\n"
+	         "-z|"
 #endif
-	     "   -p | --programmer <name>:         specify the programmer device");
+	         "-E|-r <file>|-w <file>|-v <file>]\n"
+	       "       [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n"
+	       "       [-i <image>] [-p <programmername>[:<parameters>]]\n",
+	       name);
+
+	printf("Please note that the command line interface for flashrom has "
+	         "changed between\n"
+	       "0.9.1 and 0.9.2 and will change again before flashrom 1.0.\n"
+	       "Do not use flashrom in scripts or other automated tools "
+	         "without checking\n"
+	       "that your flashrom version won't interpret options in a "
+	         "different way.\n\n");
+
+	printf("   -h | --help                       print this help text\n"
+	       "   -R | --version                    print version (release)\n"
+	       "   -r | --read <file>                read flash and save to "
+	         "<file>\n"
+	       "   -w | --write <file>               write <file> to flash\n"
+	       "   -v | --verify <file>              verify flash against "
+	         "<file>\n"
+	       "   -E | --erase                      erase flash device\n"
+	       "   -V | --verbose                    more verbose output\n"
+	       "   -c | --chip <chipname>            probe only for specified "
+	         "flash chip\n"
+#if INTERNAL_SUPPORT == 1
+	       /* FIXME: --mainboard should be a programmer parameter */
+	       "   -m | --mainboard <[vendor:]part>  override mainboard "
+	         "detection\n"
+#endif
+	       "   -f | --force                      force specific operations "
+	         "(see man page)\n"
+	       "   -n | --noverify                   don't auto-verify\n"
+	       "   -l | --layout <file>              read ROM layout from "
+	         "<file>\n"
+	       "   -i | --image <name>               only flash image <name> "
+	         "from flash layout\n"
+	       "   -L | --list-supported             print supported devices\n"
+#if PRINT_WIKI_SUPPORT == 1
+	       "   -z | --list-supported-wiki        print supported devices "
+	         "in wiki syntax\n"
+#endif
+	       "   -p | --programmer <name>[:<param>] specify the programmer "
+	         "device");
 
 	for (p = 0; p < PROGRAMMER_INVALID; p++) {
 		pname = programmer_table[p].name;
@@ -88,12 +108,19 @@
 			printf(")\n");
 		}
 	}
-		
-	printf(
-	     "   -h | --help:                      print this help text\n"
-	     "   -R | --version:                   print the version (release)\n"
-	     "\nYou can specify one of -E, -r, -w, -v or no operation. If no operation is\n"
-	     "specified, then all that happens is that flash info is dumped.\n\n");
+
+	printf("\nYou can specify one of -h, -R, -L, "
+#if PRINT_WIKI_SUPPORT == 1
+	         "-z, "
+#endif
+	         "-E, -r, -w, -v or no operation.\n"
+	       "If no operation is specified, flashrom will only probe for "
+	         "flash chips.\n\n");
+}
+
+void cli_classic_abort_usage(const char *name)
+{
+	printf("Please run \"%s --help\" for usage info.\n", name);
 	exit(1);
 }
 
@@ -115,16 +142,12 @@
 	int operation_specified = 0;
 	int i;
 
-#if PRINT_WIKI_SUPPORT == 1
-	const char *optstring = "rRwvnVEfc:m:l:i:p:Lzh";
-#else
-	const char *optstring = "rRwvnVEfc:m:l:i:p:Lh";
-#endif
+	const char *optstring = "r:Rw:v:nVEfc:m:l:i:p:Lzh";
 	static struct option long_options[] = {
-		{"read", 0, 0, 'r'},
-		{"write", 0, 0, 'w'},
+		{"read", 1, 0, 'r'},
+		{"write", 1, 0, 'w'},
 		{"erase", 0, 0, 'E'},
-		{"verify", 0, 0, 'v'},
+		{"verify", 1, 0, 'v'},
 		{"noverify", 0, 0, 'n'},
 		{"chip", 1, 0, 'c'},
 		{"mainboard", 1, 0, 'm'},
@@ -133,9 +156,7 @@
 		{"layout", 1, 0, 'l'},
 		{"image", 1, 0, 'i'},
 		{"list-supported", 0, 0, 'L'},
-#if PRINT_WIKI_SUPPORT == 1
 		{"list-supported-wiki", 0, 0, 'z'},
-#endif
 		{"programmer", 1, 0, 'p'},
 		{"help", 0, 0, 'h'},
 		{"version", 0, 0, 'R'},
@@ -147,18 +168,15 @@
 	char *tempstr = NULL;
 
 	print_version();
-
-	if (argc > 1) {
-		/* Yes, print them. */
-		printf_debug("The arguments are:\n");
-		for (i = 1; i < argc; ++i)
-			printf_debug("%s\n", argv[i]);
-	}
+	print_banner();
 
 	if (selfcheck())
 		exit(1);
 
 	setbuf(stdout, NULL);
+	/* FIXME: Delay all operation_specified checks until after command
+	 * line parsing to allow --help overriding everything else.
+	 */
 	while ((opt = getopt_long(argc, argv, optstring,
 				  long_options, &option_index)) != EOF) {
 		switch (opt) {
@@ -166,16 +184,18 @@
 			if (++operation_specified > 1) {
 				fprintf(stderr, "More than one operation "
 					"specified. Aborting.\n");
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			}
+			filename = strdup(optarg);
 			read_it = 1;
 			break;
 		case 'w':
 			if (++operation_specified > 1) {
 				fprintf(stderr, "More than one operation "
 					"specified. Aborting.\n");
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			}
+			filename = strdup(optarg);
 			write_it = 1;
 			break;
 		case 'v':
@@ -183,20 +203,21 @@
 			if (++operation_specified > 1) {
 				fprintf(stderr, "More than one operation "
 					"specified. Aborting.\n");
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			}
 			if (dont_verify_it) {
 				fprintf(stderr, "--verify and --noverify are"
 					"mutually exclusive. Aborting.\n");
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			}
+			filename = strdup(optarg);
 			verify_it = 1;
 			break;
 		case 'n':
 			if (verify_it) {
 				fprintf(stderr, "--verify and --noverify are"
 					"mutually exclusive. Aborting.\n");
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			}
 			dont_verify_it = 1;
 			break;
@@ -210,36 +231,55 @@
 			if (++operation_specified > 1) {
 				fprintf(stderr, "More than one operation "
 					"specified. Aborting.\n");
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			}
 			erase_it = 1;
 			break;
-#if INTERNAL_SUPPORT == 1
 		case 'm':
+#if INTERNAL_SUPPORT == 1
 			tempstr = strdup(optarg);
 			lb_vendor_dev_from_string(tempstr);
-			break;
+#else
+			fprintf(stderr, "Error: Internal programmer support "
+				"was not compiled in and --mainboard only\n"
+				"applies to the internal programmer. Aborting.\n");
+			cli_classic_abort_usage(argv[0]);
 #endif
+			break;
 		case 'f':
 			force = 1;
 			break;
 		case 'l':
 			tempstr = strdup(optarg);
 			if (read_romlayout(tempstr))
-				exit(1);
+				cli_classic_abort_usage(argv[0]);
 			break;
 		case 'i':
 			tempstr = strdup(optarg);
 			find_romentry(tempstr);
 			break;
 		case 'L':
+			if (++operation_specified > 1) {
+				fprintf(stderr, "More than one operation "
+					"specified. Aborting.\n");
+				cli_classic_abort_usage(argv[0]);
+			}
 			list_supported = 1;
 			break;
-#if PRINT_WIKI_SUPPORT == 1
 		case 'z':
+#if PRINT_WIKI_SUPPORT == 1
+			if (++operation_specified > 1) {
+				fprintf(stderr, "More than one operation "
+					"specified. Aborting.\n");
+				cli_classic_abort_usage(argv[0]);
+			}
 			list_supported_wiki = 1;
-			break;
+#else
+			fprintf(stderr, "Error: Wiki output was not compiled "
+				"in. Aborting.\n");
+			cli_classic_abort_usage(argv[0]);
 #endif
+			break;
 		case 'p':
 			for (programmer = 0; programmer < PROGRAMMER_INVALID; programmer++) {
 				name = programmer_table[programmer].name;
@@ -267,21 +307,37 @@
 				}
 			}
 			if (programmer == PROGRAMMER_INVALID) {
-				printf("Error: Unknown programmer %s.\n", optarg);
-				exit(1);
+				fprintf(stderr, "Error: Unknown programmer "
+					"%s.\n", optarg);
+				cli_classic_abort_usage(argv[0]);
 			}
 			break;
 		case 'R':
 			/* print_version() is always called during startup. */
+			if (++operation_specified > 1) {
+				fprintf(stderr, "More than one operation "
+					"specified. Aborting.\n");
+				cli_classic_abort_usage(argv[0]);
+			}
 			exit(0);
 			break;
 		case 'h':
-		default:
+			if (++operation_specified > 1) {
+				fprintf(stderr, "More than one operation "
+					"specified. Aborting.\n");
+				cli_classic_abort_usage(argv[0]);
+			}
 			cli_classic_usage(argv[0]);
+			exit(0);
+			break;
+		default:
+			cli_classic_abort_usage(argv[0]);
 			break;
 		}
 	}
 
+	/* FIXME: Print the actions flashrom will take. */
+
 	if (list_supported) {
 		print_supported();
 		exit(0);
@@ -294,18 +350,18 @@
 	}
 #endif
 
-	if (read_it && write_it) {
-		printf("Error: -r and -w are mutually exclusive.\n");
-		cli_classic_usage(argv[0]);
+	if (optind < argc) {
+		fprintf(stderr, "Error: Extra parameter found.\n");
+		cli_classic_abort_usage(argv[0]);
 	}
 
-	if (optind < argc)
-		filename = argv[optind++];
-	
-	if (optind < argc) {
-		printf("Error: Extra parameter found.\n");
-		cli_classic_usage(argv[0]);
+#if INTERNAL_SUPPORT == 1
+	if ((programmer != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) {
+		fprintf(stderr, "Error: --mainboard requires the internal "
+				"programmer. Aborting.\n");
+		cli_classic_abort_usage(argv[0]);
 	}
+#endif
 
 	if (chip_to_probe) {
 		for (flash = flashchips; flash && flash->name; flash++)
@@ -321,13 +377,15 @@
 		/* Clean up after the check. */
 		flash = NULL;
 	}
-		
+
+	msg_pdbg("Initializing %s programmer\n",
+		 programmer_table[programmer].name);
 	if (programmer_init()) {
 		fprintf(stderr, "Error: Programmer initialization failed.\n");
 		exit(1);
 	}
 
-	// FIXME: Delay calibration should happen in programmer code.
+	/* FIXME: Delay calibration should happen in programmer code. */
 	myusec_calibrate_delay();
 
 	for (i = 0; i < ARRAY_SIZE(flashes); i++) {
@@ -383,7 +441,7 @@
 		printf("No operations were specified.\n");
 		// FIXME: flash writes stay enabled!
 		programmer_shutdown();
-		exit(1);
+		exit(0);
 	}
 
 	if (!filename && !erase_it) {
diff --git a/flash.h b/flash.h
index 9180583..f1ecb21 100644
--- a/flash.h
+++ b/flash.h
@@ -548,6 +548,7 @@
 int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran);
 char *strcat_realloc(char *dest, const char *src);
 void print_version(void);
+void print_banner(void);
 int selfcheck(void);
 int doit(struct flashchip *flash, int force, char *filename, int read_it, int write_it, int erase_it, int verify_it);
 
diff --git a/flashrom.8 b/flashrom.8
index ab53ff8..5ca14fc 100644
--- a/flashrom.8
+++ b/flashrom.8
@@ -1,9 +1,13 @@
-.TH FLASHROM 8 "May 21, 2009"
+.TH FLASHROM 8 "Apr 29, 2010"
 .SH NAME
 flashrom \- detect, read, write, verify and erase flash chips
 .SH SYNOPSIS
-.B flashrom \fR[\fB\-VfLzhRn\fR] [\fB\-E\fR|\fB\-r\fR file|\fB\-w\fR file|\fB\-v\fR file] [\fB\-c\fR chipname]
-         [\fB\-m\fR [vendor:]part] [\fB\-l\fR file] [\fB\-i\fR image] [\fB\-p\fR programmer]
+.B flashrom \fR[\fB\-n\fR] [\fB\-V\fR] [\fB\-f\fR] [\fB\-h\fR|\fB\-R\fR|\
+\fB\-L\fR|\fB\-z\fR|\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\
+\fB\-v\fR <file>]
+         [\fB\-c\fR <chipname>] [\fB\-m\fR [<vendor>:]<part>] \
+[\fB\-l\fR <file>]
+         [\fB\-i\fR <image>] [\fB\-p\fR <programmername>[:<parameters>]]
 .SH DESCRIPTION
 .B flashrom
 is a utility for detecting, reading, writing, verifying and erasing flash
@@ -20,9 +24,8 @@
 flashrom 1.0. Do not use flashrom in scripts or other automated tools without
 checking that your flashrom version won't interpret options in a different way.
 .PP
-You can specify one of \-E, \-r, \-w, \-v or no operation.
-If no operation is specified, then all that happens
-is that flash info is dumped and the flash chip is set to writable. It is
+You can specify one of \-h, \-R, \-L, \-z, \-E, \-r, \-w, \-v or no operation.
+If no operation is specified, flashrom will only probe for flash chips. It is
 recommended that if you try flashrom the first time on a system, you run it
 in probe only mode and check the output. Also you are advised to make a
 backup of your current ROM contents with \-r before you try to write a new
@@ -33,19 +36,19 @@
 .BR <file> .
 .TP
 .B "\-w, \-\-write <file>"
-Write file into flash ROM.
+Write
+.B <file>
+into flash ROM.
 .TP
 .B "\-n, \-\-noverify"
-Do
-.B not
-verify the flash ROM contents after writing them to the chip. Using this
+Skip the automatic verification of flash ROM contents after writing. Using this
 option is
 .B not
-recommended, you should only use it if you know what you are doing and you
+recommended, you should only use it if you know what you are doing and if you
 feel that the time for verification takes too long.
 .sp
 Typical usage is:
-.B "flashrom -wn file"
+.B "flashrom -n -w file"
 .sp
 This option is only useful in combination with
 .BR \-\-write .
@@ -66,14 +69,14 @@
 .B "flashrom \-L"
 without the vendor name. Please note that the chip name is case sensitive.
 .TP
-.B "\-m, \-\-mainboard" <[vendor:]part>
+.B "\-m, \-\-mainboard" [<vendor>:]<part>
 Override mainboard settings.
 .sp
 flashrom reads the coreboot table to determine the current mainboard. If no
 coreboot table could be read or if you want to override these values, you can
 specify \-m, e.g.:
 .sp
-.B "  flashrom -w --mainboard AGAMI:ARUMA agami_aruma.rom"
+.B "  flashrom --mainboard AGAMI:ARUMA -w agami_aruma.rom"
 .sp
 See the 'Supported mainboards' section in the output of 'flashrom \-L' for
 a list of boards which require the specification of the board name, if no
@@ -108,19 +111,15 @@
 All addresses are offsets within the file, not absolute addresses!
 If you only want to update the normal image in a ROM you can say:
 .sp
-.B "  flashrom -w --layout rom.layout --image normal agami_aruma.rom"
+.B "  flashrom --layout rom.layout --image normal -w agami_aruma.rom"
 .sp
 To update normal and fallback but leave the VGA BIOS alone, say:
 .sp
-.B "  flashrom -w -l rom.layout -i normal \"
+.B "  flashrom -l rom.layout -i normal \"
 .br
-.B "           -i fallback agami_aruma.rom"
+.B "           -i fallback -w agami_aruma.rom"
 .sp
 Currently overlapping sections are not supported.
-.sp
-ROM layouts should replace the \-s and \-e option since they are more
-flexible and they should lead to a ROM update file format with the
-ROM layout and the ROM image in one file (cpio, zip or something?).
 .TP
 .B "\-i, \-\-image <name>"
 Only flash image
@@ -141,7 +140,8 @@
 Same as
 .BR \-\-list\-supported ,
 but outputs the supported hardware in MediaWiki syntax, so that it can be
-easily pasted into the wiki page at http://www.flashrom.org/.
+easily pasted into the wiki page at http://www.flashrom.org/. Please note
+that MediaWiki output is not compiled in by default.
 .TP
 .B "\-p, \-\-programmer <name>[:parameter[,parameter[,parameter]]]"
 Specify the programmer device. Currently supported are:
@@ -237,6 +237,7 @@
 .sp
 If your mainboard uses an ITE IT87 series Super I/O for LPC<->SPI flash bus
 translation, flashrom should autodetect that configuration. You can use
+.sp
 .B "flashrom -p internal:it87spiport=portnum"
 syntax as explained in the
 .B it87spi
@@ -382,6 +383,8 @@
 .br
 Markus Boas <ryven@ryven.de>
 .br
+Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
+.br
 Nikolay Petukhov <nikolay.petukhov@gmail.com>
 .br
 Peter Stuge <peter@stuge.se>
@@ -392,6 +395,8 @@
 .br
 Ronald Hoogenboom <ronald@zonnet.nl>
 .br
+Sean Nelson <audiohacked@gmail.com>
+.br
 Stefan Reinauer <stepan@coresystems.de>
 .br
 Stefan Wildemann <stefan.wildemann@kontron.com>
@@ -406,5 +411,6 @@
 .br
 some others 
 .PP
-This manual page was written by Uwe Hermann <uwe@hermann-uwe.de>.
+This manual page was written by Uwe Hermann <uwe@hermann-uwe.de> and Carl-Daniel
+Hailfinger.
 It is licensed under the terms of the GNU GPL (version 2 or later).
diff --git a/flashrom.c b/flashrom.c
index c302271..1b01381 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1130,8 +1130,9 @@
 {
 	msg_gerr("Your flash chip is in an unknown state.\n"
 		"Get help on IRC at irc.freenode.net (channel #flashrom) or\n"
-		"mail flashrom@flashrom.org!\n--------------------"
-		"-----------------------------------------------------------\n"
+		"mail flashrom@flashrom.org!\n"
+		"-------------------------------------------------------------"
+		  "------------------\n"
 		"DO NOT REBOOT OR POWEROFF!\n");
 }
 
@@ -1183,10 +1184,17 @@
 
 void print_version(void)
 {
-	msg_ginfo("flashrom v%s\n", flashrom_version);
+	msg_ginfo("flashrom v%s", flashrom_version);
 	print_sysinfo();
 }
 
+void print_banner(void)
+{
+	msg_ginfo("flashrom is free software, get the source code at "
+		    "http://www.flashrom.org\n");
+	msg_ginfo("\n");
+}
+
 int selfcheck(void)
 {
 	int ret = 0;
@@ -1247,13 +1255,20 @@
 			msg_cinfo("\n");
 		}
 		/* FIXME: This message is designed towards CLI users. */
-		msg_cinfo("Please email a report to flashrom@flashrom.org if any "
-		       "of the above operations\nwork correctly for you with "
-		       "this flash part. Please include the flashrom\noutput "
-		       "with the additional -V option for all operations you "
-		       "tested (-V, -rV,\n-wV, -EV), and mention which "
-		       "mainboard or programmer you tested.\nThanks for your "
-		       "help!\n===\n");
+		msg_cinfo("The test status of this chip may have been updated "
+			    "in the latest development\n"
+			  "version of flashrom. If you are running the latest "
+			    "development version,\n"
+			  "please email a report to flashrom@flashrom.org if "
+			    "any of the above operations\n"
+			  "work correctly for you with this flash part. Please "
+			    "include the flashrom\n"
+			  "output with the additional -V option for all "
+			    "operations you tested (-V, -Vr,\n"
+			  "-Vw, -VE), and mention which mainboard or "
+			    "programmer you tested.\n"
+			  "Thanks for your help!\n"
+			  "===\n");
 	}
 }
 
diff --git a/print.c b/print.c
index 2a2c81b..abc1209 100644
--- a/print.c
+++ b/print.c
@@ -247,6 +247,9 @@
 #if SATASII_SUPPORT == 1
 		print_supported_pcidevs(satas_sii);
 #endif
+#if ATAHPT_SUPPORT == 1
+		print_supported_pcidevs(ata_hpt);
+#endif
 }
 
 
diff --git a/print_wiki.c b/print_wiki.c
index 87adf4d..38505ed 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -25,6 +25,7 @@
 #include "flash.h"
 #include "flashchips.h"
 
+#if INTERNAL_SUPPORT == 1
 struct board_info_url {
 	const char *vendor;
 	const char *name;
@@ -36,6 +37,7 @@
 	const char *name;
 	const char *note;
 };
+#endif
 
 const char *wiki_header = "= Supported devices =\n\n\
 <div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
@@ -44,6 +46,7 @@
 generated by pasting '''flashrom -z''' output.<br />\
 '''Last update:''' %s(generated by flashrom %s)\n</small></div>\n";
 
+#if INTERNAL_SUPPORT == 1
 const char *chipset_th = "{| border=\"0\" style=\"font-size: smaller\"\n\
 |- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
 ! align=\"left\" | Southbridge\n! align=\"left\" | PCI IDs\n\
@@ -69,6 +72,7 @@
 Mainboards which don't appear in the list may or may not work (we don't \
 know, someone has to give it a try). Please report any further verified \
 mainboards on the [[Mailinglist|mailing list]].\n";
+#endif
 
 const char *chip_th = "{| border=\"0\" style=\"font-size: smaller\" \
 valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
@@ -85,6 +89,7 @@
 ! align=\"left\" | Device\n! align=\"left\" | PCI IDs\n\
 ! align=\"left\" | Status\n\n";
 
+#if INTERNAL_SUPPORT == 1
 const char *laptop_intro = "\n== Supported laptops/notebooks ==\n\n\
 In general, flashing laptops is more difficult because laptops\n\n\
 * often use the flash chip for stuff besides the BIOS,\n\
@@ -505,6 +510,7 @@
 	wiki_helper("Known good (worked out of the box)", "OK", 1, laptops_ok);
 	wiki_helper("Not supported (yet)", "No", 1, laptops_bad);
 }
+#endif
 
 void print_supported_chips_wiki(void)
 {
@@ -576,9 +582,11 @@
 	time_t t = time(NULL);
 
 	printf(wiki_header, ctime(&t), flashrom_version);
+#if INTERNAL_SUPPORT == 1
 	print_supported_chips_wiki();
 	print_supported_chipsets_wiki();
 	print_supported_boards_wiki();
+#endif
 	printf("%s", programmer_section);
 #if NIC3COM_SUPPORT == 1
 	print_supported_pcidevs_wiki(nics_3com);