[comp.windows.x] Telling X not to reset when there are no connections

tsf@theory.cs.cmu.edu (Timothy Freeman) (04/20/87)

The X server resets itself whenever it has no connections.  This is a
nuisance when the server is started up by interactively running xinit,
so I made an option "-R" that tells the server not to reset when it
has no connections.  Here are the diffs to X/main.c:

*** main.c	Sun Apr 19 17:47:42 1987
--- newmain.c	Sun Apr 19 17:26:52 1987
***************
*** 83,88
  static short default_mono = 0;		/* Force monochrome */
  static short default_blank = 0;		/* Blank video preferred */
  
  static ColorDef basecolors[2] = {{BlackPixel, 0, 0, 0x8000},
  				 {WhitePixel, 0xff00, 0xff00, 0xff00}};
  static ColorDef randomcolors[2] = {{BlackPixel, 0, 0, 0},

--- 83,90 -----
  static short default_mono = 0;		/* Force monochrome */
  static short default_blank = 0;		/* Blank video preferred */
  
+ static short reset_when_no_connects = 1; /* Reset the server when there are no connections? */
+ 
  static ColorDef basecolors[2] = {{BlackPixel, 0, 0, 0x8000},
  				 {WhitePixel, 0xff00, 0xff00, 0xff00}};
  static ColorDef randomcolors[2] = {{BlackPixel, 0, 0, 0},
***************
*** 171,176
  		default_repeat = 0;
  	    } else if (strcmp (arg, "r") == 0) {
  		default_repeat = 1;
  	    } else if (strcmp (arg, "-s") == 0 && i < argc) {
  		default_savertime = atoi (argv[i]);
  		if (default_savertime == 0) Usage ();

--- 173,184 -----
  		default_repeat = 0;
  	    } else if (strcmp (arg, "r") == 0) {
  		default_repeat = 1;
+ 	    } else if (strcmp (arg, "R") == 0) {
+ 		reset_when_no_connects = 1;
+ 		i++;
+ 	    } else if (strcmp (arg, "-R") == 0) {
+ 		reset_when_no_connects = 0;
+ 		i++;
  	    } else if (strcmp (arg, "-s") == 0 && i < argc) {
  		default_savertime = atoi (argv[i]);
  		if (default_savertime == 0) Usage ();
***************
*** 202,208
  Usage ()
  {
  	printf("usage:  X <display> [option ...] <tty>\n");
! 	printf("options: -a #, c #, -c, -f #, -l, l, m, -p #, -r, r, -s #, -t #, v, -v\n");
  	printf("         -0 <color> -1 <color> -D <rgbdb>\n");
  	exit(1);
  }

--- 210,216 -----
  Usage ()
  {
  	printf("usage:  X <display> [option ...] <tty>\n");
! 	printf("options: -a #, c #, -c, -f #, -l, l, m, -p #, -r, r, -R, R, -s #, -t #, v, -v\n");
  	printf("         -0 <color> -1 <color> -D <rgbdb>\n");
  	printf("R means to reset the server when there are no connections; -R means not to.\n");
  	exit(1);
***************
*** 204,209
  	printf("usage:  X <display> [option ...] <tty>\n");
  	printf("options: -a #, c #, -c, -f #, -l, l, m, -p #, -r, r, -s #, -t #, v, -v\n");
  	printf("         -0 <color> -1 <color> -D <rgbdb>\n");
  	exit(1);
  }
  

--- 212,218 -----
  	printf("usage:  X <display> [option ...] <tty>\n");
  	printf("options: -a #, c #, -c, -f #, -l, l, m, -p #, -r, r, -R, R, -s #, -t #, v, -v\n");
  	printf("         -0 <color> -1 <color> -D <rgbdb>\n");
+ 	printf("R means to reset the server when there are no connections; -R means not to.\n");
  	exit(1);
  }
  
***************
*** 656,662
  	Free_client_resources (i);
  	Deal_with_movement ();
  	/* if nobody is left, clean up after them */
! 	if (maxsock == firstsock)
  	    Restore_root ();
  }
  

--- 665,671 -----
  	Free_client_resources (i);
  	Deal_with_movement ();
  	/* if nobody is left, clean up after them */
! 	if ((maxsock == firstsock) && reset_when_no_connects)
  	    Restore_root ();
  }