Listing 5. Ttchmod: ToolTalk Client

#include <stdio.h>
#include <Tt/tt_c.h>
main(int argc, char *argv[])
{
Tt_message msg;
Tt_status ttstat;
if (argc != 3) {
   printf("Usage: %s <mode> <filename>\n",
      argv[0]);
   exit(1);
   }
tt_open();
msg = tt_message_create();
tt_message_scope_set(msg, TT_SESSION);
tt_message_session_set(msg, tt_default_session());
tt_message_class_set(msg, TT_REQUEST);
tt_message_handler_set(msg, "TtChmod");
tt_message_address_set(msg, TT_PROCEDURE);
tt_message_op_set(msg, "Chmod");
tt_message_arg_add(msg, TT_IN, "string", argv[2]);
tt_message_arg_add(msg, TT_IN, "string", argv[1]);
ttstat = tt_message_send(msg);
if (ttstat != TT_OK) {
   printf("%s\n", tt_status_message(
      (int) ttstat));
   exit(1);
   }
}