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 |
} |
} |
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 && |
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 |
} |
} |
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 |
|
|
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 */ |
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 |
|
|
2979 |
static char * getInitrdVal(struct grubConfig * config, |
static char * getInitrdVal(struct grubConfig * config, |
2980 |
const char * prefix, struct singleLine *tmplLine, |
const char * prefix, struct singleLine *tmplLine, |
2981 |
const char * newKernelInitrd, |
const char * newKernelInitrd, |
2982 |
char ** extraInitrds, int extraInitrdCount) |
const char ** extraInitrds, int extraInitrdCount) |
2983 |
{ |
{ |
2984 |
char *initrdVal, *end; |
char *initrdVal, *end; |
2985 |
int i; |
int i; |
3024 |
|
|
3025 |
int addNewKernel(struct grubConfig * config, struct singleEntry * template, |
int addNewKernel(struct grubConfig * config, struct singleEntry * template, |
3026 |
const char * prefix, |
const char * prefix, |
3027 |
char * newKernelPath, char * newKernelTitle, |
const char * newKernelPath, const char * newKernelTitle, |
3028 |
char * newKernelArgs, char * newKernelInitrd, |
const char * newKernelArgs, const char * newKernelInitrd, |
3029 |
char ** extraInitrds, int extraInitrdCount, |
const char ** extraInitrds, int extraInitrdCount, |
3030 |
char * newMBKernel, char * newMBKernelArgs) { |
const char * newMBKernel, const char * newMBKernelArgs) { |
3031 |
struct singleEntry * new; |
struct singleEntry * new; |
3032 |
struct singleLine * newLine = NULL, * tmplLine = NULL, * masterLine = NULL; |
struct singleLine * newLine = NULL, * tmplLine = NULL, * masterLine = NULL; |
3033 |
int needs; |
int needs; |
3813 |
} |
} |
3814 |
if (addNewKernel(config, template, bootPrefix, newKernelPath, |
if (addNewKernel(config, template, bootPrefix, newKernelPath, |
3815 |
newKernelTitle, newKernelArgs, newKernelInitrd, |
newKernelTitle, newKernelArgs, newKernelInitrd, |
3816 |
extraInitrds, extraInitrdCount, |
(const char **)extraInitrds, extraInitrdCount, |
3817 |
newMBKernel, newMBKernelArgs)) return 1; |
newMBKernel, newMBKernelArgs)) return 1; |
3818 |
|
|
3819 |
|
|