Skip to content
Snippets Groups Projects
Commit 91fcf9f4 authored by rswindell's avatar rswindell
Browse files

Getting rid of gcc warnings/errors.

parent 4d3df3db
No related branches found
No related tags found
No related merge requests found
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#if !defined(__unix__) #if defined(__unix__)
#define O_BINARY 0
#else
#include <io.h> /* open */ #include <io.h> /* open */
#endif #endif
void main(void) int main(void)
{ {
char *files[]={ char *files[]={
"scfg.c" "scfg.c"
...@@ -31,51 +33,52 @@ void main(void) ...@@ -31,51 +33,52 @@ void main(void)
long l; long l;
FILE *stream,*out; FILE *stream,*out;
if((out=fopen("scfghelp.dat","wb"))==NULL) { if((out=fopen("scfghelp.dat","wb"))==NULL) {
printf("error opening scfghelp.dat\r\n"); printf("error opening scfghelp.dat\r\n");
return; } return(-1); }
if((ixb=open("scfghelp.ixb",O_WRONLY|O_CREAT|O_BINARY,S_IWRITE|S_IREAD))==-1) { if((ixb=open("scfghelp.ixb",O_WRONLY|O_CREAT|O_BINARY,S_IWRITE|S_IREAD))==-1) {
printf("error opening scfghelp.ixb\r\n"); printf("error opening scfghelp.ixb\r\n");
return; } return(-1); }
for(i=0;files[i];i++) { for(i=0;files[i];i++) {
if((stream=fopen(files[i],"rb"))==NULL) { if((stream=fopen(files[i],"rb"))==NULL) {
printf("error opening %s\r\n",files[i]); printf("error opening %s\r\n",files[i]);
return; } return(-3); }
printf("\r\n%s ",files[i]); printf("\r\n%s ",files[i]);
line=0; line=0;
while(!feof(stream)) { while(!feof(stream)) {
if(!fgets(str,128,stream)) if(!fgets(str,128,stream))
break; break;
line++;
if(strstr(str,"SETHELP(WHERE);")) {
l=ftell(out);
write(ixb,files[i],12);
write(ixb,&line,2);
write(ixb,&l,4);
fgets(str,128,stream); /* skip start comment */
line++; line++;
while(!feof(stream)) { if(strstr(str,"SETHELP(WHERE);")) {
if(!fgets(str,128,stream)) l=ftell(out);
break; write(ixb,files[i],12);
if(strchr(str,9)) { /* Tab expansion */ write(ixb,&line,2);
strcpy(tmp,str); write(ixb,&l,4);
k=strlen(tmp); fgets(str,128,stream); /* skip start comment */
for(j=l=0;j<k;j++) {
if(tmp[j]==9) {
str[l++]=32;
while(l%4)
str[l++]=32; }
else
str[l++]=tmp[j]; }
str[l]=0; }
line++; line++;
if(strstr(str,"*/")) /* end comment */ while(!feof(stream)) {
break; if(!fgets(str,128,stream))
fputs(str,out); } break;
fputc(0,out); } } if(strchr(str,9)) { /* Tab expansion */
fclose(stream); } strcpy(tmp,str);
fclose(out); k=strlen(tmp);
printf("\n"); for(j=l=0;j<k;j++) {
if(tmp[j]==9) {
str[l++]=32;
while(l%4)
str[l++]=32; }
else
str[l++]=tmp[j]; }
str[l]=0; }
line++;
if(strstr(str,"*/")) /* end comment */
break;
fputs(str,out); }
fputc(0,out); } }
fclose(stream); }
fclose(out);
printf("\n");
return(0);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment