.\" As its sole author, I explicitly place this file in the public domain. .\" It may be used by anyone in any way for any purpose, though I would .\" appreciate credit where it's due. .\" der Mouse, mouse@rodents.montreal.qc.ca, 1999-10-13 .Dd October 13, 1999 .Dt LSEEK 1 .Os NetBSD 1.4 .Sh NAME .Nm lseek .Nd stream repositioning utility .Sh SYNOPSIS .Nm .Op Fl set .Op Fl cur .Op Fl end .Op Fl incr .Op Fl xtnd .Ar fd .Ar offset .Sh DESCRIPTION .Nm is a small tool to reposition streams. It is just a command-line interface to .Xr lseek 2 . It is normally used to position a file descriptor as desired before running some other program (such as .Xr dd 1 ) , as in .Dl % (lseek 0 8192; dd bs=1048576 of=...) < /dev/... .Pp The .Ar fd argument specifies the file descriptor the seek is done on, such as 0 for standard input or 1 for standard output. The .Ar offset argument specifies the offset to seek to. By default, the third argument to .Xr lseek 2 is .Dv SEEK_SET ; to change this, one of .Fl set , .Fl cur , or .Fl end may be given, to specify .Dv SEEK_SET , .Dv SEEK_CUR , or .Dv SEEK_END , respectively. (The .Fl incr and .Fl xtnd names are for compatability with the old .Dv L_INCR and .Dv L_XTND names for .Dv SEEK_CUR and .Dv SEEK_END ; .Fl incr is equivalent to .Fl cur and .Fl xtnd is equivalent to .Fl end . ) If conflicting specifiers are given, the one appearing last on the command line wins. .Pp .Fl q specifies that .Nm is to run quietly. When this is given and .Xr lseek 2 fails, instead of printing an error and exiting with status 2, .Nm prints nothing and exits with exit status equal to the system error number returned (see .Xr errno 2 ) . With .Fl q , command-line errors produce a complaint on standard error and an exit status of .Dv EINVAL . (Note that this applies only to errors occurring after the .Fl q option itself.) Without .Fl q , command-line errors provoke an exit status of 1 (and a complaint on standard error) and .Xr lseek 2 failures produce a complaint on standard error and exit status 2. In all cases, if there is no error, the exit status is zero and nothing is printed. .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .