OpenCOBOL 1.1pre-rel
Functions
termio.c File Reference
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <time.h>
#include "move.h"
#include "coblocal.h"
#include "termio.h"
#include "screenio.h"
Include dependency graph for termio.c:

Go to the source code of this file.

Functions

void cob_display (const int outorerr, const int newline, const int varcnt,...)
void cob_accept (cob_field *f)
void cob_init_termio (void)

Function Documentation

void cob_accept ( cob_field f)

Definition at line 234 of file termio.c.

{
/* RXW
        size_t          size;
*/
        cob_field_attr  attr;
        cob_field       temp;

        if (cob_screen_initialized) {
                cob_field_accept (f, NULL, NULL, NULL, NULL, NULL, 0);
                return;
        }
        temp.data = term_buff;
        temp.attr = &attr;
        COB_ATTR_INIT (COB_TYPE_ALPHANUMERIC, 0, 0, 0, NULL);
        /* read a line */
        if (fgets ((char *)term_buff, COB_MEDIUM_BUFF, stdin) == NULL) {
                temp.size = 1;
                term_buff[0] = ' ';
                term_buff[1] = 0;
        } else {
                temp.size = strlen ((char *)term_buff) - 1;
        }
        if (COB_FIELD_TYPE(f) == COB_TYPE_NUMERIC_DISPLAY) {
                if (temp.size > f->size) {
                        temp.size = f->size;
                }
        }
        cob_move (&temp, f);
/* RXW
        if (isatty (fileno (stdin))) {
                temp.size = strlen ((char *)term_buff) - 1;
                cob_move (&temp, f);
        } else {
                size = strlen ((char *)term_buff) - 1;
                if (size > f->size) {
                        size = f->size;
                }
                memcpy (f->data, term_buff, size);
                memset (f->data + size, ' ', f->size - size);
        }
*/
}

Here is the call graph for this function:

void cob_display ( const int  outorerr,
const int  newline,
const int  varcnt,
  ... 
)

Definition at line 205 of file termio.c.

{
        FILE            *fp;
        cob_field       *f;
        int             i;
        va_list         args;

        if (!outorerr && !cob_screen_initialized) {
                fp = stdout;
        } else {
                fp = stderr;
        }
        va_start (args, varcnt);
        for (i = 0; i < varcnt; ++i) {
                f = va_arg (args, cob_field *);
                display (f, fp);
        }
        va_end (args);
        if (newline) {
                putc ('\n', fp);
                fflush (fp);
        }
}
void cob_init_termio ( void  )

Definition at line 279 of file termio.c.

{
        term_buff = cob_malloc (COB_MEDIUM_BUFF);
}

Here is the call graph for this function:

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines