mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-22 11:12:07 +00:00
@@ -114,8 +114,8 @@ int main(int argc, char *argv[])
|
||||
unsigned long value; /* For storing `strtoul`'s return value */
|
||||
|
||||
/* Parse options */
|
||||
while ((optionChar = getopt_long_only(argc, argv, optstring, longopts,
|
||||
NULL)) != -1) {
|
||||
while ((optionChar = musl_getopt_long_only(argc, argv, optstring,
|
||||
longopts, NULL)) != -1) {
|
||||
switch (optionChar) {
|
||||
case 'd':
|
||||
isDmgMode = true;
|
||||
|
||||
@@ -150,9 +150,8 @@ static void writeBank(struct SortedSection *bankSections, uint16_t baseOffset,
|
||||
|
||||
/* Output padding up to the next SECTION */
|
||||
while (offset + baseOffset < section->org) {
|
||||
putc_unlocked(overlayFile ? getc_unlocked(overlayFile)
|
||||
: padValue,
|
||||
outputFile);
|
||||
putc(overlayFile ? getc(overlayFile) : padValue,
|
||||
outputFile);
|
||||
offset++;
|
||||
}
|
||||
|
||||
@@ -162,7 +161,7 @@ static void writeBank(struct SortedSection *bankSections, uint16_t baseOffset,
|
||||
if (overlayFile) {
|
||||
/* Skip bytes even with pipes */
|
||||
for (uint16_t i = 0; i < section->size; i++)
|
||||
getc_unlocked(overlayFile);
|
||||
getc(overlayFile);
|
||||
}
|
||||
offset += section->size;
|
||||
|
||||
@@ -170,9 +169,7 @@ static void writeBank(struct SortedSection *bankSections, uint16_t baseOffset,
|
||||
}
|
||||
|
||||
while (offset < size) {
|
||||
putc_unlocked(overlayFile ? getc_unlocked(overlayFile)
|
||||
: padValue,
|
||||
outputFile);
|
||||
putc(overlayFile ? getc(overlayFile) : padValue, outputFile);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
@@ -188,10 +185,6 @@ static void writeROM(void)
|
||||
checkOverlay();
|
||||
|
||||
if (outputFile) {
|
||||
flockfile(outputFile);
|
||||
if (overlayFile)
|
||||
flockfile(overlayFile);
|
||||
|
||||
if (sections[SECTTYPE_ROM0].nbBanks > 0)
|
||||
writeBank(sections[SECTTYPE_ROM0].banks[0].sections,
|
||||
0x0000, 0x4000);
|
||||
@@ -199,10 +192,6 @@ static void writeROM(void)
|
||||
for (uint32_t i = 0 ; i < sections[SECTTYPE_ROMX].nbBanks; i++)
|
||||
writeBank(sections[SECTTYPE_ROMX].banks[i].sections,
|
||||
0x4000, 0x4000);
|
||||
|
||||
if (overlayFile)
|
||||
funlockfile(overlayFile);
|
||||
funlockfile(outputFile);
|
||||
}
|
||||
|
||||
closeFile(outputFile);
|
||||
|
||||
@@ -164,7 +164,7 @@ static char const * const commands[] = {
|
||||
|
||||
static int readChar(FILE *file)
|
||||
{
|
||||
int curchar = getc_unlocked(file);
|
||||
int curchar = getc(file);
|
||||
|
||||
if (curchar == EOF && ferror(file))
|
||||
err(1, "%s(%u): Unexpected error in %s", linkerScriptName,
|
||||
|
||||
Reference in New Issue
Block a user