write.c (29433) | write.c (48566) |
---|---|
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 --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44#if 0 45static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93"; 46#endif 47static const char rcsid[] = | 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 --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44#if 0 45static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93"; 46#endif 47static const char rcsid[] = |
48 "$Id: write.c,v 1.9 1997/09/15 00:17:38 ache Exp $"; | 48 "$Id: write.c,v 1.10 1997/09/15 00:40:34 ache Exp $"; |
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> --- 197 unchanged lines hidden (view full) --- 254 uid_t myuid; 255{ 256 register char *login, *nows; 257 register 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 */ | 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> --- 197 unchanged lines hidden (view full) --- 254 uid_t myuid; 255{ 256 register char *login, *nows; 257 register 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) | 262 if ((login = getlogin()) == NULL) { |
263 if ((pwd = getpwuid(myuid))) 264 login = pwd->pw_name; 265 else 266 login = "???"; | 263 if ((pwd = getpwuid(myuid))) 264 login = pwd->pw_name; 265 else 266 login = "???"; |
267 } |
|
267 268 (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); 269 if ((freopen(path, "w", stdout)) == NULL) 270 err(1, "%s", path); 271 272 (void)signal(SIGINT, done); 273 (void)signal(SIGHUP, done); 274 --- 58 unchanged lines hidden --- | 268 269 (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); 270 if ((freopen(path, "w", stdout)) == NULL) 271 err(1, "%s", path); 272 273 (void)signal(SIGINT, done); 274 (void)signal(SIGHUP, done); 275 --- 58 unchanged lines hidden --- |