Christopher Wellons avatar Christopher Wellons committed 696938d

Add a --quiet (-q) option to disable the startup banner.

Comments (0)

Files changed (3)

   { "sectors", required_argument, NULL, 'S', "in lfdisk, specify the number of sectors per track"},
   { "list-partition-types", no_argument, NULL, 't', "displays a list of supported partition types"},
   { "version", no_argument, NULL, 'v', "displays the version"},
+  { "quiet", no_argument, NULL, 'q', "do not print the introductory and copyright messages"},
   
   /* Last element must be NULL */
   { NULL, 0, NULL, 0, NULL}
  * to this string 
  *
  * NOTE: I will make function to build dynamic in the future */
-static const char* short_option_string = "hlipvLGs:A:utb:C:H:S:r";
+static const char* short_option_string = "hlipvLGs:A:utb:C:H:S:rq";
 
 
 
 	case 'S':
 	  user_sectors = atoi(optarg);
 	  break;
+	case 'q':
+	  quiet_mode = 1;
+	  break;
 	}
     }
   
 /* global and used in fdisk.c */
 char* interface_name = "GNU Fdisk " VERSION;
 
+int quiet_mode = 0;
+
 #define MAX_WORDS	1024
 
 static StrList*		command_line;
   PedDisk *disk;
   StrList* command_names = fdisk_command_get_names (cmd_list);
     
-  puts (interface_name);
-  do_banner_message();
+  if(!quiet_mode)
+    {
+      puts (interface_name);
+      do_banner_message();
+    }
 
   /* Christian <mail.kristian@yahoo.it>:
    * FIRST try open device as a disk with a partition table, if this doesn't
 extern char*	fdisk_prog_name;
 extern int	fdisk_opt_script_mode;
 extern char *interface_name;
+extern int quiet_mode;
 extern void fdisk_usage_msg();
 extern void fdisk_help_msg ();
 /* extern int fdisk_interactive_mode (PedDisk** disk, FdiskCommand* cmd_list[]); */
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.