Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
Massive CRLF to LF conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
dd86k committed Nov 11, 2018
1 parent f563649 commit f294a73
Show file tree
Hide file tree
Showing 92 changed files with 4,529 additions and 4,530 deletions.
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
t
ff.exe
ff
*.zip
*.tar
*.tar.xz
*.tar.gz
bin/
t
ff.exe
ff
*.zip
*.tar
*.tar.xz
*.tar.gz
bin/
.vscode
12 changes: 6 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright 2018 dd86k
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Copyright 2018 dd86k

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# ff, simple binary file scanner

ff aims to be a simple, fast, and easy-to-understand binary file scanner.

![ff screenshot](https://dd86k.github.io/imgs/ff0.png)

# Compiling

The Makefile is **not** ready.

To compile ff:

You **MUST**:
- Byte-align structs
- cl, clang-cl: `/Zp`
- clang, gcc: `-fpack-struct=1`

You **COULD**:
- Use one of the build scripts
- They usually includes the `TIMESTAMP` macro
- Windows: `%DATE% %TIME%`
- Linux: (To be defined)
- They require clang to be installed

## Windows Notes

### File Globbing

# ff, simple binary file scanner

ff aims to be a simple, fast, and easy-to-understand binary file scanner.

![ff screenshot](https://dd86k.github.io/imgs/ff0.png)

# Compiling

The Makefile is **not** ready.

To compile ff:

You **MUST**:
- Byte-align structs
- cl, clang-cl: `/Zp`
- clang, gcc: `-fpack-struct=1`

You **COULD**:
- Use one of the build scripts
- They usually includes the `TIMESTAMP` macro
- Windows: `%DATE% %TIME%`
- Linux: (To be defined)
- They require clang to be installed

## Windows Notes

### File Globbing

If you wish to include globbing, throw in `setargv.obj` alongside the build script. This object file is included with your Visual Studio install. Don't forget to use the proper target architecture.
4 changes: 2 additions & 2 deletions build-clang.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#T="\"`date +"%Y-%m-%d %H:%M:%S"`\""
clang src/*.c src/executables/*.c src/etc/*.c src/images/*.c src/documents/*.c src/audio/*.c src/archives/*.c src/vdisk/*.c $1 -std=gnu99 -fno-stack-protector -fshort-enums -fstrict-enums -fpack-struct=1 -lm -off
#T="\"`date +"%Y-%m-%d %H:%M:%S"`\""
clang src/*.c src/executables/*.c src/etc/*.c src/images/*.c src/documents/*.c src/audio/*.c src/archives/*.c src/vdisk/*.c $1 -std=gnu99 -fno-stack-protector -fshort-enums -fstrict-enums -fpack-struct=1 -lm -off
#-DTIMESTAMP="$T"
176 changes: 88 additions & 88 deletions docs/ff.1
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
." Hi! This manual (man page) was written by dd86k.
." Please read man-pages(7) and groff_man(7) about the manual page format.
."
.TH ff 1 "April 2018" dd86k "User manual"
.SH NAME
.B ff
- Determine the file type via pre-determined magic.

.SH SYNOPSIS
.SY ff
.OP -cmsvh
.IR file " ..."
.YS
.SY ff
.OP --help
.OP --version
.YS

.SH DESCRIPTION
This document describes ff version 0.3.0.

.B ff
is a simple binary file scanner that is very similar to and inspired by the UNIX/BSD file(1) utility and is mostly aimed for binary formats.

It works by scanning an internal switch case (against signatures) in order: 4-bytes, 3-bytes, 2-bytes, then offsets.

If ff can't find the file format could not be found, it reports
.B data
to stdout and returns 0.

.SH OPTIONS

.IP -c
Continue on symlink.

.IP -m
Show more information, if available.

.IP -s
Prepend filename to result, useful while globbing.

.IP -v
Show version screen and exit.

.IP -h
Show help screen and exit.

.SH EXAMPLES
.EX
$ ff ff ff.exe
ELF64 LE System V Shared object for x86-64 machines
PE32+ Windows Console Executable for x86-64 machines, LARGE_ADDRESS_AWARE
$ ff ff.exe -m
PE32+ Windows Console Executable for x86-64 machines, LARGE_ADDRESS_AWARE
Number of sections : 0h
Timestamp : 5AA58AC4h
Pointer to Symbol Table: 0h
Number of symbols : 0h
Size of Optional Header: F0h
Characteristics : 22h
$ ff t/*.png -sm
t/8bit.png: Portable Network Graphics image, 201 x 192 pixels, 8-bit PLTE Palette
Default compression, Default filtering, No interlacing
t/asciifull.png: Portable Network Graphics image, 715 x 823 pixels, 32-bit RGBA
Default compression, Default filtering, No interlacing
t/mspaint.png: Portable Network Graphics image, 281 x 198 pixels, 24-bit RGB
Default compression, Default filtering, No interlacing
.EE

.SH WARNINGS
ff is still a work in progress and may give incorrect results.

.SH NOTES
None.

.SH BUGS
ISO9660 buffers are not cleared on globbing, which will

.SH AUTHOR
Program and man-gage written by dd86k
.MT devddstuff@gmail.com
.ME .

.UR https://github.com/dd86k/ff
Homepage:
.UE
." Hi! This manual (man page) was written by dd86k.
." Please read man-pages(7) and groff_man(7) about the manual page format.
."
.TH ff 1 "April 2018" dd86k "User manual"
.SH NAME
.B ff
- Determine the file type via pre-determined magic.

.SH SYNOPSIS
.SY ff
.OP -cmsvh
.IR file " ..."
.YS
.SY ff
.OP --help
.OP --version
.YS

.SH DESCRIPTION
This document describes ff version 0.3.0.

.B ff
is a simple binary file scanner that is very similar to and inspired by the UNIX/BSD file(1) utility and is mostly aimed for binary formats.

It works by scanning an internal switch case (against signatures) in order: 4-bytes, 3-bytes, 2-bytes, then offsets.

If ff can't find the file format could not be found, it reports
.B data
to stdout and returns 0.

.SH OPTIONS

.IP -c
Continue on symlink.

.IP -m
Show more information, if available.

.IP -s
Prepend filename to result, useful while globbing.

.IP -v
Show version screen and exit.

.IP -h
Show help screen and exit.

.SH EXAMPLES
.EX
$ ff ff ff.exe
ELF64 LE System V Shared object for x86-64 machines
PE32+ Windows Console Executable for x86-64 machines, LARGE_ADDRESS_AWARE
$ ff ff.exe -m
PE32+ Windows Console Executable for x86-64 machines, LARGE_ADDRESS_AWARE
Number of sections : 0h
Timestamp : 5AA58AC4h
Pointer to Symbol Table: 0h
Number of symbols : 0h
Size of Optional Header: F0h
Characteristics : 22h
$ ff t/*.png -sm
t/8bit.png: Portable Network Graphics image, 201 x 192 pixels, 8-bit PLTE Palette
Default compression, Default filtering, No interlacing
t/asciifull.png: Portable Network Graphics image, 715 x 823 pixels, 32-bit RGBA
Default compression, Default filtering, No interlacing
t/mspaint.png: Portable Network Graphics image, 281 x 198 pixels, 24-bit RGB
Default compression, Default filtering, No interlacing
.EE

.SH WARNINGS
ff is still a work in progress and may give incorrect results.

.SH NOTES
None.

.SH BUGS
ISO9660 buffers are not cleared on globbing, which will

.SH AUTHOR
Program and man-gage written by dd86k
.MT devddstuff@gmail.com
.ME .

.UR https://github.com/dd86k/ff
Homepage:
.UE
24 changes: 12 additions & 12 deletions src/archives/cab.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <stdio.h>
#include "../utils.h"
#include "../settings.h"
#include "../ff.h"
#include "cab.h"

void scan_cab() {
struct cfh_hdr h;
_ddread(&h, sizeof(h));
reportf("Microsoft Cabinet archive v%d.%d", h.major, h.minor);
_printfd(h.size);
printf(", %d files, %d folders\n", h.files, h.folders);
#include <stdio.h>
#include "../utils.h"
#include "../settings.h"
#include "../ff.h"
#include "cab.h"

void scan_cab() {
struct cfh_hdr h;
_ddread(&h, sizeof(h));
reportf("Microsoft Cabinet archive v%d.%d", h.major, h.minor);
_printfd(h.size);
printf(", %d files, %d folders\n", h.files, h.folders);
}
32 changes: 16 additions & 16 deletions src/archives/cab.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
struct cfh_hdr {
//char[4] magic;
uint32_t reserved1;
uint32_t size;
uint32_t reserved2;
uint32_t offset;
uint32_t reserved3;
uint8_t minor;
uint8_t major;
uint16_t folders;
uint16_t files;
uint16_t flags;
uint16_t id;
uint16_t seq;
};

struct cfh_hdr {
//char[4] magic;
uint32_t reserved1;
uint32_t size;
uint32_t reserved2;
uint32_t offset;
uint32_t reserved3;
uint8_t minor;
uint8_t major;
uint16_t folders;
uint16_t files;
uint16_t flags;
uint16_t id;
uint16_t seq;
};

void scan_cab(void);
Loading

0 comments on commit f294a73

Please # to comment.