Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
display.c
Go to the documentation of this file.
1 /*
2 Copyright 2021 Arizona Board of Regents on behalf of the University of Arizona.
3 
4 For commercial uses, to obtain a license to sell and or sublicense copies of
5 the Software please contact the University of Arizona at Tech Launch Arizona:
6 lewish@tla.arizona.edu.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction for non-commercial use educational and
11 research purposes, including without limitation the rights to use, copy,
12 modify, merge, publish, distribute, and to permit persons to whom the Software
13 is furnished to do so, subject to the following conditions:
14 
15 The entire above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25 
26 1. Additional Required Provisions
27 
28 1.1. Arbitration. The parties agree that if a dispute arises between them
29 concerning this Agreement, the parties may be required to submit the matter to
30 arbitration pursuant to Arizona law.
31 
32 1.2. Applicable Law and Venue. This Agreement shall be interpreted pursuant
33 to the laws of the State of Arizona. Any arbitration or litigation between the
34 Parties shall be conducted in Pima County, ARIZONA, and LICENSEE hereby
35 submits to venue and jurisdiction in Pima County, ARIZONA.
36 
37 1.3. Non-Discrimination. The Parties agree to be bound by state and federal
38 laws and regulations governing equal opportunity and non-discrimination and
39 immigration.
40 
41 1.4. Appropriation of Funds. The Parties recognize that performance by
42 ARIZONA may depend upon appropriation of funds by the State Legislature of
43 ARIZONA. If the Legislature fails to appropriate the necessary funds, or if
44 ARIZONA’S appropriation is reduced during the fiscal year, ARIZONA may cancel
45 this Agreement without further duty or obligation. ARIZONA will notify
46 LICENSEE as soon as reasonably possible after it knows of the loss of funds.
47 
48 1.5. Conflict of Interest. This Agreement is subject to the provisions of
49 A.R.S. 38-511 and other conflict of interest regulations. Within three years
50 of the EFFECTIVE DATE, ARIZONA may cancel this Agreement if any person
51 significantly involved in initiating, negotiating, drafting, securing, or
52 creating this Agreement for or on behalf of ARIZONA becomes an employee or
53 consultant in any capacity of LICENSEE with respect to the subject matter of
54 this Agreement.
55 
56  */
57 
58 
59 #include "extern.h"
60 
61 
62 int doDayMode()
63 {
64  char sysBuf[256], *cp;
65 
66  cp = getenv("LINUXPOPS_HOME");
67 
68  sprintf(sysBuf, "xrdb -merge %s/share/daymode.Xdefaults", cp);
69 
70  system(sysBuf);
71 
72  sock_send(xgraphic, "restart");
73 
74  st_report("Gnuplot Set for White Background");
76 
77  return(0);
78 }
79 
80 
82 {
83  char sysBuf[256], *cp;
84 
85  cp = getenv("LINUXPOPS_HOME");
86 
87  sprintf(sysBuf, "xrdb -merge %s/share/nightmode.Xdefaults", cp);
88 
89  system(sysBuf);
90 
91  sock_send(xgraphic, "restart");
92 
93  st_report("Gnuplot Set for Black Background");
95 
96  return(0);
97 }
98 
99 
101 {
102  char pbuf[256], line[256], *string;
103  FILE *fp;
104 
105  sprintf(pbuf, "xrdb -query");
106 
107  if( (fp = popen(pbuf, "r") ) <= (FILE *)0 )
108  {
109  st_fail("Unable to open %s", pbuf);
110 
111  return(1);
112  }
113 
114  while((string = fgets(line, sizeof(line), fp)) != NULL)
115  {
116  if(strstr(line, "gnuplot*background"))
117  {
118  if(strstr(line, "white"))
119  {
120  st_report("Gnuplot Set for White Background");
121  env->displaymode = WHITE;
122  pclose(fp);
123  return(0);
124  }
125 
126  if(strstr(line, "black"))
127  {
128  st_report("Gnuplot Set for Black Background");
129  env->displaymode = BLACK;
130  pclose(fp);
131  return(0);
132  }
133  }
134  }
135 
136  pclose(fp);
137 
138  return(0);
139 }
struct SOCK * xgraphic
Definition: linuxpops.c:75
int initGnuplotBackground()
Definition: display.c:100
FILE * fp
Definition: linuxpops.c:70
#define WHITE
Definition: colors.h:11
struct ENVIRONMENT * env
Definition: linuxpops.c:71
int displaymode
Definition: env.h:155
int sock_send(struct SOCK *s, char *message)
void st_fail()
int doDayMode()
Definition: display.c:62
void st_report()
#define BLACK
Definition: colors.h:4
int doNightMode()
Definition: display.c:81