Link to home
Start Free TrialLog in
Avatar of demonic_from_hell
demonic_from_hell

asked on

Cannot Compile, Problem with MAKEFILE

Hello,

I am studying the antivirus development and found some pieces of code, but having problem to compile. Just wonder if anyone has experience with Aztec C by Manx?

The compiler can be downloaded from http://www.clipshop.ca/Aztec/

The code below was taken from a book, published in 1992.

If someone knows how to compile it, please let me know. Thanks.

(If using other compiler is ok, just need to know how to do it. if modification required, please do so and inform me so i can modify mine as well.)


makefile
mrxas.txt
mrxscan.txt
Avatar of sonstkeiner
sonstkeiner
Flag of Germany image

State your problem more clearly.  You say:
  "Cannot Compile, Problem with MAKEFILE"
What problem exactly?
What command lines did you use when trying to compile?
What is the output of the commands?

The command lines in the attached makefile lack the required tabulator characters.
Thex need to start with a tab character (as all command lines for a make rule do).  
See the code snippet.

mrxas.o: mrxas.asm
mrxscan.o: mrxscan.c
MRXSCAN=mrxscan.o mrxas.o
mrxscan: mrxscan.exe
	@echo mrxscan made
mrxscan.exe: $(MRXSCAN)
	ln $(MRXSCAN) -lc

Open in new window

Avatar of demonic_from_hell
demonic_from_hell

ASKER

ok, without the tabs:

F:\MICROV~1\MRXSCA~1>make
MAKE  Version 2.0   Copyright (c) 1987, 1988 Borland International
Error makefile 6: Redefinition of target 'mrxscan'
Error makefile 6: Command syntax error
Error makefile 7: Redefinition of target 'mrxscan.o'
Error makefile 7: Redefinition of target 'mrxas.o'
Error makefile 7: Command syntax error

Available memory 587313 bytes

*** 5 errors in compile ***


I have taken the makefile that you had modified, ok. no problem, but was no output file. nothings have been created.


That's the problem.


Compiled using
Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.
"make mrxscan" is what you really want, I assume.
To make this the default, you can add "default: mrxscan" as the first line,
or move the definition of rule "mrxscan" to the top.

Without arguments, the default make target is the first one in the makefile, in this case mrxas.o .
Make should at least have tried to create mrxas.o .  Are you sure it's not there?

If it's not there, it may be that Make does not find your compiler or assembler
(But this should be evident in some error messages).
Make has built-in rules that tell it what to do to satisfy rules such as

mrxas.o: mrxas.asm
mrxscan.o: mrxscan.c

For the .o.c rule, Make probably looks for a program called cc.
See your Make documentation for an option that tells Make to explain what it is trying to do and why.
See if you can invoke the compiler manually.

What command does this output come from?:

  Compiled using
  Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.
Dear sonstkeiner,

Added as what you told, and now this is the error:

C:\AZ8652A\SAMPLES\MRXScanner>make
MAKE  Version 2.0   Copyright (c) 1987, 1988 Borland International

Available memory 587367 bytes

        ln mrxscan.o mrxas.o -lc
Aztec C86 Linker v5.2a 8-6-92 (C) 1982-1992 by Manx Software Systems, Inc.
file: mrxscan.o Can't open.

** error 10 ** deleting mrxscan.exe

default: mrxscan
mrxas.o: mrxas.asm
mrxscan.o: mrxscan.c
MRXSCAN=mrxscan.o mrxas.o
mrxscan: mrxscan.exe
	@echo mrxscan made
mrxscan.exe: $(MRXSCAN)
	ln $(MRXSCAN) -lc

Open in new window

Please answer all questions, even if the answer may seem obvious to you.

Repeat: [...] mrxas.o .  Are you sure it's not there?

Could it be that your object files are not suffixed with ".o" but with something else?

Repeat: What command does this output come from?:

  Compiled using
  Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.

I assume it is from your first call to make, when "mrxas.o: mrxas.asm" was the first line.
(The line merely states a dependency relation).
That make invocation should have printed the command that it used to invoke the compiler.
What was it?
To recreate the output, start over.
Remove the object files and call make again.

Your problem statement says that you have a problem with your makefile.
Now, your makefile looks OK by itself.  
Make does what you and its default configuration told it to.
The default make config may not be what you need, though.
You need to first figure out what you need.

Did you try to invoke the compiler manually (without using make)?
Repeat: [...] mrxas.o .  Are you sure it's not there?

>>> Yes, no file was created, at all.

Could it be that your object files are not suffixed with ".o" but with something else?

>>> After I invoked the command, no files was created in the same folder.

Repeat: What command does this output come from?:

  Compiled using
  Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.
 
>>> i invoked   c:\>cc

I assume it is from your first call to make, when "mrxas.o: mrxas.asm" was the first line.
(The line merely states a dependency relation).
That make invocation should have printed the command that it used to invoke the compiler.
What was it?
To recreate the output, start over.
Remove the object files and call make again.

>>> Shown on screen:   ln mrxscan.o mrxas.o -lc

Full screen:

C:\AZ8652A\SAMPLES\MRXSCA~1>make
MAKE  Version 2.0   Copyright (c) 1987, 1988 Borland International

Available memory 587367 bytes

        ln mrxscan.o mrxas.o -lc
Aztec C86 Linker v5.2a 8-6-92 (C) 1982-1992 by Manx Software Systems, Inc.
file: mrxscan.o Can't open.

** error 10 ** deleting mrxscan.exe




Your problem statement says that you have a problem with your makefile.
Now, your makefile looks OK by itself.  
Make does what you and its default configuration told it to.
The default make config may not be what you need, though.
You need to first figure out what you need.

Did you try to invoke the compiler manually (without using make)?

Ok, just did, let see the result:
(oh, god!)

C:\AZ8652A\SAMPLES\MRXSCA~1>cc mrxas.asm
Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.
codeseg segment word public
               ^
mrxas.asm:1: ERROR 7: bad declaration syntax:
dataseg segment byte public
               ^
mrxas.asm:2: ERROR 7: bad declaration syntax:
assume cs:codeseg,ds:dataseg,es:dataseg,ss:dataseg
         ^
mrxas.asm:3: ERROR 7: bad declaration syntax:
dataseg ends
            ^
mrxas.asm:4: ERROR 7: bad declaration syntax:
                        public  getfirst_
                                         ^
mrxas.asm:6: ERROR 7: bad declaration syntax:
Do you wish to continue?



C:\AZ8652A\SAMPLES\MRXSCA~1>cc mrxscan.c
Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.
#include <libc.h>
                 ^
mrxscan.c:10: ERROR 47: open failure on include file:



It seems that problem with the file itself.
>>> Shown on screen:   ln mrxscan.o mrxas.o -lc

No. I saw that, but that line is for the mrxscan.exe rule.
I was asking for the output from the mrxas.o rule.
If your removed any object files (there were none anyway, I understand)
and call "make mrxas.o", what is the output?

> cc mrxas.asm
That cc tries to interpret the assembler code as C code. :-)
You need to give it the right option to tell it to work as an assembler.
The assembler may not even be reachable by calling cc, its executable probably has a different name.
See the compiler documentation.

> #include <libc.h>
For standard ISO/ANSI C compilers that would be #include <stdlib.h>.
Looks like you have a really ancient program here, written in K&R (Kernighan and Richie) style.

The mrxscan.c file header states that the program was written in 2006.
That is hard to believe given the archaic style that is written in.
If you took the code from a book, state that in the file header instead,
together with an appropriate license.

In general:

o You apparently have little experience using make (or writing or compiling code).
  Start with an easier program than this one ("Hello World"), then work your way up.

o Consider looking for someone to help you at your location.
  You could benefit greatly from talking to someone who knows how to program in C.

o Are you sure you want to play information archeologist and resurrect a program that old? ;-)

o To really learn how to use make, read a tutorial or the GNU Make manpage.

o Consider installing Cygwin and try to compile using the GNU tool set (make, gcc).
Dear sonstkeiner,

i was able to construct mrxas.asm (invoking Aztec Assembler)

but still facing difficulties with mrxscan.c (replaced to stdlib.h and it worked!), still have lot of errors.

the header was for local references only, i have to make it as simple as i can. references to original code, i had put in the report that i had to submit earlier (removed to save time to scroll down).

my purpose of doing this is to prove that the old system works, thus it can be modified into working model to fit current operating system.

the original code was taken from Computer Viruses And Anti-virus Warfare (Jan Hruska, Second Edition, July 1992). he mentioned of Manx Aztec, got the compiler but still facing problem.

o i dont have experience with MAKE, learn to use Borland without MAKE, and VC++ without make too.
o i've been looking for help in my university and (ok you can laugh) none knows of this old C.
o not playing archeologist, but it has been a must for me to troubleshoot and submit a report on it.
o i will grab more info on MAKE, i promise u i will
o GCC, can the code work with it? will be tested.

i feel like crazy already... duh!!! as u can see, i still have lot of thing to learn.

i appreciate if u can help.

thanks!
ASKER CERTIFIED SOLUTION
Avatar of sonstkeiner
sonstkeiner
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A few more comments:

o If this is a modified version of the 1992 program,
  and you have the original 1992 program available, consider starting again from there.
  First get the original to work as expected before you try to modify it.
  Then apply one change after the other, making sure it works after each step.

o The program looks as if written for MS DOS (or a look-alike).
 You may need help from someone with experience in building
 and running MS-DOS programs on modern OSs.

o For the program to work, you will need to link against some OS-Specific library.
  This is evident from calls to several undeclared functions, such as for example "currentdisk()".

o You are supposed to write a report on this?
  Maybe the purpose of the assignment is for you to find out whether it makes sense
  to resurrect this program.

Note that it took several hours to help you.  
Help someone else next time you have the chance.
Dear sonstkeiner,

Thank you so much that you spend sometime to help me on this.

It was rather difficult to figure what was the problem with the MAKEFILE.

The code was not a modified version, but have been re-type from printed book, hence it might have errors. I try not to make changes, and supposed not to make changes at all.

Yes, it was written for MS-DOS environment. That is why i need to resurrect the program, so it can works and tested it onto MS-DOS (that related to that particular year). Please dont laugh, however big and resourceful my university is, those lecturers are almost new and i am have been trying to look for help for no avail. (Luckily, I have u here!)

currentdisk() and some disk related functions are in the asm file. i was able to compile the asm to o object - so today, i shall spend few more hours fixing the errors that might came from typo.

the purpose of the assignment is that i need to prove that the old model as given by author are perfectly working and discuss the methodology used to search for virus (string compare) and how the writer keep virus string (signature). at the end i have to come up with solutions in VB or VC++ (windows program) to demonstrate that virus signature-based program can be implemented and the result will be used to enhance and create a faster searching algorithm. (pattern-matching, i dont like graphic, therefore i chose to do the virus searching)

I am very much appreciated that you are here to help me, and sure, am looking forward to help however possible i can do.
You really typed this in?  It is hard to believe.  However, the errors look just like typos, true.

It is ridiculous to want to get this program to run, especially when you had to type it in.
Why don't you just rewrite the program from scratch?

Following the example in c/AZ8652A/SAMPLES/TEXTVU/MAKEFILE, I further modified the makefile,
see the copy below.
This got the compiler to at least try to do its work.

Which assembler command did you use to build mrxas.o?

The linker now stops with this:

ERROR: Undefined symbol: agetc_

Did you mean to type "fgetc" or "getc"?

---
Transcript:

C:\mrxscan>make mrxscan
MAKE  Version 2.0   Copyright (c) 1987, 1988 Borland International

Available memory 578810 bytes

        as mrxas.asm
Aztec C86 Assembler v5.2a 10-6-92 (C) 1982-1992 by Manx Software Systems, Inc.
        copy C:\AZ8652A\BIN\CGEN.EXE .
        1 file(s) copied
        copy C:\AZ8652A\BIN\AS.EXE .
        1 file(s) copied
        cc  -c mrxscan.c
Aztec C86 Pass1 v5.2a 11-17-92 (C) 1982-1992 by Manx Software Systems, Inc.
Aztec C86 Pass2 v5.2a 10-26-92 (C) 1982-1992 by Manx Software Systems, Inc.
Aztec C86 Assembler v5.2a 10-6-92 (C) 1982-1992 by Manx Software Systems, Inc.
        del CGEN.EXE
        del AS.EXE
        ln mrxas.o mrxscan.o -lc
Aztec C86 Linker v5.2a 8-6-92 (C) 1982-1992 by Manx Software Systems, Inc.
ERROR: Undefined symbol: agetc_
Code: 2300  FarData: 0000  Data: 07ba  Udata: 3344  Total: 005dfe

** error 1 ** deleting mrxscan.exe

default: mrxscan
mrxas.o: mrxas.asm Makefile
	as mrxas.asm
mrxscan.o: mrxscan.c Makefile
	copy $(CBIN)CGEN.EXE .
	copy $(CBIN)AS.EXE .
	cc $(C_FLAGS) -c mrxscan.c
	del CGEN.EXE
	del AS.EXE
 
MRXSCAN=mrxas.o mrxscan.o
mrxscan: mrxscan.exe
	@echo mrxscan made
mrxscan.exe: $(MRXSCAN)
	ln $(MRXSCAN) -lc
 
clean:
	del mrxas.o
	del mrxscan.o
	del mrxscan.exe

Open in new window

Line 11 should have been: MRXSCAN=mrxscan.o mrxas.o
The other way around builds a MRXAS.EXE :-)
Do you have a MRXCODE.PAT file?
Yes, i have to type all those characters in... Sounds crazy, but being student - i dont know if i have other choice.

compiled the assembly file using the AS.EXE provided in the BIN folder.

I have checked, the agetc(infp), it was the same in the book. u have any idea?

i attached here, the pattern code - i have not work on this yet, so many pages to type in (numbers and texts that dont have sound)

does this mean that you had accomplished it? man, you rock!
MRXCODE.PAT.txt
> being student - i dont know if i have other choice.

One choice might be to ask the book's author whether he has an electronic copy of the code and data.  Don't be shy, most authors will be delighted that you bother with such an old book of theirs.

> I have checked, the agetc(infp), it was the same in the book. u have any idea?

A coworker pointed me me to:
http://apple2.org.za/gswv/a2zine/Docs/AztecC_minimanual.txt
In section 4.2.1 Standard I/0:

agetc       (stream)                    ASCII version of getc
fgetc       (stream)                    gets a single character from stream
getc        (stream)                    gets a single character from stream

Not the exact same compiler, but close enough for my taste.
Looks like agetc can safely be replaced by fgetc.

Instead of another error-prone typing session, try to find a similar pattern file elsewhere.
Maybe the Clam AV project has such patterns that you can convert to the needed format.

I'm still not convinced that your whole project is a good idea.  Did your instructor require you to work on exactly this program from this book?
Jan Hruska - the author, he has a website in Chezh. I'll try to bother him soon.

For my proposed project, I will deliver an old program as mentioned in the book (and emulate it in DOS). I shall write an extensive report of the finding from the old program and find any issues related to viruses technology in its dearly age. Based on the report, I will write a second report discussing the evolving technology known on detecting virus (and it sorts) and how to evaluate its processes. I will then need to come will full schema of how REAL antivirus works and technology that is behind it. So, I shall have to discuss Boyer Moore Algorithms, Carrosack and lot other. My final report will be developing (by enhancing) one chosen algorithm to do a "search (exact or near exact pattern matching)" that can demonstrate how antivirus works and how I have extended the algorithm mathematically. I shall compose my final project in C# or VB.net or VB 6 or VC++ 6 with capability to show that pattern matching (exact or near exact) can be enhanced and developed with few smart-searchings which its methodology will try to cover the core of antivirus functions. (I hope this is brief enough, Mathematical Modeling, Universiti Sains Malaysia)

Therefore it is important for me to be able to compile the code into working exe so i can prepare emulator to work on for my report.

If you do have solutions on turning those codes into exe, i badly need ur help, so i can study and write report immediately and study available algorithms mathematically.

Thanks!
> Jan Hruska - the author, he has a website in Chezh.
Be careful to contact the right Jan Hruska. Consider looking on the Sophos site.

You did not answer my question:
> Did your instructor require you to work on exactly this program from this book?

I already told you that you need to get the program to compile and run on your own.
This is your project and you need to learn how to solve such problems.
It is not that hard, really.

Let GCC help you find the errors, if AztecCs messages don't help you.
> Did your instructor require you to work on exactly this program from this book?

My instructor (supervisor) requires me to find a working a model on what i shall compose for final project. I decided to choose this code, and she agreed as long as i can demonstrate a working exe to which she would not be able to assist, she doesnt do dealt with MS-DOS and C. Mostly with C++/Matlab/Mathamematica/SPSS and the sort.

Finding this simple program that i can demonstrate and shows it flows and logic will save a lot of my research to kick-off.

I know that i need to learn and all that, but if i can save some time already and do the real work, it would be better.

(downloading GCC as we are speaking) but still hope that you can share the debug/edited C code.

Thanks sonstkeiner (you shed some light already)
Repeat: You need to learn how to do it yourself.  

> if i can save some time already and do the real work

For you, "the real work" is learning.
The only way to really learn is by doing.

To be able to do research in computer science, you need to be able to code.
Your research need not consist of coding, but you need to be able to do it.

So go and get this baby to compile and run.
downloading GCC now, and will compile and look at the problem, will try to solve, should i have more problem, shall come back to this thread and looking for you, give me around 2 hours to solve, or i shall post in the morning around 9 am. Now it is 12.15 in the morning, and shall need energy for tomorrow too.

thanks...
Again, why did you choose that old program?

> My instructor (supervisor) requires me to find a working a model

But she did not require you to find an *old* model, did she?

> on what i shall compose for final project.

Do you mean "on which I shall build the final project"?

If your goal is just to build on some existing virus checker, you might as well start with a modern open source one.  That way there will be a community that has an interest in common with you - to further develop the checker.
> But she did not require you to find an *old* model, did she?

She did not suggest so, but either i be creative to use simple thing to work on, or go for big project with harder and longer code to understand (like CLAM AV). Besides, solving this pieces of code, already made me crazy, and i like it that it helped me learn something (in useful way).

> Do you mean "on which I shall build the final project"?

Sorry for the grammar :-)

> If your goal is just to build on some existing virus checker, you might as well start with a modern open source one.  That way there will be a community that has an interest in common with you - to further develop the checker.

My goal is to find pattern-matching algorithm that i can enhance and extend it usage. To show its useful usage, would be no other way, but the industry-work way. Pattern-matching can be used for many purposes, detecting fish species based on captured image; search engine (using near exact match); or the one i chose: searching for virus pattern.

Yes, you are correct, better start with current existing open source, but it will take time for me to really understand the process of the program, while all i need is a basic set of instructions available in the code i found in Jan Hruska's book.
ok... i got common error now... so need ur help to understand.

here's the errors:

C:\AZ8652A\SAMPLES\MRXSCA~1>gcc mrxscan.c

mrxscan.c:83: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'contains_no_pattern'
mrxscan.c:94: error: conflicting types for 'malloc'

mrxscan.c: In function 'main':
mrxscan.c:103: warning: incompatible implicit declaration of built-in function 'printf'

mrxscan.c: In function 'nonrecursive_search_files':
mrxscan.c:148: warning: incompatible implicit declaration of built-in function 'strcpy'
mrxscan.c:150: warning: incompatible implicit declaration of built-in function 'strlen'

mrxscan.c: In function 'recursive_search_files':
mrxscan.c:167: warning: incompatible implicit declaration of built-in function 'strcpy'
mrxscan.c: In function 'do_path':
mrxscan.c:182: warning: incompatible implicit declaration of built-in function 'strcpy'
mrxscan.c:183: warning: incompatible implicit declaration of built-in function 'strlen'

mrxscan.c: In function 'add_dir_to_list':
mrxscan.c:220: warning: incompatible implicit declaration of built-in function 'strlen'
mrxscan.c:221: warning: incompatible implicit declaration of built-in function 'strcpy'

mrxscan.c: In function 'complete_search_buff':
mrxscan.c:284: error: 'struct patt' has no member named 'pattern'
mrxscan.c:288: error: 'struct patt' has no member named 'pattern'

mrxscan.c: In function 'complete_search_file':
mrxscan.c:333: error: 'struct patt' has no member named 'pattern'

mrxscan.c: In function 'find_dir':
mrxscan.c:370: warning: incompatible implicit declaration of built-in function 'strcpy'

mrxscan.c: In function 'read_patterns':
mrxscan.c:384: error: 'FILE' undeclared (first use in this function)
mrxscan.c:384: error: (Each undeclared identifier is reported only once
mrxscan.c:384: error: for each function it appears in.)
mrxscan.c:384: error: 'infp' undeclared (first use in this function)

mrxscan.c: In function 'convert_to_pattern':
mrxscan.c:420: warning: incompatible implicit declaration of built-in function 'sprintf'

mrxscan.c: In function 'convert_string_to_pattern':
mrxscan.c:448: error: 'struct patt' has no member named 'pattern'
mrxscan.c:454: error: 'struct patt' has no member named 'pattern'
mrxscan.c:472: error: 'struct patt' has no member named 'pattern'

mrxscan.c: In function 'fmaxgets':
mrxscan.c:518: error: expected declaration specifiers before 'FILE'

mrxscan.c: In function 'main':
mrxscan.c:537: error: 's' undeclared (first use in this function)
mrxscan.c:538: error: expected ';' before 'char'
mrxscan.c:560: error: expected declaration or statement at end of input
mrxscan.c:560: error: expected declaration or statement at end of input


My problem:
1. malloc
2. FILE
3. 'struct patt' has no member named 'pattern'   <--- check the struct, it seems correct already.


hope you can give some useful comment to solve this.
i attached the code file i had edited.
mrxscan.c.txt
this one:

3. 'struct patt' has no member named 'pattern

SOLVED.
Again, i hv updated, and solved more errors (im so happy! thanks to you)

new errors:

C:\AZ8652A\SAMPLES\MRXSCA~1>gcc mrxscan.c
mrxscan.c:92: error: conflicting types for 'malloc'
mrxscan.c: In function 'main':
mrxscan.c:101: warning: incompatible implicit declaration of built-in function 'printf'

mrxscan.c: In function 'nonrecursive_search_files':
mrxscan.c:146: warning: incompatible implicit declaration of built-in function 'strcpy'
mrxscan.c:148: warning: incompatible implicit declaration of built-in function 'strlen'

mrxscan.c: In function 'recursive_search_files':
mrxscan.c:165: warning: incompatible implicit declaration of built-in function 'strcpy'

mrxscan.c: In function 'do_path':
mrxscan.c:180: warning: incompatible implicit declaration of built-in function 'strcpy'
mrxscan.c:181: warning: incompatible implicit declaration of built-in function 'strlen'

mrxscan.c: In function 'add_dir_to_list':
mrxscan.c:218: warning: incompatible implicit declaration of built-in function 'strlen'
mrxscan.c:219: warning: incompatible implicit declaration of built-in function 'strcpy'

mrxscan.c: In function 'find_dir':
mrxscan.c:368: warning: incompatible implicit declaration of built-in function 'strcpy'

mrxscan.c: In function 'read_patterns':
mrxscan.c:382: error: 'FILE' undeclared (first use in this function)
mrxscan.c:382: error: (Each undeclared identifier is reported only once
mrxscan.c:382: error: for each function it appears in.)
mrxscan.c:382: error: 'infp' undeclared (first use in this function)

mrxscan.c: In function 'convert_to_pattern':
mrxscan.c:418: warning: incompatible implicit declaration of built-in function 'sprintf'

mrxscan.c: In function 'fmaxgets':
mrxscan.c:516: error: expected declaration specifiers before 'FILE'

mrxscan.c: In function 'main':
mrxscan.c:537: error: 's' undeclared (first use in this function)
mrxscan.c:538: error: expected ';' before 'char'
mrxscan.c:560: error: expected declaration or statement at end of input
mrxscan.c:560: error: expected declaration or statement at end of input


solved/updated code below.
mrxscan.c.txt
See? Finding the errors yourself makes you happy. :-)

Try gcc -Wall. That should warn you about more things that are missing.
Hint: You've rightfully added <stdlib.h>.  Why?  Extrapolate.

You have not fixed at least one of the errors in the list I gave.
(Note that the error that I mentioned as "missing struct declaration" was actually a different one, I found the struct later, the reference to it had the wrong name.  And you've already fixed that one.)
In addition, "missing return types" is missing from my list.
mrxscan actually works on Windows XP.  No need to run it in an emulator.
Given a suitable bait, it detects all four virus signatures.

Now that's interesting.  
My usual virus scanner reports three of the bait files as infected, but not the fourth.
Regarding testing:
In its default configuration, my usual virus scanner only detects the signatures when the bait files have a virus-prone suffix like ".COM".  To make it actually scan the .VIR files I created, I had to change its config.

My virus scanner claims that it recognizes 8-TUNES as well, but apparently it looks for a different signature.
ok, i have been looking at everything, but i still do not how to solve this.

mrxscan.c:94: error: conflicting types for 'malloc'

mrxscan.c: In function 'main':
mrxscan.c:562: error: expected declaration or statement at end of input
mrxscan.c:562: error: expected declaration or statement at end of input



For FILE problem, i added stdio.h - so that one solved.

Can i just remove this line?

char *malloc();

----

>  missing semicolon (several),
looked and fixed

>opening instead of closing brace (!),
looked and fixed

>extraneous closing parenthesis,

>missing closing parenthesis (several),

>missing logical operator,
>missing opening brace,

>wrong variable name (several),
fixed

>missing struct declaration,
>missing variable, function and parameter declarations (tons),
 "((" instead of "==" (that's a good one, sticky keyboard? :-),

>typo in keyword,
fixed.
>Can i just remove this line? char *malloc();
Good idea.  Try it. :-)  If it solves the problem, why?

Did you solve these?  How?:
> mrxscan.c:101: warning: incompatible implicit declaration of built-in function 'strcpy'

You've caught a mistake in my list of errors ("==" instead of "<").
Thankfully you can compare with the book. ;-)

In your above list, you wrote "looked [found] and fixed" after only some lines.
Does this mean that you fixed only those lines?  
Apparently not, since you have also fixed some of the other ones.
It would be much easier to see which problems you already solved and how, if you attached the new version.
i check some site on the net, it seems that the malloc doed need not to be declared before usage. So, i decided to remove it. And no warning when compiled by GCC.

Line 283, < instead of <=

This is new errors i got:

mrxscan.c: In function 'main':
mrxscan.c:539: error: 's' undeclared (first use in this function)
mrxscan.c:539: error: (Each undeclared identifier is reported only once
mrxscan.c:539: error: for each function it appears in.)
mrxscan.c:540: error: expected ';' before 'char'
mrxscan.c:562: error: expected declaration or statement at end of input
mrxscan.c:562: error: expected declaration or statement at end of input

i try to look and compare line-by-line, hopefully no more typo.
mrxscan.c.txt
You are making progress, good.
However, you need to be more thorough.

Again, you did not answer some of my questions.  
Sometimes I am posing a question, not because I do not know the answer,
but because I want you to think about it.
It takes time for me to think up a question and write it down.
Please answer them.

> it seems that the malloc doed need not to be declared before usage.
Nope. You should declare all functions before usage, including malloc, strcpy, etc.
Some compilers may let you get away with not declaring certain built-in functions,
but "gcc -Wall" will not (maybe not even plain "gcc").

> So, i decided to remove it.
You did not remove it, you disabled it.
The way you did that with a C++-style comment works with GCC, but Aztec will croak.

> And no warning when compiled by GCC.
That means that it *did* find a declaration.
Hint: What is the effect of "#include <xyz.h>"?

Repeat: Did you solve these?  How?:
> mrxscan.c:101: warning: incompatible implicit declaration of built-in function 'strcpy'

Do not make change unnecessary changes such as introducing whitespace, until the program works.
This makes it easier to see the important differences between different file versions.

> Line 283, < instead of <=
Surprisingly, that mistake did not keep the program from working. :-)

>>opening instead of closing brace (!),
>looked and fixed
Where did you fix that?

Also, it seems that you do not use the -Wall option.
ok,

>Repeat: Did you solve these?  How?:
>> mrxscan.c:101: warning: incompatible implicit declaration of built-in function 'strcpy

i used #include <string.h>
no more warning for that.

>>>opening instead of closing brace (!),
>>looked and fixed
>Where did you fix that?

i found it!!!! Line 111, in the function main()
fixed!

NO MORE ERRORS, just WARNINGS, working on it now... (but still cant figure out about malloc)


F:\MRXSCA~1>gcc -Wall mrxscan.c
mrxscan.c:101: warning: return type defaults to 'int'
mrxscan.c: In function 'nonrecursive_search_files':
mrxscan.c:157: warning: implicit declaration of function 'getfirst'
mrxscan.c:159: warning: implicit declaration of function 'getnext'
mrxscan.c: In function 'recursive_search_files':
mrxscan.c:176: warning: implicit declaration of function 'find_dir'
mrxscan.c: In function 'add_dir_to_list':
mrxscan.c:222: warning: suggest parentheses around assignment used as truth value
mrxscan.c:224: warning: suggest parentheses around assignment used as truth value
mrxscan.c: In function 'search_dos_boot_sector':
mrxscan.c:240: warning: implicit declaration of function 'currentdisk'
mrxscan.c:241: warning: implicit declaration of function 'bytesfree'
mrxscan.c: In function 'complete_search_file':
mrxscan.c:325: warning: implicit declaration of function 'read'
mrxscan.c:350: warning: format '%061x' expects type 'unsigned int', but argument 4 has type 'long int'
mrxscan.c:363: warning: implicit declaration of function 'close'
mrxscan.c: In function 'read_patterns':
mrxscan.c:394: warning: implicit declaration of function 'fmaxgets'
mrxscan.c:403: warning: implicit declaration of function 'contains_no_pattern'
mrxscan.c:404: warning: implicit declaration of function 'convert_to_pattern'
mrxscan.c: In function 'convert_to_pattern':
mrxscan.c:436: warning: implicit declaration of function 'convert_string_to_pattern'
mrxscan.c: In function 'fmaxgets':
mrxscan.c:528: warning: suggest parentheses around assignment used as truth value
mrxscan.c:541: warning: control reaches end of non-void function
mrxscan.c: At top level:
mrxscan.c:545: warning: return type defaults to 'int'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x3fb): undefined reference to `_getfirst'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x443): undefined reference to `_getnext'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x560): undefined reference to `_getfirst'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x641): undefined reference to `_getnext'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x6b4): undefined reference to `_getfirst'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x73f): undefined reference to `_getnext'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x8b2): undefined reference to `_currentdisk'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x8c5): undefined reference to `_bytesfree'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0x8f6): undefined reference to `_absread'
c:/djgpp/tmp/ccoYm8nM.o:mrxscan.c:(.text+0xa12): undefined reference to `_lowdiskread'
collect2: ld returned 1 exit status

do i need to declare prototype for each functions?
>>>>opening instead of closing brace (!),
>>>looked and fixed
>>Where did you fix that?
>i found it!!!! Line 111, in the function main()
Good.  What did you mean by "looked and fixed", above?

You missed a question. What is the effect of ...?

> do i need to declare prototype for each functions?
This question has already been answered above. Try it.

Another way to get rid of the warnings is to reorder the function definitions,
such that each definition is before its first use.
Essentially you might have to reverse the order of definitions.
In my programs, main() always comes last.

However, if you change the definition order,
you can no longer sensibly compare your program with the original.
Providing a bunch of prototypes at the beginning of the file is much less intrusive,
and keeps the difference between your new program and the original small.
It also allows you to easily move the declarations to a new header file.
At this point, you could try if AztecC already compiles it.

But keep going until "gcc -Wall -Wextra" is silent.
Yet another thought:
Next time, post a question like this under Programming -> Languages -> C.
"Algorithms" is for discussing algorithms independently of the programming language.
i have successfully compiled under Aztec C,

i got three distinct results:

1. mrxas (without any argument), it scans haywire.

2. mrax f:\test\ (argument is a path)

just got this result:

F:\MRXSCA~1>mrxas f:\test\
Searching for 10 patterns.
1 bytes searched.
No virus patterns discovered.

which is supposed to come with few result, since the same files contain the same string were in it.

3. Argument supplied with file name. Succeeded, but still need to know why the long address.
F:\MRXSCA~1>mrxas testworm.exe
Searching for 10 patterns.
Checking TESTWORM.EXE
Virus REVOLKID found in the file TESTWORM.EXE starting at the addres 00000000000
00000000000000000000000000000000000000000000000d4f
53418 bytes searched.
1 virus pattern(s) discovered.

Probably we can make discussion here of, what is happening.

Thanks
Finally you've got it working.  How do you feel?

> Probably we can make discussion here of, what is happening.
You mean the above wasn't a discussion?  You've got to be joking. :-)

> 1. mrxas (without any argument), it scans haywire.
What do you mean by "haywire"?  
To me, that word means "unpredictable", "follow a chaotic path".
Look at the code to see what the program should do without an argument.
You will see what it is trying to do.

Above I told you to swap the order of files in the make variable MRXSCAN.
Remake and you should get mrxscan.exe.

> 2. mrax f:\test\ (argument is a path)
Look at the code to see what the program does when you pass an argument.
Whether the program expects or accepts or scans directories, I have no idea.

> which is supposed to come with few result, since the same files contain the same string were in it.

The pattern file contains an encoding of the patterns, not the patterns themselves.
This has several advantages.  
One of them is that otherwise the virus scanner might detect its own pattern file as infected.
OK, in this case the pattern file name is hard-coded, so the scanner could try to avoid scanning it.
But that would be cheating. ;-)  And it would not work in many cases.
Look at the code to see how the patterns are decoded.

3. Look at the code that formats the address.  
I haven't, and don't really care about the leading zeros.
 
Apparently, you have more test patterns now.
Did you type them in or did you find something else?
ok sonstkeiner,

how about you give me some time to re-do this work, i'll try to print the code and find out what the problem really was, i'll write a brief report for the post- (or tested) exe. That what i mean, and I so so much appreciated that we discuss the development (or to be correct, correcting bugs and learning from my stupidity :-) I really am.

I am very much relieved and i am very HAPPY! For i can have a good night knowing that i can start writing off the report and start the real study for Boyer Moore (or any other algorithm i decided later).

Below is result from invoking the program without any argument. invoking through this command:

F:\MRXSCA~1>mrxas > haywire.txt

What i mean by haywire is that, i do not know what the program does and it seems doing something it supposed not. I have to press CTRL C to stop the process. (Means that, i have to print the code, and study the scope and draw what is happening, got to correct that before my supervisor put her hand testing the system herself).

I think it is not cheating that pattern file is hard coded, you see that the pattern is in HEX, and when read into array, it is turn into binary - therefore, the scanner wont fooled itself and find any virus should it scan it own pattern file.

For the pattern file, i have reference of known virus until June 1992, like 64 pages long with some details of what it does. Still need to wait to type ALL the hex into the pattern, and hopefully without errors, so i just do part by part, like 2 or 3 by half an hour.

since you had helped me, i wish to give you credit in my report (to which you really, yes really! deserved it for spending fews days and burnt your calories and some brain cells to help me out), u can send some short detail to my email ofpgrid @ gmail . com

i hope you dont mind, i will print the code first and study the problem (warnings, and post-compiled errors - runtime errors) and i shall get back here asap.

you had really helped me, and i thank you so much for that!
haywire.txt
> HAPPY!
Great :^)

> haywire.txt
When I invoke it with no argument, it seems to do something reasonable.
Yes, it went "all over the disk", but purposefully.  Just like in your log.

> I think it is not cheating that pattern file is hard coded
I meant the file name "MRXCODE.PAT" - that is hard-coded in mrxscan.c.  
If the scanner avoided all files with that name, that would be "cheating".

Typing in 64 pages of hex?  Now that would cost some brain cells :-).
Can't you transform Clam AV signatures to the format that you need?

Notify me here when your report is done, I would be interested to have a look at it.
can i hv ur email, so i can send the not-so-lengthy report to you.