RCS_ID_C="$Id: iomode.c,v 1.3 1994/03/30 07:39:20 jraja Exp $";
/*
 * iomode.c --- set file io mode (normal or translated)
 *
 * Author: jraja <Jarno.Rajahalme@hut.fi>
 *
 * This file is part of the AmiTCP/IP Network Support Library.
 *
 * Copyright © 1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
 *                  Helsinki University of Technology, Finland.
 *                  All rights reserved.
 *
 * Created      : Thu Mar 17 21:52:49 1994 jraja
 * Last modified: Wed Mar 30 10:35:45 1994 jraja
 *
 */

#include <ios1.h>
#include <stdlib.h>

int
iomode(int fd, int mode)
{
  struct UFB *ufb;

  /*
   * find the ufb *
   */
  if ((ufb = __chkufb(fd)) == NULL) {
    return -1;
  }
  /*
   * Set the translation mode
   *
   * mode == 0 - translate mode on
   * mode == 1 - translate mode off
   */
  if (mode)
    ufb->ufbflg &= ~UFB_XLAT;
  else
    ufb->ufbflg |= UFB_XLAT;

  return 0;
}
