rlogin.c File Reference

#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <net/netlib.h>
#include <net/hton.h>
#include <net/gen/in.h>
#include <net/gen/netdb.h>
#include <net/gen/tcp.h>
#include <net/gen/tcp_io.h>
#include <termios.h>
#include <setjmp.h>
#include <errno.h>
#include <pwd.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>

Include dependency graph for rlogin.c:

Go to the source code of this file.

Data Structures

struct  speed

Defines

#define TIOCPKT_WINDOW   0x80
#define SIGUSR1   30
#define get_window_size(fd, wp)   ioctl(fd, TIOCGWINSZ, wp)
#define OPTIONS   "8EKLde:l:"
#define READING   1
#define WRITING   2

Functions

int main _ARGS ((int argc, char **argv))
static void usage _ARGS ((void))
static u_char getescape _ARGS ((char *p))
static char *speeds2str _ARGS ((speed_t speed))
static void lostpeer _ARGS ((int sig))
static void setsignal _ARGS ((int sig, void(*act)(int sig)))
static void msg _ARGS ((char *str))
static void done _ARGS ((int status))
static void mode _ARGS ((int f))
static void echo _ARGS ((int c))
int main (int argc, char **argv)
static void doit ()
static void setsignal (int sig, act)
static void done (int status)
void sigwinch ()
static void catch_child (int sig)
static void writer ()
static void echo (int c)
 stop (char cmdc)
static int reader ()
static void mode (int f)
static void lostpeer (int sig)
static void msg (char *str)
static void usage ()
static u_char getescape (char *p)
static char * speeds2str (speed_t speed)

Variables

char copyright []
int errno
int eight
int litout
int rem
int noescape
u_char escapechar = '~'
speed speeds []
winsize winsize
termios defattr rawattr
int child
int dosigwinch
int rcvcnt
int rcvstate
char rcvbuf [8 *1024]


Define Documentation

#define get_window_size fd,
wp   )     ioctl(fd, TIOCGWINSZ, wp)
 

Definition at line 143 of file rlogin.c.

Referenced by main().

#define OPTIONS   "8EKLde:l:"
 

Referenced by main().

#define READING   1
 

Definition at line 772 of file rlogin.c.

Referenced by devio(), devread(), devwrite(), do_read(), get_block(), new_icopy(), old_icopy(), pipe_check(), read_write(), Recover_Blocks(), rw_block(), rw_chunk(), and select_request_pipe().

#define SIGUSR1   30
 

Definition at line 96 of file rlogin.c.

Referenced by deathtrap(), do_child(), do_parent(), handler(), main(), onsig(), pm_init(), sig_handler(), test37a(), and test3a().

#define TIOCPKT_WINDOW   0x80
 

Definition at line 91 of file rlogin.c.

#define WRITING   2
 

Definition at line 773 of file rlogin.c.

Referenced by common_open(), devwrite(), do_pipe(), do_sync(), do_write(), flushall(), new_node(), put_block(), put_inode(), read_write(), reader(), rw_chunk(), rw_inode(), and select_request_pipe().


Function Documentation

static void echo _ARGS (int c  )  [static]
 

static void mode _ARGS (int f  )  [static]
 

static void done _ARGS (int status  )  [static]
 

static void msg _ARGS (char *str  )  [static]
 

static void setsignal _ARGS (int sig, void(*act)(int sig))   )  [static]
 

static void catch_child _ARGS (int sig  )  [static]
 

static char* speeds2str _ARGS (speed_t speed  )  [static]
 

static u_char getescape _ARGS (char *p  )  [static]
 

static void usage _ARGS (void)   )  [static]
 

int main _ARGS (int argc, char **argv)   ) 
 

static void catch_child int  sig  )  [static]
 

Definition at line 574 of file rlogin.c.

References done, pid, status, waitpid, WEXITSTATUS, WIFSTOPPED, WNOHANG, WTERMSIG, and WUNTRACED.

Referenced by doit(), and stop().

static void doit  )  [static]
 

Definition at line 383 of file rlogin.c.

References termios::c_iflag, termios::c_lflag, termios::c_oflag, catch_child(), done, ECHO, ECHONL, errno, exit(), fork, fprintf(), ICANON, ICRNL, IEXTEN, IGNCR, INLCR, ISIG, ISTRIP, IXOFF, IXON, mode, msg, OPOST, PARMRK, r, rawattr, reader(), rem, result, sb, setsignal(), SIG_IGN, SIGCHLD, SIGHUP, SIGINT, signal(), SIGQUIT, sleep, stderr, strerror(), tcgetattr, and writer.

Referenced by do_devio(), exec_one(), and main().

static void done int  status  )  [static]
 

Definition at line 550 of file rlogin.c.

References exit(), kill, mode, SIG_DFL, SIGCHLD, SIGKILL, signal(), and wait.

static void echo int  c  )  [static]
 

Definition at line 680 of file rlogin.c.

References escapechar, p, STDOUT_FILENO, and write.

static u_char getescape char *  p  )  [static]
 

Definition at line 941 of file rlogin.c.

References NULL, strlen(), strtol(), and val.

Referenced by main().

static void lostpeer int  sig  )  [static]
 

Definition at line 869 of file rlogin.c.

References done, msg, SIG_IGN, signal(), and SIGPIPE.

Referenced by main().

int main int  argc,
char **  argv
 

Definition at line 186 of file rlogin.c.

References cfgetospeed, dflag, doit(), ECONNREFUSED, eight, ENOENT, EOF, errno, error, escapechar, exit(), fprintf(), get_window_size, getenv(), getescape(), getopt(), getpwuid(), getservbyname(), getuid, host, ioctl, litout, lostpeer(), noescape, NULL, NWIOSTCPOPT, NWTO_BSD_URG, one, optarg, optind, OPTIONS, p, passwd::pw_name, rcmd(), rem, rindex(), schedule(), setuid, signal(), SIGPIPE, sp, speeds2str(), stderr, strcat(), strcmp, strerror(), strncpy(), tcgetattr, term, uid, usage, user, warning(), and winsize.

static void mode int  f  )  [static]
 

Definition at line 850 of file rlogin.c.

References rawattr, sb, TCSAFLUSH, and tcsetattr.

static void msg char *  str  )  [static]
 

Definition at line 878 of file rlogin.c.

References fprintf(), and stderr.

static int reader  )  [static]
 

Definition at line 779 of file rlogin.c.

References EINTR, errno, getpid, n, pid, STDOUT_FILENO, write, and WRITING.

static void setsignal int  sig,
act 
[static]
 

Definition at line 541 of file rlogin.c.

References SIG_IGN, and signal().

void sigwinch  ) 
 

Referenced by main(), and stop().

static char* speeds2str speed_t  speed  )  [static]
 

Definition at line 965 of file rlogin.c.

References i, speed::name, NULL, speed::speed, and speeds.

Referenced by main().

stop char  cmdc  ) 
 

Definition at line 704 of file rlogin.c.

References catch_child(), getpid, kill, mode, SIG_IGN, SIGCHLD, signal(), SIGTSTP, and sigwinch().

static void usage void   )  [static]
 

Definition at line 902 of file rlogin.c.

References exit(), fprintf(), and stderr.

static void writer  )  [static]
 

Definition at line 600 of file rlogin.c.

References c, EINTR, errno, local, n, read, and STDIN_FILENO.


Variable Documentation

int child
 

Definition at line 379 of file rlogin.c.

Referenced by do_trace(), execute(), maketree(), readin(), test5a(), and traversetree().

char copyright[]
 

Initial value:

"@(#) Copyright (c) 1983, 1990 The Regents of the University of California.\n\
 All rights reserved.\n"

Definition at line 35 of file rlogin.c.

int dosigwinch
 

Definition at line 567 of file rlogin.c.

int eight
 

Definition at line 100 of file rlogin.c.

Referenced by main().

int errno
 

Definition at line 70 of file rcp.c.

u_char escapechar = '~'
 

Definition at line 103 of file rlogin.c.

Referenced by echo(), and main().

int litout
 

Definition at line 100 of file rlogin.c.

Referenced by main().

int noescape
 

Definition at line 102 of file rlogin.c.

Referenced by main().

struct termios defattr rawattr
 

Definition at line 375 of file rlogin.c.

Referenced by doit(), and mode().

char rcvbuf[8 *1024]
 

Definition at line 776 of file rlogin.c.

int rcvcnt
 

Definition at line 775 of file rlogin.c.

int rcvstate
 

Definition at line 775 of file rlogin.c.

int rem
 

Definition at line 100 of file rlogin.c.

struct speed speeds[]
 

Referenced by getspeed(), and speeds2str().

struct winsize winsize
 

Definition at line 141 of file rlogin.c.

Referenced by do_control(), main(), report(), showtop(), and ts_winsize().


Generated on Fri Apr 14 23:07:22 2006 for minix by  doxygen 1.4.6