Xosd!
This commit is contained in:
parent
a19547ad17
commit
48b3637b9b
3 changed files with 89 additions and 10 deletions
|
@ -1,10 +1,10 @@
|
||||||
# $Amigan: cidserv/xcid/src/Makefile,v 1.2 2004/12/23 23:11:50 dcp1990 Exp $
|
# $Amigan: cidserv/xcid/src/Makefile,v 1.3 2005/05/26 23:40:37 dcp1990 Exp $
|
||||||
#gcc -g -I/usr/X11R6/include -L/usr/X11R6/lib -lXt -lX11 -lXaw -o xcid xcid.c network.c wind.c
|
#gcc -g -I/usr/X11R6/include -L/usr/X11R6/lib -lXt -lX11 -lXaw -o xcid xcid.c network.c wind.c
|
||||||
CFLAGS=-g -Wall
|
CFLAGS=-g -Wall
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CPPFLAGS=-I/usr/X11R6/include
|
CPPFLAGS=-I/usr/X11R6/include -DUSE_XOSD
|
||||||
#-DDEBUG
|
#-DDEBUG
|
||||||
LDFLAGS=-L/usr/X11R6/lib -lXt -lX11 -lXaw
|
LDFLAGS=-L/usr/X11R6/lib -lXt -lX11 -lXaw -lxosd -lpthread
|
||||||
OBJS=xcid.o network.o wind.o
|
OBJS=xcid.o network.o wind.o
|
||||||
SRCS=xcid.c network.c wind.c
|
SRCS=xcid.c network.c wind.c
|
||||||
all: xcid
|
all: xcid
|
||||||
|
|
|
@ -35,6 +35,15 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef USE_XOSD
|
||||||
|
#define DEF_XOSD_TIMEOUT 5
|
||||||
|
#define DEF_XOSD_COLOUR "green"
|
||||||
|
#define DEF_XOSD_VOFFSET 30
|
||||||
|
#define DEF_XOSD_FONT "-misc-fixed-medium-r-semicondensed-*-13-*-*-*-c-*-koi8-r"
|
||||||
|
#include <xosd.h>
|
||||||
|
extern int XOSD_TIMEOUT, XOSD_VOFFSET;
|
||||||
|
extern char *XOSD_COLOUR, *XOSD_FONT;
|
||||||
|
#endif
|
||||||
short int tsec = 10;
|
short int tsec = 10;
|
||||||
typedef struct cis
|
typedef struct cis
|
||||||
{
|
{
|
||||||
|
@ -160,9 +169,14 @@ telluser (buf)
|
||||||
char *buf;
|
char *buf;
|
||||||
{
|
{
|
||||||
cidinfo cid;
|
cidinfo cid;
|
||||||
|
#ifdef USE_XOSD
|
||||||
|
xosd *osd;
|
||||||
|
#endif
|
||||||
|
#ifndef USE_XOSD
|
||||||
|
char *tav[] = { "xcid", NULL };
|
||||||
char *ltx;
|
char *ltx;
|
||||||
size_t lent;
|
size_t lent;
|
||||||
char *tav[] = { "xcid", NULL };
|
#endif
|
||||||
bzero(&cid, sizeof cid);
|
bzero(&cid, sizeof cid);
|
||||||
parseinfo (buf, &cid);
|
parseinfo (buf, &cid);
|
||||||
if(cid.name == NULL) return;
|
if(cid.name == NULL) return;
|
||||||
|
@ -171,15 +185,35 @@ telluser (buf)
|
||||||
cid.name, cid.number, cid.date, cid.time);
|
cid.name, cid.number, cid.date, cid.time);
|
||||||
#endif
|
#endif
|
||||||
if(cid.name == NULL || cid.number == NULL) {return;}
|
if(cid.name == NULL || cid.number == NULL) {return;}
|
||||||
|
#ifdef USE_XOSD
|
||||||
|
/* lent += sizeof(" -- \nDate: -- Time:\n ");
|
||||||
|
ltx = malloc(lent);
|
||||||
|
memset(ltx, 0, lent);
|
||||||
|
snprintf(ltx, lent, "%s -- %s\nDate: %s -- Time: %s",
|
||||||
|
cid.name, cid.number, cid.date, cid.time);*/
|
||||||
|
osd = xosd_create(2);
|
||||||
|
xosd_set_font(osd, XOSD_FONT);
|
||||||
|
xosd_set_colour(osd, XOSD_COLOUR);
|
||||||
|
xosd_set_timeout(osd, XOSD_TIMEOUT);
|
||||||
|
xosd_set_pos(osd, XOSD_top);
|
||||||
|
xosd_set_align(osd, XOSD_right);
|
||||||
|
xosd_set_vertical_offset(osd, XOSD_VOFFSET);
|
||||||
|
xosd_set_shadow_offset(osd, 1);
|
||||||
|
xosd_display(osd, 0, XOSD_printf, "%s -- %s", cid.name, cid.number);
|
||||||
|
xosd_display(osd, 1, XOSD_printf, "Date: %s -- Time: %s", cid.date,
|
||||||
|
cid.time);
|
||||||
|
xosd_wait_until_no_display(osd);
|
||||||
|
xosd_destroy(osd);
|
||||||
|
#else
|
||||||
|
lent += sizeof ("Name: \nNumber: \nDate: \nTime: \n ");
|
||||||
lent =
|
lent =
|
||||||
sizeof (char) * (strlen (cid.name) + strlen (cid.number) +
|
sizeof (char) * (strlen (cid.name) + strlen (cid.number) +
|
||||||
strlen (cid.date) + strlen (cid.time) +
|
strlen (cid.date) + strlen (cid.time));
|
||||||
sizeof
|
|
||||||
("Name: \nNumber: \nDate: \nTime: \n "));
|
|
||||||
ltx = (char *) malloc (lent);
|
ltx = (char *) malloc (lent);
|
||||||
memset (ltx, 0, lent);
|
memset (ltx, 0, lent);
|
||||||
snprintf (ltx, lent, "Name: %s\nNumber: %s\nDate: %s\nTime: %s\n",
|
snprintf (ltx, lent, "Name: %s\nNumber: %s\nDate: %s\nTime: %s\n",
|
||||||
cid.name, cid.number, cid.date, cid.time);
|
cid.name, cid.number, cid.date, cid.time);
|
||||||
wind (0, tav, ltx);
|
wind (0, tav, ltx);
|
||||||
free (ltx);
|
free (ltx);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,15 +26,29 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* $Amigan: cidserv/xcid/src/xcid.c,v 1.3 2004/12/23 23:11:50 dcp1990 Exp $ */
|
/* $Amigan: cidserv/xcid/src/xcid.c,v 1.4 2005/05/26 23:40:37 dcp1990 Exp $ */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
char* servaddr;
|
char* servaddr;
|
||||||
int start_netloop (void);
|
int start_netloop (void);
|
||||||
static const char rcsid[] = "$Amigan: cidserv/xcid/src/xcid.c,v 1.3 2004/12/23 23:11:50 dcp1990 Exp $";
|
static const char rcsid[] = "$Amigan: cidserv/xcid/src/xcid.c,v 1.4 2005/05/26 23:40:37 dcp1990 Exp $";
|
||||||
|
#ifdef USE_XOSD
|
||||||
|
#define DEF_XOSD_TIMEOUT 5
|
||||||
|
#define DEF_XOSD_COLOUR "green"
|
||||||
|
#define DEF_XOSD_VOFFSET 30
|
||||||
|
#define DEF_XOSD_FONT "-misc-fixed-medium-r-semicondensed-*-13-*-*-*-c-*-koi8-r"
|
||||||
|
int XOSD_VOFFSET = DEF_XOSD_VOFFSET, XOSD_TIMEOUT = DEF_XOSD_TIMEOUT;
|
||||||
|
char *XOSD_FONT = DEF_XOSD_FONT;
|
||||||
|
char *XOSD_COLOUR = DEF_XOSD_COLOUR;
|
||||||
|
#endif
|
||||||
|
void usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: xcid [-c colourname] [-f fontspec] [-o voffset"
|
||||||
|
"] [-t timeoutsecs]\n");
|
||||||
|
}
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -43,6 +57,37 @@ main (int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
servaddr = strdup(argv[1]); */
|
servaddr = strdup(argv[1]); */
|
||||||
|
#ifdef USE_XOSD
|
||||||
|
int ch;
|
||||||
|
while ((ch = getopt(argc, argv, "f:t:o:c:")) != -1) {
|
||||||
|
switch(ch) {
|
||||||
|
case 'f':
|
||||||
|
XOSD_FONT = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
XOSD_TIMEOUT = atoi(optarg);
|
||||||
|
if(XOSD_TIMEOUT < 1) XOSD_TIMEOUT =
|
||||||
|
DEF_XOSD_TIMEOUT;
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
XOSD_VOFFSET = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
XOSD_COLOUR = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
#endif
|
||||||
start_netloop ();
|
start_netloop ();
|
||||||
|
#ifdef USE_XOSD
|
||||||
|
free(XOSD_COLOUR);
|
||||||
|
free(XOSD_FONT);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue