/****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
+ * Copyright 2020,2021 Thomas E. Dickey *
+ * Copyright 1998-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 <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: comp_expand.c,v 1.31 2017/04/20 08:55:08 tom Exp $")
+MODULE_ID("$Id: comp_expand.c,v 1.33 2021/02/28 00:58:19 tom Exp $")
#if 0
#define DEBUG_THIS(p) DEBUG(9, p)
return 0;
}
- DEBUG_THIS(("_nc_tic_expand %s", _nc_visbuf(srcp)));
+ DEBUG_THIS(("_nc_tic_expand %s:%s:%s",
+ tic_format ? "ti" : "tc",
+ numbers ? "#" : "",
+ _nc_visbuf(srcp)));
bufp = 0;
while ((ch = UChar(*str)) != 0) {
if (ch == '%' && REALPRINT(str + 1)) {
trailing_spaces(str))) {
buffer[bufp++] = '\\';
buffer[bufp++] = 's';
- } else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) {
+ } else if ((ch == ',' || ch == '^') && tic_format) {
buffer[bufp++] = '\\';
buffer[bufp++] = (char) ch;
} else if (REALPRINT(str)
&& (ch != ','
- && ch != ':'
+ && !(ch == ':' && !tic_format)
&& !(ch == '!' && !tic_format)
&& ch != '^'))
buffer[bufp++] = (char) ch;