Index: util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.c
@@ -0,0 +1,87 @@
+/*
+  Changes:
+  Sat Mar 20 09:51:38 EST 1999 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+  	Internationalization
+*/
+#include <stdio.h>              /* stderr */
+#include <string.h>             /* strstr */
+#include <unistd.h>             /* write */
+
+#include <endian.h>
+
+#include "common.h"
+#include "fdisk.h"
+#include "fdiskmaclabel.h"
+#include "nls.h"
+
+#define MAC_BITMASK 0xffff0000
+
+
+static	int     other_endian = 0;
+static  short	volumes=1;
+
+/*
+ * only dealing with free blocks here
+ */
+
+static void
+mac_info( void ) {
+    puts(
+	_("\n\tThere is a valid Mac label on this disk.\n"
+	"\tUnfortunately fdisk(1) cannot handle these disks.\n"
+	"\tUse either pdisk or parted to modify the partition table.\n"
+	"\tNevertheless some advice:\n"
+	"\t1. fdisk will destroy its contents on write.\n"
+	"\t2. Be sure that this disk is NOT a still vital\n"
+	"\t   part of a volume group. (Otherwise you may\n"
+	"\t   erase the other disks as well, if unmirrored.)\n")
+
+    );
+}
+
+void
+mac_nolabel( void )
+{
+    maclabel->magic = 0;
+    mac_label = 0;
+    partitions = 4;
+    memset( MBRbuffer, 0, sizeof(MBRbuffer) );	/* avoid fdisk cores */
+    return;
+}
+
+int
+check_mac_label( void )
+{
+	/*
+	Conversion: only 16 bit should compared
+	e.g.: HFS Label is only 16bit long
+	*/
+
+	int magic_masked = 0 ;
+	magic_masked =  maclabel->magic & MAC_BITMASK ;
+
+	switch (magic_masked) {
+		case MAC_LABEL_MAGIC :
+		case MAC_LABEL_MAGIC_2:
+		case MAC_LABEL_MAGIC_3:
+			goto IS_MAC;
+			break;
+		default:
+			mac_label = 0;
+  	 		 other_endian = 0;
+			return 0;
+
+
+	}
+
+    IS_MAC:
+    other_endian = (maclabel->magic == MAC_LABEL_MAGIC_SWAPPED); // =?
+    update_units();
+    mac_label = 1;
+    partitions= 1016; // =?
+    volumes = 15;	// =?
+    mac_info();
+    mac_nolabel();		/* %% */
+    mac_label = 1;		/* %% */
+    return 1;
+}
Index: util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.h
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.h
@@ -0,0 +1,40 @@
+#include <linux/types.h>   /* for __u32 etc */
+/*
+ * Copyright (C) Andreas Neuper, Sep 1998.
+ *	This file may be redistributed under
+ *	the terms of the GNU Public License.
+ */
+
+typedef struct {
+	unsigned int  magic;        /* expect MAC_LABEL_MAGIC */
+	unsigned int   fillbytes1[124];
+	unsigned int   physical_volume_id;
+	unsigned int   fillbytes2[124];
+} mac_partition;
+
+#define	MAC_LABEL_MAGIC		0x45520000		// MAC magic number only 16bits, do i always know that there are 0200 following ? Problem, after magic   the uint16_t        res1; follows, i donnno know about the 200k
+#define	MAC_LABEL_MAGIC_2		0x50530000
+#define	MAC_LABEL_MAGIC_3		0x504d0000
+
+
+#define	MAC_LABEL_MAGIC_SWAPPED		0x00002554
+
+#define	MAC_LABEL_MAGIC_2_SWAPPED		0x00003505
+#define	MAC_LABEL_MAGIC_3_SWAPPED		0x0000d405
+
+
+/* fdisk.c */
+#define maclabel ((mac_partition *)MBRbuffer)
+extern char MBRbuffer[MAX_SECTOR_SIZE];
+extern char changed[MAXIMUM_PARTS];
+extern unsigned int heads, sectors, cylinders;
+extern int show_begin;
+extern int mac_label;
+extern char *partition_type(unsigned char type);
+extern void update_units(void);
+extern char read_chars(char *mesg);
+
+/* fdiskmaclabel.c */
+extern struct	systypes mac_sys_types[];
+extern void 	mac_nolabel( void );
+extern int 	check_mac_label( void );
Index: util-linux-ng-2.12r+git20070330/fdisk/fdisk.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/fdisk/fdisk.c
+++ util-linux-ng-2.12r+git20070330/fdisk/fdisk.c
@@ -26,6 +26,7 @@
 #include "fdisksunlabel.h"
 #include "fdisksgilabel.h"
 #include "fdiskaixlabel.h"
+#include "fdiskmaclabel.h"
 
 #ifdef HAVE_LINUX_COMPILER_H
 #include <linux/compiler.h>
@@ -167,11 +168,12 @@ unsigned int	heads,
 
 unsigned long long total_number_of_sectors;
 
-#define dos_label (!sun_label && !sgi_label && !aix_label && !osf_label)
+#define dos_label (!sun_label && !sgi_label && !aix_label && !mac_label && !osf_label)
 int     sun_label = 0;                  /* looking at sun disklabel */
 int	sgi_label = 0;			/* looking at sgi disklabel */
 int	aix_label = 0;			/* looking at aix disklabel */
 int	osf_label = 0;			/* looking at OSF/1 disklabel */
+int     mac_label = 0;                  /* looking at mac disklabel */
 int	possibly_osf_label = 0;
 
 jmp_buf listingbuf;
@@ -365,6 +367,10 @@ menu(void) {
 	   puts(_("   v   verify the partition table"));
 	   puts(_("   w   write table to disk and exit"));
 	}
+	else if (mac_label) {
+	   puts(_("no Commands available"));
+
+	}
 	else if (aix_label) {
 	   puts(_("Command action"));
 	   puts(_("   m   print this menu"));
@@ -445,6 +451,9 @@ xmenu(void) {
 	   puts(_("   v   verify the partition table"));
 	   puts(_("   w   write table to disk and exit"));
 	}
+	 else if (mac_label) {
+	   puts(_("no Commands available"));
+	}
 	else {
 	   puts(_("Command action"));
 	   puts(_("   b   move beginning of data in a partition")); /* !sun */
@@ -945,6 +954,9 @@ get_boot(enum action what) {
 	if (check_aix_label())
 		return 0;
 
+	if (check_mac_label())
+		return 0;
+
 	if (check_osf_label()) {
 		possibly_osf_label = 1;
 		if (!valid_part_table_flag(MBRbuffer)) {
@@ -2077,6 +2089,15 @@ new_partition(void) {
 		return;
 	}
 
+	if (mac_label) {
+		printf(_("\tSorry - this fdisk cannot handle Mac disk labels."
+		         "\n\tIf you want to add DOS-type partitions, create"
+		         "\n\ta new empty DOS partition table first. (Use o.)"
+		         "\n\tWARNING: "
+		         "This will destroy the present disk contents.\n"));
+		 return;
+	}
+
 	for (i = 0; i < 4; i++)
 		free_primary += !ptes[i].part_table->sys_ind;
 
@@ -2406,7 +2427,11 @@ try(char *device, int user_specified) {
 		if (gb > 0) { /* I/O error */
 		} else if (gb < 0) { /* no DOS signature */
 			list_disk_geometry();
-			if (!aix_label && btrydev(device) < 0)
+			if (aix_label)
+				return;
+			if (mac_label)
+				return;
+			if (btrydev(device) < 0)
 				fprintf(stderr,
 					_("Disk %s doesn't contain a valid "
 					  "partition table\n"), device);
Index: util-linux-ng-2.12r+git20070330/fdisk/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/fdisk/Makefile.am
+++ util-linux-ng-2.12r+git20070330/fdisk/Makefile.am
@@ -8,6 +8,7 @@ sbin_PROGRAMS = fdisk
 man_MANS = fdisk.8
 fdisk_SOURCES = fdisk.c disksize.c fdiskbsdlabel.c fdisksgilabel.c \
 	fdisksunlabel.c fdiskaixlabel.c i386_sys_types.c partname.c \
+	fdiskmaclabel.c \
 	common.h fdisk.h fdisksunlabel.h fdisksgilabel.h fdiskaixlabel.h \
 	 fdiskbsdlabel.h