🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #25463

Telling X not to reset when there are no connections

#25463
From: Timothy Freeman
Date: Sun, 19 Apr 1987 22:18
99 lines
3938 bytes
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 ();
  }
Technical Details
Message-ID: <1031@theory.cs.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!theory.cs.cmu.edu!tsf

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!theory.cs.cmu.edu!tsf
From: tsf@theory.cs.cmu.edu (Timothy Freeman)
Newsgroups: comp.windows.x
Subject: Telling X not to reset when there are no connections
Message-ID: <1031@theory.cs.cmu.edu>
Date: Sun, 19-Apr-87 17:18:24 EST
Article-I.D.: theory.1031
Posted: Sun Apr 19 17:18:24 1987
Date-Received: Sun, 19-Apr-87 22:43:54 EST
Organization: Carnegie-Mellon University, CS/RI
Lines: 99