Listing 3. Ttchmodd: ToolTalk Registration

Register()
{
int     ttfd;
char    *session;
char    *procid;
Tt_status ttrc;
int     ttmark;
ttmark = tt_mark();
session = tt_X_session(
   DisplayString(XtDisplay(topLevel)));
ttrc = tt_default_session_set(session);
ToolTalkAbort("TtServer():
   tt_default_session_set", ttrc);
procid = tt_open();
ToolTalkAbort("TtServer(): tt_open",
   tt_ptr_error(procid));
ttfd = tt_fd();
ToolTalkAbort("TtServer(): tt_fd",
   tt_int_error(ttfd));
ttrc = tt_ptype_declare("TtChmod");
ToolTalkAbort("TtServer():
   tt_ptype_declare", ttrc);
ttrc = tt_session_join(
   tt_default_session());
ToolTalkAbort("TtServer():
   tt_session_join", ttrc);
tt_release(ttmark);
return(ttfd);
}