command line argument problem

Hi, I have a program, which name is p1.
I want it to do different things when I give different command line arguments.

For example,
if I give the command: p1 testfilename
I want it to build a directed and unweighted graph.

and if I give: p1 -u testfilename
I want it to build an undirected and unweighted graph.

also, if: p1 -w testfile name
build a directed and weighted graph.

and, if p1 -w -u testfilename
build an undirected and weighted graph.

I have all the graph ADTs written but I couldn't figure it out how to write the main function to let the program choose different classes to build the graph I want depending on the command line given in unix. Please be specific, any help would be appreciated.
Topic archived. No new replies allowed.