diff options
| author | bernard <[email protected]> | 2017-11-02 13:50:42 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-11-02 13:50:42 +0800 |
| commit | b2057f506a09e2adef81fc77efd697d16ae14bec (patch) | |
| tree | 3affefabfe376a0ec1b3ac4a5eef957c1dd58dc8 /components/external/SQLite-3.8.1/tool/extract.c | |
| parent | 23582c8129228b4961ad35319cfd2d270039345f (diff) | |
[External] Remove external from RT-Thread
Diffstat (limited to 'components/external/SQLite-3.8.1/tool/extract.c')
| -rw-r--r-- | components/external/SQLite-3.8.1/tool/extract.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/components/external/SQLite-3.8.1/tool/extract.c b/components/external/SQLite-3.8.1/tool/extract.c deleted file mode 100644 index 5bf5caa31c..0000000000 --- a/components/external/SQLite-3.8.1/tool/extract.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -** Extract a range of bytes from a file. -** -** Usage: -** -** extract FILENAME OFFSET AMOUNT -** -** The bytes are written to standard output. -*/ -#include <stdio.h> -#include <stdlib.h> - -int main(int argc, char **argv){ - FILE *f; - char *zBuf; - int ofst; - int n; - size_t got; - - if( argc!=4 ){ - fprintf(stderr, "Usage: %s FILENAME OFFSET AMOUNT\n", *argv); - return 1; - } - f = fopen(argv[1], "rb"); - if( f==0 ){ - fprintf(stderr, "cannot open \"%s\"\n", argv[1]); - return 1; - } - ofst = atoi(argv[2]); - n = atoi(argv[3]); - zBuf = malloc( n ); - if( zBuf==0 ){ - fprintf(stderr, "out of memory\n"); - return 1; - } - fseek(f, ofst, SEEK_SET); - got = fread(zBuf, 1, n, f); - fclose(f); - if( got<n ){ - fprintf(stderr, "got only %d of %d bytes\n", got, n); - return 1; - }else{ - fwrite(zBuf, 1, n, stdout); - } - return 0; -} |
