[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Thu May 29 12:33:58 UTC 2008


 libparted/arch/linux.c                   |    4 +-
 libparted/exception.c                    |   10 ++---
 libparted/fs/ext2/ext2_block_relocator.c |    9 ++--
 libparted/fs/ext2/ext2_mkfs.c            |    4 +-
 libparted/fs/fat/resize.c                |    6 +--
 libparted/fs/fat/traverse.c              |    2 -
 libparted/fs/fat/traverse.h              |    3 +
 libparted/labels/dos.c                   |   16 ++++----
 libparted/labels/mac.c                   |   14 +++----
 maint.mk                                 |   60 ++++++++++++++++++++++++------
 parted/parted.c                          |   36 +++++++++---------
 parted/ui.c                              |   10 ++---
 parted/ui.h                              |    4 +-
 tests/Makefile.am                        |    1 
 tests/t2200-dos-label-recog.sh           |   61 +++++++++++++++++++++++++++++++
 15 files changed, 171 insertions(+), 69 deletions(-)

New commits:
commit dddef445867696a3fb8635c4856ce764feeeca2f
Author: Jim Meyering <meyering at redhat.com>
Date:   Thu May 29 11:37:51 2008 +0200

    * maint.mk: Update from coreutils.

diff --git a/maint.mk b/maint.mk
index e8671bd..d89cd76 100644
--- a/maint.mk
+++ b/maint.mk
@@ -131,7 +131,7 @@ sc_prohibit_atoi_atof:
 
 # Use STREQ rather than comparing strcmp == 0, or != 0.
 sc_prohibit_strcmp:
-	@grep -nE '! *str''cmp \(|\<str''cmp \([^)]+\) *=='		\
+	@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *=='		\
 	    $$($(VC_LIST_EXCEPT)) &&					\
 	  { echo '$(ME): use STREQ in place of the above uses of str''cmp' \
 		1>&2; exit 1; } || :
@@ -622,38 +622,72 @@ null_AM_MAKEFLAGS = \
   AUTOHEADER=false \
   MAKEINFO=false
 
-built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
+built_programs = \
+  $$(cd src && echo '_spy:;@echo $$(sbin_PROGRAMS)' \
+     | MAKEFLAGS= $(MAKE) -s make -f Makefile -f - _spy)
 
 warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
 bin=bin-$$$$
 
 write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
 
+TMPDIR ?= /tmp
+t=$(TMPDIR)/$(PACKAGE)/test
+pfx=$(t)/i
+
+# Verify that a twisted use of --program-transform-name=PROGRAM works.
+define install-transform-check
+  echo running install-transform-check			\
+    && rm -rf $(pfx)					\
+    && $(MAKE) program_transform_name='s/.*/zyx/'	\
+      prefix=$(pfx) install				\
+    && test "$$(echo $(pfx)/sbin/*)" = "$(pfx)/sbin/zyx"	\
+    && test "$$(echo $(pfx)/share/man/man1/*)" =	\
+                    "$(pfx)/share/man/man1/zyx.1"
+endef
+
+# Install, then verify that all binaries and man pages are in place.
+# Note that neither the binary, ginstall, nor the ].1 man page is installed.
+define my-instcheck
+  echo running my-instcheck				\
+    && $(MAKE) prefix=$(pfx) install			\
+    && test ! -f $(pfx)/bin/ginstall			\
+    && { fail=0;					\
+      for i in $(built_programs); do			\
+        test "$$i" = ginstall && i=install;		\
+        for j in "$(pfx)/bin/$$i"			\
+                 "$(pfx)/share/man/man1/$$i.1"; do	\
+          case $$j in *'[.1') continue;; esac;		\
+          test -f "$$j" && :				\
+            || { echo "$$j not installed"; fail=1; };	\
+        done;						\
+      done;						\
+      test $$fail = 1 && exit 1 || :;			\
+    }
+endef
+
 # Use -Wformat -Werror to detect format-string/arg-list mismatches.
 # Also, check for shadowing problems with -Wshadow, and for pointer
 # arithmetic problems with -Wpointer-arith.
 # These CFLAGS are pretty strict.  If you build this target, you probably
 # have to have a recent version of gcc and glibc headers.
-# The for-loop below ensures that there is a bin/ directory full of all
-# of the programs under test (except the few that are required for basic
-# Makefile rules), all symlinked to the just-built "false" program.
+# The hard-linking for-loop below ensures that there is a bin/ directory
+# full of all of the programs under test (except the ones that are required
+# for basic Makefile rules), all symlinked to the just-built "false" program.
 # This is to ensure that if ever a test neglects to make PATH include
 # the build srcdir, these always-failing programs will run.
 # Otherwise, it is too easy to test the wrong programs.
 # Note that "false" itself is a symlink to true, so it too will malfunction.
-TMPDIR ?= /tmp
-t=$(TMPDIR)/$(PACKAGE)/test
-my-distcheck: $(local-check) check
+my-distcheck: $(DIST_ARCHIVES) $(local-check) check
 	-rm -rf $(t)
 	mkdir -p $(t)
 	GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
 	cd $(t)/$(distdir)				\
-	  && ./configure --disable-nls --prefix=$(t)/i	\
+	  && ./configure --disable-nls			\
 	  && $(MAKE) CFLAGS='$(warn_cflags)'		\
 	      AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'	\
 	  && $(MAKE) dvi				\
-	  && $(MAKE) install				\
-	  && test -f $(mandir)/man1/ls.1		\
+	  && $(my-instcheck)				\
 	  && mkdir $(bin)				\
 	  && ($(write_loser)) > $(bin)/loser            \
 	  && chmod a+x $(bin)/loser                     \
@@ -666,7 +700,9 @@ my-distcheck: $(local-check) check
 	     done					\
 	  && ln -sf ../src/true $(bin)/false		\
 	  && PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
-	  && $(MAKE) -C gnulib-tests check		\
+	  && { test -d gnulib-tests			\
+	         && $(MAKE) -C gnulib-tests check	\
+	         || :; }				\
 	  && rm -rf $(bin)				\
 	  && $(MAKE) distclean
 	(cd $(t) && mv $(distdir) $(distdir).old	\

commit 2fb0836622aafcdcb7da511c3890a28887a36754
Author: Jim Meyering <meyering at redhat.com>
Date:   Thu May 29 11:21:05 2008 +0200

    test for improved DOS-partition-table recognition
    
    * tests/t2200-dos-label-recog.sh: New file.
    * tests/Makefile.am (TESTS): Add t2200-dos-label-recog.sh.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index d9b0878..e41b5ae 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,6 +6,7 @@ TESTS = \
   t1500-small-ext2.sh \
   t2000-mkfs.sh \
   t2100-mkswap.sh \
+  t2200-dos-label-recog.sh \
   t3000-constraints.sh \
   t3100-resize-ext2-partion.sh \
   t4100-msdos-partition-limits.sh \
diff --git a/tests/t2200-dos-label-recog.sh b/tests/t2200-dos-label-recog.sh
new file mode 100755
index 0000000..d5d2670
--- /dev/null
+++ b/tests/t2200-dos-label-recog.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+test_description='improved MSDOS partition-table recognition'
+
+. ./init.sh
+
+######################################################################
+# With vestiges of a preceding FAT file system boot sector in the MBR,
+# parted 1.8.8.1.29 and earlier would fail to recognize a DOS
+# partition table.
+######################################################################
+N=100k
+dev=loop-file
+test_expect_success \
+    'create a file to simulate the underlying device' \
+    'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null'
+
+test_expect_success \
+    'label the test disk' \
+    'parted -s $dev mklabel msdos > out 2>&1'
+test_expect_success 'expect no output' '$compare out /dev/null'
+
+test_expect_success \
+    'create two partition' \
+    '
+    parted -s $dev mkpart primary  1s 40s > out 2>&1 &&
+    parted -s $dev mkpart primary 41s 80s > out 2>&1
+
+    '
+test_expect_success 'expect no output' '$compare out /dev/null'
+
+test_expect_success \
+    'write "FAT" where it would cause trouble' \
+    'printf FAT|dd bs=1c seek=82 count=3 of=$dev conv=notrunc'
+
+test_expect_success \
+    'print the partition table' \
+    '
+    parted -m -s $dev unit s p > out &&
+    tail -2 out > k && mv k out &&
+    printf "1:1s:40s:40s:::;\n2:41s:80s:40s:::;\n" > exp
+
+    '
+test_expect_success 'expect two partitions' '$compare out exp'
+
+test_done

commit d732a2b78255d62162fab57b552a3f069b53f33f
Author: Colin Watson <cjwatson at ubuntu.com>
Date:   Wed May 28 12:12:51 2008 +0100

    bug fix: improve DOS partition table recognition
    
    * libparted/labels/dos.c (msdos_probe): Make Parted's partition-table
    recognition code use the same technique that is used by the Linux
    kernel and by util-linux's fdisk.  I.e., accept it whenever all four
    boot indicators are 0 or 0x80, rather than using the FAT file system-
    recognizing heuristic.
    More analysis here:
      http://thread.gmane.org/gmane.comp.gnu.parted.devel/2142/focus=2154
    Reported by David Balažic here:
      https://bugs.launchpad.net/ubuntu/+source/parted/+bug/232175
      http://thread.gmane.org/gmane.comp.gnu.parted.devel/2142

diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index e513a05..81d8600 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -192,14 +192,16 @@ msdos_probe (const PedDevice *dev)
 	if (PED_LE16_TO_CPU (part_table->magic) != MSDOS_MAGIC)
 		goto probe_fail;
 
-	/* if this is a FAT fs, fail here.  Note that the Smart Boot Manager
-	 * Loader (SBML) signature indicates a partition table, not a file
-	 * system.
+	/* If this is a FAT fs, fail here.  Checking for the FAT signature
+	 * has some false positives; instead, do what the Linux kernel does
+	 * and ensure that each partition has a boot indicator that is
+	 * either 0 or 0x80.
 	 */
-	if ((!strncmp (part_table->boot_code + 0x36, "FAT", 3)
-	    && strncmp (part_table->boot_code + 0x40, "SBML", 4) != 0)
-	    || !strncmp (part_table->boot_code + 0x52, "FAT", 3))
-		goto probe_fail;
+	for (i = 0; i < 4; i++) {
+		if (part_table->partitions[i].boot_ind != 0
+		    && part_table->partitions[i].boot_ind != 0x80)
+			goto probe_fail;
+	}
 
 	/* If this is a GPT disk, fail here */
 	for (i = 0; i < 4; i++) {

commit 7863057791a7850f7319a9f035b5e9d79526ff93
Author: Jim Meyering <meyering at redhat.com>
Date:   Fri May 23 15:58:20 2008 +0200

    avoid const-related compiler warnings
    
    * libparted/arch/linux.c (init_dasd, init_generic): Likewise.
    * libparted/exception.c (type_strings, option_strings): Likewise.
    (ped_exception_get_type_string, ped_exception_get_option_string):
    * libparted/fs/ext2/ext2_block_relocator.c (ext2_block_relocator_flush):
    * libparted/fs/ext2/ext2_mkfs.c (_set_dirent): Likewise.
    * libparted/fs/fat/resize.c (ask_type): Likewise.
    * libparted/fs/fat/traverse.c (fat_traverse_begin): Likewise.
    * libparted/fs/fat/traverse.h (buffer_size): Likewise.
    * libparted/labels/mac.c (_rawpart_cmp_type, _rawpart_cmp_name):
    (_rawpart_is_partition_map, _rawpart_is_boot, _rawpart_is_driver):
    (_rawpart_has_driver): Likewise.
    * parted/parted.c (options, options_help, number_msg): Likewise.
    (label_type_msg_start, flag_msg_start, unit_msg_start): Likewise.
    (part_type_msg, fs_type_msg_start, start_end_msg, state_msg): Likewise.
    (device_msg, name_msg, resize_msg_start, copyright_msg, do_print):
    * parted/ui.c (prog_name, banner_msg, usage_msg, bug_msg): Likewise.
    (screen_width): Likewise.
    * parted/ui.h (prog_name): Likewise.

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index c332cf8..545d74c 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -987,7 +987,7 @@ error:
 }
 
 static int
-init_dasd (PedDevice* dev, char* model_name)
+init_dasd (PedDevice* dev, const char* model_name)
 {
         struct stat             dev_stat;
         struct hd_geometry      geo;
@@ -1043,7 +1043,7 @@ error:
 }
 
 static int
-init_generic (PedDevice* dev, char* model_name)
+init_generic (PedDevice* dev, const char* model_name)
 {
         struct stat             dev_stat;
         PedExceptionOption      ex_status;
diff --git a/libparted/exception.c b/libparted/exception.c
index 5fb3c79..3980e4e 100644
--- a/libparted/exception.c
+++ b/libparted/exception.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -73,7 +73,7 @@ static PedExceptionHandler*	ex_handler = default_handler;
 static PedException*		ex = NULL;
 static int			ex_fetch_count = 0;
 
-static char*	type_strings [] = {
+static const char *const type_strings [] = {
 	N_("Information"),
 	N_("Warning"),
 	N_("Error"),
@@ -82,7 +82,7 @@ static char*	type_strings [] = {
 	N_("No Implementation")
 };
 
-static char*	option_strings [] = {
+static const char *const option_strings [] = {
 	N_("Fix"),
 	N_("Yes"),
 	N_("No"),
@@ -98,7 +98,7 @@ static char*	option_strings [] = {
 char*
 ped_exception_get_type_string (PedExceptionType ex_type)
 {
-	return type_strings [ex_type - 1];
+	return (char *) type_strings [ex_type - 1];
 }
 
 /* FIXME: move this out to the prospective math.c */
@@ -121,7 +121,7 @@ ped_log2 (int n)
 char*
 ped_exception_get_option_string (PedExceptionOption ex_opt)
 {
-	return option_strings [ped_log2 (ex_opt)];
+	return (char *) option_strings [ped_log2 (ex_opt)];
 }
 
 static PedExceptionOption
diff --git a/libparted/fs/ext2/ext2_block_relocator.c b/libparted/fs/ext2/ext2_block_relocator.c
index b75a4c5..60f3d50 100644
--- a/libparted/fs/ext2/ext2_block_relocator.c
+++ b/libparted/fs/ext2/ext2_block_relocator.c
@@ -691,10 +691,11 @@ static int ext2_block_relocator_flush(struct ext2_fs *fs, struct ext2_block_relo
 		{
 			/* FIXXXME gross hack */
 			fprintf(stderr, "relocating %s blocks",
-				((char *[4]){"direct",
-						     "singly indirect",
-						     "doubly indirect",
-						     "triply indirect"})[i]);
+				((const char *const [4])
+				 {"direct",
+				  "singly indirect",
+				  "doubly indirect",
+				  "triply indirect"})[i]);
 			fflush(stderr);
 		}
 
diff --git a/libparted/fs/ext2/ext2_mkfs.c b/libparted/fs/ext2/ext2_mkfs.c
index 19931dd..b1a8ce3 100644
--- a/libparted/fs/ext2/ext2_mkfs.c
+++ b/libparted/fs/ext2/ext2_mkfs.c
@@ -1,6 +1,6 @@
 /*
     ext2_mkfs.c -- ext2 fs creator
-    Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2001, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -263,7 +263,7 @@ error:
 
 /* returns the offset into the buffer of the start of the next dir entry */
 static int _set_dirent(void* buf, int offset, int block_size, int is_last,
-		       uint32_t inode, char* name, int file_type)
+		       uint32_t inode, const char* name, int file_type)
 {
 	struct ext2_dir_entry_2 *dirent = (void*) (((char*)buf) + offset);
 	int name_len = strlen(name);
diff --git a/libparted/fs/fat/resize.c b/libparted/fs/fat/resize.c
index 7386948..5f24ec2 100644
--- a/libparted/fs/fat/resize.c
+++ b/libparted/fs/fat/resize.c
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -481,8 +481,8 @@ ask_type (PedFileSystem* fs, int fat16_ok, int fat32_ok, FatType* out_fat_type)
 {
 	FatSpecific*		fs_info = FAT_SPECIFIC (fs);
 	PedExceptionOption	status;
-	char*			fat16_msg;
-	char*			fat32_msg;
+	const char*		fat16_msg;
+	const char*		fat32_msg;
 
 	if (fs_info->fat_type == FAT_TYPE_FAT16)
 		fat16_msg = _("If you leave your file system as FAT16, "
diff --git a/libparted/fs/fat/traverse.c b/libparted/fs/fat/traverse.c
index 367f511..c613dab 100644
--- a/libparted/fs/fat/traverse.c
+++ b/libparted/fs/fat/traverse.c
@@ -120,7 +120,7 @@ fat_traverse_mark_dirty (FatTraverseInfo* trav_info)
 
 FatTraverseInfo*
 fat_traverse_begin (PedFileSystem* fs, FatCluster start_cluster,
-		    char* dir_name)
+		    const char* dir_name)
 {
 	FatSpecific*		fs_info = FAT_SPECIFIC (fs);
 	FatTraverseInfo*	trav_info;
diff --git a/libparted/fs/fat/traverse.h b/libparted/fs/fat/traverse.h
index 17e4580..4fdc90f 100644
--- a/libparted/fs/fat/traverse.h
+++ b/libparted/fs/fat/traverse.h
@@ -42,7 +42,8 @@ extern int fat_traverse_entries_per_buffer (FatTraverseInfo* trav_info);
 /* starts traversal at an arbitary cluster.  if start_cluster==0, then uses
    root directory */
 extern FatTraverseInfo* fat_traverse_begin (PedFileSystem* fs,
-				     FatCluster start_cluster, char* dir_name);
+					    FatCluster start_cluster,
+					    const char* dir_name);
 
 extern int fat_traverse_complete (FatTraverseInfo* trav_info);
 
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index ae352aa..2c10e05 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2002, 2004, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -378,19 +378,19 @@ mac_clobber (PedDevice* dev)
 #endif /* !DISCOVER_ONLY */
 
 static int
-_rawpart_cmp_type (MacRawPartition* raw_part, char* type)
+_rawpart_cmp_type (const MacRawPartition* raw_part, const char* type)
 {
 	return strncasecmp (raw_part->type, type, 32) == 0;
 }
 
 static int
-_rawpart_cmp_name (MacRawPartition* raw_part, char* name)
+_rawpart_cmp_name (const MacRawPartition* raw_part, const char* name)
 {
 	return strncasecmp (raw_part->name, name, 32) == 0;
 }
 
 static int
-_rawpart_is_partition_map (MacRawPartition* raw_part)
+_rawpart_is_partition_map (const MacRawPartition* raw_part)
 {
 	return _rawpart_cmp_type (raw_part, "Apple_partition_map");
 }
@@ -410,7 +410,7 @@ strncasestr (const char* haystack, const char* needle, int n)
 }
 
 static int
-_rawpart_is_boot (MacRawPartition* raw_part)
+_rawpart_is_boot (const MacRawPartition* raw_part)
 {
 	if (!strcasecmp(raw_part->type, "Apple_Bootstrap"))
 		return 1;
@@ -422,7 +422,7 @@ _rawpart_is_boot (MacRawPartition* raw_part)
 }
 
 static int
-_rawpart_is_driver (MacRawPartition* raw_part)
+_rawpart_is_driver (const MacRawPartition* raw_part)
 {
 	if (strncmp (raw_part->type, "Apple_", 6) != 0)
 		return 0;
@@ -432,7 +432,7 @@ _rawpart_is_driver (MacRawPartition* raw_part)
 }
 
 static int
-_rawpart_has_driver (MacRawPartition* raw_part, MacDiskData* mac_disk_data)
+_rawpart_has_driver (const MacRawPartition* raw_part, MacDiskData* mac_disk_data)
 {
 	MacDeviceDriver *driverlist;
 	uint16_t i, bsz;
diff --git a/parted/parted.c b/parted/parted.c
index 0f6768b..7acfa2f 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -78,7 +78,7 @@ typedef struct {
         time_t  predicted_time_left;
 } TimerContext;
 
-static struct option    options[] = {
+static const struct option const options[] = {
         /* name, has-arg, string-return-val, char-return-val */
         {"help",        0, NULL, 'h'},
         {"list",        0, NULL, 'l'},
@@ -89,7 +89,7 @@ static struct option    options[] = {
         {NULL,          0, NULL, 0}
 };
 
-static char*    options_help [][2] = {
+static const char *const options_help [][2] = {
         {"help",        N_("displays this help message")},
         {"list",        N_("lists partition layout on all block devices")},
         {"machine",     N_("displays machine parseable output")},
@@ -106,26 +106,26 @@ int     opt_machine_mode = 0;
 int     disk_is_modified = 0;
 int     is_toggle_mode = 0;
 
-static char* number_msg = N_(
+static const char* number_msg = N_(
 "NUMBER is the partition number used by Linux.  On MS-DOS disk labels, the "
 "primary partitions number from 1 to 4, logical partitions from 5 onwards.\n");
 
-static char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
-static char* flag_msg_start =   N_("FLAG is one of: ");
-static char* unit_msg_start =   N_("UNIT is one of: ");
-static char* part_type_msg =    N_("PART-TYPE is one of: primary, logical, "
+static const char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
+static const char* flag_msg_start =   N_("FLAG is one of: ");
+static const char* unit_msg_start =   N_("UNIT is one of: ");
+static const char* part_type_msg =    N_("PART-TYPE is one of: primary, logical, "
                                    "extended\n");
-static char* fs_type_msg_start = N_("FS-TYPE is one of: ");
-static char* start_end_msg =    N_("START and END are disk locations, such as "
+static const char* fs_type_msg_start = N_("FS-TYPE is one of: ");
+static const char* start_end_msg =    N_("START and END are disk locations, such as "
                 "4GB or 10%.  Negative values count from the end of the disk.  "
                 "For example, -1s specifies exactly the last sector.\n");
-static char* state_msg =        N_("STATE is one of: on, off\n");
-static char* device_msg =       N_("DEVICE is usually /dev/hda or /dev/sda\n");
-static char* name_msg =         N_("NAME is any word you want\n");
-static char* resize_msg_start = N_("The partition must have one of the "
+static const char* state_msg =        N_("STATE is one of: on, off\n");
+static const char* device_msg =       N_("DEVICE is usually /dev/hda or /dev/sda\n");
+static const char* name_msg =         N_("NAME is any word you want\n");
+static const char* resize_msg_start = N_("The partition must have one of the "
                                    "following FS-TYPEs: ");
 
-static char* copyright_msg = N_(
+static const char* copyright_msg = N_(
 "Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
 "This program is free software, covered by the GNU General Public License.\n"
 "\n"
@@ -1274,10 +1274,10 @@ do_print (PedDevice** dev)
         int             has_free_arg = 0;
         int             has_list_arg = 0;
         int             has_num_arg = 0;
-        char*           transport[14] = {"unknown", "scsi", "ide", "dac960",
-                                         "cpqarray", "file", "ataraid", "i2o",
-                                         "ubd", "dasd", "viodasd", "sx8", "dm",
-                                         "xvd"};
+        const char *const transport[14] = {"unknown", "scsi", "ide", "dac960",
+					   "cpqarray", "file", "ataraid", "i2o",
+					   "ubd", "dasd", "viodasd", "sx8", "dm",
+					   "xvd"};
         char*           peek_word;
         char*           start;
         char*           end;
diff --git a/parted/ui.c b/parted/ui.c
index d9ab107..3d9bd08 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -154,17 +154,17 @@ struct siginfo_t {
 #  define ILL_BADSTK (INTMAX - 8)
 #endif
 
-char* prog_name = "GNU Parted " VERSION "\n";
+const char* prog_name = "GNU Parted " VERSION "\n";
 
-static char* banner_msg = N_(
+static const char* banner_msg = N_(
 "Welcome to GNU Parted! Type 'help' to view a list of commands.\n");
 
-static char* usage_msg = N_(
+static const char* usage_msg = N_(
 "Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]\n"
 "Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, "
 "run in\ninteractive mode.\n");
 
-static char* bug_msg = N_(
+static const char* bug_msg = N_(
 "\n\nYou found a bug in GNU Parted! Here's what you have to do:\n\n"
 "Don't panic! The bug has most likely not affected any of your data.\n"
 "Help us to fix this bug by doing the following:\n\n"
@@ -218,7 +218,7 @@ screen_width ()
 
 /* HACK: don't specify termcap separately - it'll annoy the users. */
 #ifdef HAVE_LIBREADLINE
-        width = tgetnum ("co");
+        width = tgetnum ((char *) "co");
 #endif
 
         if (width <= 0)
diff --git a/parted/ui.h b/parted/ui.h
index f5cf760..77bb194 100644
--- a/parted/ui.h
+++ b/parted/ui.h
@@ -1,6 +1,6 @@
 /*
     parted - a frontend to libparted
-    Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2001, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 
 #include "strlist.h"
 
-extern char*	prog_name;
+extern const char *prog_name;
 
 extern int init_ui ();
 extern int non_interactive_mode (PedDevice** dev, Command* cmd_list[],



More information about the Parted-commits mailing list