[Previous] [Contents] [Next]

my_main()

initialize the program and parse command-line arguments

Synopsis:

int my_main( int argc, char **argv );

Description:

This function initializes the program and parses the command-line arguments passed in argc and argv. It also calls my_init() to initialize the _doc_ctrl structure.

This function processes the following command-line arguments and removes them from the list before passing it to my_init():

-V
Increase verbosity (-VV for even more). If this option is set, the global variable verbose is set to a value greater than 0. Your functions should check this variable to see how much debugging output is desired.
-D filename
Open a debug output file and set the global variable debug_fd to point to the file. Your functions should use write() to send debugging output to this file.
-b size
Set the size of the ram_buffer member of the doc_ctrl structure.
-w width
Set the src.w member of the _doc_ctrl structure to the given size. This may be redefined by the values in the phs file.
-h height
Set the src.h member of the _doc_ctrl structure to the given size. This may be redefined by the values in the phs file.
-x coord
Set the src.x member of the _doc_ctrl structure to the given coordinate. This may be redefined by the values in the phs file.
-y coord
Set the src.y member of the _doc_ctrl structure to the given coordinate. This may be redefined by the values in the phs file.
-c n
Specify the number of bytes required to represent each pixel in the image. This is stored in the bpp member of the _doc_ctrl structure. This is usually set to 3 in start_document() so it will work with the dithering implementation in dither.c.
-p start[,end]
Specify the first and last page to print. If end isn't specified, start is used. The firstpage and endpage members of the _doc_ctrl structure are set to the given values.
-A
Force anti-aliasing. The RF_FORCE_ANTIALIAS flag is set in the flags member of the _doc_ctrl structure.
-L
Specify landscape printing. The Pp_LANDSCAPE flag is set in the orientation member of the _doc_ctrl structure.
-d
Delete the input file when printing is complete. The global variable delete_flag is set, and atexit() is used to register a function that deletes the file when the filter ends.
-U filename
Delete the specified file when printing is complete. The global variable unlink_file is set, and atexit() is used to register a function that deletes the file when the filter ends. This is typically used to remove the shared Render library.

You shouldn't have to replace the default version of this function. Any changes you need to make should be to my_init().

Returns:

0
Success.
Any other value
An error occurred.

Classification:

Photon

Safety:
Interrupt handler Not applicable
Signal handler Not applicable
Thread Not applicable

[Previous] [Contents] [Next]