No longer use `glibtop_machine.h' for Linux.

1998-07-03  Martin baulig  <martin@home-of-linux.org>

	* macros/gnome-libgtop-sysdeps.m4: No longer use
	`glibtop_machine.h' for Linux.

	* sysdeps/linux/glibtop_machine.h: Removed.

	* sysdeps/guile/guile.awk: Using `scm_append'
	instead of `gh_append'.

	* sysdeps/guile/names/guile-names.awk: dito.

	* sysdeps/linux/*.c: Using code from stable branch again.

	* include/glibtop/parameter.h: New file.

	* lib/parameter.c: New file.

	* lib/{open, init}.c: Done some more work on server
	initialization
This commit is contained in:
Martin baulig
1998-07-03 17:19:25 +00:00
committed by Martin Baulig
parent 94715ef718
commit 9532dadc2e
26 changed files with 557 additions and 355 deletions

View File

@@ -33,97 +33,36 @@ void
glibtop_open_l (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)
{
char version [BUFSIZ], buffer [BUFSIZ], *temp, *temp2;
glibtop_sysdeps sysdeps;
int connect_type, ret;
memset (server, 0, sizeof (glibtop));
server->name = program_name;
/* Is the user allowed to override the server ? */
/* It is important to set _GLIBTOP_INIT_STATE_OPEN here when we
* do recursive calls to glibtop_init_r (). */
server->flags |= _GLIBTOP_INIT_STATE_OPEN;
if (server->method == GLIBTOP_METHOD_INET) {
int connect_type;
fprintf (stderr, "Connecting to '%s' port %d.\n",
server->server_host, server->server_port);
connect_type = glibtop_make_connection
(server->server_host, server->server_port,
&server->socket);
server->features = -1;
if (flags & GLIBTOP_OPEN_NO_OVERRIDE)
return;
/* Try to get data from environment. */
temp = getenv ("LIBGTOP_SERVER") ?
getenv ("LIBGTOP_SERVER") : GTOP_SERVER;
server->server_command = glibtop_strdup_r (server, temp);
temp = getenv ("LIBGTOP_RSH") ?
getenv ("LIBGTOP_RSH") : "rsh";
server->server_rsh = glibtop_strdup_r (server, temp);
/* If the first character of 'server_command' is a colon,
* the first field is the method to connect to the server. */
if (server->server_command [0] == ':') {
/* Everything up to the next colon is the method. */
temp = strstr (server->server_command+1, ":");
if (temp) *temp = 0;
/* Dispatch method. */
if (!strcmp (server->server_command+1, "direct")) {
/* Use sysdeps dir instead of connecting to server
* even if using the server would be required on
* the current system. */
return;
} else if (!strcmp (server->server_command+1, "inet")) {
/* Connect to internet server. */
if (temp == NULL) {
server->server_host = glibtop_strdup_r
(server, "localhost");
} else {
temp2 = strstr (temp+1, ":");
if (temp2) *temp2 = 0;
server->server_host = glibtop_strdup_r
(server, temp+1);
temp = temp2;
}
if (temp == NULL) {
server->server_port = DEFAULT_PORT;
} else {
temp2 = strstr (temp+1, ":");
if (temp2) *temp2 = 0;
ret = sscanf (temp+1, "%d", &server->server_port);
if (ret != 1)
server->server_port = DEFAULT_PORT;
temp = temp2 ? temp2 + 1 : temp2;
}
fprintf (stderr, "Connecting to '%s' port %d.\n",
server->server_host, server->server_port);
connect_type = glibtop_make_connection
(server->server_host, server->server_port,
&server->socket);
server->features = -1;
return;
}
}
glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
sizeof (glibtop_sysdeps), &sysdeps);
server->features = sysdeps.features;
/* If the server has been started, ask it for its features. */
if (server->flags & _GLIBTOP_INIT_STATE_SERVER) {
glibtop_sysdeps sysdeps;
glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
sizeof (glibtop_sysdeps), &sysdeps);
server->features = sysdeps.features;
}
}