static + __dead

This commit is contained in:
joerg 2011-09-06 18:28:35 +00:00
parent 75acfabd7f
commit 3e796e7d89

View File

@ -1,4 +1,4 @@
/* $NetBSD: rlogin.c,v 1.40 2009/04/13 04:37:53 lukem Exp $ */
/* $NetBSD: rlogin.c,v 1.41 2011/09/06 18:28:35 joerg Exp $ */
/*
* Copyright (c) 1983, 1990, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1990, 1993\
#if 0
static char sccsid[] = "@(#)rlogin.c 8.4 (Berkeley) 4/29/95";
#else
__RCSID("$NetBSD: rlogin.c,v 1.40 2009/04/13 04:37:53 lukem Exp $");
__RCSID("$NetBSD: rlogin.c,v 1.41 2011/09/06 18:28:35 joerg Exp $");
#endif
#endif /* not lint */
@ -87,11 +87,11 @@ __RCSID("$NetBSD: rlogin.c,v 1.40 2009/04/13 04:37:53 lukem Exp $");
#define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0)
#endif
int eight, rem;
struct termios deftty;
static int eight, rem;
static struct termios deftty;
int noescape;
u_char escapechar = '~';
static int noescape;
static u_char escapechar = '~';
#ifdef OLDSUN
struct winsize {
@ -101,30 +101,29 @@ struct winsize {
#else
#define get_window_size(fd, wp) ioctl(fd, TIOCGWINSZ, wp)
#endif
struct winsize winsize;
static struct winsize winsize;
void catch_child(int);
void copytochild(int);
void doit(sigset_t *);
void done(int);
void echo(int);
u_int getescape(char *);
void lostpeer(int);
int main(int, char **);
void mode(int);
void msg(const char *);
void oob(int);
int reader(sigset_t *);
void sendwindow(void);
void setsignal(int);
void sigwinch(int);
void stop(int);
void usage(void);
void writer(void);
void writeroob(int);
static void catch_child(int);
static void copytochild(int);
__dead static void doit(sigset_t *);
__dead static void done(int);
static void echo(int);
static u_int getescape(char *);
__dead static void lostpeer(int);
static void mode(int);
static void msg(const char *);
static void oob(int);
static int reader(sigset_t *);
static void sendwindow(void);
static void setsignal(int);
static void sigwinch(int);
static void stop(int);
__dead static void usage(void);
static void writer(void);
static void writeroob(int);
#ifdef OLDSUN
int get_window_size(int, struct winsize *);
static int get_window_size(int, struct winsize *);
#endif
int
@ -294,9 +293,9 @@ main(int argc, char *argv[])
return (0);
}
pid_t child;
static pid_t child;
void
static void
doit(sigset_t *smask)
{
struct sigaction sa;
@ -340,7 +339,7 @@ doit(sigset_t *smask)
}
/* trap a signal, unless it is being ignored. */
void
static void
setsignal(int sig)
{
struct sigaction sa;
@ -360,7 +359,7 @@ setsignal(int sig)
(void)sigprocmask(SIG_SETMASK, &sigs, (sigset_t *) 0);
}
void
static void
done(int status)
{
pid_t w;
@ -381,13 +380,13 @@ done(int status)
exit(status);
}
int dosigwinch;
static int dosigwinch;
/*
* This is called when the reader process gets the out-of-band (urgent)
* request to turn on the window-changing protocol.
*/
void
static void
writeroob(int signo)
{
struct sigaction sa;
@ -402,7 +401,7 @@ writeroob(int signo)
dosigwinch = 1;
}
void
static void
catch_child(int signo)
{
int status;
@ -425,7 +424,7 @@ catch_child(int signo)
* ~^Z suspend rlogin process.
* ~<delayed-suspend char> suspend rlogin process, but leave reader alone.
*/
void
static void
writer(void)
{
int bol, local, n;
@ -489,7 +488,7 @@ writer(void)
}
}
void
static void
echo(int i)
{
char c = (char)i;
@ -512,7 +511,7 @@ echo(int i)
(void)write(STDOUT_FILENO, buf, p - buf);
}
void
static void
stop(int all)
{
struct sigaction sa;
@ -529,7 +528,7 @@ stop(int all)
sigwinch(0); /* check for size changes */
}
void
static void
sigwinch(int signo)
{
struct winsize ws;
@ -544,7 +543,7 @@ sigwinch(int signo)
/*
* Send the window size to the server via the magic escape
*/
void
static void
sendwindow(void)
{
struct winsize *wp;
@ -569,12 +568,12 @@ sendwindow(void)
#define READING 1
#define WRITING 2
jmp_buf rcvtop;
pid_t ppid;
int rcvcnt, rcvstate;
char rcvbuf[8 * 1024];
static jmp_buf rcvtop;
static pid_t ppid;
static int rcvcnt, rcvstate;
static char rcvbuf[8 * 1024];
void
static void
oob(int signo)
{
struct termios tty;
@ -655,7 +654,7 @@ oob(int signo)
}
/* reader: read from remote: line -> 1 */
int
static int
reader(sigset_t *smask)
{
pid_t pid;
@ -703,7 +702,7 @@ reader(sigset_t *smask)
}
}
void
static void
mode(int f)
{
struct termios tty;
@ -734,7 +733,7 @@ mode(int f)
}
}
void
static void
lostpeer(int signo)
{
struct sigaction sa;
@ -746,14 +745,14 @@ lostpeer(int signo)
}
/* copy SIGURGs to the child process. */
void
static void
copytochild(int signo)
{
(void)kill(child, SIGURG);
}
void
static void
msg(const char *str)
{
@ -761,7 +760,7 @@ msg(const char *str)
}
void
static void
usage(void)
{
(void)fprintf(stderr,
@ -775,10 +774,8 @@ usage(void)
* Suns and others. Suns have only a `ttysize', so we convert it to a winsize.
*/
#ifdef OLDSUN
int
get_window_size(fd, wp)
int fd;
struct winsize *wp;
static int
get_window_size(int fd, struct winsize *wp)
{
struct ttysize ts;
int error;
@ -793,7 +790,7 @@ get_window_size(fd, wp)
}
#endif
u_int
static u_int
getescape(char *p)
{
long val;