/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: b_text.c,v 1.2 1997/09/25 17:09:21 ae59 Exp $ */
/*
$Log: b_text.c,v $
 * Revision 1.2  1997/09/25  17:09:21  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:21:49  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : b_text.c                              */
/*                                                              */
/*      Entry           : a_bool b_text(desc,in)                */
/*                        f_text *desc;                         */
/*                        a_bool in;                            */
/*                                                              */
/*      Arguments       : desc   - file descriptor              */
/*                        in     - test for input file          */
/*                                                              */
/*      Description     : Display message if not text file      */
/*                        and not opened for input (in==TRUE)   */
/*                        or not opened for output (in==FALSE). */
/*                                                              */
/*      Date            : 1991-04-18                            */
/*      1991-04-18 : TEXT file checking is done by PXSC compiler*/
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local a_bool b_text(f_text *desc,a_bool in)
#else
local a_bool b_text(desc,in)

f_text *desc;
a_bool in;
#endif
        {
        int msg = 0;

        E_TPUSH("b_text")

        if (desc->asgd==FALSE || desc->fp==NULL) msg = 17;
#ifdef CHECK_TEXT_FILE
        else if (desc->text==FALSE) msg = 19;
#endif
        else if (in)
           {
           if (desc->infl==FALSE) msg = 18;
           if (desc->eof==TRUE) msg = 20;
           }
        else
           {
           if (desc->outf==FALSE) msg = 34;
           if (desc->err==TRUE) msg = 35;
           }

        if (msg) e_trap(I_O_ERROR,4,E_TMSG,msg,E_TSTR+E_TEXT(8),desc->name);

        E_TPOPP("b_text")
        return((msg) ? FALSE : TRUE);
        }

