Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
makemem.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 #include <stdio.h>
59 #include <stdlib.h>
60 #include <string.h>
61 #include <math.h>
62 #include <errno.h>
63 #include <sys/types.h>
64 #include <sys/stat.h>
65 #include <fcntl.h>
66 #include <unistd.h>
67 #include <signal.h>
68 #include <sys/ioctl.h>
69 #include <sys/stat.h>
70 #include <readline/readline.h>
71 #include <readline/history.h>
72 
73 #include "sex.h"
74 #include "scans.h"
75 #include "global.h"
76 #include "object.h"
77 #include "gridmap.h"
78 #include "linuxlib_proto.h"
79 #include "caclib_proto.h"
80 #include "observing_par.h"
81 
82 //#include "proto.h"
83 
84 #define READ_HISTORY 1
85 #define WRITE_HISTORY 2
86 
87 #define CWRITE 1
88 #define CAPPEND 2
89 
90 #define VERBOSE_PARSE 1
91 
92 /* The following are required to link to ../lib/liblinux.a */
95 
96 /* Environment Variables */
97 char pkg_home[256], obs_home[256], data_home[256], obs_inits[256],
98  printer[256], help_home[256], lockFileName[256], globalName[256],
99  onlineDataFile[256];
100 
101 char *prompt = " ";
102 
104 char *firstArg = tok[0];
105 char *secondArg = tok[1];
106 char *thirdArg = tok[2];
107 char *fourthArg = tok[3];
108 char *fifthArg = tok[4];
109 char *sixthArg = tok[5];
110 
111 
112 int get_tok(edit)
113 char *edit;
114 {
115  int c = 0;
116  char *token;
117 
118  bzero((char *)&tok, sizeof(tok));
119 
120  token = strtok(edit, ",\n\t ");
121  while(token != (char *)NULL)
122  {
123  sprintf(tok[c++], "%s", token);
124  token = strtok((char *)NULL, ",\n\t ");
125  }
126 
127  return(c);
128 }
129 
130 
132 {
133  char *cp;
134 
135  cp = getenv("LINUXPOPS_HOME");
136  if(cp)
137  {
138  strcpy(pkg_home, cp);
139  }
140  else
141  {
142  strcpy(pkg_home, "/home/staff/tfolkers/cactus/continum");
143  }
144 
145  cp = getenv("OBSDAT");
146  if(cp)
147  {
148  strcpy(data_home, cp);
149  }
150  else
151  {
152  strcpy(data_home, "../linuxpops");
153  }
154 
155  cp = getenv("HOME");
156  if(cp)
157  {
158  strcpy(obs_home, cp);
159  }
160  else
161  {
162  strcpy(obs_home, "./");
163  }
164 
165  cp = getenv("OBSINIT");
166  if(cp)
167  {
168  strcpy(obs_inits, cp);
169  }
170  else
171  {
172  strcpy(obs_inits, "sys");
173  }
174 
175  cp = getenv("PRINTER");
176  if(cp)
177  {
178  strcpy(printer, cp);
179  }
180  else
181  {
182  sprintf(printer, "lp");
183  }
184 
185  cp = getenv("LINUXPOPS_HELP_DIR");
186  if(cp)
187  {
188  strcpy(help_home, cp);
189  }
190  else
191  {
192  strcpy(help_home, "../help");
193  }
194 
195  st_report("");
196  st_report("Package Dir: %s", pkg_home);
197  st_report("Help Dir: %s", help_home);
198  st_report("Obs Dir: %s", obs_home);
199  st_report("Data Dir: %s", data_home);
200  st_report("Obs Inits: %s", obs_inits);
201  st_report("Global Memory: %s", globalName);
202  st_report("");
203 
204 
205  return(0);
206 }
207 
208 
209 int main(argc, argv)
210 int argc;
211 char *argv[];
212 {
213  int opt, manGlobal=0;
214 
215 
216  while ((opt = getopt(argc, argv, "g:")) != -1)
217  {
218  switch (opt)
219  {
220  case 'g':
221  st_report("Using Global Memory %s", optarg);
222  strcpy(globalName, optarg);
223  manGlobal = 1;
224  break;
225 
226  default: /* '?' */
227  fprintf(stderr, "Usage: %s [-g global_memory_file]\n", argv[0]);
228  exit(1);
229  break;
230 
231  }
232  }
233 
234  if(!manGlobal)
235  {
236  sprintf(globalName, "./LPMEMORY-64");
237  }
238 
239  getEnvironment();
240 
241  if(!gm_map(globalName, 1))
242  {
243  fprintf(stderr, "Unable to map global memory\n");
244  exit(1);
245  }
246 
247  //strcpy(CGM->envrs[0].title, "Online");
248 
249 
250  return(0);
251 }
252 
253 
int main(void)
Definition: gsl_try_2.c:176
char pkg_home[256]
Definition: makemem.c:97
char * prompt
Definition: makemem.c:101
char * secondArg
Definition: makemem.c:105
struct GLOBAL_MEMORY * gm_map()
int getEnvironment()
Definition: env.c:477
char * sixthArg
Definition: makemem.c:109
#define MAX_TOKENS
Definition: defines.h:40
int stquiet
Definition: env.c:90
char tok[MAX_TOKENS][MAX_TOKENS]
Definition: make_env.c:67
char * thirdArg
Definition: makemem.c:106
int recursiveLevel
Definition: makemem.c:93
char cmd_tok[MAX_TOKENS][MAX_TOKENS]
Definition: makemem.c:103
char globalName[256]
Definition: makemem.c:97
char printer[256]
Definition: makemem.c:97
int get_tok(char *edit)
Definition: make_env.c:69
char * fourthArg
Definition: makemem.c:107
char onlineDataFile[256]
Definition: makemem.c:97
char obs_home[256]
Definition: makemem.c:97
void st_report()
char lockFileName[256]
Definition: makemem.c:97
char obs_inits[256]
Definition: makemem.c:97
char help_home[256]
Definition: makemem.c:97
char * firstArg
Definition: makemem.c:104
char data_home[256]
Definition: makemem.c:97
int lp_logging
Definition: linuxpops.c:88
char * fifthArg
Definition: makemem.c:108
FILE * errPrint_fp
Definition: linuxpops.c:70
int verboseLevel
Definition: linuxpops.c:80