#include <progs.priv.h>
#include <tty_settings.h>
-MODULE_ID("$Id: tabs.c,v 1.46 2021/03/20 16:07:29 tom Exp $")
+MODULE_ID("$Id: tabs.c,v 1.47 2021/04/03 23:00:00 tom Exp $")
static GCC_NORETURN void usage(void);
print_ruler(int *tab_list)
{
int last = 0;
- int stop;
int n;
/* first print a readable ruler */
/* now, print '*' for each stop */
for (n = 0, last = 0; (tab_list[n] > 0) && (last < max_cols); ++n) {
- stop = tab_list[n];
+ int stop = tab_list[n];
+
while (++last < stop) {
if (last <= max_cols) {
putchar('-');
trimmed_tab_list(const char *source)
{
char *result = strdup(source);
- int ch, j, k, last;
-
if (result != 0) {
+ int j, k, last;
+
for (j = k = last = 0; result[j] != 0; ++j) {
- ch = UChar(result[j]);
+ int ch = UChar(result[j]);
if (isspace(ch)) {
if (last == '\0') {
continue;
if (tab_list != 0 && *tab_list != '\0') {
if (comma_is_needed(tab_list)) {
- int n, ch;
+ int n;
+
for (n = 0; tab_list[n] != '\0'; ++n) {
- ch = UChar(tab_list[n]);
+ int ch = UChar(tab_list[n]);
+
if (!(isdigit(ch) || ch == ',' || ch == '+')) {
fprintf(stderr,
"%s: unexpected character found '%c'\n",