Re: Easy command to launch remote desktop on cygwin-xfree?

2002-08-09 Thread Thomas Chadwick

This has come up a number of times recently.  Look in the archives for July, 
2002:

http://cygwin.com/ml/cygwin-xfree/2002-07

Search for the following subjects:

scripting using Xterm ssh
need help scripting multiple xfree startups
Your help please...

From: CRAIG SETERA [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Easy command to launch remote desktop on cygwin-xfree?
Date: Thu, 08 Aug 2002 14:46:49 -0400

I've already tried all of the different HOWTO's to try and get XDM going 
without any success.  That was why I was hoping someone could give me a 
command or two to get it going via SSH forwarding.

Thanks,
Craig




_
Chat with friends online, try MSN Messenger: http://messenger.msn.com




Re: Easy command to launch remote desktop on cygwin-xfree?

2002-08-08 Thread ratmice

CRAIG SETERA wrote:
 I've already tried all of the different HOWTO's to try and get XDM going 
 without any success.  That was why I was hoping someone could give me a 
 command or two to get it going via SSH forwarding.
 
 Thanks,
 Craig
 

just hacked this out... it isn't ideal and requires... modification of 
the source...
it's based off an old x example xxterm.c, which was in the kdevelop examples

modify the machines at the beginning to your network
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o sxterm sxterm.c -lX11

./xsterm

it has 2 arguments, username and remote_command
if you want to run things w/ 2 different usernames you might fix it..
or run xsterm twice :)

oh my
command line parsing is badness, and if you want to use option 2, you 
should also provide option 1
ie this works for me
xsterm matt /usr/X11R6/bin/xeyes


/***
 * Purpose: To provide a tool that allows people to login to machines.
 *
 * Compile: Edit BUTTONS- Number of machines.
 *  Edit XTERM  - Location of the xterm command.
 *  Edit 'machines' - Names of the machines.
 *
 *  Compile command for Linux and Sun
 *
 *  gcc xxterm.c -o xxterm -lX11
 * User notes:
 *  This is only of use to people running UNIX boxes on a LAN.
 *
 * History: 
 *
 * Rev Date  Author Comments.
 * ---   -- -
 * 1.0 30-May-95 MJLInital Release.
 */
/** Includes /
/* These are in /usr/X386   */
#include X11/Xlib.h
#include X11/Xutil.h
#include X11/Xos.h
#include X11/X.h
#include stdio.h
#include unistd.h /* setuid   */

/** Defines */

#define  BUTTONS  7 /* --- number of machines. */

/* V--- Location of the xterm comnd */
#define  XTERM  xterm -sb -e ssh

/* window background colour */
#define  BACKGROUND_COLOUR  light grey
#define  BUTTON_COLOUR  blue  

#define  DOWN   down
#define  ACTIVE active
/** Global Variables /
int has_user_name = 0;
int has_remote_command = 0;
char *user_name = matt;
char *remote_command = ;
Display *display;
int  screen;
Colormap colormap;

/*  Machines you want to access */
char * machines[] = {
foo,
bar,
baz,
blah,
bah,
humbug,
boo
};
char * commands[] = 
{
   xterm -sb -e ssh 
};
/** Structures **/
/* Hold the co-ordinates of the buttons */
struct {
XPoint topleft;
XPoint topright;
XPoint botleft;
XPoint botright;
   } buttons[BUTTONS+1];


struct window_info
  {
  Window win;
  GC gc;
  };

/** Functions ***/

void init_buttons(char *button_caps[]);

void draw_image (Window, GC *, char *button_caps[]);

int  draw_button 
(Window,
 GC *gc, 
 char *text,/* Text to put on screen button cap */
 int x, int y,  /* Position of button in window */
 int width, int height, 
 int,
 char button_caps[]);
/* Change the colour in the graphics
 * context. 
 */ 
void set_colour (GC *gc, char *, Colormap);

int  where_am_i (Window, GC *gc);

/* Take an action based on the 
 * button ID.
 */
int process_button
(Window win, 
 GC *gc, 
 char *button_caps[], 
 int button);   /* Button ID.   */

void press_button 
(Window, 
 GC *gc, 
 char *button_caps[], 
 char *text );

struct window_info create_window
(int x, /* Window size  */
 int y);

/* Execute system commands  */
void execute_command
(int root,  /* 1 == must be run by root
 * 0 == Can be run by anyone*/
 char *command, /* Command  */
 char *machine);

//

int main(int argc, char **argv)
   {

  unsigned int width;
  unsigned int height;  /* Size of the window.  */
   int  x=0, y=0;   /* x is across, y is down!  */
   unsigned int border_width=4; /* Window border.  */

/* Array of pointers, one for each screen
 * button, they point to a string constant
 * describing their status, active, down,
 * inactive
 */
   char *button_caps[BUTTONS+1];

   struct window_info window;

   Window   win;
   GC   gc;
   XEvent   report;
   XFontStruct *font_info;
   XColor   colour;

   char *   display_name=NULL;

   

Re: Easy command to launch remote desktop on cygwin-xfree?

2002-08-08 Thread ratmice

CRAIG SETERA wrote:
 I've already tried all of the different HOWTO's to try and get XDM going 
 without any success.  That was why I was hoping someone could give me a 
 command or two to get it going via SSH forwarding.
 
 Thanks,
 Craig
 

just hacked this out... it isn't ideal and requires... modification of 
the source...
it's based off an old x example xxterm.c, which was in the kdevelop 
examples

modify the machines at the beginning to your network
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o xsterm xsterm.c

./xsterm

it has 2 optional arguments, username and remote_command
if you want to run things w/ 2 different usernames you might fix it..
or run xsterm twice :)






/***
 * Purpose: To provide a tool that allows people to login to machines.
 *
 * Compile: Edit BUTTONS- Number of machines.
 *  Edit XTERM  - Location of the xterm command.
 *  Edit 'machines' - Names of the machines.
 *
 *  Compile command for Linux and Sun
 *
 *  gcc xxterm.c -o xxterm -lX11
 * User notes:
 *  This is only of use to people running UNIX boxes on a LAN.
 *
 * History: 
 *
 * Rev Date  Author Comments.
 * ---   -- -
 * 1.0 30-May-95 MJLInital Release.
 */
/** Includes /
/* These are in /usr/X386   */
#include X11/Xlib.h
#include X11/Xutil.h
#include X11/Xos.h
#include X11/X.h
#include stdio.h
#include unistd.h /* setuid   */

/** Defines */

#define  BUTTONS  7 /* --- number of machines. */

/* V--- Location of the xterm comnd */
#define  XTERM  xterm -sb -e ssh

/* window background colour */
#define  BACKGROUND_COLOUR  light grey
#define  BUTTON_COLOUR  blue  

#define  DOWN   down
#define  ACTIVE active
/** Global Variables /
int has_user_name = 0;
int has_remote_command = 0;
char *user_name = matt;
char *remote_command = ;
Display *display;
int  screen;
Colormap colormap;

/*  Machines you want to access */
char * machines[] = {
foo,
bar,
baz,
blah,
bah,
humbug,
boo
};
char * commands[] = 
{
   xterm -sb -e ssh 
};
/** Structures **/
/* Hold the co-ordinates of the buttons */
struct {
XPoint topleft;
XPoint topright;
XPoint botleft;
XPoint botright;
   } buttons[BUTTONS+1];


struct window_info
  {
  Window win;
  GC gc;
  };

/** Functions ***/

void init_buttons(char *button_caps[]);

void draw_image (Window, GC *, char *button_caps[]);

int  draw_button 
(Window,
 GC *gc, 
 char *text,/* Text to put on screen button cap */
 int x, int y,  /* Position of button in window */
 int width, int height, 
 int,
 char button_caps[]);
/* Change the colour in the graphics
 * context. 
 */ 
void set_colour (GC *gc, char *, Colormap);

int  where_am_i (Window, GC *gc);

/* Take an action based on the 
 * button ID.
 */
int process_button
(Window win, 
 GC *gc, 
 char *button_caps[], 
 int button);   /* Button ID.   */

void press_button 
(Window, 
 GC *gc, 
 char *button_caps[], 
 char *text );

struct window_info create_window
(int x, /* Window size  */
 int y);

/* Execute system commands  */
void execute_command
(int root,  /* 1 == must be run by root
 * 0 == Can be run by anyone*/
 char *command, /* Command  */
 char *machine);

//

int main(int argc, char **argv)
   {

  unsigned int width;
  unsigned int height;  /* Size of the window.  */
   int  x=0, y=0;   /* x is across, y is down!  */
   unsigned int border_width=4; /* Window border.  */

/* Array of pointers, one for each screen
 * button, they point to a string constant
 * describing their status, active, down,
 * inactive
 */
   char *button_caps[BUTTONS+1];

   struct window_info window;

   Window   win;
   GC   gc;
   XEvent   report;
   XFontStruct *font_info;
   XColor   colour;

   char *   display_name=NULL;

   /*
*
*   Setup the window environment 
*
*/
if (argc =2) {
  if