[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

496.0. "small "xbiff" for VMS users" by VMSSPT::LEMBREE (Just do it.) Tue Mar 28 1989 18:00

	I was wandering around in Ultrix-land some time ago and
saw an X application that indicated mail/nomail with a bitmap
image of a mailbox.  Thinking it was neat, I decided to write
it as my first X program.  Well, here it is.  I haven't actually
used or seen the code for the Ultrix version, so it'll be no
surprise to me that this doesn't do alot of things that the
Ultrix one does.  I'm sure there will be bugs/suggestions and
the like for this, so when you find them or think them up, send
them to me at VMSSPT::LEMBREE.  Good luck!

Nasties:  it terminates if you hit the window with a mouse
	click.  improved kill method in a later release.

$ cc xbiff
$ link xbiff,sys$input:/opt
SYS$SHARE:MAILSHR.EXE/SHARE
SYS$SHARE:DECW$DWTLIBSHR/SHARE
SYS$SHARE:DECW$XLIBSHR/SHARE
$ 

============== cut here =======================

#module XBIFF$MAIN "Xbiff main routine"

/*
**++
**  FACILITY:
**
**      XBIFF
**
**  ABSTRACT:
**
**      Notifies a VMS user of new mail arrival using
**	    an Xwindows pixmap of a mailbox.
**
**	Defaults Used:
**	    xbiff.x		    -defines x location of window
**	    xbiff.y		    -defines y location of window
**	    xbiff.UpdateInterval    -defines interval in seconds of update
**
**	Must be linked against normal DECwindows shareables, as well as
**	    SYS$SHARE:MAILSHR.EXE/SHARE
**
**  AUTHORS:
**
**      R.D. Lembree	(VMSSPT::LEMBREE)
**
**
**  CREATION DATE:     24-Feb-89
**
**  MODIFICATION HISTORY:
**
**  V1.0 - first release, 28-MAR-1989
**
**--
**/


/*
**
**  INCLUDE FILES
**
**/


#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

/*
**
**  MACRO DEFINITIONS
**
**/

typedef
    struct MailItemListElement {		/* Item list structure */
        unsigned short  BufferLength;		/* length of buffer */
        unsigned short  ItemCode;		/* item code */
        char		*BufferAddress;		/* address of buffer */
        unsigned short  *ReturnLengthAddress;	/* address of length returned */
        } MailItemListElement, *MailItemListPtr;

long	    CurrentX, CurrentY, CurrentHeight, CurrentWidth;
int	    stat;
Pixmap	    Mail_Pixmap;	/* pixmap of full mailbox	*/
Pixmap	    Nomail_Pixmap;	/* pixmap of empty mailbox	*/
short	    NewMessages = 0;	/* number of new mail messages	*/
int	    MailContext = 0;	/* saved mail context		*/
static readonly MailItemListElement NullList = {0, 0, 0, 0};
				/* item list terminator		*/
static readonly MailItemListElement StdList[3] =    {
						    {0, 4099, 0, 0},
						    {0, 0, 0, 0}};
				/* standard mail item list	*/
MailItemListElement NewMailMessageList[2] = {
					    {2, 3146, 0, 0},
					    {0, 0, 0, 0}};
				/* request item for new mail	*/
Display	    *Xbiff_Display;
Window	    Xbiff_Window;
XEvent	    Xbiff_Event;
GC	    Xbiff_GC;
long	    TimerInterval[2] ;

main(argc, argv, envp)
int	argc;
char	*argv[];
char	*envp[];
{
#define PIXMAP_WIDTH 64
#define PIXMAP_HEIGHT 64

static char mail_bits[] = {
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
 0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,
 0x00,0x80,0x01,0x00,0x00,0x80,0x07,0x00,0x00,0x80,0x01,0x00,0x00,0x70,0x38,
 0x00,0x00,0x80,0x01,0x00,0x00,0x0e,0xc0,0x00,0x00,0x80,0x01,0x00,0xc0,0x01,
 0x00,0x01,0x00,0x80,0x01,0x00,0x38,0x00,0x20,0x02,0x00,0x80,0x01,0x00,0x06,
 0x00,0x38,0x04,0x00,0x80,0x01,0xc0,0x1f,0x00,0x3e,0x04,0x00,0x80,0x01,0x30,
 0x60,0x80,0x3f,0x08,0x00,0x80,0x01,0x08,0x80,0x80,0x3f,0x08,0x00,0x80,0x01,
 0x04,0x07,0x81,0x3f,0x10,0x00,0x80,0x01,0x82,0x0f,0x82,0x3f,0x10,0x00,0x80,
 0x01,0x82,0x0f,0x82,0x1f,0x10,0x00,0x80,0x01,0x01,0x07,0x84,0x07,0x20,0x00,
 0x80,0x01,0x01,0x00,0x84,0x01,0x20,0x00,0x80,0x81,0x00,0x00,0x88,0x00,0x20,
 0x00,0x80,0x81,0x40,0x00,0x88,0x00,0x20,0x00,0x80,0x81,0xa0,0x00,0x88,0x00,
 0x20,0x00,0x80,0x81,0x12,0xa3,0x88,0x00,0x20,0x00,0x80,0x41,0x4e,0xa6,0x90,
 0x00,0x20,0x00,0x80,0x41,0xa6,0xac,0x90,0x01,0x20,0x00,0x80,0x41,0x42,0xa9,
 0x90,0x01,0x20,0x00,0x80,0x41,0x81,0xb0,0x10,0x00,0x20,0x00,0x80,0xc1,0x00,
 0xa0,0x17,0x00,0x20,0x00,0x80,0x41,0x01,0x40,0x10,0x00,0x20,0x00,0x80,0x41,
 0x02,0x82,0x10,0x00,0x20,0x00,0x80,0x41,0x06,0x05,0x17,0x00,0x20,0x00,0x80,
 0x41,0x88,0x0a,0x12,0x00,0x30,0x00,0x80,0x41,0xfe,0xff,0x17,0x00,0x3c,0x0e,
 0x80,0x41,0x00,0x00,0x10,0x00,0x0f,0x11,0x80,0x41,0x00,0x00,0x10,0xc0,0x1b,
 0x11,0x80,0x41,0x00,0x00,0x10,0xf0,0xe4,0x10,0x80,0x41,0x00,0x00,0x10,0x3c,
 0x84,0x08,0x80,0x41,0x00,0x00,0x10,0x0f,0x88,0x3c,0x80,0x41,0x00,0x00,0xd0,
 0x03,0xf0,0x43,0x80,0x41,0x00,0x00,0xf0,0x01,0x8c,0x43,0x80,0xc1,0xff,0xff,
 0x3f,0x01,0x82,0x24,0x80,0xc1,0xff,0xff,0x1f,0x01,0x82,0x18,0x80,0x01,0x00,
 0x02,0x02,0x01,0xfc,0x08,0x80,0x01,0x00,0x02,0x02,0x01,0x20,0x09,0x80,0x01,
 0x00,0x02,0x02,0x01,0x10,0x06,0x80,0x01,0x00,0x02,0x02,0x01,0x10,0x00,0x80,
 0x01,0x00,0x02,0x02,0x01,0x08,0x00,0x80,0x01,0x00,0x02,0x02,0x01,0x08,0x00,
 0x80,0x01,0x00,0x02,0x02,0x01,0xb4,0x3f,0x80,0x01,0x00,0x02,0x02,0x01,0x0e,
 0x28,0x80,0x01,0x00,0x02,0x02,0x01,0x03,0x16,0x80,0x01,0x00,0x02,0x02,0x81,
 0xc0,0x11,0x80,0x01,0x00,0x02,0x02,0x41,0x38,0x08,0x80,0x01,0x00,0x02,0x02,
 0x21,0x04,0x04,0x80,0x01,0x00,0x02,0x02,0x11,0x03,0x02,0x80,0x01,0x00,0x02,
 0x02,0xc9,0x80,0x01,0x80,0x01,0x00,0x02,0x02,0x25,0x60,0x00,0x80,0x01,0x00,
 0x02,0x02,0x13,0x18,0x00,0x80,0x01,0x00,0x02,0x02,0x01,0x07,0x00,0x80,0x01,
 0x00,0x02,0xc2,0xfe,0x00,0x00,0x80,0x01,0x00,0x02,0x32,0x00,0x00,0x00,0x80,
 0x01,0x00,0x02,0x0e,0x00,0x00,0x00,0x80,0x01,0x00,0xfe,0x03,0x00,0x00,0x00,
 0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,
 0xff,0xff};

static char nomail_bits[] = {
 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
 0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,
 0x00,0x80,0x01,0x00,0x00,0x80,0x07,0x00,0x00,0x80,0x01,0x00,0x00,0x70,0x38,
 0x00,0x00,0x80,0x01,0x00,0x00,0x0e,0xc0,0x00,0x00,0x80,0x01,0x00,0xc0,0x01,
 0x00,0x01,0x00,0x80,0x01,0x00,0x38,0x00,0x00,0x02,0x00,0x80,0x01,0x00,0x06,
 0x00,0x00,0x04,0x00,0x80,0x01,0xc0,0x1f,0x00,0x00,0x04,0x00,0x80,0x01,0x30,
 0x60,0x00,0x00,0x08,0x00,0x80,0x01,0x08,0x80,0x00,0x00,0x08,0x00,0x80,0x01,
 0x04,0x07,0x01,0x00,0x10,0x00,0x80,0x01,0x82,0x0f,0x02,0x00,0x10,0x00,0x80,
 0x01,0x82,0x0f,0x02,0x00,0x10,0x00,0x80,0x01,0x01,0x07,0x04,0x00,0x20,0x00,
 0x80,0x01,0x01,0x00,0x04,0x00,0x20,0x00,0x80,0x81,0x00,0x00,0x08,0x00,0x26,
 0x00,0x80,0x81,0x00,0x00,0x08,0x80,0x27,0x00,0x80,0x81,0x00,0x00,0x08,0xe0,
 0x27,0x00,0x80,0x81,0x22,0xa2,0x08,0xd8,0x27,0x00,0x80,0x41,0x36,0xa5,0x10,
 0xc6,0x27,0x00,0x80,0x41,0xaa,0xa8,0x90,0xc1,0x27,0x00,0x80,0x41,0xaa,0xaf,
 0x90,0xc1,0x27,0x00,0x80,0x41,0xa2,0xa8,0x10,0xc0,0x27,0x00,0x80,0x41,0xa2,
 0xa8,0x17,0xc0,0x21,0x00,0x80,0x41,0x00,0x00,0x10,0x40,0x20,0x00,0x80,0x41,
 0x00,0x00,0x10,0x00,0x20,0x00,0x80,0x41,0xfe,0xff,0x17,0x00,0x20,0x00,0x80,
 0x41,0x00,0x00,0x10,0x00,0x30,0x00,0x80,0x41,0xfe,0xff,0x17,0x00,0x3c,0x0e,
 0x80,0x41,0x00,0x00,0x10,0x00,0x0f,0x11,0x80,0x41,0x00,0x00,0x10,0xc0,0x1b,
 0x11,0x80,0x41,0x00,0x00,0x10,0xf0,0xe4,0x10,0x80,0x41,0x00,0x00,0x10,0x3c,
 0x84,0x08,0x80,0x41,0x00,0x00,0x10,0x0f,0x88,0x3c,0x80,0x41,0x00,0x00,0xd0,
 0x03,0xf0,0x43,0x80,0x41,0x00,0x00,0xf0,0x01,0x8c,0x43,0x80,0xc1,0xff,0xff,
 0x3f,0x01,0x82,0x24,0x80,0xc1,0xff,0xff,0x1f,0x01,0x82,0x18,0x80,0x01,0x00,
 0x02,0x02,0x01,0xfc,0x08,0x80,0x01,0x00,0x02,0x02,0x01,0x20,0x09,0x80,0x01,
 0x00,0x02,0x02,0x01,0x10,0x06,0x80,0x01,0x00,0x02,0x02,0x01,0x10,0x00,0x80,
 0x01,0x00,0x02,0x02,0x01,0x08,0x00,0x80,0x01,0x00,0x02,0x02,0x01,0x08,0x00,
 0x80,0x01,0x00,0x02,0x02,0x01,0xb4,0x3f,0x80,0x01,0x00,0x02,0x02,0x01,0x0e,
 0x28,0x80,0x01,0x00,0x02,0x02,0x01,0x03,0x16,0x80,0x01,0x00,0x02,0x02,0x81,
 0xc0,0x11,0x80,0x01,0x00,0x02,0x02,0x41,0x38,0x08,0x80,0x01,0x00,0x02,0x02,
 0x21,0x04,0x04,0x80,0x01,0x00,0x02,0x02,0x11,0x03,0x02,0x80,0x01,0x00,0x02,
 0x02,0xc9,0x80,0x01,0x80,0x01,0x00,0x02,0x02,0x25,0x60,0x00,0x80,0x01,0x00,
 0x02,0x02,0x13,0x18,0x00,0x80,0x01,0x00,0x02,0x02,0x01,0x07,0x00,0x80,0x01,
 0x00,0x02,0xc2,0xfe,0x00,0x00,0x80,0x01,0x00,0x02,0x32,0x00,0x00,0x00,0x80,
 0x01,0x00,0x02,0x0e,0x00,0x00,0x00,0x80,0x01,0x00,0xfe,0x03,0x00,0x00,0x00,
 0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,
 0xff,0xff};

int	    Xbiff_Screen;
int	    Xloc, Yloc;
unsigned long	    white, black;
XGCValues   Xbiff_GCValues;
XWMHints    Xbiff_WMHints;
XSizeHints  Xbiff_SizeHints;
Pixmap	    Mail_Bitmap;
char	    wintitle[80] = "xbiff";
char	    *UserDefault;


NewMailMessageList[0].BufferAddress = &NewMessages;

    MAIL$USER_BEGIN (
		&MailContext,
		&StdList,
		&NullList);

Xbiff_Display = XOpenDisplay(0);
    if (Xbiff_Display == NULL)
	{
	fprintf(stderr, "Couldn't open display!\n");
	exit();
	}

    if (UserDefault = XGetDefault(Xbiff_Display, "xbiff", "UpdateInterval"))
	TimerInterval[0] = (atoi(UserDefault) * -10000000);
    else
	TimerInterval[0] = (-150000000);
    TimerInterval[1] = -1;

    if (UserDefault = XGetDefault(Xbiff_Display, "xbiff", "x"))
	Xloc = atoi(UserDefault);
    else
	Xloc = 0;

    if (UserDefault = XGetDefault(Xbiff_Display, "xbiff", "y"))
	Yloc = atoi(UserDefault);
    else
	Yloc = 0;

    Xbiff_Screen = XDefaultScreen(Xbiff_Display);
    white = XWhitePixel(Xbiff_Display, Xbiff_Screen);
    black = XBlackPixel(Xbiff_Display, Xbiff_Screen);

    Mail_Pixmap = XCreateBitmapFromData(Xbiff_Display, DefaultRootWindow(Xbiff_Display), mail_bits, 
    Nomail_Pixmap = XCreateBitmapFromData(Xbiff_Display, DefaultRootWindow(Xbiff_Display), nomail_bi

    Xbiff_Window = XCreateSimpleWindow(Xbiff_Display, DefaultRootWindow(Xbiff_Display), Xloc, Yloc,
			      64, 64, 1, black, white);

    Xbiff_SizeHints.width = PIXMAP_WIDTH;
    Xbiff_SizeHints.height = PIXMAP_HEIGHT;

    Xbiff_SizeHints.x = Xloc;
    Xbiff_SizeHints.y = Yloc;

    Xbiff_SizeHints.flags = PPosition | PSize;

    XSetStandardProperties(
		Xbiff_Display, Xbiff_Window,
		wintitle,
		wintitle,
		None,
		argv, argc,
		&Xbiff_SizeHints);

    Xbiff_GCValues.foreground = black;
    Xbiff_GCValues.background = white;
    Xbiff_GC = XCreateGC(Xbiff_Display, Xbiff_Window, GCForeground | GCBackground, &Xbiff_GCValues);
    Xbiff_WMHints.input = 0;
    Xbiff_WMHints.flags = InputHint;

    XSetWMHints(Xbiff_Display, Xbiff_Window, &Xbiff_WMHints);
    XSelectInput(Xbiff_Display, Xbiff_Window, ExposureMask | ButtonPressMask );
    XMapWindow(Xbiff_Display, Xbiff_Window);

    CheckMail();

    while (1) {
	XNextEvent(Xbiff_Display, &Xbiff_Event);
	switch (Xbiff_Event.xany.type)
	  {
	  case Expose:
	    CurrentX = Xbiff_Event.xexpose.x;
	    CurrentY = Xbiff_Event.xexpose.y;
	    CurrentHeight = Xbiff_Event.xexpose.height;
	    CurrentWidth = Xbiff_Event.xexpose.width;		
	    if (NewMessages > 0)
		    {
		    XCopyPlane(Xbiff_Display, Mail_Pixmap, Xbiff_Window, Xbiff_GC, Xbiff_Event.xexpose.x, Xbiff_Ev
			       Xbiff_Event.xexpose.width, Xbiff_Event.xexpose.height,
			       Xbiff_Event.xexpose.x, Xbiff_Event.xexpose.y, 1);
		    }
	    else
		    {
		    XCopyPlane(Xbiff_Display, Nomail_Pixmap, Xbiff_Window, Xbiff_GC, Xbiff_Event.xexpose.x, Xbiff_
			       Xbiff_Event.xexpose.width, Xbiff_Event.xexpose.height,
			       Xbiff_Event.xexpose.x, Xbiff_Event.xexpose.y, 1);
		    }
	    XFlush(Xbiff_Display);
	    break;
	  case ButtonPress:
	    XCloseDisplay(Xbiff_Display);
	    MAIL$USER_END (
			&MailContext,
			&StdList,
			&NullList);
	    exit();
	  }
	}
}





CheckMail()
{
    MAIL$USER_GET_INFO (
		&MailContext,
		&NullList,
		&NewMailMessageList);

    if (NewMessages > 0)
	    {
	    XCopyPlane(Xbiff_Display, Mail_Pixmap, Xbiff_Window, Xbiff_GC, CurrentX, CurrentY,
		       CurrentWidth, CurrentHeight,
		       CurrentX, CurrentY, 1); 
	    }
    else
	    {
	    XCopyPlane(Xbiff_Display, Nomail_Pixmap, Xbiff_Window, Xbiff_GC, CurrentX, CurrentY,
		       CurrentWidth, CurrentHeight,
		       CurrentX, CurrentY, 1); 
	    }

    XFlush(Xbiff_Display);

    sys$setimr (
	0, 
	&TimerInterval, 
	&CheckMail, 
	0, 
	0);
}

T.RTitleUserPersonal
Name
DateLines
496.1MU::PORTERwaiting for BardotTue Mar 28 1989 21:5712
    I wrote a similar thing, 'cept mine just displays the
    new message count.  Yours sounds like it might be a bit
    snazzier (I can't try it out right now, I'm at home).
    
    You can see mine in SMAUG::DAVES_BITSHOP:NEWMAIL.C -- feel free 
    to steal anything you like the look of.  I might do the same to your code,
    when I'm nearer my workstation tube.  
    
    Your program name is much better than mine!
    
    

496.2LESLIE::LESLIEBorn to be MildWed Mar 29 1989 03:235
    Can one of you gurus post a .EXE please? Not all of us have the room
    for the programming stuff. Preferably for VMS T5.2-41M.
    
    Andy

496.3BOBOB::LEMBREEJust do it.Wed Mar 29 1989 10:148
    I'd like to be able to post a .EXE, but can't allow FAL access to my
    machine.  Contact me via e-mail with a place to copy one to, and I'll
    do that.  Perhaps there's someone who could volunteer some space to
    keep an exe around for network access?

    bob

496.4Will it work on a cluster?TLE::DANIELSBrad Daniels, VAX C RTL whipping boyThu Mar 30 1989 12:1514
Along these lines....

I get  all of my mail on the cluster, and have my mail job running ther with
th  display st back to my workstation. I would like to also put something on
the  cluster  that  would  intercept  messages  to  me  (mail ones at least,
preferably  also  job  completion  notices), and display them in a window. I
couldn't tell from looking at your program whether it would work for me, and
don't  know enough about how these messages are delivered to be able to even
figure out if what I want is possible.

Pointers are appreciated.

- Brad

496.5Run xbiff (what does the name mean) on the clusterOSLACT::OLAVDo it in parallel!Thu Mar 30 1989 12:4010
Just start xbiff on the cluster using the display of your workstation.

$ SET DISPLAY/NODE=<your workstation>/CREATE
$ RUN XBIFF

Remember to add your <clusternode>::<username> in Customize Security on your
workstation.

Olav

496.6xbiff the dog...TLE::DANIELSBrad Daniels, VAX C RTL whipping boyThu Mar 30 1989 12:4914
Re .-1:

Will xbiff  then  "trap"  all  of the messages which would normally go to my
sessions on the cluster?  Or will those sessions also get notified?

I think the name "xbiff" comes from "biff", which is a program on Unix which
notifies  the  user  of  new  mail  (sort of like the "new mail" messages on
VMS)...  The  program  was  named  after  a dog that used to hang around the
Berkeley  computer  center.  I think it may have belonged to the programmer,
but  I'm not sure. I'm not sure whether it was named after the dog just as a
joke, or because the dog would bark whenever someone new arrived...

- Brad (whose nickname in college was "biff")

496.7Works for me...MCNALY::MILLERBush For President...Kate Bush!Thu Mar 30 1989 13:0410
Brad,

I'm not sure if I understand your question, but I'm running XBIFF
from a cluster and it seems to be detecting mail from all of the nodes.


Regards,

                 == ken miller ==

496.8VMSSG::LEMBREEJust do it.Thu Mar 30 1989 13:078
xbiff uses callable mail to determine whether or not you have new mail,
it does not intercept broadcast messages.  as a result, it will work on
any cluster member, provided the cluster isn't configured in some strange
way.  it will not perform any sort of "notification" per se, except of course
for the little mailbox change.  it also does not shut off mail's normal
notification mechanism, this being breakthrus to any logged in terminals on
the cluster.

496.9latest in bugsVMSSG::LEMBREEJust do it.Thu Mar 30 1989 13:168
Hello,
	There seems to be a bug in the way you can specify update rates for
xbiff.  Workaround: stick to the default of 15 seconds.  Apparently I didn't
entirely understand the mechanism I used.  This will be fixed in a future
release.

Bob

496.10MU::PORTERwaiting for BardotThu Mar 30 1989 18:0512
I have a user interface question.   Xbiff indicates that
new mail has arrived by raising the flag on the mailbox.

On my postal route, the flag is used exclusively as a signal
to the mailman that outgoing mail is available.  It is not 
raised to indicate that the mailman has placed some incoming
mail in the box.

(This is a question from someone who wasn't brought up in the
 USA and who didn't know about those funny mailboxes until
 a few years ago).

496.11a shaggy dog storyCRLVMS::HALBERTCRL, TrellisThu Mar 30 1989 18:186
    re .6: I personally know the dog in question; he was named Biff, and he
    belonged to a CS graduate student at Berkeley, whose name was not Biff.
    He was a very friendly dog. I was also present when Bill Joy named the
    command; Biff was in the room. I heard later that Biff barked when the
    mail carrier showed up, but that may be apocryphal.  --Dan