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

Commit

Permalink
Revert FILE OPTIONS CLI order, fix printl usage, mark mp4 as containe…
Browse files Browse the repository at this point in the history
…r for m4a
  • Loading branch information
dd86k committed Aug 25, 2018
1 parent 0ed99c7 commit dc6ef1f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ void scan() {
case 0x70797466: // "ftyp"
switch (*(b + 1)) {
case 0x6D6F7369: // "isom"
//TODO: WARNING -- m4a is based on this
report("ISO Base Media (MPEG-4) v1 video");
report("ISO Base Media (MPEG-4) v1 video container");
return;
case 0x20207471: // "qt "
report("QuickTime video");
Expand Down
2 changes: 1 addition & 1 deletion src/images/flif.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void scan_flif() {
case 1: printl(", Grayscale"); break;
case 3: printl(", RGB"); break;
case 4: printl(", RGBA"); break;
default: printl(", %d channels", h.type & 0xF);
default: printf(", %d channels", h.type & 0xF);
}

switch (h.type >> 4) {
Expand Down
6 changes: 3 additions & 3 deletions src/images/gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ void scan_gif() {
if (h.packed & GLOBAL_COLOR_TABLE) {
printl(", Global Color Table");
if (h.packed & 3)
printl(" of %lf bytes", pow(2, ((h.packed & 3) + 1)));
printf(" of %lf bytes", pow(2, ((h.packed & 3) + 1)));
if (h.packed & SORT_FLAG)
printl(", Sorted");
if (h.bgcolor)
printl(", BG Index of %X", h.bgcolor);
printf(", BG Index of %X", h.bgcolor);
}

if (h.aspect)
printl(", %f pixel ratio (reported)", ((float)h.aspect + 15) / 64);
printf(", %f pixel ratio (reported)", ((float)h.aspect + 15) / 64);
}

putchar('\n');
Expand Down
16 changes: 8 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
void help() {
puts(
"Simple binary file scanner\n"
" Usage: ff [OPTIONS] FILE\n"
" Usage: ff FILE [OPTIONS]\n"
" ff {-v|--version|-h|--help}\n"
"\nOPTIONS\n"
" -c Continue on soft symbolic link\n"
Expand Down Expand Up @@ -94,15 +94,15 @@ MAIN {
return 0;
}
while (--argc >= 1) {
++argv;
if (_args) {
if ((*argv)[1] == '-') { // long arguments
sb(*argv + 2); continue;
} else if ((*argv)[0] == '-') { // short arguments
sa(*argv); continue;
if (argv[argc][1] == '-') { // long arguments
sb(argv[argc] + 2); continue;
} else if (argv[argc][0] == '-') { // short arguments
sa(argv[argc]); continue;
}
}
_currf = *argv;
_currf = argv[argc];
// -- Windows --
#ifdef _WIN32
uint32_t a = GetFileAttributesW(_currf);
if (a == 0xFFFFFFFF) { // INVALID_FILE_ATTRIBUTES
Expand Down Expand Up @@ -135,7 +135,7 @@ _fo: f = CreateFileW(_currf,
scan();
CloseHandle(f);
}
#else // POSIX
#else // -- POSIX --
struct stat s;
if (lstat(_currf, &s) == 0) {
switch (s.st_mode & S_IFMT) { // stat(2)
Expand Down

0 comments on commit dc6ef1f

Please # to comment.