Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 15th, 2006, 2:50 AM   #1
khanshan
Newbie
 
Join Date: May 2006
Posts: 5
Rep Power: 0 khanshan is on a distinguished road
PLZZ HELP me...

hi. i need help...i wish someone could help me... we have an assignment about file manuplation... I have no idea about it..
We have to implement "make" utility..

Here is my question..
Is there any function that you can find the date of a file when it is updated last?

I mean you ll give "a.o" file to that function and it will return a time value or sth about time...

I m waiting for your helps..

(Here my assignment)

1) Using C, implement a slimmed-down version of the make utility
Your implementation should
* enable its users to enter rules stating the dependencies found in the current project.
* display not only the actions that are taken- that is, the commands that are executed- but also those that have been skipped. In other words, if an action is not taken for some reason- say, for instance, the target file is older than all of the prerequisite files- you are required to inform the user of the utility about this.
* let its users define environment variables. Such variables start with '$' and can contain alphanumeric characters, underscore, and the dollar sign. Variables starting with “$$” are reserved for predefined environment variables. These include $$0 for the target file name, $$1 thru $$9 for the prerequisite file names. For the following rule; $$0 is a.exe, $$1 is b.o, $$2 is c.o, and so on.
a.exe : b.o c.o d.o ...
gcc -o $$0 $$
Redefining a variable or attempting to use an undefined one results in aborting the parse of the make file.
* give users of the utility a chance to insert single-line comments that start with '#'. Anything to the right of this character should be ignored by the utility.
* consider the possibility of failure of an action.

It is sufficient to start processing from the default rule, which is the first rule from the top of your file. Using a command line argument to change this is not required but will be considered as an extra and be duly awarded.

You are not supposed to check the syntactic correctness of the action to be taken. In case such an error may occur, however, you are expected to relay it to the user in a
reasonable way.
khanshan is offline   Reply With Quote
Old May 15th, 2006, 3:13 AM   #2
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 873
Rep Power: 4 The Dark is on a distinguished road
The function you are looking for is called stat
The Dark is offline   Reply With Quote
Old May 15th, 2006, 3:25 AM   #3
khanshan
Newbie
 
Join Date: May 2006
Posts: 5
Rep Power: 0 khanshan is on a distinguished road
thnx so much... mr The Dark...

wht do you think about assignment.. Is it hard or normal...
In the program there will me "makefile" file... Rule file... And i will make implementation on it... like this

**********************
RNGMod_Test.exe : RNGMod.o RNGMod_Test.c
gcc -o $@ RNGMod.o RNGMod_Test.c

RNGMod.o : RNGMod.c RNGMod.h
gcc -c RNGMod.c
**********************

Look this is a simple makefile... You know there would be so many rules... I think to hold them in a multi linked list.Wht you suggest another storage type...
khanshan is offline   Reply With Quote
Old May 15th, 2006, 4:53 AM   #4
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 873
Rep Power: 4 The Dark is on a distinguished road
I'm not sure whether this is hard or not - it depends on your level of experience. It does look like a fair amount of work.

A linked list of rules sounds like a good start. It might be better to break down the project into a few steps
- read the file into the linked list (and ignore comments)
- run through looking for rules that need to be run
- work out how to check the dependencies
- add in the variable handling

Also note in your example make file, you need to use $$0 instead of $@ to match the variable names given in the assignment.
The Dark is offline   Reply With Quote
Old May 16th, 2006, 4:22 AM   #5
khanshan
Newbie
 
Join Date: May 2006
Posts: 5
Rep Power: 0 khanshan is on a distinguished road
yes. i think there is two part in problem... list implementation and parsing...

i started parsing the file...

Is there anyone who has sample list implementation ..
creation listing iterating... No complicated list.. A simple list is enough

and can (s)he share it with me??
khanshan is offline   Reply With Quote
Old May 16th, 2006, 4:51 AM   #6
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 873
Rep Power: 4 The Dark is on a distinguished road
Do a google search for
c linked list sample

60 million pages, most of the ones on the first page seem to be pretty good, espacially this one and this one
The Dark is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC