Commit f775de66 authored by rswindell's avatar rswindell

Created macros for the special node "connection" constants, adding values for

RLogin and SSH.
parent 6c477f1d
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -388,6 +388,29 @@ void sbbs_t::nodelist(void)
}
}
static char* node_connection_desc(ushort conn, char* str)
{
switch(conn) {
case NODE_CONNECTION_LOCAL:
strcpy(str,"Locally");
break;
case NODE_CONNECTION_TELNET:
strcpy(str,"via telnet");
break;
case NODE_CONNECTION_RLOGIN:
strcpy(str,"via rlogin");
break;
case NODE_CONNECTION_SSH:
strcpy(str,"via ssh");
break;
default:
sprintf(str,"at %ubps",conn);
break;
}
return str;
}
/****************************************************************************/
/* Displays the information for node number 'number' contained in 'node' */
/****************************************************************************/
......@@ -427,12 +450,7 @@ void sbbs_t::printnodedat(uint number, node_t* node)
bputs("New user");
attr(cfg.color[clr_nodestatus]);
bputs(" applying for access ");
if(!node->connection)
bputs("Locally");
else if(node->connection==0xffff)
bprintf("via telnet");
else
bprintf("at %ubps",node->connection);
bputs(node_connection_desc(node->connection, tmp));
break;
case NODE_QUIET:
if(!SYSOP) {
......@@ -555,12 +573,7 @@ void sbbs_t::printnodedat(uint number, node_t* node)
default:
bputs(ultoa(node->action,tmp,10));
break; }
if(!node->connection)
bputs(" locally");
else if(node->connection==0xffff)
bprintf(" via telnet");
else
bprintf(" at %ubps",node->connection);
bprintf(" %s",node_connection_desc(node->connection, tmp));
if(node->action==NODE_DLNG) {
if(cfg.sys_misc&SM_MILITARY) {
hour=node->aux/60;
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -217,12 +217,36 @@ char *unpackchatpass(char *pass, node_t node)
return(pass);
}
static char* node_connection_desc(ushort conn, char* str)
{
switch(conn) {
case NODE_CONNECTION_LOCAL:
strcpy(str,"Locally");
break;
case NODE_CONNECTION_TELNET:
strcpy(str,"via telnet");
break;
case NODE_CONNECTION_RLOGIN:
strcpy(str,"via rlogin");
break;
case NODE_CONNECTION_SSH:
strcpy(str,"via ssh");
break;
default:
sprintf(str,"at %ubps",conn);
break;
}
return str;
}
/****************************************************************************/
/* Displays the information for node number 'number' contained in 'node' */
/****************************************************************************/
void printnodedat(int number, node_t node)
{
char hour,mer[3];
char tmp[128];
printf("Node %2d: ",number);
switch(node.status) {
......@@ -250,12 +274,7 @@ void printnodedat(int number, node_t node)
case NODE_NEWUSER:
printf("New user");
printf(" applying for access ");
if(!node.connection)
printf("locally");
else if(node.connection==0xffff)
printf("via telnet");
else
printf("at %ubps",node.connection);
printf("%s",node_connection_desc(node.connection,tmp));
break;
case NODE_QUIET:
case NODE_INUSE:
......@@ -349,12 +368,7 @@ void printnodedat(int number, node_t node)
default:
printf(itoa(node.action,tmp,10));
break; }
if(!node.connection)
printf(" locally");
else if(node.connection==0xffff)
printf(" via telnet");
else
printf(" at %ubps",node.connection);
printf(" %s",node_connection_desc(node.connection,tmp));
if(node.action==NODE_DLNG) {
if((node.aux/60)>=12) {
if(node.aux/60==12)
......@@ -435,7 +449,7 @@ int main(int argc, char **argv)
}
if(argc<2) {
printf("usage: node [/debug] [action [on|off]] [node numbers] [...]"
printf("usage: node [-debug] [action [on|off]] [node numbers] [...]"
"\n\n");
printf("actions (default is list):\n\n");
printf("list = list status\n");
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -43,6 +43,7 @@
#define _NODEDEFS_H
#include "smbdefs.h" /* uchar, ushort, ulong and _PACK */
#include "limits.h"
enum { /* Node Status */
NODE_WFC /* Waiting for Call */
......@@ -117,6 +118,10 @@ typedef struct _PACK { /* Node information kept in node.dab */
action; /* Action User is doing on Node */
ushort useron, /* User on Node */
connection, /* Connection rate of Node */
#define NODE_CONNECTION_LOCAL 0
#define NODE_CONNECTION_TELNET USHRT_MAX /* 0xffff */
#define NODE_CONNECTION_RLOGIN (USHRT_MAX-1)
#define NODE_CONNECTION_SSH (USHRT_MAX-2)
misc, /* Miscellaneous bits for node */
aux; /* Auxillary word for node */
ulong extaux; /* Extended aux dword for node */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -800,9 +800,33 @@ char* DLLCALL unpackchatpass(char *pass, node_t* node)
return(pass);
}
static char* node_connection_desc(ushort conn, char* str)
{
switch(conn) {
case NODE_CONNECTION_LOCAL:
strcpy(str,"Locally");
break;
case NODE_CONNECTION_TELNET:
strcpy(str,"via telnet");
break;
case NODE_CONNECTION_RLOGIN:
strcpy(str,"via rlogin");
break;
case NODE_CONNECTION_SSH:
strcpy(str,"via ssh");
break;
default:
sprintf(str,"at %ubps",conn);
break;
}
return str;
}
char* DLLCALL nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen)
{
char str[256];
char tmp[128];
char* mer;
int hour;
......@@ -835,13 +859,8 @@ char* DLLCALL nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen)
strcpy(str,"Running external event");
break;
case NODE_NEWUSER:
strcpy(str,"New user applying for access ");
if(!node->connection)
strcat(str,"Locally");
else if(node->connection==0xffff) {
strcat(str,"via telnet");
} else
sprintf(str+strlen(str),"at %ubps",node->connection);
sprintf(str,"New user applying for access %s"
,node_connection_desc(node->connection, tmp));
break;
case NODE_QUIET:
case NODE_INUSE:
......@@ -949,12 +968,7 @@ char* DLLCALL nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen)
sprintf(str+strlen(str),"%d",node->action);
break;
}
if(!node->connection)
strcat(str," locally");
if(node->connection==0xffff) {
strcat(str," via telnet");
} else
sprintf(str+strlen(str)," at %ubps",node->connection);
strcat(str, node_connection_desc(node->connection, tmp));
if(node->action==NODE_DLNG) {
if((node->aux/60)>=12) {
if(node->aux/60==12)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment