/****************************************************************************
- * Copyright 2020,2021 Thomas E. Dickey *
+ * Copyright 2020-2022,2023 Thomas E. Dickey *
* Copyright 2008-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <progs.priv.h>
#include <tty_settings.h>
-MODULE_ID("$Id: tabs.c,v 1.50 2021/10/10 00:54:41 tom Exp $")
+MODULE_ID("$Id: tabs.c,v 1.52 2023/05/27 20:13:10 tom Exp $")
static GCC_NORETURN void usage(void);
int prior = 0;
int ch;
- if (result == 0)
+ if (result == NULL)
failed("decode_tabs");
if (margin < 0)
if (isdigit(UChar(ch))) {
value *= 10;
value += (ch - '0');
+ if (value > max_cols)
+ value = max_cols;
} else if (ch == ',') {
result[n] = value + prior + margin;
if (n > 0 && result[n] <= result[n - 1]) {
}
static void
-print_ruler(int *tab_list, const char *new_line)
+print_ruler(const int *const tab_list, const char *new_line)
{
int last = 0;
int n;
/* set tty modes to -ocrnl to allow \r */
if (isatty(STDOUT_FILENO)) {
TTY new_settings = tty_settings;
- new_settings.c_oflag &= (unsigned)~OCRNL;
+ new_settings.c_oflag &= (unsigned) ~OCRNL;
update_tty_settings(&tty_settings, &new_settings);
change_tty = TRUE;
new_line = "\r\n";