# include <kapa_internal.h>

int KiiJPEG (int fd, 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, 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, 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, int scaleMode, int pageMode, char *filename, char *pagename) {

  char buffer[20];

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

name:
  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);
}
