mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-18 09:46:33 +02:00
[HAVE_LIMITS_H]: Include limits.h for INT_MAX.
[!INT_MAX]: Define it. (main): Append INT_MAX to command-line-specified tab list to ensure termination in unexpand's inner loop. Derived from a patch from Keith Owens.
This commit is contained in:
@@ -44,6 +44,19 @@
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
|
||||
#endif
|
||||
|
||||
#ifndef INT_MAX
|
||||
# define INT_MAX ((int) (UINT_MAX >> 1))
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
|
||||
/* The number of bytes added at a time to the amount of memory
|
||||
@@ -440,7 +453,11 @@ main (int argc, char **argv)
|
||||
else if (first_free_tab == 1)
|
||||
tab_size = tab_list[0];
|
||||
else
|
||||
tab_size = 0;
|
||||
{
|
||||
/* Append a sentinel to the list of tab stop indices. */
|
||||
add_tabstop (INT_MAX);
|
||||
tab_size = 0;
|
||||
}
|
||||
|
||||
if (optind == argc)
|
||||
file_list = stdin_argv;
|
||||
|
||||
Reference in New Issue
Block a user