X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=direct.c;h=100db425f7afe7bad4fad3a0e5e64603fcfbb587;hb=bb94015a443a0aebaa93ee62f9f2738fa3a96784;hp=3471742ea179a28ca817d232b46501e5887ac41b;hpb=49dca3f4aa9df6022a2902be0246b6e8d93def66;p=rmac diff --git a/direct.c b/direct.c index 3471742..100db42 100644 --- a/direct.c +++ b/direct.c @@ -298,15 +298,15 @@ int d_noclear(void) // int d_incbin(void) { - int i, j; + int fd; int bytes = 0; - long pos, size; - char buf; + long pos, size, bytesRead; + char msg[256]; // Check to see if we're in BSS, and, if so, throw an error if (scattr & SBSS) { - errors("Cannot include binary file \"%s\" in BSS section", string[tok[1]]); + errors("cannot include binary file \"%s\" in BSS section", string[tok[1]]); return ERROR; } @@ -316,7 +316,7 @@ int d_incbin(void) return ERROR; } -// if ((j = open((char *)tok[1], _OPEN_INC)) >= 0) +#if 0 if ((j = open(string[tok[1]], _OPEN_INC)) >= 0) { size = lseek(j, 0L, SEEK_END); @@ -337,12 +337,57 @@ int d_incbin(void) } else { -// errors("cannot open include binary file (%s)", (char *)tok[1]); errors("cannot open include binary file (%s)", string[tok[1]]); return ERROR; } +#else + if ((fd = open(string[tok[1]], _OPEN_INC)) < 0) + { + errors("cannot open include binary file (%s)", string[tok[1]]); + return ERROR; + } + + size = lseek(fd, 0L, SEEK_END); + pos = lseek(fd, 0L, SEEK_SET); + chcheck(size); + + DEBUG + { + printf("INCBIN: File '%s' is %li bytes.\n", string[tok[1]], size); + } + +#if 0 + for(i=0; i