/**************************************************************************/
/*                                                                        */
/*                                 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: a_popt.c,v 1.2 1997/09/25 16:52:49 ae59 Exp $ */
/*
$Log: a_popt.c,v $
 * Revision 1.2  1997/09/25  16:52:49  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:20:48  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : a_popt.c                              */
/*                                                              */
/*      Entry           : void a_popt(desc,option)              */
/*                        f_text *desc;                         */
/*                        s_trng option;                        */
/*                                                              */
/*      Arguments       : desc   - file descriptor              */
/*                        option - name of option               */
/*                                                              */
/*      Description     : Check for runtime option and process  */
/*                                                              */
/*      Date            : 1991-02-13                            */
/*      1991-02-13 : copy string before call to b_popt()        */
/*      1991-02-01 : b_text() used to reduce code               */
/****************************************************************/

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

#ifdef LINT_ARGS
local void a_popt(f_text *desc,s_trng option)
#else
local void a_popt(desc,option)

f_text *desc;
s_trng option;
#endif

        {
        int i,k;
        char *buffer;

        E_TPUSH("a_popt")

        if (b_text(desc,FALSE))
           {
           for (i=0;i<option.clen;)
              {

              /* search for start of option */
              while (i<option.clen)
                 if (option.ptr[i]!=' ') break; else i++;

              /* search for end of option */
              k = i+1;
              while (k<option.clen)
                 if (option.ptr[k]==' ') break; else k++;

              /* process option if any */
              if (i<option.clen)
                 {
                 buffer = (char *)memcpy((char *)b_cp__,option.ptr+i,k-i);
                 buffer[k-i] = '\0';
                 (void)b_popt(desc->fp,buffer);
                 i = k+1;
                 }
              }
           }

        if (option.tmp) s_free(&option);

        E_TPOPP("a_popt")
        return;
        }
