Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference


The following code example retrieves the value of an option named aspect_ratio. Before calling mtaOptionFloat(), a default value is set for the variable to receive the value of the option. If the option was not specified in the option file, then the variable will retain that default setting. If the option was specified, then the variable will assume the value set in the file.

ratio = 1.0;
mtaOptionFloat(opt, "aspect_ratio", 0, &ratio);

If it is important to know whether or not the option was specified, then use mtaOptionString() to test to see if the option was specified as shown in the following code example. In this example, when the routine returns, the code determines that the option was specified by whether or not the value of the buflen variable has changed.

char buf[1];
size_t buflen;

buflen = 0xffffffff;
mtaOptionString(opt, "aspect_ratio", 0, buf, &buflen,
ratio_specified = (buflen != 0xffffffff) ? 1 : 0;