Skip to content

Commit

Permalink
Minor changes so it can compile. Writing to file using binary mode si…
Browse files Browse the repository at this point in the history
…nce windows will add one byte for each ending line. Updated README for windows instruction.
  • Loading branch information
jin-stuff committed Feb 5, 2016
1 parent 7015555 commit 006c698
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.o
*.exe
*.ko
*.obj
*.elf
*.gch
*.pch
*.lib
*.la
*.lo
*.dll
*.so
*.so.*
*.dylib
*.out
*.app
*.i*86
*.x86_64
*.hex
*.dSYM/
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SYS := $(shell uname -s | tr -d "[0-9]" | tr -d "-" | tr "[A-Z]" "[a-z]")
# You can cross compile this program for Win32 using Linux and the
# MinGW compiler. See the README for details. If you have already
# installed MinGW, put the location ($PREFIX) here:
CR_BASE = /usr/local/cross-tools/i386-mingw32msvc/bin
CR_BASE = /opt/mingw32/bin

# You shouldn't need to change anything below this line
#---------------------------------------------------------------------
Expand All @@ -19,6 +19,7 @@ CR_BASE = /usr/local/cross-tools/i386-mingw32msvc/bin
#RAW_FLAGS += -D__DEBUG -ggdb

NAME = foremost
NAME_OUTPUT = $(NAME)
MAN_PAGES = $(NAME).8.gz

RAW_FLAGS += -DVERSION=\"$(VERSION)\"
Expand Down Expand Up @@ -92,6 +93,7 @@ win_general: goals

# Cross compiling from Linux to Windows. See README for more info
cross: CC = $(CR_CC) $(CR_OPT)
cross: NAME_OUTPUT = $(CR_GOAL)
cross: STRIP = $(CR_STRIP)
cross: win_general

Expand All @@ -110,7 +112,7 @@ cygwin: unix
#---------------------------------------------------------------------

foremost: $(OBJ)
$(CC) $(OBJ) -o $(NAME) $(LINK_OPT)
$(CC) $(OBJ) -o $(NAME_OUTPUT) $(LINK_OPT)


#---------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
WINDOWS:
Requires path to MinGW.
Makefile defaults MinGW gcc path to /opt/mingw32/bin
If you installed mingw32 in different location modify line 13 in Makefile.
Requires libiberty.a to compile

$ make cross


----------------------------------------------------------------------


FOREMOST
----------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion api.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ int FATblk;
int currFATblk;
int highblk = 0;
int block_list[OUR_BLK_SIZE / sizeof(int)];
extern int errno;

/*Inititialize those globals used by extract_ole*/
void init_ole()
Expand Down
3 changes: 1 addition & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ int make_new_directory(f_state *s, char *fn)
#ifdef __WIN32

#ifndef __CYGWIN
fprint(stderr,"Calling mkdir with\n");
if (mkdir(fn))
#endif

Expand Down Expand Up @@ -367,7 +366,7 @@ int write_to_disk(f_state *s, s_spec *needle, u_int64_t len, unsigned char *buf,
test = fopen(fn, "r");
}

if (!(f = fopen(fn, "w")))
if (!(f = fopen(fn, "wb"))) /* added b so it can extract correctly for windows */
{
printf("fn = %s failed\n", fn);
fatal_error(s, "Can't open file for writing \n");
Expand Down
Binary file added libiberty.a
Binary file not shown.
1 change: 1 addition & 0 deletions main.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

#elif defined (__WIN32)
#include <sys/param.h>
#define __U16_TYPE unsigned short

#elif defined (__MACOSX)
#include <machine/endian.h>
Expand Down

0 comments on commit 006c698

Please sign in to comment.