/[gxemul]/trunk/src/console.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/console.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by dpavlin, Mon Oct 8 16:18:11 2007 UTC revision 10 by dpavlin, Mon Oct 8 16:18:27 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: console.c,v 1.8 2005/05/29 17:51:45 debug Exp $   *  $Id: console.c,v 1.9 2005/06/26 11:36:27 debug Exp $
29   *   *
30   *  Generic console support functions.   *  Generic console support functions.
31   *   *
# Line 186  static void start_xterm(int handle) Line 186  static void start_xterm(int handle)
186          a[4] = console_handles[handle].name;          a[4] = console_handles[handle].name;
187          a[5] = "-e";          a[5] = "-e";
188          a[6] = progname;          a[6] = progname;
189          a[7] = malloc(50);          a[7] = malloc(80);
190          sprintf(a[7], "-WW@S%i,%i", filedes[0], filedesB[1]);          snprintf(a[7], 80, "-WW@S%i,%i", filedes[0], filedesB[1]);
191          a[8] = NULL;          a[8] = NULL;
192    
193          p = fork();          p = fork();
# Line 641  static struct console_handle *console_ne Line 641  static struct console_handle *console_ne
641  int console_start_slave(struct machine *machine, char *consolename)  int console_start_slave(struct machine *machine, char *consolename)
642  {  {
643          int handle;          int handle;
644            size_t mlen;
645          struct console_handle *chp;          struct console_handle *chp;
646    
647          if (machine == NULL || consolename == NULL) {          if (machine == NULL || consolename == NULL) {
# Line 650  int console_start_slave(struct machine * Line 651  int console_start_slave(struct machine *
651    
652          chp = console_new_handle(consolename, &handle);          chp = console_new_handle(consolename, &handle);
653    
654          chp->name = malloc(strlen(machine->name) + strlen(consolename) + 100);          mlen = strlen(machine->name) + strlen(consolename) + 40;
655            chp->name = malloc(mlen);
656          if (chp->name == NULL) {          if (chp->name == NULL) {
657                  printf("out of memory\n");                  printf("out of memory\n");
658                  exit(1);                  exit(1);
659          }          }
660          sprintf(chp->name, "GXemul: '%s' %s", machine->name, consolename);          snprintf(chp->name, mlen, "GXemul: '%s' %s",
661                machine->name, consolename);
662    
663  #if 0  #if 0
664          if (!machine->use_x11) {          if (!machine->use_x11) {
# Line 684  int console_start_slave_inputonly(struct Line 687  int console_start_slave_inputonly(struct
687  {  {
688          struct console_handle *chp;          struct console_handle *chp;
689          int handle;          int handle;
690            size_t mlen;
691    
692          if (machine == NULL || consolename == NULL) {          if (machine == NULL || consolename == NULL) {
693                  printf("console_start_slave(): NULL ptr\n");                  printf("console_start_slave(): NULL ptr\n");
# Line 693  int console_start_slave_inputonly(struct Line 697  int console_start_slave_inputonly(struct
697          chp = console_new_handle(consolename, &handle);          chp = console_new_handle(consolename, &handle);
698          chp->inputonly = 1;          chp->inputonly = 1;
699    
700          chp->name = malloc(strlen(machine->name) + strlen(consolename) + 100);          mlen = strlen(machine->name) + strlen(consolename) + 40;
701            chp->name = malloc(mlen);
702          if (chp->name == NULL) {          if (chp->name == NULL) {
703                  printf("out of memory\n");                  printf("out of memory\n");
704                  exit(1);                  exit(1);
705          }          }
706          sprintf(chp->name, "GXemul: '%s' %s", machine->name, consolename);          snprintf(chp->name, mlen, "GXemul: '%s' %s",
707                machine->name, consolename);
708    
709          return handle;          return handle;
710  }  }

Legend:
Removed from v.6  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26