]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gnuplot/files/debian-separate-x11-package.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gnuplot / files / debian-separate-x11-package.patch
1 --- gnuplot-4.0.0.orig/src/term.c
2 +++ gnuplot-4.0.0/src/term.c
3 @@ -1278,6 +1278,33 @@
4      return (t);
5  }
6  
7 +#ifdef X11
8 +int
9 +x11driver_found()
10 +{
11 +  char *binname = "/gnuplot_x11";
12 +  char *fullname;
13 +  struct stat buf;
14 +  
15 +  fullname = (char*)malloc(sizeof(X11_DRIVER_DIR) + sizeof(binname) + 1);
16 +  strcat(fullname, X11_DRIVER_DIR);
17 +  strcat(fullname, binname);
18 +
19 +  /* exists? */
20 +  if (stat(fullname, &buf)) {
21 +    free(fullname);
22 +    return 0;
23 +  }
24 +
25 +  free(fullname);
26 +  /* executable? */
27 +  if (buf.st_mode && S_IXOTH)
28 +    return 1;
29 +
30 +  return 0;
31 +}
32 +#endif
33 +
34  /*
35   * Routine to detect what terminal is being used (or do anything else
36   * that would be nice).  One anticipated (or allowed for) side effect
37 @@ -1356,12 +1383,18 @@
38         env_term = getenv("TERM");      /* try $TERM */
39         if (term_name == (char *) NULL
40             && env_term != (char *) NULL && strcmp(env_term, "xterm") == 0)
41 -           term_name = "x11";
42 +         term_name = "x11";
43         display = getenv("DISPLAY");
44         if (term_name == (char *) NULL && display != (char *) NULL)
45 -           term_name = "x11";
46 +         term_name = "x11";
47         if (X11_Display)
48 -           term_name = "x11";
49 +         term_name = "x11";
50 +       /* if x11 was selected check for driver */
51 +       if (term_name && (strcmp(term_name, "x11") == 0) && !x11driver_found() && isatty(fileno(stdin))) {
52 +         printf("*** X11 output driver not found, switching to dumb terminal!\n");
53 +         printf("*** If you want to use the X11 output, please install the ""gnuplot-x11"" package\n");
54 +         term_name = "dumb";
55 +       };      
56  #endif /* x11 */
57  
58  #ifdef AMIGA
59