![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 5
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 873
Rep Power: 4
![]() |
The function you are looking for is called stat
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: May 2006
Posts: 5
Rep Power: 0
![]() |
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... |
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 873
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#5 |
|
Newbie
Join Date: May 2006
Posts: 5
Rep Power: 0
![]() |
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?? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|