# include <kapa_internal.h>

int KiiJPEG (int fd, const char *filename) {

  char buffer[20];

  KiiSendCommand (fd, 4, "JPEG");
  KiiSendMessage (fd, "%s", filename);

  /* block for the response, which says the operation completed */
  read (fd, buffer, 4);
  return (TRUE);
}

int KapaPNG (int fd, const char *filename) {

  char buffer[20];

  KiiSendCommand (fd, 4, "PNGF");
  KiiSendMessage (fd, "%s", filename);

  /* block for the response, which says the operation completed */
  read (fd, buffer, 4);
  return (TRUE);
}

int KapaPPM (int fd, const char *filename) {

  char buffer[20];

  KiiSendCommand (fd, 4, "PPMF");
  KiiSendMessage (fd, "%s", filename);

  /* block for the response, which says the operation completed */
  read (fd, buffer, 4);
  return (TRUE);
}

int KiiPS (int fd, const char *filename, int scaleMode, int pageMode, char *pagename) {

  char buffer[20];

  /* the default operation */
  KiiSendCommand (fd, 4, "PSIT");

  KiiSendMessage (fd, "%s %s %d %d", filename, pagename, scaleMode, pageMode);

  /* block for the response, which says the operation completed */
  read (fd, buffer, 4);
  return (TRUE);
}
