Back to index

tetex-bin  3.0
Functions
visbuf.c File Reference
#include <curses.priv.h>
#include <tic.h>
#include <ctype.h>

Go to the source code of this file.

Functions

static char * _nc_vischar (char *tp, unsigned c)
static const char * _nc_visbuf2n (int bufnum, const char *buf, int len)
 _nc_visbuf2 (int bufnum, const char *buf)
 _nc_visbuf (const char *buf)
 _nc_visbufn (const char *buf, int len)

Function Documentation

_nc_visbuf ( const char *  buf)

Definition at line 118 of file visbuf.c.

{
    return _nc_visbuf2(0, buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

_nc_visbuf2 ( int  bufnum,
const char *  buf 
)

Definition at line 112 of file visbuf.c.

{
    return _nc_visbuf2n(bufnum, buf, -1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* _nc_visbuf2n ( int  bufnum,
const char *  buf,
int  len 
) [static]

Definition at line 79 of file visbuf.c.

{
    char *vbuf;
    char *tp;
    int c;

    if (buf == 0)
       return ("(null)");
    if (buf == CANCELLED_STRING)
       return ("(cancelled)");

    if (len < 0)
       len = strlen(buf);

#ifdef TRACE
    tp = vbuf = _nc_trace_buf(bufnum, (unsigned) (len * 4) + 5);
#else
    {
       static char *mybuf[2];
       mybuf[bufnum] = typeRealloc(char, (unsigned) (len * 4) + 5, mybuf[bufnum]);
       tp = vbuf = mybuf[bufnum];
    }
#endif
    *tp++ = D_QUOTE;
    while ((--len >= 0) && (c = *buf++) != '\0') {
       tp = _nc_vischar(tp, UChar(c));
    }
    *tp++ = D_QUOTE;
    *tp++ = '\0';
    return (vbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

_nc_visbufn ( const char *  buf,
int  len 
)

Definition at line 124 of file visbuf.c.

{
    return _nc_visbuf2n(0, buf, len);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* _nc_vischar ( char *  tp,
unsigned  c 
) [static]

Definition at line 47 of file visbuf.c.

{
    if (c == '"' || c == '\\') {
       *tp++ = '\\';
       *tp++ = c;
    } else if (is7bits(c) && (isgraph(c) || c == ' ')) {
       *tp++ = c;
    } else if (c == '\n') {
       *tp++ = '\\';
       *tp++ = 'n';
    } else if (c == '\r') {
       *tp++ = '\\';
       *tp++ = 'r';
    } else if (c == '\b') {
       *tp++ = '\\';
       *tp++ = 'b';
    } else if (c == '\033') {
       *tp++ = '\\';
       *tp++ = 'e';
    } else if (is7bits(c) && iscntrl(UChar(c))) {
       *tp++ = '\\';
       *tp++ = '^';
       *tp++ = '@' + c;
    } else {
       sprintf(tp, "\\%03lo", ChCharOf(c));
       tp += strlen(tp);
    }
    *tp = 0;
    return tp;
}

Here is the call graph for this function:

Here is the caller graph for this function: