rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit aea9f2fdebb7daf2c0b16af9430bb05a07ab86b1
parent dca1eabff1b5fd37367a5921153c51a694063bcb
Author: tjg <tjg>
Date:   Wed, 31 Oct 2001 12:30:00 +0000

  Feature: large file support (thanks Scott Schwartz, Chris
  Siebenmann).

Diffstat:
MINSTALL | 22++++++++++++++++++++++
Mtrip.rc | 12++++++++++++
Mtripping.c | 23+++++++++++++++++++++++
3 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/INSTALL b/INSTALL @@ -11,6 +11,7 @@ need to configure, build, test, and install rc. This will build rc in the source directory (see below for details on how to build rc in a different directory). + BUILD AND CONFIGURATION OPTIONS There are lots of options you can give to configure to modify rc's @@ -134,6 +135,25 @@ do this. This will produce some output, and should end with "trip is complete". If the trip instead ends with "trip took a wrong turn..." please contact the maintainer. + +LARGE FILE SUPPORT + +This release of rc supports large files (i.e. with 64 bit offsets), on +systems where the configure script can figure out how to enable this. +When you run `make trip' (you always run `make trip', right?) the +penultimate line of output (before "trip complete") reports whether +large file support seems to be working or not. + +Large file support is a function of file systems, as well as +applications. For example, NFS and tmpfs file systems often do not +support large files. The test used by `make trip' is therefore +subject to false negatives. That is, a report that "large file +support seems NOT to be working" may be erroneous. To minimise this +possibility, the test is performed both in the current directory +(where you built rc) and /tmp. (I don't think there's any scenario +where a false positive can be reported.) + + BUILDING IN ANOTHER DIRECTORY If you have a suitable `make', you can build rc in a different directory @@ -142,6 +162,7 @@ are building rc for multiple architectures. All you need do is specify the path to the configure script in the first step. Suitable `make's include GNU, HP-UX, and SunOS, but not Irix, nor Ultrix, nor UnixWare. + COMPILATION WARNINGS If your C compiler is gcc, the option `-Wall' is turned on. This may @@ -162,6 +183,7 @@ incorrect declaration of `getgroups()' in those systems' header files. Any other warnings should be reported to the maintainer. + OLD C rc needs an ISO C (89) compiler, or at least one that has a reasonable diff --git a/trip.rc b/trip.rc @@ -586,3 +586,15 @@ eval z^`{whatis -v x} fn x {echo x.y $(x.y)} ~ ``''{whatis -f x} 'fn x {echo x.y $''x.y''} ' || fail sneaky parens bug + +# large file support + +# this is, by no means, an exhaustive test. since particular file +# systems do, or do not, support large files, we try it both in the +# build directory and /tmp. + +if (./tripping l > big.$pid >[2] /dev/null || + ./tripping l > /tmp/big.$pid >[2] /dev/null) { + echo large file support seems to work +} else echo large file support seems NOT to work - see INSTALL file +rm -f big.$pid /tmp/big.$pid diff --git a/tripping.c b/tripping.c @@ -1,7 +1,12 @@ /* This is an auxiliary test program for rc. */ +#include "config.h" + #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <unistd.h> static void out0(void) { putchar('t'); putchar('r'); @@ -14,6 +19,21 @@ static void ctrl_a(void) { puts("a\001ab\002b"); } +static void large(void) { + char c = 'c'; + +#define LARGE (((off_t)1<<33)+1) + + if (lseek(1, LARGE, SEEK_SET) != LARGE) { + perror("lseek"); + exit(1); + } + if (write(1, &c, 1) == -1) { + perror("write"); + exit(1); + } +} + static void makenonblock(void) { int flags; @@ -32,6 +52,9 @@ int main(int argc, char **argv) { case 'a': ctrl_a(); break; + case 'l': + large(); + break; case 'n': makenonblock(); break;