FreeBSD Bugzilla – Attachment 5483 Details for
Bug 13070
line(1) as required by Unix 98
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.shar
file.shar (text/plain), 4.61 KB, created by
howardjp
on 1999-08-11 13:30:00 UTC
(
hide
)
Description:
file.shar
Filename:
MIME Type:
Creator:
howardjp
Created:
1999-08-11 13:30:00 UTC
Size:
4.61 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># Makefile ># line.1 ># line.c ># >echo x - Makefile >sed 's/^X//' >Makefile << 'END-of-Makefile' >XPROG=line >X >X.include <bsd.prog.mk>END-of-Makefile >echo x - line.1 >sed 's/^X//' >line.1 << 'END-of-line.1' >X.\" Copyright (c) 1999 James Howard >X.\" All rights reserved. >X.\" >X.\" Redistribution and use in source and binary forms, with or without >X.\" modification, are permitted provided that the following conditions >X.\" are met: >X.\" 1. Redistributions of source code must retain the above copyright >X.\" notice, this list of conditions and the following disclaimer. >X.\" 2. Redistributions in binary form must reproduce the above copyright >X.\" notice, this list of conditions and the following disclaimer in the >X.\" documentation and/or other materials provided with the distribution. >X.\" >X.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND >X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >X.\" SUCH DAMAGE. >X.\" >X.\" >X.\" $Id$ >X.\" >X.Dd August 9, 1999 >X.Dt LINE 1 >X.Os >X.Sh NAME >X.Nm line >X.Nd read and output one line >X.Sh SYNOPSIS >X.Nm >X.Sh DESCRIPTION >XThe >X.Nm >Xutility reads one line text up to and including a >Xnew line from the standard input and prints that line >Xto the standard output. It always prints at least >Xa new line. >X.Pp >XThis utility has been depreciated and users should >Xmigrate to the >X.Xr read 1 >Xutility. >X.Sh DIAGNOSTICS >XThe >X.Nm >Xutility returns 1 if an end of file condition is >Xreached on the standard input; 0 is returned otherwise. >X.Sh SEE ALSO >X.Xr csh 1 , >X.Xr sh 1 >X.Sh STANDARDS >XThe >X.Nm >Xutility is expected to be XPG5 compliant. >END-of-line.1 >echo x - line.c >sed 's/^X//' >line.c << 'END-of-line.c' >X/*- >X * Copyright (c) 1999 James Howard >X * All rights reserved. >X * >X * Redistribution and use in source and binary forms, with or without >X * modification, are permitted provided that the following conditions >X * are met: >X * 1. Redistributions of source code must retain the above copyright >X * notice, this list of conditions and the following disclaimer. >X * 2. Redistributions in binary form must reproduce the above copyright >X * notice, this list of conditions and the following disclaimer in the >X * documentation and/or other materials provided with the distribution. >X * >X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND >X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >X * SUCH DAMAGE. >X * >X * $Id$ >X */ >X >X#include <stdio.h> >X >X/* >X * An XPG5 compliant implementation of line(1). The line utility reads a >X * line of text from the standard input and prints it to the standard output. >X */ >X >Xint >Xmain(void) >X{ >X char *l; >X int len; >X >X /* Grab a line and print it. */ >X l = fgetln(stdin, &len); >X (void) fwrite(l, len, 1, stdout); >X >X /* >X * Check for the special condition that EOF was encountered on the >X * standard input and that a newline was not the last character in >X * the buffer. If it is not, print one. >X */ >X if (l[len - 1] != '\n') >X fputc('\n', stdout); >X >X /* >X * Find out if we received EOF on the standard input and return that >X * as the exit status. >X */ >X return feof(stdin); >X} >END-of-line.c >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13070
: 5483