mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-25 05:29:34 +00:00
make_b: clean up whitespace
This commit is contained in:
parent
75bfb3c573
commit
2f482f68aa
@ -7,56 +7,56 @@
|
||||
#include "version.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int in_fd,out_fd,offset,write_result;
|
||||
|
||||
unsigned char buffer[256];
|
||||
int result,file_size;
|
||||
|
||||
struct stat file_info;
|
||||
|
||||
if (argc!=4) {
|
||||
printf("MAKE_B version %s\b",VERSION);
|
||||
printf(" Usage: %s in_file out_file offset\n\n",argv[0]);
|
||||
printf("\tin_file : input file\n");
|
||||
printf("\tout_file : output file\n");
|
||||
printf("\toffset : offset which file should be loaded\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (stat(argv[1],&file_info)<0) {
|
||||
printf("Error! %s not found!\n",argv[1]);
|
||||
exit(2);
|
||||
}
|
||||
file_size=(int)file_info.st_size;
|
||||
|
||||
if ((in_fd=open(argv[1],O_RDONLY))<0) {
|
||||
printf("Error opening %s!\n",argv[1]);
|
||||
exit(3);
|
||||
}
|
||||
int in_fd,out_fd,offset,write_result;
|
||||
|
||||
if ((out_fd=open(argv[2],O_WRONLY|O_CREAT,0666))<0) {
|
||||
printf("Error opening %s\n",argv[2]);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
offset=strtol(argv[3],NULL,0);
|
||||
|
||||
buffer[0]=offset&0xff;
|
||||
buffer[1]=(offset>>8)&0xff;
|
||||
buffer[2]=file_size&0xff;
|
||||
buffer[3]=(file_size>>8)&0xff;
|
||||
|
||||
write_result=write(out_fd,&buffer,4);
|
||||
|
||||
while( (result=read(in_fd,&buffer,256))>0) {
|
||||
write_result=write(out_fd,&buffer,result);
|
||||
}
|
||||
|
||||
if (write_result<0) fprintf(stderr,"Error writing\n");
|
||||
|
||||
close(in_fd);
|
||||
close(out_fd);
|
||||
|
||||
return 0;
|
||||
unsigned char buffer[256];
|
||||
int result,file_size;
|
||||
|
||||
struct stat file_info;
|
||||
|
||||
if (argc!=4) {
|
||||
printf("MAKE_B version %s\b",VERSION);
|
||||
printf(" Usage: %s in_file out_file offset\n\n",argv[0]);
|
||||
printf("\tin_file : input file\n");
|
||||
printf("\tout_file : output file\n");
|
||||
printf("\toffset : offset which file should be loaded\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (stat(argv[1],&file_info)<0) {
|
||||
printf("Error! %s not found!\n",argv[1]);
|
||||
exit(2);
|
||||
}
|
||||
file_size=(int)file_info.st_size;
|
||||
|
||||
if ((in_fd=open(argv[1],O_RDONLY))<0) {
|
||||
printf("Error opening %s!\n",argv[1]);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if ((out_fd=open(argv[2],O_WRONLY|O_CREAT,0666))<0) {
|
||||
printf("Error opening %s\n",argv[2]);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
offset=strtol(argv[3],NULL,0);
|
||||
|
||||
buffer[0]=offset&0xff;
|
||||
buffer[1]=(offset>>8)&0xff;
|
||||
buffer[2]=file_size&0xff;
|
||||
buffer[3]=(file_size>>8)&0xff;
|
||||
|
||||
write_result=write(out_fd,&buffer,4);
|
||||
|
||||
while( (result=read(in_fd,&buffer,256))>0) {
|
||||
write_result=write(out_fd,&buffer,result);
|
||||
}
|
||||
|
||||
if (write_result<0) fprintf(stderr,"Error writing\n");
|
||||
|
||||
close(in_fd);
|
||||
close(out_fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user