#include "kaos.hh"

# include <stdio.h>
# include <string.h>

PUBLIC int sdu_sort = -1;

PUBLIC udatum
sdu1 ()
{
  static udatum kkk= 0;

  if (kkk == 0) {
    kkk= ud_alloc ();
    kkk->ino= 0;        /* user coding */
    (void) ud_const (sdu_sort,kkk);
    kkk->ptr= (void*) "SDU 1";
  }
  return kkk;
}

PUBLIC udatum
mk_sdu (msg)
  char* msg;
{
  udatum sdu;

  sdu= ud_alloc ();
  sdu->ino= 0;
  sdu->ptr= (void *) strdup (msg);
  return sdu;
}

PUBLIC void
free_sdu (sdu)
  udatum sdu;
{
  free ((char*) sdu->ptr);
}

PUBLIC char*
draw_sdu (sdu)
  udatum sdu;
{
  static char buff[BUFSIZ];

  (void) sprintf (buff, "%s", sdu->ptr);
  return buff;
}

PUBLIC int
equal_sdu (sdu1, sdu2)
  udatum sdu1, sdu2;
{
  return (sdu1 == sdu2);
}
