]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: move code for renaming SGI bootfile to SGI module
authorFrancesco Cosoleto <cosoleto@gmail.com>
Thu, 15 Dec 2011 19:02:39 +0000 (20:02 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 16 Dec 2011 13:04:00 +0000 (14:04 +0100)
This moves the code for renaming SGI bootfile from command_prompt() to
sgi_set_bootfilename() function.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
fdisk/fdisk.c
fdisk/fdisksgilabel.c
fdisk/fdisksgilabel.h

index a23f45ee906e1814ccfbda3b7e48bfb29496cd96..1a4c823ae7e36a3fb00281c0f13a00c8d21bc770 100644 (file)
@@ -2906,15 +2906,9 @@ static void command_prompt(void)
                                unknown_command(c);
                        break;
                case 'b':
-                       if (disklabel == SGI_LABEL) {
-                               printf(_("\nThe current boot file is: %s\n"),
-                                      sgi_get_bootfile());
-                               if (read_chars(_("Please enter the name of the "
-                                              "new boot file: ")) == '\n')
-                                       printf(_("Boot file unchanged\n"));
-                               else
-                                       sgi_set_bootfile(line_ptr);
-                       } else if (disklabel == DOS_LABEL) {
+                       if (disklabel == SGI_LABEL)
+                               sgi_set_bootfile();
+                       else if (disklabel == DOS_LABEL) {
                                disklabel = OSF_LABEL;
                                bsd_command_prompt();
                                disklabel = DOS_LABEL;
index 002688a4cc0e84cce2fc5112f3a410d55b17f4de..b432b1344c04c4d4e91e522d3ea40c3da1dcc710 100644 (file)
@@ -316,20 +316,21 @@ sgi_check_bootfile(const char* aFile) {
        return 0;       /* filename did not change */
 }
 
-const char *
-sgi_get_bootfile(void) {
-       return (char *) sgilabel->boot_file;
-}
-
 void
-sgi_set_bootfile(const char* aFile) {
+sgi_set_bootfile(void)
+{
+       printf(_("\nThe current boot file is: %s\n"), sgilabel->boot_file);
+       if (read_chars(_("Please enter the name of the new boot file: ")) == '\n') {
+               printf(_("Boot file unchanged\n"));
+               return;
+       }
 
-       if (sgi_check_bootfile(aFile)) {
+       if (sgi_check_bootfile(line_ptr)) {
                size_t i = 0;
                while (i < 16) {
-                       if ((aFile[i] != '\n')  /* in principle caught again by next line */
-                           &&  (strlen(aFile) > i))
-                               sgilabel->boot_file[i] = aFile[i];
+                       if ((line_ptr[i] != '\n')       /* in principle caught again by next line */
+                           &&  (strlen(line_ptr) > i))
+                               sgilabel->boot_file[i] = line_ptr[i];
                        else
                                sgilabel->boot_file[i] = 0;
                        i++;
index 1c47bb4742665aab137eb8be7c1821dd7eab399c..255fe9cfa38964a02f0ad6f3fec794350278e134 100644 (file)
@@ -133,7 +133,6 @@ extern void sgi_set_bootpartition( int i );
 extern void    sgi_set_swappartition( int i );
 extern int     sgi_get_bootpartition( void );
 extern int     sgi_get_swappartition( void );
-extern void    sgi_set_bootfile( const char* aFile );
-extern const char *sgi_get_bootfile( void );
+extern void    sgi_set_bootfile(void);
 
 #endif /* FDISK_SGI_LABEL_H */