Deleted Added
full compact
write.c (50477) write.c (87682)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
38
39__FBSDID("$FreeBSD: head/usr.bin/write/write.c 87682 2001-12-11 22:34:38Z markm $");
40
37#ifndef lint
38static const char copyright[] =
39"@(#) Copyright (c) 1989, 1993\n\
40 The Regents of the University of California. All rights reserved.\n";
41#ifndef lint
42static const char copyright[] =
43"@(#) Copyright (c) 1989, 1993\n\
44 The Regents of the University of California. All rights reserved.\n";
41#endif /* not lint */
45#endif
42
43#ifndef lint
46
47#ifndef lint
44#if 0
45static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93";
48static const char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93";
46#endif
49#endif
47static const char rcsid[] =
48 "$FreeBSD: head/usr.bin/write/write.c 50477 1999-08-28 01:08:13Z peter $";
49#endif /* not lint */
50
51#include <sys/param.h>
52#include <sys/signal.h>
53#include <sys/stat.h>
54#include <sys/file.h>
55#include <sys/time.h>
56#include <ctype.h>
57#include <err.h>

--- 190 unchanged lines hidden (view full) ---

248/*
249 * do_write - actually make the connection
250 */
251void
252do_write(tty, mytty, myuid)
253 char *tty, *mytty;
254 uid_t myuid;
255{
50
51#include <sys/param.h>
52#include <sys/signal.h>
53#include <sys/stat.h>
54#include <sys/file.h>
55#include <sys/time.h>
56#include <ctype.h>
57#include <err.h>

--- 190 unchanged lines hidden (view full) ---

248/*
249 * do_write - actually make the connection
250 */
251void
252do_write(tty, mytty, myuid)
253 char *tty, *mytty;
254 uid_t myuid;
255{
256 register char *login, *nows;
257 register struct passwd *pwd;
256 const char *login;
257 char *nows;
258 struct passwd *pwd;
258 time_t now;
259 char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
260
261 /* Determine our login name before the we reopen() stdout */
262 if ((login = getlogin()) == NULL) {
263 if ((pwd = getpwuid(myuid)))
264 login = pwd->pw_name;
265 else

--- 20 unchanged lines hidden (view full) ---

286 wr_fputs(line);
287}
288
289/*
290 * done - cleanup and exit
291 */
292void
293done(n)
259 time_t now;
260 char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
261
262 /* Determine our login name before the we reopen() stdout */
263 if ((login = getlogin()) == NULL) {
264 if ((pwd = getpwuid(myuid)))
265 login = pwd->pw_name;
266 else

--- 20 unchanged lines hidden (view full) ---

287 wr_fputs(line);
288}
289
290/*
291 * done - cleanup and exit
292 */
293void
294done(n)
294int n; /* signal number */
295 int n __unused;
295{
296 (void)printf("EOF\r\n");
297 exit(0);
298}
299
300/*
301 * wr_fputs - like fputs(), but makes control characters visible and
302 * turns \n into \r\n
303 */
304void
305wr_fputs(s)
296{
297 (void)printf("EOF\r\n");
298 exit(0);
299}
300
301/*
302 * wr_fputs - like fputs(), but makes control characters visible and
303 * turns \n into \r\n
304 */
305void
306wr_fputs(s)
306 register unsigned char *s;
307 unsigned char *s;
307{
308
309#define PUTC(c) if (putchar(c) == EOF) err(1, NULL);
310
311 for (; *s != '\0'; ++s) {
312 if (*s == '\n') {
313 PUTC('\r');
314 } else if (((*s & 0x80) && *s < 0xA0) ||

--- 19 unchanged lines hidden ---
308{
309
310#define PUTC(c) if (putchar(c) == EOF) err(1, NULL);
311
312 for (; *s != '\0'; ++s) {
313 if (*s == '\n') {
314 PUTC('\r');
315 } else if (((*s & 0x80) && *s < 0xA0) ||

--- 19 unchanged lines hidden ---