New file. Imported from xemacs 20.3.
1998-06-14 Martin Baulig <martin@home-of-linux.org> * include/glibtop/gnuserv.h: New file. Imported from xemacs 20.3. * sysdeps/common/gnuslib.c: New file. Imported from xemacs 20.3 * lib/gnuclient.c: New file. Imported from xemacs 20.3 * sysdeps/daemon/gnuserv.c: New file. Imported from xemacs 20.3 * sysdeps/daemon: New directory. * configure.in (LIBGTOP_LIBS, LIBGTOP_GUILE_LIBS): Added `$X_LIBS -lXau' when we have xauth.
This commit is contained in:
committed by
Martin Baulig
parent
7d0d3db11c
commit
28dfff5752
13
ChangeLog
13
ChangeLog
@@ -1,5 +1,18 @@
|
||||
1998-06-14 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/gnuserv.h: New file. Imported from xemacs 20.3.
|
||||
|
||||
* sysdeps/common/gnuslib.c: New file. Imported from xemacs 20.3
|
||||
|
||||
* lib/gnuclient.c: New file. Imported from xemacs 20.3
|
||||
|
||||
* sysdeps/daemon/gnuserv.c: New file. Imported from xemacs 20.3
|
||||
|
||||
* sysdeps/daemon: New directory.
|
||||
|
||||
* configure.in (LIBGTOP_LIBS, LIBGTOP_GUILE_LIBS): Added
|
||||
`$X_LIBS -lXau' when we have xauth.
|
||||
|
||||
* acconfig.h (HAVE_XAUTH): New tag.
|
||||
|
||||
* configure.in: Added check for `HAVE_XAUTH'.
|
||||
|
10
configure.in
10
configure.in
@@ -6,6 +6,8 @@ AC_INIT(copyright.txt)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_INIT_AUTOMAKE(libgtop, 0.01)
|
||||
|
||||
AM_ACLOCAL_INCLUDE(macros)
|
||||
|
||||
AC_ISC_POSIX
|
||||
@@ -32,8 +34,6 @@ export cross_compiling
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AM_INIT_AUTOMAKE(libgtop, 0.01)
|
||||
|
||||
dnl If you want to use libgtop without gnome, comment the following line out.
|
||||
GNOME_INIT_HOOK(gnome_found=yes)
|
||||
|
||||
@@ -121,7 +121,7 @@ test -z "$with_xauth" && { AC_CHECK_LIB(Xau, XauGetAuthByAddr,[:],with_xauth=no,
|
||||
test -z "$with_xauth" && with_xauth=yes
|
||||
if test "$with_xauth" = "yes"; then
|
||||
AC_DEFINE(HAVE_XAUTH)
|
||||
XE_SPACE(libs_xauth, $X_EXTRA_LIBS -lXau $libs_x $X_PRE_LIBS)
|
||||
XE_SPACE(libs_xauth, $X_LIBS -lXau)
|
||||
fi
|
||||
AC_SUBST(libs_xauth)
|
||||
|
||||
@@ -186,8 +186,8 @@ fi
|
||||
|
||||
AC_SUBST(libgtop_want_guile_names)
|
||||
|
||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common"
|
||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common"
|
||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common $ibs_xauth"
|
||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common $libs_xauth"
|
||||
|
||||
if test "x$need_server" = "xyes" ; then
|
||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop"
|
||||
|
@@ -19,7 +19,7 @@ first_SOURCES = first.c
|
||||
first_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||
|
||||
first_static_SOURCES = $(first_SOURCES)
|
||||
first_static_LDADD = $(first_LDADD)
|
||||
@@ -29,7 +29,7 @@ second_SOURCES = second.c
|
||||
second_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||
|
||||
second_static_SOURCES = $(second_SOURCES)
|
||||
second_static_LDADD = $(second_LDADD)
|
||||
@@ -46,7 +46,7 @@ third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
|
||||
$(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
|
||||
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||
|
||||
third_static_SOURCES = $(third_SOURCES)
|
||||
third_static_LDADD = $(third_LDADD)
|
||||
|
@@ -56,8 +56,8 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup a
|
||||
|
||||
|
||||
#define INTERNET_DOMAIN_SOCKETS
|
||||
#define UNIX_DOMAIN_SOCKETS
|
||||
/* #define SYSV_IPC */
|
||||
// #define UNIX_DOMAIN_SOCKETS
|
||||
// #define SYSV_IPC
|
||||
|
||||
/*
|
||||
* Define additional authentication protocols to be used. These methods will
|
||||
@@ -77,7 +77,7 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup a
|
||||
* stuff related to supporting MIT-MAGIC-COOKIE-1
|
||||
*/
|
||||
|
||||
#define MCOOKIE_SCREEN "999" /* screen # to use as the gnuserv cookie */
|
||||
#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
|
||||
#define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
|
||||
#define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
|
||||
|
||||
@@ -155,9 +155,8 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup a
|
||||
#undef TRUE
|
||||
#define TRUE 1
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern char *progname;
|
||||
// extern char *optarg;
|
||||
// extern int optind;
|
||||
|
||||
/* The casts shut Sun's compiler up and are safe in the context these
|
||||
are actually used. */
|
||||
@@ -177,15 +176,18 @@ extern char *progname;
|
||||
#define CONN_IPC 2
|
||||
|
||||
/* function declarations */
|
||||
int make_connection (char *hostarg, int portarg, int *s);
|
||||
extern int glibtop_make_connection __P((const char *, int, int *));
|
||||
|
||||
#ifdef SYSV_IPC
|
||||
void disconnect_from_ipc_server();
|
||||
#endif
|
||||
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
|
||||
void send_string (int s, const char *msg);
|
||||
void disconnect_from_server (int s, int echo);
|
||||
int read_line (int s, char *dest);
|
||||
// void send_string (int s, const char *msg);
|
||||
// void disconnect_from_server (int s, int echo);
|
||||
// int read_line (int s, char *dest);
|
||||
#endif
|
||||
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
int internet_addr (char *host);
|
||||
extern long glibtop_internet_addr __P((const char *));
|
||||
#endif
|
||||
|
@@ -19,3 +19,9 @@ lib.c: lib.awk $(top_builddir)/config.h $(top_builddir)/features.def
|
||||
EXTRA_DIST = lib.awk
|
||||
|
||||
CLEANFILES = lib.c
|
||||
|
||||
bin_PROGRAMS = gnuclient
|
||||
gnuclient_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
|
||||
gnuclient_LDFLAGS = -static
|
||||
|
617
lib/gnuclient.c
617
lib/gnuclient.c
@@ -42,579 +42,88 @@ Boston, MA 02111-1307, USA.
|
||||
static char rcsid [] = "!Header: gnuclient.c,v 2.2 95/12/12 01:39:21 wing nene !";
|
||||
#endif
|
||||
|
||||
#include "gnuserv.h"
|
||||
#include "getopt.h"
|
||||
#include <glibtop/gnuserv.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
|
||||
#else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
|
||||
!defined(INTERNET_DOMAIN_SOCKETS)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "Sorry, the Emacs server is only "
|
||||
"supported on systems that have\n");
|
||||
fprintf (stderr, "Unix Domain sockets, Internet Domain "
|
||||
"sockets or System V IPC.\n");
|
||||
exit (1);
|
||||
} /* main */
|
||||
#else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
static char cwd[MAXPATHLEN+2]; /* current working directory when calculated */
|
||||
static char *cp = NULL; /* ptr into valid bit of cwd above */
|
||||
|
||||
static pid_t emacs_pid; /* Process id for emacs process */
|
||||
|
||||
void initialize_signals (void);
|
||||
|
||||
static void
|
||||
tell_emacs_to_resume (int sig)
|
||||
{
|
||||
char buffer[GSERV_BUFSZ+1];
|
||||
int s; /* socket / msqid to server */
|
||||
int connect_type; /* CONN_UNIX, CONN_INTERNET, or
|
||||
ONN_IPC */
|
||||
* CONN_IPC */
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
char *hostarg = NULL; /* remote hostname */
|
||||
char thishost[HOSTNAMSZ]; /* this hostname */
|
||||
char remotepath[MAXPATHLEN+1]; /* remote pathname */
|
||||
int rflg = 0; /* pathname given on cmdline */
|
||||
u_short port = 0; /* port to server */
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
#ifdef SYSV_IPC
|
||||
struct msgbuf *msgp; /* message */
|
||||
#endif /* SYSV_IPC */
|
||||
|
||||
/* Why is SYSV so retarded? */
|
||||
/* We want emacs to realize that we are resuming */
|
||||
signal(SIGCONT, tell_emacs_to_resume);
|
||||
glibtop_init ();
|
||||
|
||||
connect_type = make_connection (NULL, (u_short) 0, &s);
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
memset (remotepath, 0, sizeof (remotepath));
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
sprintf(buffer,"(gnuserv-eval '(resume-pid-console %d))", (int)getpid());
|
||||
send_string(s, buffer);
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS)
|
||||
connect_type = glibtop_make_connection (hostarg, port, &s);
|
||||
#else
|
||||
connect_type = glibtop_make_connection (NULL, (u_short) 0, &s);
|
||||
#endif
|
||||
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
if (connect_type == (int) CONN_INTERNET)
|
||||
{
|
||||
char *ptr;
|
||||
gethostname (thishost, HOSTNAMSZ);
|
||||
if (!rflg)
|
||||
{ /* attempt to generate a path
|
||||
* to this machine */
|
||||
if ((ptr = getenv ("LIBGTOP_NODE")) != NULL)
|
||||
/* user specified a path */
|
||||
strcpy (remotepath, ptr);
|
||||
}
|
||||
#if 0 /* This is really bogus... re-enable it if you must have it! */
|
||||
#if defined (hp9000s300) || defined (hp9000s800)
|
||||
else if (strcmp (thishost,hostarg))
|
||||
{ /* try /net/thishost */
|
||||
strcpy (remotepath, "/net/"); /* (this fails using internet
|
||||
addresses) */
|
||||
strcat (remotepath, thishost);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{ /* same machines, no need for path */
|
||||
remotepath[0] = '\0'; /* default is the empty path */
|
||||
}
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
#ifdef SYSV_IPC
|
||||
if ((msgp = (struct msgbuf *)
|
||||
malloc (sizeof *msgp + GSERV_BUFSZ)) == NULL)
|
||||
glibtop_error_io ("not enough memory for message buffer");
|
||||
|
||||
msgp->mtext[0] = '\0'; /* ready for later strcats */
|
||||
#endif /* SYSV_IPC */
|
||||
|
||||
raise (SIGSTOP);
|
||||
|
||||
#ifdef SYSV_IPC
|
||||
if (connect_type == (int) CONN_IPC)
|
||||
disconnect_from_ipc_server (s, msgp, FALSE);
|
||||
#else /* !SYSV_IPC */
|
||||
if (connect_type != (int) CONN_IPC)
|
||||
disconnect_from_server (s, FALSE);
|
||||
; // disconnect_from_server (s, FALSE);
|
||||
#endif /* !SYSV_IPC */
|
||||
}
|
||||
|
||||
static void
|
||||
pass_signal_to_emacs (int sig)
|
||||
{
|
||||
if (kill (emacs_pid, sig) == -1)
|
||||
{
|
||||
fprintf (stderr, "gnuattach: Could not pass signal to emacs process\n");
|
||||
exit (1);
|
||||
}
|
||||
initialize_signals ();
|
||||
}
|
||||
|
||||
void
|
||||
initialize_signals ()
|
||||
{
|
||||
/* Set up signal handler to pass relevant signals to emacs process.
|
||||
We used to send SIGSEGV, SIGBUS, SIGPIPE, SIGILL and others to
|
||||
Emacs, but I think it's better not to. I can see no reason why
|
||||
Emacs should SIGSEGV whenever gnuclient SIGSEGV-s, etc. */
|
||||
signal (SIGHUP, pass_signal_to_emacs);
|
||||
signal (SIGQUIT, pass_signal_to_emacs);
|
||||
signal (SIGINT, pass_signal_to_emacs);
|
||||
#ifdef SIGWINCH
|
||||
signal (SIGWINCH, pass_signal_to_emacs);
|
||||
#endif
|
||||
|
||||
/* We want emacs to realize that we are resuming */
|
||||
signal (SIGCONT, tell_emacs_to_resume);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
get_current_working_directory -- return the cwd.
|
||||
*/
|
||||
static char *
|
||||
get_current_working_directory (void)
|
||||
{
|
||||
if (cp == NULL)
|
||||
{ /* haven't calculated it yet */
|
||||
#ifdef BSD
|
||||
if (getwd (cwd) == 0)
|
||||
#else /* !BSD */
|
||||
if (getcwd (cwd,MAXPATHLEN) == NULL)
|
||||
#endif /* !BSD */
|
||||
{
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to get current working directory\n",
|
||||
progname);
|
||||
exit (1);
|
||||
} /* if */
|
||||
|
||||
/* on some systems, cwd can look like '@machine/' ... */
|
||||
/* ignore everything before the first '/' */
|
||||
for (cp = cwd; *cp && *cp != '/'; ++cp)
|
||||
;
|
||||
|
||||
} /* if */
|
||||
|
||||
return cp;
|
||||
|
||||
} /* get_current_working_directory */
|
||||
|
||||
|
||||
/*
|
||||
filename_expand -- try to convert the given filename into a fully-qualified
|
||||
pathname.
|
||||
*/
|
||||
static void
|
||||
filename_expand (char *fullpath, char *filename)
|
||||
/* fullpath - returned full pathname */
|
||||
/* filename - filename to expand */
|
||||
{
|
||||
int len;
|
||||
|
||||
fullpath[0] = '\0';
|
||||
|
||||
if (filename[0] && filename[0] != '/')
|
||||
{ /* relative filename */
|
||||
strcat (fullpath, get_current_working_directory ());
|
||||
len = strlen (fullpath);
|
||||
|
||||
if (len > 0 && fullpath[len-1] == '/') /* trailing slash already? */
|
||||
; /* yep */
|
||||
else
|
||||
strcat (fullpath, "/"); /* nope, append trailing slash */
|
||||
} /* if */
|
||||
|
||||
strcat (fullpath,filename);
|
||||
|
||||
} /* filename_expand */
|
||||
|
||||
/* Encase the string in quotes, escape all the backslashes and quotes
|
||||
in string. */
|
||||
static char *
|
||||
clean_string (const char *s)
|
||||
{
|
||||
int i = 0;
|
||||
char *p, *res;
|
||||
|
||||
for (p = s; *p; p++, i++)
|
||||
{
|
||||
if (*p == '\\' || *p == '\"')
|
||||
++i;
|
||||
else if (*p == '\004')
|
||||
i += 3;
|
||||
}
|
||||
p = res = (char *)malloc (i + 2 + 1);
|
||||
*p++ = '\"';
|
||||
for (; *s; p++, s++)
|
||||
{
|
||||
switch (*s)
|
||||
{
|
||||
case '\\':
|
||||
*p++ = '\\';
|
||||
*p = '\\';
|
||||
break;
|
||||
case '\"':
|
||||
*p++ = '\\';
|
||||
*p = '\"';
|
||||
break;
|
||||
case '\004':
|
||||
*p++ = '\\';
|
||||
*p++ = 'C';
|
||||
*p++ = '-';
|
||||
*p = 'd';
|
||||
break;
|
||||
default:
|
||||
*p = *s;
|
||||
}
|
||||
}
|
||||
*p++ = '\"';
|
||||
*p = '\0';
|
||||
return res;
|
||||
}
|
||||
|
||||
#define GET_ARGUMENT(var, desc) do { \
|
||||
if (*(p + 1)) (var) = p + 1; \
|
||||
else \
|
||||
{ \
|
||||
if (!argv[++i]) \
|
||||
{ \
|
||||
fprintf (stderr, "%s: `%s' must be followed by an argument\n", \
|
||||
progname, desc); \
|
||||
exit (1); \
|
||||
} \
|
||||
(var) = argv[i]; \
|
||||
} \
|
||||
over = 1; \
|
||||
} while (0)
|
||||
|
||||
/* A strdup immitation. */
|
||||
static char *
|
||||
my_strdup (const char *s)
|
||||
{
|
||||
char *new = malloc (strlen (s) + 1);
|
||||
if (new)
|
||||
strcpy (new, s);
|
||||
return new;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int starting_line = 1; /* line to start editing at */
|
||||
char command[MAXPATHLEN+50]; /* emacs command buffer */
|
||||
char fullpath[MAXPATHLEN+1]; /* full pathname to file */
|
||||
char *eval_form = NULL; /* form to evaluate with `-eval' */
|
||||
char *eval_function = NULL; /* function to evaluate with `-f' */
|
||||
char *load_library = NULL; /* library to load */
|
||||
int quick = 0; /* quick edit, don't wait for user to
|
||||
finish */
|
||||
int batch = 0; /* batch mode */
|
||||
int view = 0; /* view only. */
|
||||
int nofiles = 0;
|
||||
int errflg = 0; /* option error */
|
||||
int s; /* socket / msqid to server */
|
||||
int connect_type; /* CONN_UNIX, CONN_INTERNET, or
|
||||
* CONN_IPC */
|
||||
int suppress_windows_system = 0;
|
||||
char *display = NULL;
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
char *hostarg = NULL; /* remote hostname */
|
||||
char *remotearg;
|
||||
char thishost[HOSTNAMSZ]; /* this hostname */
|
||||
char remotepath[MAXPATHLEN+1]; /* remote pathname */
|
||||
char *path;
|
||||
int rflg = 0; /* pathname given on cmdline */
|
||||
char *portarg;
|
||||
u_short port = 0; /* port to server */
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
#ifdef SYSV_IPC
|
||||
struct msgbuf *msgp; /* message */
|
||||
#endif /* SYSV_IPC */
|
||||
char *tty = NULL;
|
||||
char buffer[GSERV_BUFSZ + 1]; /* buffer to read pid */
|
||||
char result[GSERV_BUFSZ + 1];
|
||||
int i;
|
||||
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
memset (remotepath, 0, sizeof (remotepath));
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
progname = strrchr (argv[0], '/');
|
||||
if (progname)
|
||||
++progname;
|
||||
else
|
||||
progname = argv[0];
|
||||
|
||||
display = getenv ("DISPLAY");
|
||||
if (!display)
|
||||
suppress_windows_system = 1;
|
||||
else
|
||||
display = my_strdup (display);
|
||||
|
||||
for (i = 1; argv[i] && !errflg; i++)
|
||||
{
|
||||
if (*argv[i] != '-')
|
||||
break;
|
||||
else if (*argv[i] == '-'
|
||||
&& (*(argv[i] + 1) == '\0'
|
||||
|| (*(argv[i] + 1) == '-' && *(argv[i] + 2) == '\0')))
|
||||
{
|
||||
/* `-' or `--' */
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!strcmp (argv[i], "-batch") || !strcmp (argv[i], "--batch"))
|
||||
batch = 1;
|
||||
else if (!strcmp (argv[i], "-eval") || !strcmp (argv[i], "--eval"))
|
||||
{
|
||||
if (!argv[++i])
|
||||
{
|
||||
fprintf (stderr, "%s: `-eval' must be followed by an argument\n",
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
eval_form = argv[i];
|
||||
}
|
||||
else if (!strcmp (argv[i], "-display") || !strcmp (argv[i], "--display"))
|
||||
{
|
||||
suppress_windows_system = 0;
|
||||
if (!argv[++i])
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: `-display' must be followed by an argument\n",
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
if (display)
|
||||
free (display);
|
||||
/* no need to strdup. */
|
||||
display = argv[i];
|
||||
}
|
||||
else if (!strcmp (argv[i], "-nw"))
|
||||
suppress_windows_system = 1;
|
||||
else
|
||||
{
|
||||
/* Iterate over one-letter options. */
|
||||
char *p;
|
||||
int over = 0;
|
||||
for (p = argv[i] + 1; *p && !over; p++)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case 'q':
|
||||
quick = 1;
|
||||
break;
|
||||
case 'v':
|
||||
view = 1;
|
||||
break;
|
||||
case 'f':
|
||||
GET_ARGUMENT (eval_function, "-f");
|
||||
break;
|
||||
case 'l':
|
||||
GET_ARGUMENT (load_library, "-l");
|
||||
break;
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
case 'h':
|
||||
GET_ARGUMENT (hostarg, "-h");
|
||||
break;
|
||||
case 'p':
|
||||
GET_ARGUMENT (portarg, "-p");
|
||||
port = atoi (portarg);
|
||||
break;
|
||||
case 'r':
|
||||
GET_ARGUMENT (remotearg, "-r");
|
||||
strcpy (remotepath, remotearg);
|
||||
rflg = 1;
|
||||
break;
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
default:
|
||||
errflg = 1;
|
||||
}
|
||||
} /* for */
|
||||
} /* else */
|
||||
} /* for */
|
||||
|
||||
if (errflg)
|
||||
{
|
||||
fprintf (stderr,
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
"usage: %s [-nw] [-display display] [-q] [-v] [-l library]\n"
|
||||
" [-batch] [-f function] [-eval form]\n"
|
||||
" [-h host] [-p port] [-r remote-path] [[+line] file] ...\n",
|
||||
#else /* !INTERNET_DOMAIN_SOCKETS */
|
||||
"usage: %s [-nw] [-q] [-v] [-l library] [-f function] [-eval form] "
|
||||
"[[+line] path] ...\n",
|
||||
#endif /* !INTERNET_DOMAIN_SOCKETS */
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
if (batch && argv[i])
|
||||
{
|
||||
fprintf (stderr, "%s: Cannot specify `-batch' with file names\n",
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
if (suppress_windows_system && hostarg)
|
||||
{
|
||||
fprintf (stderr, "%s: Remote editing is available only on X\n",
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
*result = '\0';
|
||||
if (eval_function || eval_form || load_library)
|
||||
{
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS)
|
||||
connect_type = make_connection (hostarg, port, &s);
|
||||
#else
|
||||
connect_type = make_connection (NULL, (u_short) 0, &s);
|
||||
#endif
|
||||
sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : "");
|
||||
send_string (s, command);
|
||||
if (load_library)
|
||||
{
|
||||
sprintf (command, " (load-library %s)", clean_string (load_library));
|
||||
send_string (s, command);
|
||||
}
|
||||
if (eval_form)
|
||||
{
|
||||
sprintf (command, " %s", eval_form);
|
||||
send_string (s, command);
|
||||
}
|
||||
if (eval_function)
|
||||
{
|
||||
sprintf (command, " (%s)", eval_function);
|
||||
send_string (s, command);
|
||||
}
|
||||
send_string (s, "))");
|
||||
send_string (s, EOT_STR);
|
||||
if (read_line (s, result) == 0)
|
||||
{
|
||||
fprintf (stderr, "%s: Could not read\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
} /* eval_function || eval_form || load_library */
|
||||
else if (batch)
|
||||
{
|
||||
fprintf (stderr, "%s: `-batch' requires an evaluation\n",
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!batch)
|
||||
{
|
||||
if (suppress_windows_system)
|
||||
{
|
||||
tty = ttyname (0);
|
||||
if (!tty)
|
||||
{
|
||||
fprintf (stderr, "%s: Not connected to a tty", progname);
|
||||
exit (1);
|
||||
}
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS)
|
||||
connect_type = make_connection (hostarg, port, &s);
|
||||
#else
|
||||
connect_type = make_connection (NULL, (u_short) 0, &s);
|
||||
#endif
|
||||
send_string (s, "(gnuserv-eval '(emacs-pid))");
|
||||
send_string (s, EOT_STR);
|
||||
|
||||
if (read_line (s, buffer) == 0)
|
||||
{
|
||||
fprintf (stderr, "%s: Could not establish Emacs procces id\n",
|
||||
progname);
|
||||
exit (1);
|
||||
}
|
||||
/* Don't do disconnect_from_server becasue we have already read
|
||||
data, and disconnect doesn't do anything else. */
|
||||
#ifndef INTERNET_DOMAIN_SOCKETS
|
||||
if (connect_type == (int) CONN_IPC)
|
||||
disconnect_from_ipc_server (s, msgp, FALSE);
|
||||
#endif /* !SYSV_IPC */
|
||||
|
||||
emacs_pid = (pid_t)atol(buffer);
|
||||
initialize_signals();
|
||||
} /* suppress_windows_system */
|
||||
|
||||
#if defined(INTERNET_DOMAIN_SOCKETS)
|
||||
connect_type = make_connection (hostarg, port, &s);
|
||||
#else
|
||||
connect_type = make_connection (NULL, (u_short) 0, &s);
|
||||
#endif
|
||||
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
if (connect_type == (int) CONN_INTERNET)
|
||||
{
|
||||
char *ptr;
|
||||
gethostname (thishost, HOSTNAMSZ);
|
||||
if (!rflg)
|
||||
{ /* attempt to generate a path
|
||||
* to this machine */
|
||||
if ((ptr = getenv ("GNU_NODE")) != NULL)
|
||||
/* user specified a path */
|
||||
strcpy (remotepath, ptr);
|
||||
}
|
||||
#if 0 /* This is really bogus... re-enable it if you must have it! */
|
||||
#if defined (hp9000s300) || defined (hp9000s800)
|
||||
else if (strcmp (thishost,hostarg))
|
||||
{ /* try /net/thishost */
|
||||
strcpy (remotepath, "/net/"); /* (this fails using internet
|
||||
addresses) */
|
||||
strcat (remotepath, thishost);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{ /* same machines, no need for path */
|
||||
remotepath[0] = '\0'; /* default is the empty path */
|
||||
}
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||
|
||||
#ifdef SYSV_IPC
|
||||
if ((msgp = (struct msgbuf *)
|
||||
malloc (sizeof *msgp + GSERV_BUFSZ)) == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: not enough memory for message buffer\n", progname);
|
||||
exit (1);
|
||||
} /* if */
|
||||
|
||||
msgp->mtext[0] = '\0'; /* ready for later strcats */
|
||||
#endif /* SYSV_IPC */
|
||||
|
||||
if (suppress_windows_system)
|
||||
{
|
||||
char *term = getenv ("TERM");
|
||||
if (!term)
|
||||
{
|
||||
fprintf (stderr, "%s: unknown terminal type\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
sprintf (command, "(gnuserv-edit-files '(tty %s %s %d) '(",
|
||||
clean_string (tty), clean_string (term), (int)getpid ());
|
||||
}
|
||||
else /* !suppress_windows_system */
|
||||
{
|
||||
sprintf (command, "(gnuserv-edit-files '(x %s) '(",
|
||||
clean_string (display));
|
||||
} /* !suppress_windows_system */
|
||||
send_string (s, command);
|
||||
|
||||
if (!argv[i])
|
||||
nofiles = 1;
|
||||
|
||||
for (; argv[i]; i++)
|
||||
{
|
||||
if (i < argc - 1 && *argv[i] == '+')
|
||||
starting_line = atoi (argv[i++]);
|
||||
else
|
||||
starting_line = 1;
|
||||
/* If the last argument is +something, treat it as a file. */
|
||||
if (i == argc)
|
||||
{
|
||||
starting_line = 1;
|
||||
--i;
|
||||
}
|
||||
filename_expand (fullpath, argv[i]);
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
path = malloc (strlen (remotepath) + strlen (fullpath) + 1);
|
||||
sprintf (path, "%s%s", remotepath, fullpath);
|
||||
#else
|
||||
path = my_strdup (fullpath);
|
||||
#endif
|
||||
sprintf (command, "(%d . %s)", starting_line, clean_string (path));
|
||||
send_string (s, command);
|
||||
free (path);
|
||||
} /* for */
|
||||
|
||||
sprintf (command, ")%s%s",
|
||||
(quick || (nofiles && !suppress_windows_system)) ? " 'quick" : "",
|
||||
view ? " 'view" : "");
|
||||
send_string (s, command);
|
||||
send_string (s, ")");
|
||||
|
||||
#ifdef SYSV_IPC
|
||||
if (connect_type == (int) CONN_IPC)
|
||||
disconnect_from_ipc_server (s, msgp, FALSE);
|
||||
#else /* !SYSV_IPC */
|
||||
if (connect_type != (int) CONN_IPC)
|
||||
disconnect_from_server (s, FALSE);
|
||||
#endif /* !SYSV_IPC */
|
||||
} /* not batch */
|
||||
|
||||
if (batch && !quick)
|
||||
printf ("%s\n", result);
|
||||
|
||||
return 0;
|
||||
|
||||
} /* main */
|
||||
|
||||
#endif /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
|
||||
|
@@ -1 +1 @@
|
||||
SUBDIRS = server proxy
|
||||
SUBDIRS = server proxy daemon
|
||||
|
@@ -33,27 +33,13 @@
|
||||
static char rcsid [] = "!Header: gnuserv.c,v 2.1 95/02/16 11:58:27 arup alpha !";
|
||||
#endif
|
||||
|
||||
#include "gnuserv.h"
|
||||
#include <glibtop/gnuserv.h>
|
||||
|
||||
#ifdef AIX
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
|
||||
#if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
|
||||
!defined(INTERNET_DOMAIN_SOCKETS)
|
||||
#if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
|
||||
main ()
|
||||
{
|
||||
fprintf (stderr,"Sorry, the Emacs server is only supported on systems that have\n");
|
||||
@@ -131,16 +117,12 @@ ipc_init (struct msgbuf **msgpp)
|
||||
key_t key; /* messge key */
|
||||
char buf[GSERV_BUFSZ]; /* pathname for key */
|
||||
|
||||
sprintf (buf,"/tmp/gsrv%d",(int)geteuid ());
|
||||
sprintf (buf,"/tmp/lgtd%d",(int)geteuid ());
|
||||
creat (buf,0600);
|
||||
key = ftok (buf,1);
|
||||
|
||||
if ((ipc_qid = msgget (key,0600|IPC_CREAT)) == -1)
|
||||
{
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to create msg queue\n", progname);
|
||||
ipc_exit (1);
|
||||
} /* if */
|
||||
glibtop_error_io ("unable to create msg queue");
|
||||
|
||||
ipc_spawn_watchdog ();
|
||||
|
||||
@@ -150,8 +132,7 @@ ipc_init (struct msgbuf **msgpp)
|
||||
if ((*msgpp = (struct msgbuf *)
|
||||
malloc (sizeof **msgpp + GSERV_BUFSZ)) == NULL)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: unable to allocate space for message buffer\n", progname);
|
||||
glibtop_warn_io ("unable to allocate space for message buffer");
|
||||
ipc_exit(1);
|
||||
} /* if */
|
||||
} /* ipc_init */
|
||||
@@ -174,8 +155,7 @@ handle_ipc_request (struct msgbuf *msgp)
|
||||
|
||||
if ((len = msgrcv (ipc_qid, msgp, GSERV_BUFSZ - 1, 1, 0)) < 0)
|
||||
{
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to receive\n", progname);
|
||||
glibtop_warn_io ("msgrcv");
|
||||
ipc_exit (1);
|
||||
} /* if */
|
||||
|
||||
@@ -192,8 +172,7 @@ handle_ipc_request (struct msgbuf *msgp)
|
||||
#if 0
|
||||
if ((len = read(0,buf,GSERV_BUFSZ-1)) < 0)
|
||||
{
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to read\n", progname);
|
||||
glibtop_warn_io ("read");
|
||||
ipc_exit (1);
|
||||
} /* if */
|
||||
|
||||
@@ -210,11 +189,7 @@ handle_ipc_request (struct msgbuf *msgp)
|
||||
}
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to read\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
glibtop_error_io ("read");
|
||||
|
||||
/* parse the response from emacs, getting client fd & result length */
|
||||
buf[offset] = '\0';
|
||||
@@ -223,11 +198,7 @@ handle_ipc_request (struct msgbuf *msgp)
|
||||
while (result_len > 0)
|
||||
{
|
||||
if ((len = read(0, buf, min2 (result_len, GSERV_BUFSZ - 1))) < 0)
|
||||
{
|
||||
perror (progname);
|
||||
fprintf (stderr, "%s: unable to read\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
glibtop_error_io ("read");
|
||||
|
||||
/* Send this string off, but only if we have enough space */
|
||||
|
||||
@@ -249,23 +220,17 @@ handle_ipc_request (struct msgbuf *msgp)
|
||||
while ((len = read (0,buf,1)) == 0)
|
||||
;
|
||||
if (len < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf (stderr,"%s: unable to read\n", progname);
|
||||
exit (1);
|
||||
}
|
||||
glibtop_error_io ("read");
|
||||
|
||||
if (buf[0] != '\n')
|
||||
{
|
||||
fprintf (stderr,"%s: garbage after result [%c]\n", progname, buf[0]);
|
||||
exit (1);
|
||||
}
|
||||
glibtop_error ("garbage after result [%c]", buf[0]);
|
||||
#endif
|
||||
|
||||
/* Send a response back to the client. */
|
||||
|
||||
msgp->mtype = msg_st.msg_lspid;
|
||||
if (msgsnd (ipc_qid,msgp,strlen(msgp->mtext)+1,0) < 0)
|
||||
perror ("msgsend(gnuserv)");
|
||||
glibtop_warn_io ("msgsend(gnuserv)");
|
||||
|
||||
} /* handle_ipc_request */
|
||||
#endif /* SYSV_IPC */
|
||||
@@ -296,11 +261,8 @@ echo_request (int s)
|
||||
|
||||
} /* while */
|
||||
|
||||
if (len < 0) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to recv\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
if (len < 0)
|
||||
glibtop_error_io ("recv");
|
||||
|
||||
} /* echo_request */
|
||||
|
||||
@@ -312,6 +274,7 @@ echo_request (int s)
|
||||
static void
|
||||
handle_response (void)
|
||||
{
|
||||
#if 0
|
||||
char buf[GSERV_BUFSZ+1];
|
||||
int offset=0;
|
||||
int s;
|
||||
@@ -325,22 +288,17 @@ handle_response (void)
|
||||
offset += len;
|
||||
}
|
||||
|
||||
if (len < 0) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to read\n",progname);
|
||||
exit(1);
|
||||
}
|
||||
if (len < 0)
|
||||
glibtop_error_io ("read");
|
||||
|
||||
/* parse the response from emacs, getting client fd & result length */
|
||||
buf[offset] = '\0';
|
||||
sscanf(buf,"%d/%d", &s, &result_len);
|
||||
|
||||
while (result_len > 0) {
|
||||
if ((len = read(0,buf,min2(result_len,GSERV_BUFSZ))) < 0) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to read\n",progname);
|
||||
exit(1);
|
||||
}
|
||||
if ((len = read(0,buf,min2(result_len,GSERV_BUFSZ))) < 0)
|
||||
glibtop_error_io ("read");
|
||||
|
||||
buf[len] = '\0';
|
||||
send_string(s,buf);
|
||||
result_len -= len;
|
||||
@@ -350,20 +308,18 @@ handle_response (void)
|
||||
while ((len = read(0,buf,1)) == 0)
|
||||
;
|
||||
if (len < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to read\n",progname);
|
||||
exit(1);
|
||||
}
|
||||
glibtop_error_io ("read");
|
||||
|
||||
if (buf[0] != '\n')
|
||||
{
|
||||
fprintf(stderr,"%s: garbage after result\n",progname);
|
||||
exit(1);
|
||||
}
|
||||
glibtop_error ("garbage after result");
|
||||
|
||||
/* send the newline */
|
||||
buf[1] = '\0';
|
||||
send_string(s,buf);
|
||||
close(s);
|
||||
#else
|
||||
glibtop_error ("handle_response (): Function not implemented");
|
||||
#endif
|
||||
|
||||
} /* handle_response */
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
|
||||
@@ -412,18 +368,18 @@ timed_read (int fd, char *buf, int max, int timeout, int one_line)
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("read error on socket\004\n");
|
||||
glibtop_warn_io ("read error on socket");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (r == 0)
|
||||
{
|
||||
printf ("read timed out\004\n");
|
||||
glibtop_warn ("read timed out");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("error in select\004\n");
|
||||
glibtop_warn_io ("error in select");
|
||||
return -1;
|
||||
}
|
||||
} while ((nbytes < max) && !(one_line && (c == '\n')));
|
||||
@@ -464,9 +420,7 @@ permitted (u_long host_addr, int fd)
|
||||
if (strcmp (auth_protocol, DEFAUTH_NAME) &&
|
||||
strcmp (auth_protocol, MCOOKIE_NAME))
|
||||
{
|
||||
printf ("authentication protocol (%s) from client is invalid...\n",
|
||||
auth_protocol);
|
||||
printf ("... Was the client an old version of gnuclient/gnudoit?\004\n");
|
||||
glibtop_warn ("Authentication protocol from client is invalid", auth_protocol);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -493,7 +447,7 @@ permitted (u_long host_addr, int fd)
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
printf ("client tried Xauth, but server is not compiled with Xauth\n");
|
||||
glibtop_warn ("client tried Xauth, but server is not compiled with Xauth");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -501,7 +455,7 @@ permitted (u_long host_addr, int fd)
|
||||
* protocol....
|
||||
*/
|
||||
|
||||
printf ("Xauth authentication failed, trying GNU_SECURE auth...\004\n");
|
||||
glibtop_warn ("Xauth authentication failed, trying GNU_SECURE auth...");
|
||||
|
||||
}
|
||||
|
||||
@@ -518,7 +472,7 @@ permitted (u_long host_addr, int fd)
|
||||
key = HASH(host_addr) % TABLE_SIZE;
|
||||
|
||||
/* Now check the chain for that hash key */
|
||||
for(entry=permitted_hosts[key]; entry != NULL; entry=entry->next)
|
||||
for(entry = permitted_hosts[key]; entry != NULL; entry=entry->next)
|
||||
if (host_addr == entry->host_addr)
|
||||
return(TRUE);
|
||||
|
||||
@@ -537,13 +491,10 @@ add_host (u_long host_addr)
|
||||
int key;
|
||||
struct entry *new_entry;
|
||||
|
||||
if (!permitted(host_addr, -1))
|
||||
if (!permitted (host_addr, -1))
|
||||
{
|
||||
if ((new_entry = (struct entry *) malloc(sizeof(struct entry))) == NULL) {
|
||||
fprintf(stderr,"%s: unable to malloc space for permitted host entry\n",
|
||||
progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
if ((new_entry = (struct entry *) malloc(sizeof(struct entry))) == NULL)
|
||||
glibtop_error_io ("unable to malloc space for permitted host entry");
|
||||
|
||||
new_entry->host_addr = host_addr;
|
||||
key = HASH(host_addr) % TABLE_SIZE;
|
||||
@@ -572,17 +523,13 @@ setup_table (void)
|
||||
int i, hosts=0;
|
||||
|
||||
/* Make sure every entry is null */
|
||||
for (i=0; i<TABLE_SIZE; i++)
|
||||
permitted_hosts[i] = NULL;
|
||||
for (i = 0; i < TABLE_SIZE; i++)
|
||||
permitted_hosts [i] = NULL;
|
||||
|
||||
gethostname(hostname,HOSTNAMSZ);
|
||||
gethostname (hostname, HOSTNAMSZ);
|
||||
|
||||
if ((host_addr = internet_addr(hostname)) == -1)
|
||||
{
|
||||
fprintf(stderr,"%s: unable to find %s in /etc/hosts or from YP",
|
||||
progname,hostname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
if (((long) host_addr = glibtop_internet_addr (hostname)) == -1)
|
||||
glibtop_error ("unable to find %s in /etc/hosts or from YP", hostname);
|
||||
|
||||
#ifdef AUTH_MAGIC_COOKIE
|
||||
|
||||
@@ -596,19 +543,20 @@ setup_table (void)
|
||||
|
||||
|
||||
#if 0 /* Don't even want to allow access from the local host by default */
|
||||
add_host(host_addr); /* add local host */
|
||||
add_host (host_addr); /* add local host */
|
||||
hosts++;
|
||||
#endif
|
||||
|
||||
if (((file_name = getenv("GNU_SECURE")) != NULL && /* security file */
|
||||
(host_file = fopen(file_name,"r")) != NULL)) /* opened ok */
|
||||
if (((file_name = getenv ("GNU_SECURE")) != NULL && /* security file */
|
||||
(host_file = fopen (file_name, "r")) != NULL)) /* opened ok */
|
||||
{
|
||||
while ((fscanf(host_file,"%s",hostname) != EOF)) /* find a host */
|
||||
if ((host_addr = internet_addr(hostname)) != -1)/* get its addr */
|
||||
while ((fscanf (host_file, "%s", hostname) != EOF)) /* find a host */
|
||||
if (((long) host_addr = glibtop_internet_addr (hostname)) != -1)/* get its addr */
|
||||
{
|
||||
add_host(host_addr); /* add the addr */
|
||||
add_host (host_addr); /* add the addr */
|
||||
hosts++;
|
||||
}
|
||||
fclose(host_file);
|
||||
fclose (host_file);
|
||||
} /* if */
|
||||
|
||||
return hosts;
|
||||
@@ -631,7 +579,7 @@ internet_init (void)
|
||||
return -1;
|
||||
|
||||
/* clear out address structure */
|
||||
memset((char *)&server,0,sizeof(struct sockaddr_in));
|
||||
memset((char *)&server, 0, sizeof (struct sockaddr_in));
|
||||
|
||||
/* Set up address structure for the listen socket. */
|
||||
server.sin_family = AF_INET;
|
||||
@@ -640,38 +588,26 @@ internet_init (void)
|
||||
/* Find the information for the gnu server
|
||||
* in order to get the needed port number.
|
||||
*/
|
||||
if ((ptr=getenv("GNU_PORT")) != NULL)
|
||||
server.sin_port = htons(atoi(ptr));
|
||||
if ((ptr = getenv ("GNU_PORT")) != NULL)
|
||||
server.sin_port = htons (atoi (ptr));
|
||||
else if ((sp = getservbyname ("gnuserv", "tcp")) == NULL)
|
||||
server.sin_port = htons(DEFAULT_PORT+getuid());
|
||||
server.sin_port = htons (DEFAULT_PORT+getuid());
|
||||
else
|
||||
server.sin_port = sp->s_port;
|
||||
|
||||
/* Create the listen socket. */
|
||||
if ((ls = socket (AF_INET,SOCK_STREAM, 0)) == -1)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to create socket\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
glibtop_error_io ("unable to create socket");
|
||||
|
||||
/* Bind the listen address to the socket. */
|
||||
if (bind(ls,(struct sockaddr *) &server,sizeof(struct sockaddr_in)) == -1)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to bind socket\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
glibtop_error_io ("bind");
|
||||
|
||||
/* Initiate the listen on the socket so remote users
|
||||
* can connect.
|
||||
*/
|
||||
if (listen(ls,20) == -1)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to listen\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
glibtop_error_io ("listen");
|
||||
|
||||
return(ls);
|
||||
|
||||
@@ -692,19 +628,13 @@ handle_internet_request (int ls)
|
||||
memset((char *)&peer,0,sizeof(struct sockaddr_in));
|
||||
|
||||
if ((s = accept(ls,(struct sockaddr *)&peer, (void *) &addrlen)) == -1)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to accept\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
glibtop_error_io ("accept");
|
||||
|
||||
/* Check that access is allowed - if not return crud to the client */
|
||||
if (!permitted(peer.sin_addr.s_addr, s))
|
||||
{
|
||||
send_string(s,"gnudoit: Connection refused\ngnudoit: unable to connect to remote");
|
||||
close(s);
|
||||
|
||||
printf("Refused connection from %s\004\n", inet_ntoa(peer.sin_addr));
|
||||
glibtop_warn ("Refused connection from %s", inet_ntoa (peer.sin_addr));
|
||||
return;
|
||||
} /* if */
|
||||
|
||||
@@ -726,31 +656,22 @@ unix_init (void)
|
||||
struct sockaddr_un server; /* unix socket address */
|
||||
int bindlen;
|
||||
|
||||
if ((ls = socket(AF_UNIX,SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to create socket\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
if ((ls = socket (AF_UNIX,SOCK_STREAM, 0)) < 0)
|
||||
glibtop_error_io ("unable to create socket");
|
||||
|
||||
/* Set up address structure for the listen socket. */
|
||||
#ifdef HIDE_UNIX_SOCKET
|
||||
sprintf(server.sun_path,"/tmp/gsrvdir%d",(int)geteuid());
|
||||
if (mkdir(server.sun_path, 0700) < 0)
|
||||
sprintf (server.sun_path, "/tmp/lgtddir%d", (int)geteuid());
|
||||
if (mkdir (server.sun_path, 0700) < 0)
|
||||
{
|
||||
/* assume it already exists, and try to set perms */
|
||||
if (chmod(server.sun_path, 0700) < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: can't set permissions on %s\n",
|
||||
progname, server.sun_path);
|
||||
exit(1);
|
||||
}
|
||||
if (chmod (server.sun_path, 0700) < 0)
|
||||
glibtop_error_io ("Can't set permissions on %s", server.sun_path);
|
||||
}
|
||||
strcat(server.sun_path,"/gsrv");
|
||||
strcat(server.sun_path, "/lgtd");
|
||||
unlink(server.sun_path); /* remove old file if it exists */
|
||||
#else /* HIDE_UNIX_SOCKET */
|
||||
sprintf(server.sun_path,"/tmp/gsrv%d",(int)geteuid());
|
||||
sprintf(server.sun_path, "/tmp/lgtd%d", (int)geteuid());
|
||||
unlink(server.sun_path); /* remove old file if it exists */
|
||||
#endif /* HIDE_UNIX_SOCKET */
|
||||
|
||||
@@ -765,20 +686,13 @@ unix_init (void)
|
||||
bindlen = strlen (server.sun_path) + sizeof (server.sun_family);
|
||||
#endif
|
||||
|
||||
if (bind(ls,(struct sockaddr *)&server,bindlen) < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to bind socket\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
if (bind (ls, (struct sockaddr *)&server, bindlen) < 0)
|
||||
glibtop_error_io ("bind");
|
||||
|
||||
chmod(server.sun_path,0700); /* only this user can send commands */
|
||||
|
||||
if (listen(ls,20) < 0) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to listen\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
if (listen(ls,20) < 0)
|
||||
glibtop_error_io ("listen");
|
||||
|
||||
/* #### there are also better ways of dealing with this when
|
||||
sigvec() is present. */
|
||||
@@ -790,10 +704,10 @@ unix_init (void)
|
||||
sigprocmask (SIG_BLOCK, &_mask, NULL);
|
||||
}
|
||||
#else
|
||||
signal(SIGPIPE,SIG_IGN); /* in case user kills client */
|
||||
signal (SIGPIPE, SIG_IGN); /* in case user kills client */
|
||||
#endif
|
||||
|
||||
return(ls);
|
||||
return (ls);
|
||||
|
||||
} /* unix_init */
|
||||
|
||||
@@ -811,11 +725,8 @@ handle_unix_request (int ls)
|
||||
|
||||
server.sun_family = AF_UNIX;
|
||||
|
||||
if ((s = accept(ls,(struct sockaddr *)&server, (void *)&len)) < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to accept\n",progname);
|
||||
} /* if */
|
||||
if ((s = accept (ls, (struct sockaddr *)&server, (void *)&len)) < 0)
|
||||
glibtop_error_io ("accept");
|
||||
|
||||
echo_request(s);
|
||||
|
||||
@@ -829,17 +740,13 @@ main(argc,argv)
|
||||
char *argv[];
|
||||
{
|
||||
int chan; /* temporary channel number */
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
int ils = -1; /* internet domain listen socket */
|
||||
#endif
|
||||
#ifdef UNIX_DOMAIN_SOCKETS
|
||||
int uls = -1; /* unix domain listen socket */
|
||||
#endif
|
||||
#ifdef SYSV_IPC
|
||||
struct msgbuf *msgp; /* message buffer */
|
||||
#endif /* SYSV_IPC */
|
||||
|
||||
progname = argv[0];
|
||||
glibtop_init ();
|
||||
|
||||
for(chan=3; chan < _NFILE; close(chan++)) /* close unwanted channels */
|
||||
;
|
||||
@@ -870,11 +777,7 @@ main(argc,argv)
|
||||
|
||||
if (select(max2(fileno(stdin),max2(uls,ils)) + 1, &rmask,
|
||||
(fd_set *)NULL, (fd_set *)NULL, (struct timeval *)NULL) < 0)
|
||||
{
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to select\n",progname);
|
||||
exit(1);
|
||||
} /* if */
|
||||
glibtop_error_io ("select");
|
||||
|
||||
#ifdef UNIX_DOMAIN_SOCKETS
|
||||
if (uls > 0 && FD_ISSET(uls, &rmask))
|
||||
|
@@ -8,5 +8,4 @@ CFLAGS = -Wall -W @CFLAGS@
|
||||
|
||||
lib_LTLIBRARIES = libgtop_common.la
|
||||
|
||||
libgtop_common_la_SOURCES = sysdeps.c xmalloc.c error.c
|
||||
|
||||
libgtop_common_la_SOURCES = sysdeps.c xmalloc.c error.c gnuslib.c
|
||||
|
@@ -33,8 +33,9 @@
|
||||
static char rcsid [] = "!Header: gnuslib.c,v 2.4 95/02/16 11:57:37 arup alpha !";
|
||||
#endif
|
||||
|
||||
#include "gnuserv.h"
|
||||
#include <errno.h>
|
||||
#include <glibtop/gnuserv.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef SYSV_IPC
|
||||
static int connect_to_ipc_server (void);
|
||||
@@ -43,7 +44,7 @@ static int connect_to_ipc_server (void);
|
||||
static int connect_to_unix_server (void);
|
||||
#endif
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
static int connect_to_internet_server (char *serverhost, u_short port);
|
||||
static int connect_to_internet_server (const char *serverhost, u_short port);
|
||||
#endif
|
||||
|
||||
/* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
|
||||
@@ -59,45 +60,33 @@ static int connect_to_internet_server (char *serverhost, u_short port);
|
||||
# define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
char *progname = NULL;
|
||||
|
||||
int make_connection(hostarg, portarg, s)
|
||||
char *hostarg;
|
||||
int
|
||||
glibtop_make_connection (hostarg, portarg, s)
|
||||
const char *hostarg;
|
||||
int portarg;
|
||||
int *s;
|
||||
{
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
char *ptr;
|
||||
if (hostarg == NULL)
|
||||
hostarg = getenv("GNU_HOST");
|
||||
if (portarg == 0 && (ptr=getenv("GNU_PORT")) != NULL)
|
||||
portarg = atoi(ptr);
|
||||
hostarg = getenv ("LIBGTOP_HOST");
|
||||
if (portarg == 0 && (ptr = getenv("LIBGTOP_PORT")) != NULL)
|
||||
portarg = atoi (ptr);
|
||||
#endif
|
||||
|
||||
if (hostarg != NULL) {
|
||||
/* hostname was given explicitly, via cmd line arg or GNU_HOST,
|
||||
/* hostname was given explicitly, via cmd line arg or LIBGTOP_HOST,
|
||||
* so obey it. */
|
||||
#ifdef UNIX_DOMAIN_SOCKETS
|
||||
if (!strcmp(hostarg, "unix")) {
|
||||
*s = connect_to_unix_server();
|
||||
if (!strcmp (hostarg, "unix")) {
|
||||
*s = connect_to_unix_server ();
|
||||
return (int) CONN_UNIX;
|
||||
}
|
||||
#endif /* UNIX_DOMAIN_SOCKETS */
|
||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||
*s = connect_to_internet_server(hostarg, portarg);
|
||||
*s = connect_to_internet_server (hostarg, portarg);
|
||||
return (int) CONN_INTERNET;
|
||||
#endif
|
||||
#ifdef SYSV_IPC
|
||||
@@ -107,16 +96,16 @@ int make_connection(hostarg, portarg, s)
|
||||
/* no hostname given. Use unix-domain/sysv-ipc, or
|
||||
* internet-domain connection to local host if they're not available. */
|
||||
#if defined(UNIX_DOMAIN_SOCKETS)
|
||||
*s = connect_to_unix_server();
|
||||
*s = connect_to_unix_server ();
|
||||
return (int) CONN_UNIX;
|
||||
#elif defined(SYSV_IPC)
|
||||
*s = connect_to_ipc_server();
|
||||
*s = connect_to_ipc_server ();
|
||||
return (int) CONN_IPC;
|
||||
#elif defined(INTERNET_DOMAIN_SOCKETS)
|
||||
{
|
||||
char localhost[HOSTNAMSZ];
|
||||
gethostname(localhost,HOSTNAMSZ); /* use this host by default */
|
||||
*s = connect_to_internet_server(localhost, portarg);
|
||||
char localhost [HOSTNAMSZ];
|
||||
gethostname (localhost, HOSTNAMSZ); /* use this host by default */
|
||||
*s = connect_to_internet_server (localhost, portarg);
|
||||
return (int) CONN_INTERNET;
|
||||
}
|
||||
#endif /* IPC type */
|
||||
@@ -128,26 +117,20 @@ int make_connection(hostarg, portarg, s)
|
||||
connect_to_ipc_server -- establish connection with server process via SYSV IPC
|
||||
Returns msqid for server if successful.
|
||||
*/
|
||||
static int connect_to_ipc_server (void)
|
||||
static int
|
||||
connect_to_ipc_server (void)
|
||||
{
|
||||
int s; /* connected msqid */
|
||||
key_t key; /* message key */
|
||||
char buf[GSERV_BUFSZ+1]; /* buffer for filename */
|
||||
char buf [GSERV_BUFSZ+1]; /* buffer for filename */
|
||||
|
||||
sprintf(buf,"/tmp/gsrv%d",(int)geteuid());
|
||||
creat(buf,0600);
|
||||
if ((key = ftok(buf,1)) == -1) {
|
||||
perror(progname);
|
||||
fprintf(stderr, "%s: unable to get ipc key from %s\n",
|
||||
progname, buf);
|
||||
exit(1);
|
||||
}
|
||||
sprintf (buf, "/tmp/lgtd%d", (int)geteuid());
|
||||
creat (buf, 0600);
|
||||
if ((key = ftok (buf, 1)) == -1)
|
||||
glibtop_error_io ("unable to get ipc key from %s", buf);
|
||||
|
||||
if ((s = msgget(key,0600)) == -1) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to access msg queue\n",progname);
|
||||
exit(1);
|
||||
}; /* if */
|
||||
if ((s = msgget (key, 0600)) == -1)
|
||||
glibtop_error_io ("unable to access msg queue");
|
||||
|
||||
return(s);
|
||||
|
||||
@@ -194,7 +177,9 @@ void disconnect_from_ipc_server(s,msgp,echo)
|
||||
/*
|
||||
send_string -- send string to socket.
|
||||
*/
|
||||
void send_string(s,msg)
|
||||
#if 0
|
||||
static void
|
||||
send_string(s,msg)
|
||||
int s;
|
||||
const char *msg;
|
||||
{
|
||||
@@ -225,7 +210,8 @@ void send_string(s,msg)
|
||||
/*
|
||||
read_line -- read a \n terminated line from a socket
|
||||
*/
|
||||
int read_line(int s, char *dest)
|
||||
static int
|
||||
read_line(int s, char *dest)
|
||||
{
|
||||
int length;
|
||||
int offset=0;
|
||||
@@ -241,6 +227,7 @@ int read_line(int s, char *dest)
|
||||
strcpy(dest,buffer);
|
||||
return 1;
|
||||
} /* read_line */
|
||||
#endif
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
|
||||
|
||||
|
||||
@@ -250,28 +237,23 @@ int read_line(int s, char *dest)
|
||||
domain socket. Returns socket descriptor for server
|
||||
if successful.
|
||||
*/
|
||||
static int connect_to_unix_server (void)
|
||||
static int
|
||||
connect_to_unix_server (void)
|
||||
{
|
||||
int s; /* connected socket descriptor */
|
||||
struct sockaddr_un server; /* for unix connections */
|
||||
|
||||
if ((s = socket(AF_UNIX,SOCK_STREAM,0)) < 0) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to create socket\n",progname);
|
||||
exit(1);
|
||||
}; /* if */
|
||||
if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||
glibtop_error_io ("unable to create socket");
|
||||
|
||||
server.sun_family = AF_UNIX;
|
||||
#ifdef HIDE_UNIX_SOCKET
|
||||
sprintf(server.sun_path,"/tmp/gsrvdir%d/gsrv",(int)geteuid());
|
||||
sprintf(server.sun_path, "/tmp/lgtddir%d/lgtd", (int)geteuid());
|
||||
#else /* HIDE_UNIX_SOCKET */
|
||||
sprintf(server.sun_path,"/tmp/gsrv%d",(int)geteuid());
|
||||
sprintf(server.sun_path, "/tmp/lgtd%d", (int)geteuid());
|
||||
#endif /* HIDE_UNIX_SOCKET */
|
||||
if (connect(s,(struct sockaddr *)&server,strlen(server.sun_path)+2) < 0) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to connect to local\n",progname);
|
||||
exit(1);
|
||||
}; /* if */
|
||||
if (connect (s, (struct sockaddr *)&server, strlen(server.sun_path)+2) < 0)
|
||||
glibtop_error_io ("unable to connect to local");
|
||||
|
||||
return(s);
|
||||
|
||||
@@ -284,8 +266,8 @@ static int connect_to_unix_server (void)
|
||||
internet_addr -- return the internet addr of the hostname or
|
||||
internet address passed. Return -1 on error.
|
||||
*/
|
||||
int internet_addr(host)
|
||||
char *host;
|
||||
long glibtop_internet_addr (host)
|
||||
const char *host;
|
||||
{
|
||||
struct hostent *hp; /* pointer to host info for remote host */
|
||||
IN_ADDR numeric_addr; /* host address */
|
||||
@@ -300,7 +282,7 @@ int internet_addr(host)
|
||||
return -1;
|
||||
}
|
||||
|
||||
} /* internet_addr */
|
||||
} /* glibtop_internet_addr */
|
||||
|
||||
#ifdef AUTH_MAGIC_COOKIE
|
||||
# include <X11/X.h>
|
||||
@@ -314,7 +296,8 @@ static Xauth *server_xauth = NULL;
|
||||
an internet domain socket. Returns socket
|
||||
descriptor for server if successful.
|
||||
*/
|
||||
static int connect_to_internet_server (char *serverhost, u_short port)
|
||||
static int
|
||||
connect_to_internet_server (const char *serverhost, u_short port)
|
||||
{
|
||||
int s; /* connected socket descriptor */
|
||||
struct servent *sp; /* pointer to service information */
|
||||
@@ -322,43 +305,34 @@ static int connect_to_internet_server (char *serverhost, u_short port)
|
||||
char buf[512]; /* temporary buffer */
|
||||
|
||||
/* clear out address structures */
|
||||
memset((char *)&peeraddr_in,0,sizeof(struct sockaddr_in));
|
||||
memset((char *)&peeraddr_in, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
/* Set up the peer address to which we will connect. */
|
||||
peeraddr_in.sin_family = AF_INET;
|
||||
|
||||
/* look up the server host's internet address */
|
||||
if ((peeraddr_in.sin_addr.s_addr = internet_addr(serverhost)) == -1) {
|
||||
fprintf(stderr,"%s: unable to find %s in /etc/hosts or from YP\n",
|
||||
progname,serverhost);
|
||||
exit(1);
|
||||
}; /* if */
|
||||
if (((long) peeraddr_in.sin_addr.s_addr = glibtop_internet_addr (serverhost)) == -1)
|
||||
glibtop_error ("unable to find %s in /etc/hosts or from YP", serverhost);
|
||||
|
||||
if (port == 0) {
|
||||
if ((sp = getservbyname ("gnuserv","tcp")) == NULL)
|
||||
peeraddr_in.sin_port = htons(DEFAULT_PORT+getuid());
|
||||
if ((sp = getservbyname ("gtopd","tcp")) == NULL)
|
||||
peeraddr_in.sin_port = htons (DEFAULT_PORT+getuid());
|
||||
else
|
||||
peeraddr_in.sin_port = sp->s_port;
|
||||
} /* if */
|
||||
else
|
||||
peeraddr_in.sin_port = htons(port);
|
||||
peeraddr_in.sin_port = htons (port);
|
||||
|
||||
/* Create the socket. */
|
||||
if ((s = socket (AF_INET,SOCK_STREAM, 0))== -1) {
|
||||
perror(progname);
|
||||
fprintf(stderr,"%s: unable to create socket\n",progname);
|
||||
exit(1);
|
||||
}; /* if */
|
||||
if ((s = socket (AF_INET, SOCK_STREAM, 0))== -1)
|
||||
glibtop_error_io ("unable to create socket");
|
||||
|
||||
/* Try to connect to the remote server at the address
|
||||
* which was just built into peeraddr.
|
||||
*/
|
||||
if (connect(s, (struct sockaddr *)&peeraddr_in,
|
||||
sizeof(struct sockaddr_in)) == -1) {
|
||||
perror(progname);
|
||||
fprintf(stderr, "%s: unable to connect to remote\n",progname);
|
||||
exit(1);
|
||||
}; /* if */
|
||||
sizeof(struct sockaddr_in)) == -1)
|
||||
glibtop_error_io ("unable to connect to remote");
|
||||
|
||||
#ifdef AUTH_MAGIC_COOKIE
|
||||
|
||||
@@ -395,7 +369,9 @@ static int connect_to_internet_server (char *serverhost, u_short port)
|
||||
disconnect_from_server -- inform the server that sending has finished, and wait for
|
||||
its reply.
|
||||
*/
|
||||
void disconnect_from_server(s,echo)
|
||||
#if 0
|
||||
static void
|
||||
disconnect_from_server(s,echo)
|
||||
int s;
|
||||
int echo;
|
||||
{
|
||||
@@ -453,4 +429,5 @@ void disconnect_from_server(s,echo)
|
||||
}; /* if */
|
||||
|
||||
} /* disconnect_from_server */
|
||||
#endif
|
||||
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
|
||||
|
Reference in New Issue
Block a user