Solaris Common Desktop Environment: Programmer's Guide

Listing and Printing Calendars


Example 10-1 Listing and Printing Calendars Supported by Server

Example:
List and print out the calendars supported by a server.
 	   Free memory returned by a CSA function. 
list_calendar() 
{
 	CSA_return_code		stat;
	CSA_uint32		i, number;
 	CSA_calendar_user	*calendars;
 	char			*host;

  	/*specify some machine in the network */
 	host = "somehost";

  	stat= csa_list_calendars(host, &number, &calendars, NULL);
  	for (i = 0; i< number; i++) {
 		/* the calendar_address field contains the address of the
 		 * the calendar in the format "user@host" 		 */
 	printf("%d: %s\n", i, calendars[i].calendar_address); 	
   }

  	/* Example: free memory returned by a CSA function
 	 * free the memory returned by csa_list_calendars above
 	 */
 	stat = csa_free(calendars); 
}