home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume4
/
xgen
/
part03
/
hash_env.c
next >
Wrap
C/C++ Source or Header
|
1989-06-29
|
1KB
|
68 lines
#define MAX_NUM_ENVS 20
#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 _env env[MAX_NUM_ENVS];
enter_env_shells( name, initial_shell_header)
char *name;
struct env_shell *initial_shell_header;
{
static int i = 0;
int key;
if( i == 0 )
{
for ( i=0 ; i<MAX_NUM_ENVS ; i++ )
{
env[i].initial_shells = NULL;
}
}
key = ((*name) * *(name+1))%MAX_NUM_ENVS;
while( env[key].initial_shells != NULL )
key = ++key % MAX_NUM_ENVS ;
env[key].initial_shells = initial_shell_header ;
env[key].name = (char *)XtMalloc((strlen(name) + 1));
strcpy( env[key].name, name);
}
struct env_shell *get_env_shells(name)
char *name;
{
int key;
key = ((*name) * *(name+1))%MAX_NUM_ENVS;
while( env[key].initial_shells != NULL
&& strcmp(env[key].name, name) != 0)
key++;
return(env[key].initial_shells);
}