classifiedsdirectory you are asked to create.
ads'' directory currently exist and what files are in those subdirectories. For this homework, you will extend the functionality of the scripts you created for Homework 1, so that a user on the Web can post new advertisements to the system.
When the user selects the ``POST''
option from the main classifieds menu, a form that looks like
this should be displayed. (Ask your Web browser to save the HTML source
of this form to a file for your own use.)
This form asks the user to enter various kinds of identification and
billing information, as well as the text of the article to be posted.
When the user clicks on ``
SUBMIT'', a confirmation form that
this should be displayed.
If the user clicks on ``
OK'', then the ad should be posted,
and an entry should be made in a billing log, as described in more detail
below. Then an acknowledgement screen that looks like
this should be displayed.
Before accepting an ad to be posted, your scripts should verify that the user has in fact filled in something in the identification and billing fields, and has actually entered some text for the ad. If the user has not done this, then you should display an appropriate error screen, rather than the acknowledgement screen.
Once an ad is accepted, your scripts will post the ad by placing the
text of the ad into a file in the subdirectory of the ``
directory that corresponds to the category selected by the user.
The only real issue here is how to select a unique filename for the new
ad, so that there is no conflict with the filenames of any existing ads.
One way to do this is to maintain a special file in each subdirectory in
which ads are stored. This file could be given a name like
.NEXT'' which starts with a dot so that it won't normally
be visible using
ls. This file should have as its contents
the ASCII text representation of the next available sequence number to
be used as the name of an ad. Thus, when you first create a subdirectory,
such as "Real Estate Rentals", you would create the file
with contents, ``
1.'' The first ad inserted in the directory
would be placed in a file named ``
1'', and then the value
stored in the
.NEXT file would be changed to ``
Your scripts should also take care of computing the amount that should
be billed to a person posting an ad. Your billing should be computed
at a rate of $1 per word. You can use the ``
to count words in a file. The amount of money that will be billed for
an ad should be displayed to the user on the confirmation screen, before
actually posting the ad. When the ad is finally posted, you should
log the billing information to a file
.BILLING in the
ads'' directory. This file should contain one line for
each article posted, and it should have the format shown
Each line corresponds to one posting of transaction, and it consists
of eight TAB-separated fields containing the following items of information:
After writing and testing your scripts, submit electronically the entire
contents of your
classifieds directory as in Homework 1.
a.outwill be produced. Run this executable by typing
a.out. You should see the
Hello worldmessage printed on your screen.
helloinstead of the default executable
hello.cis printed on the standard output. Redirect this output to a file
hello.cppand have a look at it. Basically, what has taken place is the system header file
stdio.hhas been inserted in place of the
hello.oinstead of an executable binary file. Relocatable object files are linked together by the link editor to build executables from several separately compiled source files.
hello.cinto an assembly language program
hello.s. Have a look a the file
hello.s, so you recognize what it looks like.
hello.cwith an expanded symbol table that can be used by the
gdbdebugger. In general, if you intend to do debugging, you should compile your programs with this option.
hello.cby introducing an integer variable
whileloop, so that it prints the greeting 10 times instead of just once.
hello.c, together with the files