bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sharutils 4.3.71 mishandles large files


From: Paul Eggert
Subject: sharutils 4.3.71 mishandles large files
Date: Tue, 16 Jul 2002 23:09:00 -0700 (PDT)

> From: Karl Eichwalder <address@hidden>
> Date: Tue, 16 Jul 2002 20:05:31 +0200
> 
> > 2002-07-14  Bruno Haible  <address@hidden>
> >
> >     * src/shar.c (generate_one_header_line): Cast file size to long; it
> >     could be a 'long long'.
> 
> Thanks, applied (for 4.3.72 or later)!

This is an instance of a more general problem: sharutils mishandles
files whose sizes do not fit in 'long'.  For example, on hosts with
32-bit long (a common case), uuencode, uudecode and shar cannot handle
files larger than 2 GiB.  Here is a patch to sharutils 4.3.71; it
assumes that Bruno Haible's patch has already been applied.  Most of
this patch is stolen from diffutils and fileutils.

2002-07-16  Paul Eggert  <address@hidden>

        Add support for large files, e.g., files larger than 2 GiB on
        hosts where 'long' is 32 bits wide.

        * configure.ac (AC_SYS_LARGEFILE, AC_FUNC_FSEEKO,
        jm_AC_PREREQ_XSTRTOIMAX): Add.

        * lib/Makefile.am (EXTRA_DIST): Add inttostr.c, strtol.c.
        (libshar_a_SOURCES): Add offtostr.c.  Remove xalloc.h.
        (noinst_HEADERS): Add inttostr.h, xalloc.h.
        
        * lib/inttostr.c, lib/inttostr.h, lib/offtostr.c, lib/strtoimax.c,
        lib/strtol.c, lib/strtoll.c: New files, taken from diffutils and
        fileutils.

        * lib/system.h: Include inttypes.h if HAVE_INTTYPES_H.
        (strtoimax): Declare if not already declared or defined.
        (fseeko, ftello): Define if not already declared or defined.
        (SEEK_SET): Define if not defined.

        * m4/Makefile.am (EXTRA_DIST): Add inttypes.m4, longlong.m4,
        xstrtoimax.m4.
        * m4/inttypes.m4, m4/longlong.m4, m4/xstrtoimax.m4:
        New files, taken from diffutils and fileutils.

        * src/shar.c: Include limits.h if it exists.
        (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): New macros.
        Include inttostr.h.
        (file_size_limit): Now off_t, not unsigned.  Now measured in bytes,
        not kilobytes.  All uses changed.
        (first_file_position): Now off_t, not long.
        (DEBUG_PRINT, generate_one_header_line): Use offtostr to print
        file offsets, since they might be wider than `long'.
        (shar): Don't assume size_t fits in int.
        (set_file_size_limit): New function.
        (main): Use it.  -L now always sets split_file_mode to 1.

        * src/shar.c (generate_full_header, shar, main): Use ftello and
        fseeko, not ftell and fseek.  Use SEEK_SET rather than 0.
        * src/unshar.c (find_archive, unarchive_shar_file): Likewise.

diff -N'aurpx*~' sharutils-4.3.71-haible/configure.ac 
sharutils-4.3.71-off_t/configure.ac
--- sharutils-4.3.71-haible/configure.ac        2002-07-07 10:33:53.000000000 
+0000
+++ sharutils-4.3.71-off_t/configure.ac 2002-07-13 04:30:11.252435000 +0000
@@ -70,6 +70,7 @@ AC_AIX
 AC_ISC_POSIX
 AC_MINIX
 AM_PROG_CC_STDC
+AC_SYS_LARGEFILE
 if test $cross_compiling = no; then
   AC_C_CHAR_UNSIGNED
 fi
@@ -90,9 +91,11 @@ jm_FUNC_REALLOC
 AC_CHECK_FUNCS(basename fchmod getcwd isascii memcpy strchr strerror uname)
 AC_FUNC_ALLOCA
 AC_FUNC_CLOSEDIR_VOID
+AC_FUNC_FSEEKO
 AC_FUNC_STRFTIME
 AC_FUNC_VPRINTF
 AC_REPLACE_FUNCS(memset mktime stpcpy strftime)
+jm_AC_PREREQ_XSTRTOIMAX
 test "$ac_cv_func_basename" = yes || AC_LIBOBJ(basename)
 
 AC_MSG_CHECKING(for /etc/systemid)
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/Makefile.am 
sharutils-4.3.71-off_t/lib/Makefile.am
--- sharutils-4.3.71-haible/lib/Makefile.am     2002-06-25 17:08:20.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/Makefile.am      2002-07-13 06:56:34.143174000 
+0000
@@ -19,8 +19,8 @@
 
 noinst_LIBRARIES = libshar.a
 
-EXTRA_DIST = gen-uio alloca.c basename.c md5.c memset.c mktime.c       \
-stpcpy.c strftime.c
+EXTRA_DIST = gen-uio alloca.c basename.c inttostr.c md5.c memset.c mktime.c \
+stpcpy.c strftime.c strtol.c
 
 BUILT_SOURCES = unlocked-io.h
 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
@@ -28,12 +28,12 @@ DISTCLEANFILES = unlocked-io.h
 
 all-local: unlocked-io.h
 
-libshar_a_SOURCES = error.c getopt.c getopt1.c md5.c whoami.c xgetcwd.c \
-xmalloc.c xstrdup.c xalloc.h
+libshar_a_SOURCES = error.c getopt.c getopt1.c md5.c offtostr.c whoami.c \
+xgetcwd.c xmalloc.c xstrdup.c
 
 libshar_a_LIBADD = @ALLOCA@ @LIBOBJS@
 
-noinst_HEADERS = error.h getopt.h md5.h system.h pathmax.h
+noinst_HEADERS = error.h getopt.h inttostr.h md5.h pathmax.h system.h xalloc.h
 
 INCLUDES = -I.. -I$(srcdir) -I../intl
 DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/inttostr.c 
sharutils-4.3.71-off_t/lib/inttostr.c
--- sharutils-4.3.71-haible/lib/inttostr.c      1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/inttostr.c       2001-11-23 13:11:25.000000000 
+0000
@@ -0,0 +1,49 @@
+/* inttostr.c -- convert integers to printable strings
+
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Written by Paul Eggert */
+
+#include "inttostr.h"
+
+/* Convert I to a printable string in BUF, which must be at least
+   INT_BUFSIZE_BOUND (INTTYPE) bytes long.  Return the address of the
+   printable string, which need not start at BUF.  */
+
+char *
+inttostr (inttype i, char *buf)
+{
+  char *p = buf + INT_STRLEN_BOUND (inttype);
+  *p = 0;
+
+  if (i < 0)
+    {
+      do
+       *--p = '0' - i % 10;
+      while ((i /= 10) != 0);
+
+      *--p = '-';
+    }
+  else
+    {
+      do
+       *--p = '0' + i % 10;
+      while ((i /= 10) != 0);
+    }
+
+  return p;
+}
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/inttostr.h 
sharutils-4.3.71-off_t/lib/inttostr.h
--- sharutils-4.3.71-haible/lib/inttostr.h      1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/inttostr.h       2001-11-23 13:10:39.000000000 
+0000
@@ -0,0 +1,60 @@
+/* inttostr.h -- convert integers to printable strings
+
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Written by Paul Eggert */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#if HAVE_LIMITS_H
+# include <limits.h>
+#endif
+#ifndef CHAR_BIT
+# define CHAR_BIT 8
+#endif
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+/* Upper bound on the string length of an integer converted to string.
+   302 / 1000 is ceil (log10 (2.0)).  Subtract 1 for the sign bit;
+   add 1 for integer division truncation; add 1 more for a minus sign.  */
+#define INT_STRLEN_BOUND(t) \
+ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t))
+
+#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+#ifndef PARAMS
+# if defined PROTOTYPES || defined __STDC__
+#  define PARAMS(Args) Args
+# else
+#  define PARAMS(Args) ()
+# endif
+#endif
+
+char *offtostr PARAMS ((off_t, char *));
+char *imaxtostr PARAMS ((intmax_t, char *));
+char *umaxtostr PARAMS ((uintmax_t, char *));
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/offtostr.c 
sharutils-4.3.71-off_t/lib/offtostr.c
--- sharutils-4.3.71-haible/lib/offtostr.c      1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/offtostr.c       2001-11-23 13:11:43.000000000 
+0000
@@ -0,0 +1,3 @@
+#define inttostr offtostr
+#define inttype off_t
+#include "inttostr.c"
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/strtoimax.c 
sharutils-4.3.71-off_t/lib/strtoimax.c
--- sharutils-4.3.71-haible/lib/strtoimax.c     1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/strtoimax.c      2002-07-09 17:40:43.262453000 
+0000
@@ -0,0 +1,101 @@
+/* Convert string representation of a number into an intmax_t value.
+
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Written by Paul Eggert. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#ifndef PARAMS
+# if defined PROTOTYPES || defined __STDC__
+#  define PARAMS(Args) Args
+# else
+#  define PARAMS(Args) ()
+# endif
+#endif
+
+/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
+#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
+
+#ifdef UNSIGNED
+# ifndef HAVE_DECL_STRTOUL
+"this configure-time declaration test was not run"
+# endif
+# if !HAVE_DECL_STRTOUL
+unsigned long strtoul PARAMS ((char const *, char **, int));
+# endif
+# ifndef HAVE_DECL_STRTOULL
+"this configure-time declaration test was not run"
+# endif
+# if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG
+unsigned long long strtoull PARAMS ((char const *, char **, int));
+# endif
+
+#else
+
+# ifndef HAVE_DECL_STRTOL
+"this configure-time declaration test was not run"
+# endif
+# if !HAVE_DECL_STRTOL
+long strtol PARAMS ((char const *, char **, int));
+# endif
+# ifndef HAVE_DECL_STRTOLL
+"this configure-time declaration test was not run"
+# endif
+# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG
+long long strtoll PARAMS ((char const *, char **, int));
+# endif
+#endif
+
+#ifdef UNSIGNED
+# undef HAVE_LONG_LONG
+# define HAVE_LONG_LONG HAVE_UNSIGNED_LONG_LONG
+# define INT uintmax_t
+# define strtoimax strtoumax
+# define strtol strtoul
+# define strtoll strtoull
+#else
+# define INT intmax_t
+#endif
+
+INT
+strtoimax (char const *ptr, char **endptr, int base)
+{
+#if HAVE_LONG_LONG
+  verify (size_is_that_of_long_or_long_long,
+         (sizeof (INT) == sizeof (long)
+          || sizeof (INT) == sizeof (long long)));
+
+  if (sizeof (INT) != sizeof (long))
+    return strtoll (ptr, endptr, base);
+#else
+  verify (size_is_that_of_long,
+         sizeof (INT) == sizeof (long));
+#endif
+
+  return strtol (ptr, endptr, base);
+}
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/strtol.c 
sharutils-4.3.71-off_t/lib/strtol.c
--- sharutils-4.3.71-haible/lib/strtol.c        1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/strtol.c 2000-08-07 15:44:09.000000000 +0000
@@ -0,0 +1,472 @@
+/* Convert string representation of a number into an integer value.
+   Copyright (C) 1991, 92, 94, 95, 96, 97, 98, 99 Free Software Foundation, 
Inc.
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to address@hidden
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option) any
+   later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define USE_NUMBER_GROUPING
+# define STDC_HEADERS
+# define HAVE_LIMITS_H
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef NULL
+#  define NULL 0
+# endif
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+# include "../locale/localeinfo.h"
+#endif
+
+/* Nonzero if we are defining `strtoul' or `strtoull', operating on
+   unsigned integers.  */
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define INT unsigned LONG int
+#endif
+
+/* Determine the name.  */
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# if UNSIGNED
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol __wcstoull_l
+#   else
+#    define strtol __wcstoul_l
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol __strtoull_l
+#   else
+#    define strtol __strtoul_l
+#   endif
+#  endif
+# else
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol __wcstoll_l
+#   else
+#    define strtol __wcstol_l
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol __strtoll_l
+#   else
+#    define strtol __strtol_l
+#   endif
+#  endif
+# endif
+#else
+# if UNSIGNED
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol wcstoull
+#   else
+#    define strtol wcstoul
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol strtoull
+#   else
+#    define strtol strtoul
+#   endif
+#  endif
+# else
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol wcstoll
+#   else
+#    define strtol wcstol
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol strtoll
+#   endif
+#  endif
+# endif
+#endif
+
+/* If QUAD is defined, we are defining `strtoll' or `strtoull',
+   operating on `long long int's.  */
+#ifdef QUAD
+# define LONG long long
+# define STRTOL_LONG_MIN LONG_LONG_MIN
+# define STRTOL_LONG_MAX LONG_LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_LONG_MAX
+
+/* The extra casts work around common compiler bugs,
+   e.g. Cray C 5.0.3.0 when t == time_t.  */
+# ifndef TYPE_SIGNED
+#  define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+# endif
+# ifndef TYPE_MINIMUM
+#  define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
+                               ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
+                               : (t) 0))
+# endif
+# ifndef TYPE_MAXIMUM
+#  define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+# endif
+
+# ifndef ULONG_LONG_MAX
+#  define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
+# endif
+# ifndef LONG_LONG_MAX
+#  define LONG_LONG_MAX TYPE_MAXIMUM (long long int)
+# endif
+# ifndef LONG_LONG_MIN
+#  define LONG_LONG_MIN TYPE_MINIMUM (long long int)
+# endif
+
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+   /* Work around gcc bug with using this constant.  */
+   static const unsigned long long int maxquad = ULONG_LONG_MAX;
+#  undef STRTOL_ULONG_MAX
+#  define STRTOL_ULONG_MAX maxquad
+# endif
+#else
+# define LONG long
+
+# ifndef ULONG_MAX
+#  define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
+# endif
+# ifndef LONG_MAX
+#  define LONG_MAX ((long int) (ULONG_MAX >> 1))
+# endif
+# define STRTOL_LONG_MIN LONG_MIN
+# define STRTOL_LONG_MAX LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_MAX
+#endif
+
+
+/* We use this code also for the extended locale handling where the
+   function gets as an additional argument the locale which has to be
+   used.  To access the values we have to redefine the _NL_CURRENT
+   macro.  */
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# undef _NL_CURRENT
+# define _NL_CURRENT(category, item) \
+  (current->values[_NL_ITEM_INDEX (item)].string)
+# define LOCALE_PARAM , loc
+# define LOCALE_PARAM_DECL __locale_t loc;
+#else
+# define LOCALE_PARAM
+# define LOCALE_PARAM_DECL
+#endif
+
+#if defined _LIBC || defined HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+#ifdef USE_WIDE_CHAR
+# include <wctype.h>
+# define L_(Ch) L##Ch
+# define UCHAR_TYPE wint_t
+# define STRING_TYPE wchar_t
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define ISSPACE(Ch) __iswspace_l ((Ch), loc)
+#  define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
+#  define TOUPPER(Ch) __towupper_l ((Ch), loc)
+# else
+#  define ISSPACE(Ch) iswspace (Ch)
+#  define ISALPHA(Ch) iswalpha (Ch)
+#  define TOUPPER(Ch) towupper (Ch)
+# endif
+#else
+# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
+#  define IN_CTYPE_DOMAIN(c) 1
+# else
+#  define IN_CTYPE_DOMAIN(c) isascii(c)
+# endif
+# define L_(Ch) Ch
+# define UCHAR_TYPE unsigned char
+# define STRING_TYPE char
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define ISSPACE(Ch) __isspace_l ((Ch), loc)
+#  define ISALPHA(Ch) __isalpha_l ((Ch), loc)
+#  define TOUPPER(Ch) __toupper_l ((Ch), loc)
+# else
+#  define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch))
+#  define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch))
+#  define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch))
+# endif
+#endif
+
+/* For compilers which are ansi but don't define __STDC__, like SGI
+   Irix-4.0.5 cc, also check whether PROTOTYPES is defined. */
+#if defined (__STDC__) || defined (PROTOTYPES)
+# define INTERNAL(X) INTERNAL1(X)
+# define INTERNAL1(X) __##X##_internal
+# define WEAKNAME(X) WEAKNAME1(X)
+#else
+# define INTERNAL(X) __/**/X/**/_internal
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+/* This file defines a function to check for correct grouping.  */
+# include "grouping.h"
+#endif
+
+
+
+/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
+   If BASE is 0 the base is determined by the presence of a leading
+   zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
+   If BASE is < 2 or > 36, it is reset to 10.
+   If ENDPTR is not NULL, a pointer to the character after the last
+   one converted is stored in *ENDPTR.  */
+
+INT
+INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
+     const STRING_TYPE *nptr;
+     STRING_TYPE **endptr;
+     int base;
+     int group;
+     LOCALE_PARAM_DECL
+{
+  int negative;
+  register unsigned LONG int cutoff;
+  register unsigned int cutlim;
+  register unsigned LONG int i;
+  register const STRING_TYPE *s;
+  register UCHAR_TYPE c;
+  const STRING_TYPE *save, *end;
+  int overflow;
+
+#ifdef USE_NUMBER_GROUPING
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+  struct locale_data *current = loc->__locales[LC_NUMERIC];
+# endif
+  /* The thousands character of the current locale.  */
+  wchar_t thousands = L'\0';
+  /* The numeric grouping specification of the current locale,
+     in the format described in <locale.h>.  */
+  const char *grouping;
+
+  if (group)
+    {
+      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+      if (*grouping <= 0 || *grouping == CHAR_MAX)
+       grouping = NULL;
+      else
+       {
+         /* Figure out the thousands separator character.  */
+# if defined _LIBC || defined _HAVE_BTOWC
+         thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP));
+         if (thousands == WEOF)
+           thousands = L'\0';
+# endif
+         if (thousands == L'\0')
+           grouping = NULL;
+       }
+    }
+  else
+    grouping = NULL;
+#endif
+
+  if (base < 0 || base == 1 || base > 36)
+    {
+      __set_errno (EINVAL);
+      return 0;
+    }
+
+  save = s = nptr;
+
+  /* Skip white space.  */
+  while (ISSPACE (*s))
+    ++s;
+  if (*s == L_('\0'))
+    goto noconv;
+
+  /* Check for a sign.  */
+  if (*s == L_('-'))
+    {
+      negative = 1;
+      ++s;
+    }
+  else if (*s == L_('+'))
+    {
+      negative = 0;
+      ++s;
+    }
+  else
+    negative = 0;
+
+  /* Recognize number prefix and if BASE is zero, figure it out ourselves.  */
+  if (*s == L_('0'))
+    {
+      if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
+       {
+         s += 2;
+         base = 16;
+       }
+      else if (base == 0)
+       base = 8;
+    }
+  else if (base == 0)
+    base = 10;
+
+  /* Save the pointer so we can check later if anything happened.  */
+  save = s;
+
+#ifdef USE_NUMBER_GROUPING
+  if (group)
+    {
+      /* Find the end of the digit string and check its grouping.  */
+      end = s;
+      for (c = *end; c != L_('\0'); c = *++end)
+       if ((wchar_t) c != thousands
+           && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
+           && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
+         break;
+      if (*s == thousands)
+       end = s;
+      else
+       end = correctly_grouped_prefix (s, end, thousands, grouping);
+    }
+  else
+#endif
+    end = NULL;
+
+  cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;
+  cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;
+
+  overflow = 0;
+  i = 0;
+  for (c = *s; c != L_('\0'); c = *++s)
+    {
+      if (s == end)
+       break;
+      if (c >= L_('0') && c <= L_('9'))
+       c -= L_('0');
+      else if (ISALPHA (c))
+       c = TOUPPER (c) - L_('A') + 10;
+      else
+       break;
+      if ((int) c >= base)
+       break;
+      /* Check for overflow.  */
+      if (i > cutoff || (i == cutoff && c > cutlim))
+       overflow = 1;
+      else
+       {
+         i *= (unsigned LONG int) base;
+         i += c;
+       }
+    }
+
+  /* Check if anything actually happened.  */
+  if (s == save)
+    goto noconv;
+
+  /* Store in ENDPTR the address of one character
+     past the last character we converted.  */
+  if (endptr != NULL)
+    *endptr = (STRING_TYPE *) s;
+
+#if !UNSIGNED
+  /* Check for a value that is within the range of
+     `unsigned LONG int', but outside the range of `LONG int'.  */
+  if (overflow == 0
+      && i > (negative
+             ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
+             : (unsigned LONG int) STRTOL_LONG_MAX))
+    overflow = 1;
+#endif
+
+  if (overflow)
+    {
+      __set_errno (ERANGE);
+#if UNSIGNED
+      return STRTOL_ULONG_MAX;
+#else
+      return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
+#endif
+    }
+
+  /* Return the result of the appropriate sign.  */
+  return negative ? -i : i;
+
+noconv:
+  /* We must handle a special case here: the base is 0 or 16 and the
+     first two characters are '0' and 'x', but the rest are no
+     hexadecimal digits.  This is no error case.  We return 0 and
+     ENDPTR points to the `x`.  */
+  if (endptr != NULL)
+    {
+      if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
+         && save[-2] == L_('0'))
+       *endptr = (STRING_TYPE *) &save[-1];
+      else
+       /*  There was no number to convert.  */
+       *endptr = (STRING_TYPE *) nptr;
+    }
+
+  return 0L;
+}
+
+/* External user entry point.  */
+
+#if _LIBC - 0 == 0
+# undef PARAMS
+# if defined (__STDC__) && __STDC__
+#  define PARAMS(Args) Args
+# else
+#  define PARAMS(Args) ()
+# endif
+
+/* Prototype.  */
+INT strtol PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr, int base));
+#endif
+
+
+INT
+#ifdef weak_function
+weak_function
+#endif
+strtol (nptr, endptr, base LOCALE_PARAM)
+     const STRING_TYPE *nptr;
+     STRING_TYPE **endptr;
+     int base;
+     LOCALE_PARAM_DECL
+{
+  return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
+}
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/strtoll.c 
sharutils-4.3.71-off_t/lib/strtoll.c
--- sharutils-4.3.71-haible/lib/strtoll.c       1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/strtoll.c        2001-08-26 07:28:06.000000000 
+0000
@@ -0,0 +1,33 @@
+/* Function to parse a `long long int' from text.
+   Copyright (C) 1995, 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#define QUAD   1
+
+#include "strtol.c"
+
+#ifdef _LIBC
+# ifdef SHARED
+#  include <shlib-compat.h>
+
+#  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
+#  endif
+
+# endif
+weak_alias (strtoll, strtoq)
+#endif
diff -N'aurpx*~' sharutils-4.3.71-haible/lib/system.h 
sharutils-4.3.71-off_t/lib/system.h
--- sharutils-4.3.71-haible/lib/system.h        2002-06-24 15:16:38.000000000 
+0000
+++ sharutils-4.3.71-off_t/lib/system.h 2002-07-13 04:50:06.891137000 +0000
@@ -44,6 +44,14 @@ extern char *alloca ();
 # define voidstar char *
 #endif
 
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#if !HAVE_DECL_STRTOIMAX && !defined strtoimax
+intmax_t strtoimax ();
+#endif
+
 #ifdef STDC_HEADERS
 # include <stdlib.h>
 #else
@@ -161,6 +169,19 @@ FILE *fdopen ();
 long ftell ();
 FILE *popen ();
 
+#if ! HAVE_FSEEKO
+# ifndef fseeko
+#  define fseeko fseek
+# endif
+# ifndef ftello
+#  define ftello ftell
+# endif
+#endif
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif
+
 /* GNU small library functions.  */
 
 #ifndef __P
diff -N'aurpx*~' sharutils-4.3.71-haible/m4/Makefile.am 
sharutils-4.3.71-off_t/m4/Makefile.am
--- sharutils-4.3.71-haible/m4/Makefile.am      2002-07-07 10:28:39.000000000 
+0000
+++ sharutils-4.3.71-off_t/m4/Makefile.am       2002-07-11 04:37:02.165612000 
+0000
@@ -1,3 +1,4 @@
-EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4    \
-lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 error.m4  \
-malloc.m4 realloc.m4 sharutils.m4
+EXTRA_DIST = codeset.m4 error.m4 gettext.m4 glibc21.m4 iconv.m4                
\
+inttypes.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4            \
+lib-prefix.m4 longlong.m4 malloc.m4 progtest.m4 realloc.m4             \
+sharutils.m4 xstrtoimax.m4
diff -N'aurpx*~' sharutils-4.3.71-haible/m4/inttypes.m4 
sharutils-4.3.71-off_t/m4/inttypes.m4
--- sharutils-4.3.71-haible/m4/inttypes.m4      1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/m4/inttypes.m4       2001-09-03 18:45:00.000000000 
+0000
@@ -0,0 +1,32 @@
+#serial 6
+
+dnl From Paul Eggert.
+
+AC_PREREQ(2.52)
+
+# Define intmax_t to long or long long if <inttypes.h> doesn't define.
+
+AC_DEFUN([jm_AC_TYPE_INTMAX_T],
+[
+  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
+  AC_CHECK_TYPE(intmax_t, ,
+    [test $ac_cv_type_long_long = yes \
+       && ac_type='long long' \
+       || ac_type='long'
+     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
+       [Define to widest signed type if <inttypes.h> doesn't define.])])
+])
+
+# Define uintmax_t to unsigned long or unsigned long long
+# if <inttypes.h> doesn't define.
+
+AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
+[
+  AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
+  AC_CHECK_TYPE(uintmax_t, ,
+    [test $ac_cv_type_unsigned_long_long = yes \
+       && ac_type='unsigned long long' \
+       || ac_type='unsigned long'
+     AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
+       [Define to widest unsigned type if <inttypes.h> doesn't define.])])
+])
diff -N'aurpx*~' sharutils-4.3.71-haible/m4/longlong.m4 
sharutils-4.3.71-off_t/m4/longlong.m4
--- sharutils-4.3.71-haible/m4/longlong.m4      1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/m4/longlong.m4       2001-08-18 15:55:38.000000000 
+0000
@@ -0,0 +1,35 @@
+#serial 2
+
+dnl From Paul Eggert.
+
+# Define HAVE_LONG_LONG if 'long long' works.
+
+AC_DEFUN([jm_AC_TYPE_LONG_LONG],
+[
+  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
+  [AC_TRY_LINK([long long ll = 1; int i = 63;],
+    [long long llmax = (long long) -1;
+     return ll << i | ll >> i | llmax / ll | llmax % ll;],
+    ac_cv_type_long_long=yes,
+    ac_cv_type_long_long=no)])
+  if test $ac_cv_type_long_long = yes; then
+    AC_DEFINE(HAVE_LONG_LONG, 1,
+      [Define if you have the long long type.])
+  fi
+])
+
+# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
+
+AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
+[
+  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
+  [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
+    [unsigned long long ullmax = (unsigned long long) -1;
+     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
+    ac_cv_type_unsigned_long_long=yes,
+    ac_cv_type_unsigned_long_long=no)])
+  if test $ac_cv_type_unsigned_long_long = yes; then
+    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
+      [Define if you have the unsigned long long type.])
+  fi
+])
diff -N'aurpx*~' sharutils-4.3.71-haible/m4/xstrtoimax.m4 
sharutils-4.3.71-off_t/m4/xstrtoimax.m4
--- sharutils-4.3.71-haible/m4/xstrtoimax.m4    1970-01-01 00:00:00.000000000 
+0000
+++ sharutils-4.3.71-off_t/m4/xstrtoimax.m4     2001-09-28 17:53:07.000000000 
+0000
@@ -0,0 +1,41 @@
+#serial 2
+dnl Cloned from xstrtoumax.m4.  Keep these files in sync.
+
+# autoconf tests required for use of xstrtoimax.c
+
+AC_DEFUN([jm_AC_PREREQ_XSTRTOIMAX],
+[
+  AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
+  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
+  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
+  AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
+  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoimax, strtoumax])
+  AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
+
+  AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
+    jm_cv_func_strtoimax_macro,
+    AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
+#ifdef strtoimax
+ inttypes_h_defines_strtoimax
+#endif],
+      jm_cv_func_strtoimax_macro=yes,
+      jm_cv_func_strtoimax_macro=no))
+
+  if test "$jm_cv_func_strtoimax_macro" != yes; then
+    AC_REPLACE_FUNCS(strtoimax)
+  fi
+
+  dnl Only the replacement strtoimax invokes strtol and strtoll,
+  dnl so we need the replacements only if strtoimax does not exist.
+  case "$jm_cv_func_strtoimax_macro,$ac_cv_func_strtoimax" in
+    no,no)
+      AC_REPLACE_FUNCS(strtol)
+
+      dnl We don't need (and can't compile) the replacement strtoll
+      dnl unless the type `long long' exists.
+      if test "$ac_cv_type_long_long" = yes; then
+       AC_REPLACE_FUNCS(strtoll)
+      fi
+      ;;
+  esac
+])
diff -N'aurpx*~' sharutils-4.3.71-haible/src/shar.c 
sharutils-4.3.71-off_t/src/shar.c
--- sharutils-4.3.71-haible/src/shar.c  2002-07-17 05:48:51.606552000 +0000
+++ sharutils-4.3.71-off_t/src/shar.c   2002-07-13 04:41:54.811666000 +0000
@@ -67,6 +67,27 @@ static const char *cut_mark_line
 
 struct tm *localtime ();
 
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+/* Determine whether an integer type is signed, and its bounds.
+   This code assumes two's (or one's!) complement with no holes.  */
+
+/* The extra casts work around common compiler bugs,
+   e.g. Cray C 5.0.3.0 when t == time_t.  */
+#ifndef TYPE_SIGNED
+# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+#endif
+#ifndef TYPE_MINIMUM
+# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
+                              ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
+                              : (t) 0))
+#endif
+#ifndef TYPE_MAXIMUM
+# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+#endif
+
 #if !NO_WALKTREE
 
 /* Declare directory reading routines and structures.  */
@@ -101,6 +122,7 @@ struct dirent *readdir ();
 /* Option variables.  */
 
 #include "getopt.h"
+#include "inttostr.h"
 #include "md5.h"
 
 /* No Brown-Shirt mode.  */
@@ -188,8 +210,8 @@ static int debugging_mode = 0;
 /* Split files in the middle.  */
 static int split_file_mode = 0;
 
-/* File size limit in kilobytes.  */
-static unsigned file_size_limit = 0;
+/* File size limit in bytes.  */
+static off_t file_size_limit = 0;
 
 /* Other global variables.  */
 
@@ -209,7 +231,7 @@ static FILE *output = NULL;
 static off_t archive_type_position;
 
 /* Position for first file in the shar file.  */
-static long first_file_position;
+static off_t first_file_position;
 
 /* Base for output filename.  FIXME: No fix limit in GNU... */
 static char output_base_name[50];
@@ -236,7 +258,11 @@ static int sharpid;
 
 #if DEBUG
 # define DEBUG_PRINT(Format, Value) \
-    if (debugging_mode) printf(Format, Value)
+    if (debugging_mode)                                        \
+      {                                                        \
+       char buf[INT_BUFSIZE_BOUND (off_t)];            \
+       printf (Format, offtostr (Value, buf));         \
+      }
 #else
 # define DEBUG_PRINT(Format, Value)
 #endif
@@ -706,7 +732,8 @@ generate_one_header_line (local_name, re
      const char *local_name;
      const char *restore_name;
 {
-  fprintf (output, "# %6ld %s %s\n", (long) struct_stat.st_size,
+  char buf[INT_BUFSIZE_BOUND (off_t)];
+  fprintf (output, "# %6s %s %s\n", offtostr (struct_stat.st_size, buf),
           mode_string (struct_stat.st_mode), restore_name);
   return 0;
 }
@@ -838,7 +865,7 @@ generate_full_header (argc, argv)
       /* May be split, explain.  */
 
       fputs ("#\n", output);
-      archive_type_position = ftell (output);
+      archive_type_position = ftello (output);
       fprintf (output, "%-75s\n%-75s\n", "#", "#");
     }
 
@@ -901,8 +928,7 @@ shar (local_name, restore_name)
 {
   char buffer[BUFSIZ];
   FILE *input;
-  long current_size;
-  long remaining_size;
+  off_t remaining_size;
   int split_flag = 0;          /* file split flag */
   const char *file_type;       /* text of binary */
   const char *file_type_remote;        /* text or binary, avoiding locale */
@@ -925,9 +951,9 @@ shar (local_name, restore_name)
 
   if (file_size_limit)
     {
-      current_size = ftell (output);
-      remaining_size = (file_size_limit * 1024L) - current_size;
-      DEBUG_PRINT (_("In shar: remaining size %ld\n"), remaining_size);
+      off_t current_size = ftello (output);
+      remaining_size = file_size_limit - current_size - 1024;
+      DEBUG_PRINT (_("In shar: remaining size %s\n"), remaining_size);
 
       if (!split_file_mode && current_size > first_file_position
          && ((uuencoded_file_mode
@@ -938,8 +964,8 @@ shar (local_name, restore_name)
 
          /* Change to another file.  */
 
-         DEBUG_PRINT (_("New file, remaining %ld, "), remaining_size);
-         DEBUG_PRINT (_("Limit still %d\n"), file_size_limit);
+         DEBUG_PRINT (_("New file, remaining %s, "), remaining_size);
+         DEBUG_PRINT (_("Limit still %s\n"), file_size_limit);
 
          /* Close the "&&" and report an error if any of the above
             failed.  */
@@ -991,7 +1017,7 @@ exit 0\n",
 
          generate_configure ();
 
-         first_file_position = ftell (output);
+         first_file_position = ftello (output);
        }
     }
   else
@@ -1313,17 +1339,17 @@ else\n",
          if (split_file_mode
 #if MSDOS
              /* 1 extra for CR.  */
-             && (remaining_size -= (int) strlen (buffer) + 1) < 0
+             && (remaining_size -= strlen (buffer) + 1) < 0
 #else
-             && (remaining_size -= (int) strlen (buffer)) < 0
+             && (remaining_size -= strlen (buffer)) < 0
 #endif
              )
            {
 
              /* Change to another file.  */
 
-             DEBUG_PRINT (_("New file, remaining %ld, "), remaining_size);
-             DEBUG_PRINT (_("Limit still %d\n"), file_size_limit);
+             DEBUG_PRINT (_("New file, remaining %s, "), remaining_size);
+             DEBUG_PRINT (_("Limit still %s\n"), file_size_limit);
 
              fprintf (output, "%s\n", here_delimiter);
 
@@ -1365,7 +1391,7 @@ exit 0\n",
 
                  /* Rewrite the info lines on the first header.  */
 
-                 fseek (output, archive_type_position, 0);
+                 fseeko (output, archive_type_position, SEEK_SET);
                  fprintf (output, "%-75s\n%-75s\n",
                           "\
 # This is part 1 of a multipart archive.",
@@ -1445,7 +1471,7 @@ else\n",
                fprintf (output, "_sh%05d/uue &&\n", sharpid);
              else
                fprintf (output, "%s &&\n", restore_name);
-             remaining_size = file_size_limit * 1024L;
+             remaining_size = file_size_limit;
              split_flag = 1;
            }
        }
@@ -1813,6 +1839,20 @@ static const struct option long_options[
   { NULL, 0, NULL, 0 },
 };
 
+/* Limit file sizes to LIMIT KiB.  */
+
+static void
+set_file_size_limit (char const *limit)
+{
+  char *numend;
+  intmax_t lim = strtoimax (limit, &numend, 10);
+  if (*numend || ! (0 < lim && lim <= TYPE_MAXIMUM (off_t) / 1024))
+    error (EXIT_FAILURE, 0, "invalid file size limit `%s'", limit);
+  lim *= 1024;
+  if (! file_size_limit || lim < file_size_limit)
+    file_size_limit = lim;
+}
+
 /*---.
 | ?  |
 `---*/
@@ -1864,11 +1904,10 @@ main (argc, argv)
        break;
 
       case 'L':
-       if (file_size_limit = atoi (optarg), file_size_limit > 1)
-         file_size_limit--;
-       split_file_mode = file_size_limit != 0;
+       set_file_size_limit (optarg);
+       split_file_mode = 1;
        inhibit_piping_mode = 1;
-       DEBUG_PRINT (_("Hard limit %dk\n"), file_size_limit);
+       DEBUG_PRINT (_("Hard limit %s\n"), file_size_limit);
        break;
 
       case 'M':
@@ -1936,10 +1975,9 @@ This system doesn't support -Z ('compres
        break;
 
       case 'l':
-       if (file_size_limit = atoi (optarg), file_size_limit > 1)
-         file_size_limit--;
+       set_file_size_limit (optarg);
        split_file_mode = 0;
-       DEBUG_PRINT (_("Soft limit %dk\n"), file_size_limit);
+       DEBUG_PRINT (_("Soft limit %s\n"), file_size_limit);
        break;
 
       case 'm':
@@ -2143,7 +2181,7 @@ shar_wish=\n",
             output);
     }
 
-  first_file_position = ftell (output);
+  first_file_position = ftello (output);
 
   /* Process positional parameters and files.  */
 
diff -N'aurpx*~' sharutils-4.3.71-haible/src/unshar.c 
sharutils-4.3.71-off_t/src/unshar.c
--- sharutils-4.3.71-haible/src/unshar.c        2002-07-06 15:24:22.000000000 
+0000
+++ sharutils-4.3.71-off_t/src/unshar.c 2002-07-13 08:12:02.237864000 +0000
@@ -141,14 +141,14 @@ find_archive (name, file, start)
   static char res1[BUFSIZ], res2[BUFSIZ], res3[BUFSIZ], res4[BUFSIZ];
   static char *result[] = {res1, res2, res3, res4};
 
-  fseek (file, start, 0);
+  fseeko (file, start, SEEK_SET);
 
   while (1)
     {
 
       /* Record position of the start of this line.  */
 
-      position = ftell (file);
+      position = ftello (file);
 
       /* Read next line, fail if no more and no previous process.  */
 
@@ -185,7 +185,7 @@ find_archive (name, file, start)
          || starting_with (buffer, "cat ")
          || starting_with (buffer, "if "))
        {
-         fseek (file, position, 0);
+         fseeko (file, position, SEEK_SET);
          return 1;
        }
 
@@ -203,7 +203,7 @@ find_archive (name, file, start)
 
          while (1)
            {
-             position = ftell (file);
+             position = ftello (file);
 
              if (!fgets (buffer, BUFSIZ, file))
                {
@@ -222,7 +222,7 @@ find_archive (name, file, start)
          if (*buffer == '#' || *buffer == ':'
              || (('a' <= *buffer) && ('z' >= *buffer)))
            {
-             fseek (file, position, 0);
+             fseeko (file, position, SEEK_SET);
              return 1;
            }
 
@@ -283,7 +283,7 @@ unarchive_shar_file (name, file)
          pclose (shell_process);
 
          if (more_to_read)
-           current_position = ftell (file);
+           current_position = ftello (file);
          else
            break;
        }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]