All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] fdisk: add an quit/exit handling function
@ 2012-05-20 16:11 Davidlohr Bueso
  0 siblings, 0 replies; only message in thread
From: Davidlohr Bueso @ 2012-05-20 16:11 UTC (permalink / raw)
  To: Karel Zak, Petr Uzel; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 fdisk/fdisk.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 3f83297..2f3c119 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1810,6 +1810,13 @@ move_begin(int i) {
 	}
 }
 
+static void __attribute__ ((__noreturn__)) handle_quit(void)
+{
+	close(fd);
+	printf("\n");
+	exit(EXIT_SUCCESS);
+}
+
 static void
 expert_command_prompt(void)
 {
@@ -1875,9 +1882,7 @@ expert_command_prompt(void)
 				x_list_table(0);
 			break;
 		case 'q':
-			close(fd);
-			printf("\n");
-			exit(0);
+			handle_quit();
 		case 'r':
 			return;
 		case 's':
@@ -2064,9 +2069,7 @@ static void command_prompt(void)
 			list_table(0);
 			break;
 		case 'q':
-			close(fd);
-			printf("\n");
-			exit(0);
+			handle_quit();
 		case 's':
 			create_sunlabel();
 			break;
-- 
1.7.4.1





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-20 16:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-20 16:11 [PATCH 1/6] fdisk: add an quit/exit handling function Davidlohr Bueso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.