convert3-4.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: convert3-4.c /main/1 1996/04/21 19:22:31 drk $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company
  26. * (c) Copyright 1993, 1994 International Business Machines Corp.
  27. * (c) Copyright 1993, 1994 Novell, Inc.
  28. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. */
  30. #include <EUSCompat.h>
  31. #include <string.h>
  32. #include <stdlib.h>
  33. #include "rtable3.h"
  34. #include "rtable4.h"
  35. #include "convert3-4.h"
  36. /*
  37. * forward declaration of static functions
  38. */
  39. static void assign_period3to4(Period_3 *p3, Period_4 *p4);
  40. static void assign_tag3to4(Tag_3 *t3, Tag_4 *t4);
  41. static void assign_privacy3to4(Privacy_Level_3 *p3, Privacy_Level_4 *p4);
  42. static void assign_status3to4(Appt_Status_3 *s3, Appt_Status_4 *s4);
  43. static Buffer_4 buffer3_to_buffer4(Buffer_3 b);
  44. static void period3_to_period4(Period_3 *p3, Period_4 *p4);
  45. static Tag_4 * tag3_to_tag4(Tag_3 *t3);
  46. static Attribute_4 * attr3_to_attr4(Attribute_3 *a3);
  47. static Except_4 * except3_to_except4(Except_3 *e3);
  48. static void id3_to_id4(Id_3 *from, Id_4 *to);
  49. static Uid_4 * uid3_to_uid4(Uid_3 *ui3);
  50. static Appt_4 * appt3_to_appt4(Appt_3 *a3);
  51. static Abb_Appt_4 * abb3_to_abb4(Abb_Appt_3 *a3);
  52. static void apptid3_to_apptid4(Apptid_3 *from, Apptid_4 *to);
  53. static Reminder_4 * reminder3_to_reminder4(Reminder_3 *r3);
  54. static Table_Res_Type_4 tablerestype3_to_tablerestype4(Table_Res_Type_3 t);
  55. static void tablereslist3_to_tablereslist4(Table_Res_List_3 *from,
  56. Table_Res_List_4 *to);
  57. static Access_Entry_4 * acclist3_to_acclist4(Access_Entry_3 *l3);
  58. static Range_4 * range3_to_range4(Range_3 *r3);
  59. static Keyrange_4 * keyrange3_to_keyrange4(Keyrange_3 *r3);
  60. static Table_Args_Type_4 argstag3_to_argstag4(Table_Args_Type_3 t);
  61. static void args3_to_args4(Args_3 *from, Args_4 *to);
  62. static Uidopt_4 * uid3_to_uidopt(Uid_3 *uid3, Options_4 opt);
  63. /**************** DATA TYPE (3->4) CONVERSION ROUTINES **************/
  64. extern Access_Status_4
  65. _DtCm_accstat3_to_accstat4(Access_Status_3 s)
  66. {
  67. switch (s) {
  68. case access_ok_3:
  69. return(access_ok_4);
  70. case access_added_3:
  71. return(access_added_4);
  72. case access_removed_3:
  73. return(access_removed_4);
  74. case access_failed_3:
  75. return(access_failed_4);
  76. case access_exists_3:
  77. return(access_exists_4);
  78. case access_partial_3:
  79. return(access_partial_4);
  80. case access_other_3:
  81. default:
  82. return(access_other_4);
  83. }
  84. }
  85. extern Table_Res_4 *
  86. _DtCm_tableres3_to_tableres4(Table_Res_3 *r3)
  87. {
  88. Table_Res_4 *r4;
  89. if (r3==NULL) return((Table_Res_4 *)NULL);
  90. r4 = (Table_Res_4 *)calloc(1, sizeof(Table_Res_4));
  91. r4->status = _DtCm_accstat3_to_accstat4(r3->status);
  92. tablereslist3_to_tablereslist4(&(r3->res), &(r4->res));
  93. return(r4);
  94. }
  95. extern Access_Args_4 *
  96. _DtCm_accargs3_to_accargs4(Access_Args_3 *a3)
  97. {
  98. Access_Args_4 *a4;
  99. if (a3==NULL) return((Access_Args_4 *)NULL);
  100. a4 = (Access_Args_4 *)calloc(1, sizeof(Access_Args_4));
  101. a4->target = buffer3_to_buffer4(a3->target);
  102. a4->access_list = acclist3_to_acclist4(a3->access_list);
  103. return(a4);
  104. }
  105. extern Table_Args_4 *
  106. _DtCm_tableargs3_to_tableargs4(Table_Args_3 *a3)
  107. {
  108. Table_Args_4 *a4;
  109. if (a3==NULL) return((Table_Args_4 *)NULL);
  110. a4 = (Table_Args_4 *)calloc(1, sizeof(Table_Args_4));
  111. a4->target = buffer3_to_buffer4(a3->target);
  112. args3_to_args4(&(a3->args), &(a4->args));
  113. a4->pid = a3->pid;
  114. return(a4);
  115. }
  116. extern Table_Args_4 *
  117. _DtCm_tabledelargs3_to_tabledelargs4(Table_Args_3 *a3, Options_4 opt)
  118. {
  119. Table_Args_4 *a4;
  120. if (a3 == NULL)
  121. return((Table_Args_4 *)NULL);
  122. a4 = (Table_Args_4 *)calloc(1, sizeof(Table_Args_4));
  123. a4->target = buffer3_to_buffer4(a3->target);
  124. a4->pid = a3->pid;
  125. a4->args.tag = UIDOPT_4;
  126. a4->args.Args_4_u.uidopt = uid3_to_uidopt(a3->args.Args_3_u.key, opt);
  127. return(a4);
  128. }
  129. extern Registration_Status_4
  130. _DtCm_regstat3_to_regstat4(Registration_Status_3 s)
  131. {
  132. switch(s) {
  133. case registered_3:
  134. return(registered_4);
  135. case failed_3:
  136. return(failed_4);
  137. case deregistered_3:
  138. return(deregistered_4);
  139. case confused_3:
  140. return(confused_4);
  141. default:
  142. return(failed_4);
  143. }
  144. }
  145. extern Registration_4 *
  146. _DtCm_reg3_to_reg4(Registration_3 *r3)
  147. {
  148. Registration_4 *r4, *head, *prev;
  149. prev = head = NULL;
  150. while (r3 != NULL) {
  151. r4 = (Registration_4 *)calloc(1, sizeof(Registration_4));
  152. r4->target = buffer3_to_buffer4(r3->target);
  153. r4->prognum = r3->prognum;
  154. r4->versnum = r3->versnum;
  155. r4->procnum = r3->procnum;
  156. r4->next = NULL;
  157. r4->pid = r3->pid;
  158. if (head == NULL)
  159. head = r4;
  160. else
  161. prev->next = r4;
  162. prev = r4;
  163. r3 = r3->next;
  164. }
  165. return(head);
  166. }
  167. extern Table_Status_4
  168. _DtCm_tablestat3_to_tablestat4(Table_Status_3 s)
  169. {
  170. switch(s) {
  171. case ok_3:
  172. return(ok_4);
  173. case duplicate_3:
  174. return(duplicate_4);
  175. case badtable_3:
  176. return(badtable_4);
  177. case notable_3:
  178. return(notable_4);
  179. case denied_3:
  180. return(denied_4);
  181. case other_3:
  182. default:
  183. return(other_4);
  184. }
  185. }
  186. static void
  187. assign_period3to4(Period_3 *p3, Period_4 *p4)
  188. {
  189. switch (p3->period) {
  190. case single_3: p4->period = single_4;
  191. break;
  192. case daily_3: p4->period = daily_4;
  193. break;
  194. case weekly_3: p4->period = weekly_4;
  195. break;
  196. case biweekly_3: p4->period = biweekly_4;
  197. break;
  198. case monthly_3: p4->period = monthly_4;
  199. break;
  200. case yearly_3: p4->period = yearly_4;
  201. break;
  202. case nthWeekday_3: p4->period = nthWeekday_4;
  203. break;
  204. case everyNthDay_3: p4->period = everyNthDay_4;
  205. break;
  206. case everyNthWeek_3: p4->period = everyNthWeek_4;
  207. break;
  208. case everyNthMonth_3: p4->period = everyNthMonth_4;
  209. break;
  210. case otherPeriod_3: p4->period = otherPeriod_4;
  211. break;
  212. }
  213. }
  214. static void
  215. assign_tag3to4(Tag_3 *t3, Tag_4 *t4)
  216. {
  217. switch (t3->tag) {
  218. case appointment_3: t4->tag = appointment_4;
  219. break;
  220. case reminder_3: t4->tag = reminder_4;
  221. break;
  222. case otherTag_3: t4->tag = otherTag_4;
  223. break;
  224. case holiday_3: t4->tag = holiday_4;
  225. break;
  226. case toDo_3: t4->tag = toDo_4;
  227. break;
  228. }
  229. }
  230. static void
  231. assign_privacy3to4(Privacy_Level_3 *p3, Privacy_Level_4 *p4)
  232. {
  233. switch (*p3) {
  234. case public_3: *p4 = public_4;
  235. break;
  236. case private_3: *p4 = private_4;
  237. break;
  238. case semiprivate_3: *p4 = semiprivate_4;
  239. break;
  240. }
  241. }
  242. static void
  243. assign_status3to4(Appt_Status_3 *s3, Appt_Status_4 *s4)
  244. {
  245. switch (*s3) {
  246. case active_3: *s4 = active_4;
  247. break;
  248. case pendingAdd_3: *s4 = pendingAdd_4;
  249. break;
  250. case pendingDelete_3: *s4 = pendingDelete_4;
  251. break;
  252. case committed_3: *s4 = committed_4;
  253. break;
  254. case cancelled_3: *s4 = cancelled_4;
  255. break;
  256. case completed_3: *s4 = completed_4;
  257. break;
  258. }
  259. }
  260. static Buffer_4
  261. buffer3_to_buffer4(Buffer_3 b)
  262. {
  263. Buffer_4 copy;
  264. if (b!=NULL)
  265. copy = strdup(b);
  266. else
  267. copy = calloc(1, 1);
  268. return(copy);
  269. }
  270. static void
  271. period3_to_period4(Period_3 *p3, Period_4 *p4)
  272. {
  273. if (p3 == NULL || p4==NULL) return;
  274. assign_period3to4(p3, p4);
  275. p4->nth = p3->nth;
  276. }
  277. static Tag_4 *
  278. tag3_to_tag4(Tag_3 *t3)
  279. {
  280. Tag_4 *t4, *head, *prev;
  281. prev = head = NULL;
  282. while (t3 != NULL) {
  283. t4 = (Tag_4 *)calloc(1, sizeof(Tag_4));
  284. assign_tag3to4(t3, t4);
  285. t4->showtime = t3->showtime;
  286. t4->next = NULL;
  287. if (head == NULL)
  288. head = t4;
  289. else
  290. prev->next = t4;
  291. prev = t4;
  292. t3 = t3->next;
  293. }
  294. return(head);
  295. }
  296. static Attribute_4 *
  297. attr3_to_attr4(Attribute_3 *a3)
  298. {
  299. Attribute_4 *a4, *head, *prev;
  300. prev = head = NULL;
  301. while (a3 != NULL) {
  302. a4 = (Attribute_4 *)calloc(1, sizeof(Attribute_4));
  303. a4->next = NULL;
  304. a4->attr = buffer3_to_buffer4(a3->attr);
  305. a4->value = buffer3_to_buffer4(a3->value);
  306. a4->clientdata = buffer3_to_buffer4(a3->clientdata);
  307. if (head == NULL)
  308. head = a4;
  309. else
  310. prev->next = a4;
  311. prev = a4;
  312. a3 = a3->next;
  313. }
  314. return(head);
  315. }
  316. static Except_4 *
  317. except3_to_except4(Except_3 *e3)
  318. {
  319. Except_4 *e4, *head, *prev;
  320. prev = head = NULL;
  321. while (e3 != NULL) {
  322. e4 = (Except_4 *)calloc(1, sizeof(Except_4));
  323. e4->ordinal = e3->ordinal;
  324. e4->next=NULL;
  325. if (head == NULL)
  326. head = e4;
  327. else
  328. prev->next = e4;
  329. prev = e4;
  330. e3 = e3->next;
  331. }
  332. return(head);
  333. }
  334. static void
  335. id3_to_id4(Id_3 *from, Id_4 *to)
  336. {
  337. if ((from==NULL) || (to==NULL)) return;
  338. to->tick = from->tick;
  339. to->key = from->key;
  340. }
  341. static Uid_4 *
  342. uid3_to_uid4(Uid_3 *ui3)
  343. {
  344. Uid_4 *ui4, *head, *prev;
  345. prev = head = NULL;
  346. while (ui3 != NULL) {
  347. ui4 = (Uid_4 *)calloc(1, sizeof(Uid_4));
  348. id3_to_id4(&(ui3->appt_id), &(ui4->appt_id));
  349. ui4->next = NULL;
  350. if (head == NULL)
  351. head = ui4;
  352. else
  353. prev->next = ui4;
  354. prev = ui4;
  355. ui3 = ui3->next;
  356. }
  357. return(head);
  358. }
  359. static Appt_4 *
  360. appt3_to_appt4(Appt_3 *a3)
  361. {
  362. Appt_4 *a4, *head, *prev;
  363. prev = head = NULL;
  364. while (a3 != NULL) {
  365. a4 = (Appt_4 *)calloc(1, sizeof(Appt_4));
  366. id3_to_id4(&(a3->appt_id), &(a4->appt_id));
  367. a4->tag = tag3_to_tag4(a3->tag);
  368. a4->duration = a3->duration;
  369. a4->ntimes = a3->ntimes;
  370. a4->what = buffer3_to_buffer4(a3->what);
  371. period3_to_period4(&(a3->period), &(a4->period));
  372. a4->author = buffer3_to_buffer4(a3->author);
  373. a4->client_data = buffer3_to_buffer4(a3->client_data);
  374. a4->exception = except3_to_except4(a3->exception);
  375. a4->attr = attr3_to_attr4(a3->attr);
  376. assign_status3to4(&a3->appt_status, &a4->appt_status);
  377. assign_privacy3to4(&a3->privacy, &a4->privacy);
  378. a4->next = NULL;
  379. if (head == NULL)
  380. head = a4;
  381. else
  382. prev->next = a4;
  383. prev = a4;
  384. a3 = a3->next;
  385. }
  386. return(head);
  387. }
  388. static Abb_Appt_4 *
  389. abb3_to_abb4(Abb_Appt_3 *a3)
  390. {
  391. Abb_Appt_4 *a4, *head, *prev;
  392. prev = head = NULL;
  393. while (a3 != NULL) {
  394. a4 = (Abb_Appt_4 *)calloc(1, sizeof(Abb_Appt_4));
  395. id3_to_id4(&(a3->appt_id), &(a4->appt_id));
  396. a4->tag = tag3_to_tag4(a3->tag);
  397. a4->what = buffer3_to_buffer4(a3->what);
  398. a4->duration = a3->duration;
  399. period3_to_period4(&(a3->period), &(a4->period));
  400. assign_status3to4(&a3->appt_status, &a4->appt_status);
  401. assign_privacy3to4(&a3->privacy, &a4->privacy);
  402. a4->next = NULL;
  403. if (head == NULL)
  404. head = a4;
  405. else
  406. prev->next = a4;
  407. prev = a4;
  408. a3 = a3->next;
  409. }
  410. return(head);
  411. }
  412. static void
  413. apptid3_to_apptid4(Apptid_3 *from, Apptid_4 *to)
  414. {
  415. if (from==NULL || to==NULL) return;
  416. id3_to_id4(from->oid, to->oid);
  417. to->new_appt = appt3_to_appt4(from->new_appt);
  418. /* do_all is the default, the caller needs to
  419. * modify it to the appropriate value
  420. */
  421. to->option = do_all_4;
  422. }
  423. static Reminder_4 *
  424. reminder3_to_reminder4(Reminder_3 *r3)
  425. {
  426. Reminder_4 *r4, *head, *prev;
  427. Attribute_4 *attr4;
  428. prev = head = NULL;
  429. while (r3 != NULL) {
  430. r4 = (Reminder_4 *)calloc(1, sizeof(Reminder_4));
  431. id3_to_id4(&(r3->appt_id), &(r4->appt_id));
  432. r4->tick = r3->tick;
  433. attr4 = attr3_to_attr4(&(r3->attr));
  434. r4->attr = *attr4;
  435. free(attr4);
  436. r4->next = NULL;
  437. if (head == NULL)
  438. head = r4;
  439. else
  440. prev->next = r4;
  441. prev = r4;
  442. r3 = r3->next;
  443. }
  444. return(head);
  445. }
  446. static Table_Res_Type_4
  447. tablerestype3_to_tablerestype4(Table_Res_Type_3 t)
  448. {
  449. switch(t) {
  450. case AP_3:
  451. return(AP_4);
  452. case RM_3:
  453. return(RM_4);
  454. case AB_3:
  455. return(AB_4);
  456. case ID_3:
  457. return(ID_4);
  458. default:
  459. return(AP_4);
  460. }
  461. }
  462. static void
  463. tablereslist3_to_tablereslist4(Table_Res_List_3 *from, Table_Res_List_4 *to)
  464. {
  465. if (from==NULL || to==NULL) return;
  466. to->tag = tablerestype3_to_tablerestype4(from->tag);
  467. switch (from->tag) {
  468. case AP_3:
  469. to->Table_Res_List_4_u.a = appt3_to_appt4(
  470. from->Table_Res_List_3_u.a);
  471. break;
  472. case RM_3:
  473. to->Table_Res_List_4_u.r = reminder3_to_reminder4(
  474. from->Table_Res_List_3_u.r);
  475. break;
  476. case AB_3:
  477. to->Table_Res_List_4_u.b = abb3_to_abb4(
  478. from->Table_Res_List_3_u.b);
  479. break;
  480. case ID_3:
  481. to->Table_Res_List_4_u.i = uid3_to_uid4(
  482. from->Table_Res_List_3_u.i);
  483. break;
  484. default:
  485. return;
  486. }
  487. }
  488. static Access_Entry_4 *
  489. acclist3_to_acclist4(Access_Entry_3 *l3)
  490. {
  491. Access_Entry_4 *l4, *head, *prev;
  492. prev = head = NULL;
  493. while (l3 != NULL) {
  494. l4 = (Access_Entry_4 *)calloc(1, sizeof(Access_Entry_4));
  495. l4->who = buffer3_to_buffer4(l3->who);
  496. l4->access_type = l3->access_type;
  497. l4->next = NULL;
  498. if (head == NULL)
  499. head = l4;
  500. else
  501. prev->next = l4;
  502. prev = l4;
  503. l3 = l3->next;
  504. }
  505. return(head);
  506. }
  507. static Range_4 *
  508. range3_to_range4(Range_3 *r3)
  509. {
  510. Range_4 *r4, *head, *prev;
  511. prev = head = NULL;
  512. while (r3 != NULL) {
  513. r4 = (Range_4 *)calloc(1, sizeof(Range_4));
  514. r4->key1 = r3->key1;
  515. r4->key2 = r3->key2;
  516. r4->next = NULL;
  517. if (head == NULL)
  518. head = r4;
  519. else
  520. prev->next = r4;
  521. prev = r4;
  522. r3 = r3->next;
  523. }
  524. return(head);
  525. }
  526. static Keyrange_4 *
  527. keyrange3_to_keyrange4(Keyrange_3 *r3)
  528. {
  529. Keyrange_4 *r4, *head, *prev;
  530. prev = head = NULL;
  531. while (r3 != NULL) {
  532. r4 = (Keyrange_4 *)calloc(1, sizeof(Keyrange_4));
  533. r4->key = r3->key;
  534. r4->tick1 = r3->tick1;
  535. r4->tick2 = r3->tick2;
  536. r4->next = NULL;
  537. if (head == NULL)
  538. head = r4;
  539. else
  540. prev->next = r4;
  541. prev = r4;
  542. r3 = r3->next;
  543. }
  544. return(head);
  545. }
  546. static Table_Args_Type_4
  547. argstag3_to_argstag4(Table_Args_Type_3 t)
  548. {
  549. switch(t) {
  550. case TICK_3:
  551. return(TICK_4);
  552. case APPTID_3:
  553. return(APPTID_4);
  554. case UID_3:
  555. return(UID_4);
  556. case APPT_3:
  557. return(APPT_4);
  558. case RANGE_3:
  559. return(RANGE_4);
  560. case KEYRANGE_3:
  561. return(KEYRANGE_4);
  562. default:
  563. return(TICK_4);
  564. }
  565. }
  566. static void
  567. args3_to_args4(Args_3 *from, Args_4 *to)
  568. {
  569. if (from==NULL || to==NULL) return;
  570. to->tag = argstag3_to_argstag4(from->tag);
  571. switch(from->tag) {
  572. case TICK_3:
  573. to->Args_4_u.tick = from->Args_3_u.tick;
  574. break;
  575. case APPTID_3:
  576. to->Args_4_u.apptid.oid = (Id_4 *)calloc(1, sizeof(Id_4));
  577. apptid3_to_apptid4(
  578. &(from->Args_3_u.apptid),
  579. &(to->Args_4_u.apptid));
  580. break;
  581. case UID_3:
  582. to->Args_4_u.key = uid3_to_uid4(from->Args_3_u.key);
  583. break;
  584. case APPT_3:
  585. to->Args_4_u.appt = appt3_to_appt4(from->Args_3_u.appt);
  586. break;
  587. case RANGE_3:
  588. to->Args_4_u.range = range3_to_range4(from->Args_3_u.range);
  589. break;
  590. case KEYRANGE_3:
  591. to->Args_4_u.keyrange = keyrange3_to_keyrange4(
  592. from->Args_3_u.keyrange);
  593. default:
  594. break;
  595. }
  596. }
  597. static Uidopt_4 *
  598. uid3_to_uidopt(Uid_3 *uid3, Options_4 opt)
  599. {
  600. Uidopt_4 *uidopt, *head, *prev;
  601. prev = head = NULL;
  602. while (uid3 != NULL) {
  603. uidopt = (Uidopt_4 *)calloc(1, sizeof(Uidopt_4));
  604. id3_to_id4(&(uid3->appt_id), &(uidopt->appt_id));
  605. uidopt->option = opt;
  606. uidopt->next = NULL;
  607. if (head == NULL)
  608. head = uidopt;
  609. else
  610. prev->next = uidopt;
  611. prev = uidopt;
  612. uid3 = uid3->next;
  613. }
  614. return(head);
  615. }