home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume4
/
xgen
/
part03
/
hash_shell_descrip.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-29
|
1KB
|
69 lines
#define MAX_NUM_SHELLS 50
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/Intrinsic.h>
#include <X11/CompositeP.h>
#include <X11/CommandP.h>
#include <X11/LabelP.h>
#include <X11/Box.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Viewport.h>
#include <X11/Form.h>
#include <X11/Core.h>
#include <X11/VPaned.h>
#include "application.h"
static struct shell *app_shell[MAX_NUM_SHELLS];
enter_shell_descrip( pres_shell)
struct shell *pres_shell;
{
static int i = 0;
int key;
char *name;
if( i == 0 )
{
for ( i=0 ; i<MAX_NUM_SHELLS ; i++ )
{
app_shell[i] = NULL;
}
}
name = pres_shell->name;
key = ((*name) * *(name+1))%MAX_NUM_SHELLS;
while( app_shell[key] != NULL )
key = ++key%MAX_NUM_SHELLS;
app_shell[key] = pres_shell;
}
struct shell *get_shell(name)
char *name;
{
int key;
key = ((*name) * *(name+1))%MAX_NUM_SHELLS;
while( strcmp(app_shell[key]->name, name) != 0)
{
key++;
if( app_shell[key] == NULL )
{
fprintf(stderr, "shell %s: Not found.\n", name );
return( NULL );
}
}
return(app_shell[key]);
}