Added locking for mbsetup

This commit is contained in:
Michiel Broek
2002-05-04 19:45:19 +00:00
parent e3961d8449
commit ff8ee89ac1
20 changed files with 148 additions and 5 deletions

View File

@@ -34,6 +34,9 @@
#include "mutil.h"
extern int bbs_free;
static void die(int onsig)
{
signal(onsig, SIG_IGN);
@@ -420,7 +423,9 @@ int main(int argc, char *argv[])
pw = getpwuid(getuid());
InitClient(pw->pw_name);
Syslog(' ', "Started by %s", pw->pw_name);
bbs_free = FALSE;
/*
* Setup several signals so when the program terminate's it
* will properly close.

View File

@@ -33,6 +33,7 @@
#include "mutil.h"
extern int ttyfd;
int bbs_free;
unsigned char readkey(int y, int x, int fg, int bg)
@@ -370,7 +371,7 @@ static time_t lasttime;
void show_date(int fg, int bg, int y, int x)
{
time_t now;
char *p;
char *p, buf[128];
now = time(NULL);
if (now != lasttime) {
@@ -382,6 +383,27 @@ void show_date(int fg, int bg, int y, int x)
p = asctime(gmtime(&now));
Striplf(p);
mvprintw(2, 44, (char *)"%s UTC", p);
/*
* Indicator if bbs is free
*/
strcpy(buf, SockR("SFRE:0;"));
if (strncmp(buf, "100:0;", 6) == 0) {
strcpy(buf, SockR("SBBS:0;"));
if (strncmp(buf, "100:2,1", 7) == 0) {
set_color(WHITE, RED);
mvprintw(2,74, (char *)" Down ");
} else {
set_color(WHITE, BLUE);
mvprintw(2,74, (char *)" Free ");
}
bbs_free = TRUE;
} else {
set_color(WHITE, RED);
mvprintw(2,74, (char *)" Busy ");
bbs_free = FALSE;
}
if (y && x)
locate(y, x);
set_color(fg, bg);