Magellan Linux

Diff of /tags/grubby-8_18/grubby.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1801 by niro, Mon Apr 16 17:48:10 2012 UTC revision 1841 by niro, Mon Jul 2 12:49:27 2012 UTC
# Line 901  static int getNextLine(char ** bufPtr, s Line 901  static int getNextLine(char ** bufPtr, s
901   break;   break;
902   }   }
903    
904   free(line->elements[i].indent);   line->elements[i + 1].indent = line->elements[i].indent;
905   line->elements[i].indent = strdup(indent);   line->elements[i].indent = strdup(indent);
906   *p++ = '\0';   *p++ = '\0';
907   i++;   i++;
908   line->elements[i].item = strdup(p);   line->elements[i].item = strdup(p);
  line->elements[i].indent = strdup("");  
  p = line->elements[i].item;  
909   }   }
910      }      }
911   }   }
# Line 995  static struct grubConfig * readConfig(co Line 993  static struct grubConfig * readConfig(co
993      dbgPrintf("found 'set' command (%d elements): ", line->numElements);      dbgPrintf("found 'set' command (%d elements): ", line->numElements);
994      dbgPrintf("%s", line->indent);      dbgPrintf("%s", line->indent);
995      for (i = 0; i < line->numElements; i++)      for (i = 0; i < line->numElements; i++)
996   dbgPrintf("%s\"%s\"", line->elements[i].indent, line->elements[i].item);   dbgPrintf("\"%s\"%s", line->elements[i].item, line->elements[i].indent);
997      dbgPrintf("\n");      dbgPrintf("\n");
998      struct keywordTypes *kwType = getKeywordByType(LT_DEFAULT, cfi);      struct keywordTypes *kwType = getKeywordByType(LT_DEFAULT, cfi);
999      if (kwType && line->numElements == 3 &&      if (kwType && line->numElements == 3 &&
# Line 1103  static struct grubConfig * readConfig(co Line 1101  static struct grubConfig * readConfig(co
1101      /* get extras */      /* get extras */
1102      int count = 0;      int count = 0;
1103      for (i = 0; i < line->numElements; i++) {      for (i = 0; i < line->numElements; i++) {
1104   if (count == 2) {   if (count >= 2) {
1105      strcat(extras, line->elements[i].item);      strcat(extras, line->elements[i].item);
1106      strcat(extras, line->elements[i].indent);      strcat(extras, line->elements[i].indent);
1107   }   }
# Line 1463  static char *findDiskForRoot() Line 1461  static char *findDiskForRoot()
1461      buf[rc] = '\0';      buf[rc] = '\0';
1462      chptr = buf;      chptr = buf;
1463    
1464        char *foundanswer = NULL;
1465    
1466      while (chptr && chptr != buf+rc) {      while (chptr && chptr != buf+rc) {
1467          devname = chptr;          devname = chptr;
1468    
# Line 1490  static char *findDiskForRoot() Line 1490  static char *findDiskForRoot()
1490           * for '/' obviously.           * for '/' obviously.
1491           */           */
1492          if (*(++chptr) == '/' && *(++chptr) == ' ') {          if (*(++chptr) == '/' && *(++chptr) == ' ') {
1493              /*              /* remember the last / entry in mtab */
1494               * Move back 2, which is the first space after the device name, set             foundanswer = devname;
              * it to \0 so strdup will just get the devicename.  
              */  
             chptr -= 2;  
             *chptr = '\0';  
             return strdup(devname);  
1495          }          }
1496    
1497          /* Next line */          /* Next line */
# Line 1505  static char *findDiskForRoot() Line 1500  static char *findDiskForRoot()
1500              chptr++;              chptr++;
1501      }      }
1502    
1503        /* Return the last / entry found */
1504        if (foundanswer) {
1505            chptr = strchr(foundanswer, ' ');
1506            *chptr = '\0';
1507            return strdup(foundanswer);
1508        }
1509    
1510      return NULL;      return NULL;
1511  }  }
1512    
# Line 3587  int main(int argc, const char ** argv) { Line 3589  int main(int argc, const char ** argv) {
3589      }      }
3590    
3591      if (!cfi) {      if (!cfi) {
3592            if (grub2FindConfig(&grub2ConfigType))
3593        cfi = &grub2ConfigType;
3594     else
3595        #ifdef __ia64__        #ifdef __ia64__
3596   cfi = &eliloConfigType;      cfi = &eliloConfigType;
3597        #elif __powerpc__        #elif __powerpc__
3598   cfi = &yabootConfigType;      cfi = &yabootConfigType;
3599        #elif __sparc__        #elif __sparc__
3600          cfi = &siloConfigType;              cfi = &siloConfigType;
3601        #elif __s390__        #elif __s390__
3602          cfi = &ziplConfigType;              cfi = &ziplConfigType;
3603        #elif __s390x__        #elif __s390x__
3604          cfi = &ziplConfigtype;              cfi = &ziplConfigtype;
3605        #else        #else
         if (grub2FindConfig(&grub2ConfigType))  
     cfi = &grub2ConfigType;  
  else  
3606      cfi = &grubConfigType;      cfi = &grubConfigType;
3607        #endif        #endif
3608      }      }

Legend:
Removed from v.1801  
changed lines
  Added in v.1841