[Debburn-devel] [PATCH] clean up HOST_* macros

Peter Samuelson peter at p12n.org
Tue Sep 5 06:40:45 UTC 2006


Look at the HOST_{ALIAS,SUB,CPU,VENDOR,OS} macros in xconfig.h.in.
They are always used together, never separately; so it may as well be a
single macro, which I've called HOST_SYSTEM.

(Note: the @CMAKE_SYSTEM_MACHINE@ macro does not work anyway - but
that's not really related to this patch.)

Peter


Index: scgskeleton/skel.c
===================================================================
--- scgskeleton/skel.c	(revisione 214)
+++ scgskeleton/skel.c	(copia locale)
@@ -157,9 +157,9 @@
 	if (help)
 		usage(0);
 	if (pversion) {
-		printf("scgskeleton %s (%s-%s-%s) Copyright (C) 1987, 1995-2006 Jörg Schilling\n",
-								skel_version,
-								HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("scgskeleton %s (%s) "
+		       "Copyright (C) 1987, 1995-2006 Jörg Schilling\n",
+		       skel_version, HOST_SYSTEM);
 		exit(0);
 	}
 
Index: btcflash/skel.c
===================================================================
--- btcflash/skel.c	(revisione 214)
+++ btcflash/skel.c	(copia locale)
@@ -156,9 +156,10 @@
 	if (help)
 		usage(0);
 	if (pversion) {
-		printf("btcflash %s (%s-%s-%s) Copyright (C) 1987, 1995-2006 Jörg Schilling (C) 2004 David Huang\n",
-								skel_version,
-								HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("btcflash %s (%s) "
+		       "Copyright (C) 1987, 1995-2006 Jörg Schilling "
+		       "(C) 2004 David Huang\n",
+		       skel_version, HOST_SYSTEM);
 		exit(0);
 	}
 
Index: scgcheck/scgcheck.c
===================================================================
--- scgcheck/scgcheck.c	(revisione 214)
+++ scgcheck/scgcheck.c	(copia locale)
@@ -128,9 +128,9 @@
 	if (help)
 		usage(0);
 	if (pversion) {
-		printf("scgckeck %s (%s-%s-%s) Copyright (C) 1998-2002 Jörg Schilling\n",
+		printf("scgckeck %s (%s) Copyright (C) 1998-2002 Jörg Schilling\n",
 								scgc_version,
-								HOST_CPU, HOST_VENDOR, HOST_OS);
+								HOST_SYSTEM);
 		exit(0);
 	}
 
@@ -151,14 +151,15 @@
 	if (logfile == NULL)
 		comerr("Cannot open logfile.\n");
 
-	printf("Scgcheck %s (%s-%s-%s) SCSI user level transport library ABI checker.\n\
-Copyright (C) 1998,2001 Jörg Schilling\n",
+	printf("Scgcheck %s (%s) "
+	       "SCSI user level transport library ABI checker.\n"
+	       "Copyright (C) 1998,2001 Jörg Schilling\n",
 						scgc_version,
-						HOST_CPU, HOST_VENDOR, HOST_OS);
-	fprintf(logfile, "Scgcheck %s (%s-%s-%s) SCSI user level transport library ABI checker.\n\
-Copyright (C) 1998,2001 Jörg Schilling\n",
-						scgc_version,
-						HOST_CPU, HOST_VENDOR, HOST_OS);
+						HOST_SYSTEM);
+	fprintf(logfile, "Scgcheck %s (%s) "
+		"SCSI user level transport library ABI checker.\n"
+		"Copyright (C) 1998,2001 Jörg Schilling\n",
+		scgc_version, HOST_SYSTEM);
 	/*
 	 * Call scg_remote() to force loading the remote SCSI transport library
 	 * code that is located in librscg instead of the dummy remote routines
Index: readcd/readcd.c
===================================================================
--- readcd/readcd.c	(revisione 214)
+++ readcd/readcd.c	(copia locale)
@@ -312,10 +312,11 @@
 	if (help)
 		usage(0);
 	if (pversion) {
-		printf("readcd %s (%s-%s-%s) Copyright (C) 1987, 1995-2006 Joerg Schilling\n",
-								cdr_version,
-								HOST_CPU, HOST_VENDOR, HOST_OS);
-		printf("(using modified version of libscg -- don't bother Joerg Schilling with problems)\n");
+		printf("readcd %s (%s) "
+		       "Copyright (C) 1987, 1995-2006 Joerg Schilling\n",
+		       cdr_version, HOST_SYSTEM);
+		printf("(using modified version of libscg -- "
+		       "don't bother Joerg Schilling with problems)\n");
 		exit(0);
 	}
 
Index: include/xconfig.h.in
===================================================================
--- include/xconfig.h.in	(revisione 214)
+++ include/xconfig.h.in	(copia locale)
@@ -553,14 +553,4 @@
 /* #undef NO_USER_MALLOC */		/* If we cannot define our own malloc()	*/
 #define HAVE_DYN_ARRAYS 1		/* If the compiler allows dynamic sized arrays */
 
-/*
- * Strings that help to maintain OS/platform id's in C-programs
- */
-#define HOST_ALIAS "@CMAKE_SYSTEM_MACHINE@"
-/* FIXME */
-#define HOST_SUB   "@CMAKE_SYSTEM_MACHINE@"
-#define HOST_CPU   "@CMAKE_SYSTEM_MACHINE@"
-/* FIXME */
-#define HOST_VENDOR "unknown"		/* VENDOR part from HOST_SUB		*/
-#define HOST_OS "unknown"			/* CPU part from HOST_SUB		*/
-
+#define HOST_SYSTEM "unknown-system"	/* @CMAKE_SYSTEM_MACHINE@ does not work */
Index: mkisofs/mkisofs.c
===================================================================
--- mkisofs/mkisofs.c	(revisione 214)
+++ mkisofs/mkisofs.c	(copia locale)
@@ -2175,9 +2175,7 @@
 			usage(0);
 			break;
 		case OPTION_PVERSION:
-			printf("%s (%s-%s-%s)\n",
-				version_string,
-				HOST_CPU, HOST_VENDOR, HOST_OS);
+			printf("%s (%s)\n", version_string, HOST_SYSTEM);
 #ifdef	OPTION_SILO_BOOT
 			printf("Warning: this is unofficial (modified) version of mkisofs that incorporates\n");
 			printf("	support for a non Sparc compliant boot method called SILO.\n");
@@ -2805,9 +2803,7 @@
 	}
 
 	if (verbose > 1) {
-		fprintf(stderr, "%s (%s-%s-%s)\n",
-				version_string,
-				HOST_CPU, HOST_VENDOR, HOST_OS);
+		fprintf(stderr, "%s (%s)\n", version_string, HOST_SYSTEM);
 	}
 	if (cdrecord_data == NULL && !check_session && merge_image != NULL) {
 #ifdef	USE_LIBSCHILY
@@ -2944,9 +2940,8 @@
 			for (i = 0; i < argc; i++)
 				fprintf(stderr, "%s ", argv[i]);
 
-			fprintf(stderr, "\n%s (%s-%s-%s)\n",
-				version_string,
-				HOST_CPU, HOST_VENDOR, HOST_OS);
+			fprintf(stderr, "\n%s (%s)\n",
+				version_string, HOST_SYSTEM);
 		}
 	}
 	/* Find name of root directory. */
Index: mkisofs/diag/isodebug.c
===================================================================
--- mkisofs/diag/isodebug.c	(revisione 214)
+++ mkisofs/diag/isodebug.c	(copia locale)
@@ -219,8 +219,7 @@
 	if (help)
 		usage(0);
 	if (prvers) {
-		printf("isodebug %s (%s-%s-%s)\n", "2.01.01a03",
-					HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("isodebug %s (%s)\n", "2.01.01a03", HOST_SYSTEM);
 		exit(0);
 	}
 	cac = argc - 1;
Index: mkisofs/diag/dump.c
===================================================================
--- mkisofs/diag/dump.c	(revisione 214)
+++ mkisofs/diag/dump.c	(copia locale)
@@ -275,8 +275,7 @@
 	if (help)
 		usage(0);
 	if (prvers) {
-		printf("devdump %s (%s-%s-%s)\n", "2.01.01a03",
-					HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("devdump %s (%s)\n", "2.01.01a03", HOST_SYSTEM);
 		exit(0);
 	}
 	cac = argc - 1;
Index: mkisofs/diag/isoinfo.c
===================================================================
--- mkisofs/diag/isoinfo.c	(revisione 214)
+++ mkisofs/diag/isoinfo.c	(copia locale)
@@ -877,8 +877,7 @@
 	if (help)
 		usage(0);
 	if (prvers) {
-		printf("isoinfo %s (%s-%s-%s)\n", "2.01.01a03",
-					HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("isoinfo %s (%s)\n", "2.01.01a03", HOST_SYSTEM);
 		exit(0);
 	}
 	cac = argc - 1;
Index: mkisofs/diag/isovfy.c
===================================================================
--- mkisofs/diag/isovfy.c	(revisione 214)
+++ mkisofs/diag/isovfy.c	(copia locale)
@@ -708,8 +708,7 @@
 	if (help)
 		usage(0);
 	if (prvers) {
-		printf("isovfy %s (%s-%s-%s)\n", "2.01.01a03",
-					HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("isovfy %s (%s)\n", "2.01.01a03", HOST_SYSTEM);
 		exit(0);
 	}
 	cac = argc - 1;
Index: mkisofs/diag/isodump.c
===================================================================
--- mkisofs/diag/isodump.c	(revisione 214)
+++ mkisofs/diag/isodump.c	(copia locale)
@@ -558,8 +558,7 @@
 	if (help)
 		usage(0);
 	if (prvers) {
-		printf("isodump %s (%s-%s-%s)\n", "2.01.01a03",
-					HOST_CPU, HOST_VENDOR, HOST_OS);
+		printf("isodump %s (%s)\n", "2.01.01a03", HOST_SYSTEM);
 		exit(0);
 	}
 	cac = argc - 1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/debburn-devel/attachments/20060905/57706274/attachment.pgp


More information about the Debburn-devel mailing list