diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2005-10-25 14:18:00 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2005-10-25 14:18:00 +0000 |
commit | af0283385cb9108f00f94790522cf0aba8b1069d (patch) | |
tree | 8e0be54961a5011fe3409e7ff56da16067b36257 /cpukit/telnetd | |
parent | Rename register_icmds to (diff) | |
download | rtems-af0283385cb9108f00f94790522cf0aba8b1069d.tar.bz2 |
Make many functions static.
Rename rtems_telnetd_maximum_ptys to rtems_pty_maximum_ptys.
Diffstat (limited to 'cpukit/telnetd')
-rw-r--r-- | cpukit/telnetd/pty.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/cpukit/telnetd/pty.c b/cpukit/telnetd/pty.c index 38aa0a1c97..ae608929da 100644 --- a/cpukit/telnetd/pty.c +++ b/cpukit/telnetd/pty.c @@ -57,19 +57,20 @@ typedef struct { } pty_t; -int ptys_initted=FALSE; -pty_t *ptys; -int rtems_telnetd_maximum_ptys; +static int ptys_initted=FALSE; +static pty_t *ptys; -/* This procedure returns the devname for a pty slot free. - * If not slot availiable (field socket>=0) - * then the socket argument is closed +size_t rtems_pty_maximum_ptys; + +/* This procedure returns the devname for a free pty slot. + * If no slot available (field socket>=0) + * then the socket argument is closed */ -char * get_pty(int socket) { +char * rtems_pty_get(int socket) { int ndx; if (!ptys_initted) return NULL; - for (ndx=0;ndx<rtems_telnetd_maximum_ptys;ndx++) { + for (ndx=0;ndx<rtems_pty_maximum_ptys;ndx++) { if (ptys[ndx].socket<0) { ptys[ndx].socket=socket; return ptys[ndx].devname; @@ -87,9 +88,9 @@ char * get_pty(int socket) { * A litle status machine in the pty_read_byte(int minor) * */ -const char IAC_AYT_RSP[]="\r\nAYT? Yes, RTEMS-SHELL is here\r\n"; -const char IAC_BRK_RSP[]="<*Break*>"; -const char IAC_IP_RSP []="<*Interrupt*>"; +static const char IAC_AYT_RSP[]="\r\nAYT? Yes, RTEMS-SHELL is here\r\n"; +static const char IAC_BRK_RSP[]="<*Break*>"; +static const char IAC_IP_RSP []="<*Interrupt*>"; static @@ -197,13 +198,13 @@ static int ptyPollInitialize(int major,int minor,void * arg) ; static int ptyShutdown(int major,int minor,void * arg) ; static int ptyPollWrite(int minor, const char * buf,int len) ; static int ptyPollRead(int minor) ; -const rtems_termios_callbacks * pty_get_termios_handlers(int polled) ; +static const rtems_termios_callbacks * pty_get_termios_handlers(int polled) ; /*-----------------------------------------------------------*/ /* Set the 'Hardware' */ /*-----------------------------------------------------------*/ static int ptySetAttributes(int minor,const struct termios *t) { - if (minor<rtems_telnetd_maximum_ptys) { + if (minor<rtems_pty_maximum_ptys) { ptys[minor].c_cflag=t->c_cflag; } else { return -1; @@ -215,7 +216,7 @@ static int ptyPollInitialize(int major,int minor,void * arg) { rtems_libio_open_close_args_t * args = arg; struct termios t; - if (minor<rtems_telnetd_maximum_ptys) { + if (minor<rtems_pty_maximum_ptys) { if (ptys[minor].socket<0) return -1; ptys[minor].opened=TRUE; ptys[minor].ttyp=args->iop->data1; @@ -228,7 +229,7 @@ ptyPollInitialize(int major,int minor,void * arg) { /*-----------------------------------------------------------*/ static int ptyShutdown(int major,int minor,void * arg) { - if (minor<rtems_telnetd_maximum_ptys) { + if (minor<rtems_pty_maximum_ptys) { ptys[minor].opened=FALSE; if (ptys[minor].socket>=0) close(ptys[minor].socket); ptys[minor].socket=-1; @@ -244,7 +245,7 @@ ptyShutdown(int major,int minor,void * arg) { static int ptyPollWrite(int minor, const char * buf,int len) { int count; - if (minor<rtems_telnetd_maximum_ptys) { + if (minor<rtems_pty_maximum_ptys) { if (ptys[minor].socket<0) return -1; count=write(ptys[minor].socket,buf,len); } else { @@ -256,7 +257,7 @@ ptyPollWrite(int minor, const char * buf,int len) { static int ptyPollRead(int minor) { int result; - if (minor<rtems_telnetd_maximum_ptys) { + if (minor<rtems_pty_maximum_ptys) { if (ptys[minor].socket<0) return -1; result=read_pty(minor); return result; @@ -275,14 +276,14 @@ static const rtems_termios_callbacks pty_poll_callbacks = { 0 /* outputUsesInterrupts */ }; /*-----------------------------------------------------------*/ -const rtems_termios_callbacks * pty_get_termios_handlers(int polled) { +static const rtems_termios_callbacks * pty_get_termios_handlers(int polled) { return &pty_poll_callbacks; } /*-----------------------------------------------------------*/ -void init_ptys(void) { +static void init_ptys(void) { int ndx; - ptys = malloc( sizeof(pty_t) * rtems_telnetd_maximum_ptys ); - for (ndx=0;ndx<rtems_telnetd_maximum_ptys;ndx++) { + ptys = malloc( sizeof(pty_t) * rtems_pty_maximum_ptys ); + for (ndx=0;ndx<rtems_pty_maximum_ptys;ndx++) { ptys[ndx].devname=malloc(strlen("/dev/ptyXX")+1); sprintf(ptys[ndx].devname,"/dev/pty%X",ndx); ptys[ndx].ttyp=NULL; @@ -325,7 +326,7 @@ rtems_device_driver pty_initialize( /* * Register the devices */ - for (ndx=0;ndx<rtems_telnetd_maximum_ptys;ndx++) { + for (ndx=0;ndx<rtems_pty_maximum_ptys;ndx++) { status = rtems_io_register_name(ptys[ndx].devname, major, ndx); if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); @@ -333,7 +334,7 @@ rtems_device_driver pty_initialize( chown(ptys[ndx].devname,2,0); /* tty,root*/ }; printk("Device: /dev/pty%X../dev/pty%X (%d)pseudo-terminals registered.\n", - 0,rtems_telnetd_maximum_ptys-1,rtems_telnetd_maximum_ptys); + 0,rtems_pty_maximum_ptys-1,rtems_pty_maximum_ptys); return RTEMS_SUCCESSFUL; } |