Solaris 共通デスクトップ環境 プログラマーズ・ガイド

カレンダのリストおよび出力


例 10–1 サーバがサポートするカレンダをリストし出力する

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;

       /* ネットワーク上のいくつかのマシンを指定します */
       host = “somehost”;

       stat= csa_list_calendars(host, &number, &calendars, NULL);
       for (i = 0; i< number; i++) {
 		/* calendar_address フィールドには、カレンダのアドレスが
 		 * user@host の書式で入っています		 */
       printf(“%d: %s\n”, i, calendars[i].calendar_address); 	
   }

  	/* 例: CSA 関数により返されるメモリを解放する
 	 * csa_list_calendars により返されるメモリを解放します
 	 */
 	stat = csa_free(calendars); 
}