Anonymous avatar Anonymous committed b3666ea

Comments (0)

Files changed (6)

+man_MANS      =	cfdisk.8
+.TH CFDISK 8 "16 June, 2006" fdisk "GNU cfdisk Manual"
+.SH NAME
+GNU cfdisk - a curses-based partition manipulation program
+.SH SYNOPSIS
+.B cfdisk
+[options] [device]
+.SH DESCRIPTION
+.B cfdisk
+is a disk partition manipulation, which allows to create, destroy, resize, move and copy partitions using a simple menu-driven interface. It is useful for organising the disk space on a new drive, reorganising an old drive, creating space for new operating systems, and copying data to new hard disks. For a list of the supported partition types, see the
+.B --list-partition-types
+option below.
+.SH OPTIONS
+.TP
+.B -h, --help
+displays a help message.
+.TP
+.B -v, --version
+displays the program's version.
+.TP
+.B -z, --new-table
+create a new partition table on the disk. This is useful if you want to change the partition table type or want to repartition you entire drive. Note that this does not delete the old table on the disk until you commit the changes.
+.TP
+.B -u, --units \fIunit\fP
+sets the default display units to \fIunit\fP. A list of possible units is given below.
+.TP
+.B -l, --list-partition-types
+displays a list of supported partition types and features.
+.SH UNITS
+You can choose in what unit cfdisk should display quantities like partition sizes. You can choose from sectors, percents, bytes, kilobytes, etc. Note that one kilobyte is equal to 1,000 bytes, as this is consistent with the SI prefixes and is used by hard disk manufacturers. If you prefer to see the sizes in units with binary prefixes, you should instead select one kilo binary byte (kibibyte), which is equal to 1,024 bytes. Whatever display unit you have chosen, you can always enter the quantities in the unit of your choice, for example 1000000B or 1000kB.
+.TP
+.B compact
+display each size in the most suitable unit from B, kB, MB, GB and TB.
+.TP
+.B B
+one byte
+.TP
+.B kB 
+one kilobyte (1,000 bytes)
+.TP
+.B MB
+one megabyte (1,000,000 bytes)
+.TP
+.B GB
+one gigabyte (1,000,000,000 bytes)
+.TP
+.B TB
+one terabyte (1,000,000,000,000 bytes)
+.TP
+.B KiB
+one kilo binary byte (1,024 bytes)
+.TP
+.B MiB
+one mega binary byte (1,048,576 bytes)
+.TP
+.B GiB
+one giga binary byte (1,073,741,824 bytes)
+.TP
+.B TiB
+one tera binary byte (1,099,511,627,776 bytes)
+.TP
+.B s
+one sector. It depends on the sector size of the disk. You can use it if you want to see or choose the exact size in sectors.
+.TP
+.B %
+one percent from the size of the disk
+.TP
+.B cyl
+one cylinder. It depends on the cylinder size.
+.TP
+.B chs
+use CHS display units.
 # List of source files which contain translatable strings.
+src/common.c
+src/cfdisk.c
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+top_srcdir = @top_srcdir@
+subdir = src
+datadir = @datadir@
+localedir = $(datadir)/locale
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+LIBS = @LIBINTL@ @LIBS@
+
+sbin_PROGRAMS = cfdisk
+
+cfdisk_SOURCES = cfdisk.c	\
+		common.c	\
+		common.h	\
+		strlist.c	\
+		strlist.h
+
+cfdisk_LDADD = $(PARTED_LIBS) $(CURSES_LIBS)
+
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */
 
-/* TODO: These go out of here */
-#define CFDISK_VERSION "-1"
-
 #include "../config.h"
 #include "common.h"
 /*#include "command.h"*/
 #  include <libintl.h>
 #  include <locale.h>
 #  define _(String) dgettext (PACKAGE, String)
+#  define P_(String) dgettext ("parted", String)
 #else
 #  define _(String) (String)
+#  define P_(String) (String)
 #endif /* ENABLE_NLS */
 
 #include <parted/parted.h>
 	static MenuItem units[] = {
 		{ '1' , N_("Sectors"), N_("Show the sizes in sectors") },
 		{ '2' , N_("Bytes"), N_("Show the sizes in bytes") },
-		{ '3' , N_("Kilobytes"), N_("Use 1000 bytes as unit size") },
-		{ '4' , N_("Megabytes"), N_("Use 1000000 bytes as unit size") },
-		{ '5' , N_("Gigabytes"), N_("Use 1000000000 bytes as unit size") },
-		{ '6' , N_("Terabytes"), N_("Use 1000000000000 bytes as unit size") },
+		{ '3' , N_("Kilobytes"), N_("Use 1,000 bytes as unit size") },
+		{ '4' , N_("Megabytes"), N_("Use 1,000,000 bytes as unit size") },
+		{ '5' , N_("Gigabytes"), N_("Use 1,000,000,000 bytes as unit size") },
+		{ '6' , N_("Terabytes"), N_("Use 1,000,000,000,000 bytes as unit size") },
 		{ '7', N_("Percents"), N_("Show the sizes in percents") },
 		{ '8', N_("Compact"), N_("Show the size in most appropriate units") },
-		{ '9' , N_("Kibibytes"), N_("Use 1024 bytes as unit size") },
-		{ 'a' , N_("Mebibytes"), N_("Use 1048576 bytes as unit size") },
-		{ 'b' , N_("Gibibytes"), N_("Use 1073741824 bytes as unit size") },
-		{ 'c', N_("Tebibytes"), N_("Use 1099511627776 bytes as unit size") },
+		{ '9' , N_("Kibibytes"), N_("Use 1,024 bytes as unit size") },
+		{ 'a' , N_("Mebibytes"), N_("Use 1,048,576 bytes as unit size") },
+		{ 'b' , N_("Gibibytes"), N_("Use 1,073,741,824 bytes as unit size") },
+		{ 'c', N_("Tebibytes"), N_("Use 1,099,511,627,776 bytes as unit size") },
 		{ 'd', N_("Cylinders"), N_("Show the sizes in cylinders") },
 		{ 'e', N_("CHS"), N_("Show the sizes in CHS units") },
 		{ 0, NULL, NULL }
 		clrtoeol();
 	}
 	y = 0;
-	snprintf(buf,SMALLBUF,"GNU cfdisk %s",CFDISK_VERSION);
+	snprintf(buf,SMALLBUF,"GNU cfdisk %s",VERSION);
 	mvaddstr(y++,get_center(buf),buf);
 	y++;
 	
 
 static void
 do_ui (void) {
-	/*curses_ready = 1;*/
 	initscr();
 	//start_color();
 	cbreak();
 	endwin();
 }
 
+
 static void
 print_usage() {
 	exit(0);
 
 static void
 print_version() {
+	printf("cfdisk (GNU fdisk) %s\n",VERSION);
+	printf("Copyright (C) 2006 Free Software Foundation, Inc.\n");
+	printf("This is free software.  You may redistribute copies of it under the terms of\n");
+	printf("the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n");
+	printf("There is NO WARRANTY, to the extent permitted by law.");
+	exit(0);
+}
+
+static void
+_print_flag (int *i, const char *name) {
+	printf(*i == 0 ? "%s" : ",%s", name);
+	(*i)++;
+}
+
+static void
+print_partition_types() {
+	PedFileSystemType *walk;
+	char buf[SMALLBUF];
+	for (walk = ped_file_system_type_get_next(NULL); walk; walk = ped_file_system_type_get_next(walk)) {
+		int i = 0;
+		printf ("%-15s",walk->name);
+		if (walk->ops->open) _print_flag(&i,_("open"));
+		if (walk->ops->create) _print_flag(&i,_("create"));
+		if (walk->ops->check) _print_flag(&i,_("check"));
+		if (walk->ops->copy) _print_flag(&i,_("copy"));
+		if (walk->ops->resize) _print_flag(&i,_("resize"));
+		printf("\n");
+	}
 	exit(0);
 }
 
 		{ "version", no_argument, NULL, 'v' },
 		{ "units", required_argument, NULL, 'u' },
 		{ "help", no_argument, NULL, 'h' },
+		{ "list-partition-types", no_argument, NULL, 'l' },
 		{ NULL, 0, NULL, 0 }
 	};
 
 	int opt,option_index;
-	while ((opt = getopt_long(argc,argv, "hzvu:", long_options, &option_index)) != -1) {
+	while ((opt = getopt_long(argc,argv, "hzvlu:", long_options, &option_index)) != -1) {
 #else
 	int opt;
-	while ((opt = getopt(argc,argv,"hzvu:")) != -1) {
+	while ((opt = getopt(argc,argv,"hzvlu:")) != -1) {
 #endif		
 		switch (opt) {
+			case 'v':
+				print_version();
+			case 'h':
+				print_usage();
+			case 'l':
+				print_partition_types();
 			case 'z': 
 				new_table = 1;
 				break;
-			case 'v':
-				print_version();
 			case 'u':
 				unit = ped_unit_get_by_name(optarg);
 				break;
-			case 'h':
-				print_usage();
+
 
 		}
 	}
                 goto error;
 
         /* get new target */
-        if (!get_sector (_("Start?"), disk->dev, &start, &range_start, opts & UI_CUSTOM_VALUES, uiquery))
+        if (!get_sector (_("Start"), disk->dev, &start, &range_start, opts & UI_CUSTOM_VALUES, uiquery))
                 goto error_close_fs;
         end = start + old_geom.length - 1;
-        if (!get_sector (_("End?"), disk->dev, &end, &range_end, opts & UI_CUSTOM_VALUES, uiquery))
+        if (!get_sector (_("End"), disk->dev, &end, &range_end, opts & UI_CUSTOM_VALUES, uiquery))
                 goto error_close_fs;
 
         /* set / test on "disk" */
         if (!disk)
                 goto error;
 	if (!part) 
-        	if (!get_partition (_("Partition number?"), disk, &part, uiquery))
+        	if (!get_partition (_("Partition"), disk, &part, uiquery))
                 	goto error;
 	if (!name) {
 		temp = ped_partition_get_name(part);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.