/****************************************************************************
- * Copyright (c) 2001-2017,2019 Free Software Foundation, Inc. *
+ * Copyright 2019-2021,2023 Thomas E. Dickey *
+ * Copyright 2001-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.51 2019/05/04 20:31:31 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.54 2023/05/27 20:13:10 tom Exp $")
#define NUM_VISBUFS 4
static char *
_nc_vischar(char *tp, unsigned c LIMIT_ARG)
{
- if (c == '"' || c == '\\') {
+ if (tp == NULL) {
+ return NULL;
+ } else if (c == '"' || c == '\\') {
*tp++ = '\\';
*tp++ = (char) c;
} else if (is7bits((int) c) && (isgraph((int) c) || c == ' ')) {
/* use these functions for displaying parts of a line within a window */
NCURSES_EXPORT(const char *)
-_nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
+_nc_viscbuf2(int bufnum, const NCURSES_CH_T *buf, int len)
{
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
}
NCURSES_EXPORT(const char *)
-_nc_viscbuf(const NCURSES_CH_T * buf, int len)
+_nc_viscbuf(const NCURSES_CH_T *buf, int len)
{
return _nc_viscbuf2(0, buf, len);
}