diff options
author | Chris Xiong <chirs241097@gmail.com> | 2015-10-11 22:16:30 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2015-10-11 22:16:30 +0800 |
commit | bdcabc1e059ba9415e8d1f8cb436c77545680670 (patch) | |
tree | 18bd9f864290b6ad2258b143817e8bccbc3ae657 /tools | |
parent | c279262556b2ffb4324cc6e52b4d4dd9cd1bd91a (diff) | |
download | SMELT-bdcabc1e059ba9415e8d1f8cb436c77545680670.tar.xz |
Add smDtpFileR::getFileCRC.
Modify anmutil and dtputil.
Make the example compatible with Arch Linux.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dtputil/anmutil.cpp | 5 | ||||
-rw-r--r-- | tools/dtputil/dtputil.cpp | 5 | ||||
-rw-r--r-- | tools/dtputil/makefile | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/tools/dtputil/anmutil.cpp b/tools/dtputil/anmutil.cpp index 6636e2c..fd5d376 100644 --- a/tools/dtputil/anmutil.cpp +++ b/tools/dtputil/anmutil.cpp @@ -45,7 +45,7 @@ int main(int argc,char** argv) puts(c); char *ptr=file.getFilePtr(c); if(!ptr)printf("error\n");else - printf("size:%lu, first bytes:%c%c%c\n",file.getFileSize(c),*ptr,*(ptr+1),*(ptr+2)); + printf("size:%u, CRC 0x%08X\n",file.getFileSize(c),file.getFileCRC(c)); file.releaseFilePtr(c); } } @@ -53,7 +53,8 @@ int main(int argc,char** argv) for(int i=3;i<argc;++i) { char *ptr=file.getFilePtr(argv[i]); - printf("size:%lu, first bytes:%c%c%c\n",file.getFileSize(argv[i]),*ptr,*(ptr+1),*(ptr+2)); + if(!ptr)printf("error\n");else + printf("size:%u, CRC 0x%08X\n",file.getFileSize(argv[i]),file.getFileCRC(argv[i])); file.releaseFilePtr(argv[i]); } file.closeDtp(); diff --git a/tools/dtputil/dtputil.cpp b/tools/dtputil/dtputil.cpp index 142a679..6563c56 100644 --- a/tools/dtputil/dtputil.cpp +++ b/tools/dtputil/dtputil.cpp @@ -27,7 +27,7 @@ int main(int argc,char** argv) puts(c); char *ptr=file.getFilePtr(c); if(!ptr)printf("error\n");else - printf("size:%lu, first bytes:%c%c%c\n",file.getFileSize(c),*ptr,*(ptr+1),*(ptr+2)); + printf("size:%u, CRC: 0x%08X\n",file.getFileSize(c),file.getFileCRC(c)); file.releaseFilePtr(c); } } @@ -35,7 +35,8 @@ int main(int argc,char** argv) for(int i=3;i<argc;++i) { char *ptr=file.getFilePtr(argv[i]); - printf("size:%lu, first bytes:%c%c%c\n",file.getFileSize(argv[i]),*ptr,*(ptr+1),*(ptr+2)); + if(!ptr)printf("error\n");else + printf("size:%u, CRC: 0x%08X\n",file.getFileSize(argv[i]),file.getFileCRC(argv[i])); file.releaseFilePtr(argv[i]); } file.closeDtp(); diff --git a/tools/dtputil/makefile b/tools/dtputil/makefile index cb0ed0a..92ed0fb 100644 --- a/tools/dtputil/makefile +++ b/tools/dtputil/makefile @@ -4,7 +4,7 @@ LINK= -lz -lsmeltext LINK_FOLDER= -L../../extensions/ all: anmutil dtputil -anmutil: +anmutil: anmutil.cpp $(CC) anmutil.cpp -o anmutil $(CXXFLAGS) $(LINK_FOLDER) $(LINK) -dtputil: +dtputil: dtputil.cpp $(CC) dtputil.cpp -o dtputil $(CXXFLAGS) $(LINK_FOLDER) $(LINK)
\ No newline at end of file |