This file is indexed.

/usr/share/ncarg/hluex/xyplot/xy17c.c is in libncarg-data 6.4.0-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/*
 *      $Id: xy17c.c,v 1.9 2010-03-15 22:49:25 haley Exp $
 */
/***********************************************************************
 *                                                                     *
 *                Copyright (C)  1996                                  *
 *        University Corporation for Atmospheric Research              *
 *                All Rights Reserved                                  *
 *                                                                     *
 ***********************************************************************
 *
 *  File:       xy17c.c
 *
 *  Author:     Bob Lackman
 *              National Center for Atmospheric Research
 *              PO 3000, Boulder, Colorado
 *
 *  Converted to C by : Scott Snodgrass
 *
 *  Date:       14 Mar 1997
 *
 *  Description:    Reads an ASCII file with 4 variables:
 *                  lon, u, v, and t.  u, v, and t are plotted
 *                  with 3 stacked y axes.
 *
 */

#include <stdio.h>
#include <string.h>
#include <ncarg/gks.h>
#include <ncarg/ncargC.h>
#include <ncarg/hlu/hlu.h>
#include <ncarg/hlu/ResList.h>
#include <ncarg/hlu/App.h>
#include <ncarg/hlu/NcgmWorkstation.h>
#include <ncarg/hlu/PSWorkstation.h>
#include <ncarg/hlu/PDFWorkstation.h>
#include <ncarg/hlu/CairoWorkstation.h>
#include <ncarg/hlu/XyPlot.h>
#include <ncarg/hlu/CoordArrays.h>

#define ncurve 3
#define npts 129

int main ()
{
   char const *wks_type = "x11";
   int i=0, rlist, wks, appid, field1, field2, field3, xy1, xy2, xy3;
   int grlist, datadepid[1];
   int *dspec = datadepid;
   ng_size_t num_dspec;

/*
 *  Create variables to contain data.
 */

   FILE *x1_y3;
   float y [ncurve][npts], lon [npts], u [npts], v [npts], t [npts];
   float y1val [5] = {-90.0 , -80.0, -70.0, -60.0, -50.0};
   float y2val [6] = {10.0, 20.0, 30.0, 40.0, 50.0, 60.0};
   float y3val [5] = {-20.0, -10.0, 0.0, 10.0, 20.0};
 
   char *y1lab [5] = {"-90.", "-80.", "-70.", "-60.", "-50."};
   char *y2lab [6] = {"10.", "20.", "30.", "40.", "50.", "60."};
   char *y3lab [5] = {"-20.", "-10.", "0.", "10.", "20."};
   char *file = "xy.asc";

/*
 *  Read ASCII file xy.asc
 */
   x1_y3 = fopen (file,"r");
/*
 *   xy.asc has 4 vars of length 129 longitudes, lon, u, v, t
 *
 *     The data is taken at 43N latitude.  Longitude is an index
 *     1-129 standing for 0 deg - 360 deg in steps of 360/128?
 *     u and v are in m/s, and t is in deg K.
 */

   while (!feof(x1_y3)) {
      fscanf (x1_y3, "%f %f %f %f", &lon[i], &u[i], &v[i], &t[i]);
      i++;
   }

   for (i=0; i < npts; i++)
   {
      lon [i] = (lon[i]- 1.0) * 360.0/128.0;
      t [i] =  (t[i] - 273.15) * 9 / 5 + 32.0 ;
      y [0][i] = u[i];
      y [1][i] = v[i];
      y [2][i] = (t[i] - 273.15) * 9.0 / 5.0 + 32.0;
   }

   NhlInitialize ();
   rlist = NhlRLCreate (NhlSETRL);

/*
 *  Create Application object.  The Application object name is used to
 *  determine the name of the resource file, which is "xy17.res" in this
 *  case. 
 */
 
   NhlRLClear (rlist);
   NhlRLSetInteger (rlist, NhlNappDefaultParent, True);
   NhlRLSetString (rlist, NhlNappUsrDir, "./");
   NhlCreate (&appid, "xy17", NhlappClass, 0, rlist);

/*
 *  If NCGM=1, then open NCGM workstation. 
 */
   if (!strcmp(wks_type,"ncgm") || !strcmp(wks_type,"NCGM")) {
      NhlRLClear (rlist);
      NhlRLSetString (rlist, NhlNwkMetaName, "xy17c.ncgm");
      NhlCreate (&wks, "xy17Work", NhlncgmWorkstationClass, 0, rlist);
   }
   else if (!strcmp(wks_type,"x11") || !strcmp(wks_type,"X11")) {
/*
 *  Create an X workstation. 
 */
      NhlRLClear (rlist);
      NhlRLSetInteger (rlist, NhlNwkPause, True);
      NhlCreate (&wks, "xy17Work", NhlcairoWindowWorkstationClass, 0, rlist);
   }
   else if (!strcmp(wks_type,"oldps") || !strcmp(wks_type,"OLDPS")) {
/*
 *  Open PS workstation. 
 */

      NhlRLClear (rlist);
      NhlRLSetString (rlist, NhlNwkPSFileName, "xy17c.ps");
      NhlCreate (&wks, "xy17Work", NhlpsWorkstationClass, 0, rlist);
   }
   else if (!strcmp(wks_type,"oldpdf") || !strcmp(wks_type,"OLDPDF")) {
/*
 *  Open PDF workstation. 
 */
      NhlRLClear (rlist);
      NhlRLSetString (rlist, NhlNwkPDFFileName, "xy17c.pdf");
      NhlCreate (&wks, "xy17Work", NhlpdfWorkstationClass, 0, rlist);
   }
   else if (!strcmp(wks_type,"pdf") || !strcmp(wks_type,"PDF") ||
            !strcmp(wks_type,"ps") || !strcmp(wks_type,"PS")) {
/*
 *  Open cairo PS/PDF workstation. 
 */
      NhlRLClear (rlist);
      NhlRLSetString (rlist, NhlNwkFileName, "xy17c");
      NhlRLSetString (rlist, NhlNwkFormat, (char*)wks_type);
      NhlCreate (&wks, "xy17Work", NhlcairoDocumentWorkstationClass, 0, rlist);
   }
   else if (!strcmp(wks_type,"png") || !strcmp(wks_type,"PNG")) {
/*
 *  Open cairo PNG workstation. 
 */
      NhlRLClear (rlist);
      NhlRLSetString (rlist, NhlNwkFileName, "xy17c");
      NhlRLSetString (rlist, NhlNwkFormat, (char*)wks_type);
      NhlCreate (&wks, "xy17Work", NhlcairoImageWorkstationClass, 0, rlist);
   }

/*
 *  Create a coordarrays data object and configure its extents missing
 *  values and at the same time convert it from Degrees K to Degrees F  
 */

   NhlRLClear (rlist);
   NhlRLSetFloatArray (rlist, NhlNcaXArray, lon, 129);
   NhlRLSetFloatArray (rlist, NhlNcaYArray, t, 129);
   NhlCreate (&field1, "field1", NhlcoordArraysClass, appid, rlist);

/*
 *  Create a coordarrays data object and configure its extents missing
 *  values and at the same time convert it from Degrees K to Degrees F
 */

   NhlRLClear (rlist);
   NhlRLSetFloatArray (rlist, NhlNcaXArray, lon, 129);
   NhlRLSetFloatArray (rlist, NhlNcaYArray, u, 129);
   NhlCreate (&field2, "field2", NhlcoordArraysClass, appid, rlist);

/*
 *  Create a coordarrays data object and configure its extents missing
 *  values and at the same time convert it from Degrees K to Degrees F
 */

   NhlRLClear (rlist);
   NhlRLSetFloatArray (rlist, NhlNcaXArray, lon, 129);
   NhlRLSetFloatArray (rlist, NhlNcaYArray, v, 129);
   NhlCreate (&field3, "field3", NhlcoordArraysClass, appid, rlist);

/*
 *  Create XyPlot object for curve 1 and assign data to it
 */

   NhlRLClear (rlist);
   NhlRLSetFloat   (rlist, NhlNvpXF, 0.20);
   NhlRLSetFloat   (rlist, NhlNvpYF, 0.80);
   NhlRLSetFloat   (rlist, NhlNvpWidthF, 0.6);
   NhlRLSetFloat   (rlist, NhlNvpHeightF, 0.2);
   NhlRLSetInteger (rlist, NhlNxyCoordData, field1);
   NhlRLSetString  (rlist, NhlNtrYReverse, "False");
   NhlRLSetFloat   (rlist, NhlNtrYMaxF,  -50.0);
   NhlRLSetFloat   (rlist, NhlNtrYMinF,  -90.0);
   NhlRLSetFloat   (rlist, NhlNtrXMaxF,  360.0);
   NhlRLSetFloat   (rlist, NhlNtrXMinF,   0.0);
   NhlRLSetString  (rlist, NhlNtmYROn, "False");
   NhlRLSetString  (rlist, NhlNtmYUseLeft, "False");
   NhlRLSetString  (rlist, NhlNtmXMajorGrid, "True");
   NhlRLSetString  (rlist, NhlNtmXBLabelsOn, "False");
   NhlRLSetString  (rlist, NhlNtmYLLabelsOn, "True");
   NhlRLSetFloat   (rlist, NhlNtmYLMajorLengthF, 0.01);
   NhlRLSetFloat   (rlist, NhlNtmYLMajorOutwardLengthF, 0.0);
   NhlRLSetString  (rlist, NhlNtmYLMode, "Explicit");
   NhlRLSetFloatArray  (rlist, NhlNtmYLValues, y1val, 5);
   NhlRLSetStringArray (rlist, NhlNtmYLLabels, y1lab, 5);
   NhlRLSetString  (rlist, NhlNtmYLLabelsOn, "True");
   NhlRLSetString (rlist, NhlNtmYLLabelFontColor,"red");
   NhlRLSetString  (rlist, NhlNtiMainString, "Temperature, U, V Stacked Plots");
   NhlRLSetString  (rlist, NhlNtiYAxisString, "Temp (Deg C)");
   NhlRLSetFloat   (rlist, NhlNtiXAxisFontHeightF, 0.02);
   NhlRLSetFloat   (rlist, NhlNtiYAxisFontHeightF, 0.02);
   NhlRLSetString  (rlist, NhlNtiXAxisFont, "helvetica-bold");
   NhlRLSetString  (rlist, NhlNtiYAxisFont, "helvetica-bold");
   NhlRLSetString (rlist, NhlNtiYAxisFontColor,"red");
   NhlRLSetString  (rlist, NhlNtmYRMinorOn, "False");
   NhlRLSetString  (rlist, NhlNtmYLMinorOn, "False");
   NhlCreate(&xy1, "xy1", NhlxyPlotClass, wks, rlist);

/*
 *  Create XyPlot object for curve 2 and assign data to it
 */

   NhlRLClear (rlist);
   NhlRLSetFloat   (rlist, NhlNvpXF, 0.20);
   NhlRLSetFloat   (rlist, NhlNvpYF, 0.60);
   NhlRLSetFloat   (rlist, NhlNvpWidthF, 0.6);
   NhlRLSetFloat   (rlist, NhlNvpHeightF, 0.2);
   NhlRLSetInteger (rlist, NhlNxyCoordData, field2);
   NhlRLSetString  (rlist, NhlNtrYReverse, "False");
   NhlRLSetFloat   (rlist, NhlNtrYMaxF,   60.0);
   NhlRLSetFloat   (rlist, NhlNtrYMinF,   10.0);
   NhlRLSetFloat   (rlist, NhlNtrXMaxF,  360.0);
   NhlRLSetFloat   (rlist, NhlNtrXMinF,   0.0);
   NhlRLSetString  (rlist, NhlNtmYROn, "True");
   NhlRLSetString  (rlist, NhlNtmYLOn, "False");
   NhlRLSetString  (rlist, NhlNtmYUseLeft, "False");
   NhlRLSetString  (rlist, NhlNtmXMajorGrid, "True");
   NhlRLSetString  (rlist, NhlNtmYLLabelsOn, "False");
   NhlRLSetString  (rlist, NhlNtmYRLabelsOn, "True");
   NhlRLSetString  (rlist, NhlNtmYRMode, "Explicit");
   NhlRLSetFloatArray  (rlist, NhlNtmYRValues, y2val, 6);
   NhlRLSetStringArray (rlist, NhlNtmYRLabels, y2lab, 6);
   NhlRLSetString  (rlist, NhlNtmXBLabelsOn, "False");
   NhlRLSetString (rlist, NhlNtmYRLabelFontColor,"green");
   NhlRLSetString  (rlist, NhlNtiYAxisString, "U (m/s)");
   NhlRLSetFloat   (rlist, NhlNtiXAxisFontHeightF, 0.02);
   NhlRLSetFloat   (rlist, NhlNtiYAxisFontHeightF, 0.02);
   NhlRLSetString  (rlist, NhlNtiXAxisFont, "helvetica-bold");
   NhlRLSetString  (rlist, NhlNtiYAxisFont, "helvetica-bold");
   NhlRLSetString (rlist, NhlNtiYAxisFontColor,"green");
   NhlRLSetString  (rlist, NhlNtmYRMinorOn, "False");
   NhlRLSetString  (rlist, NhlNtmYLMinorOn, "False");
   NhlCreate(&xy2, "xy2", NhlxyPlotClass, wks, rlist);

/*
 *  Create XyPlot object for curve 3 and assign data to it
 *
 *  Increase the veiwport so the right scale will be about .15 NDC
 *  right of the other grids.  Plot only the right vertical axis.
 *  .5NDC = 360 deg lon, thus .65NDC = 360+108 deg lon.
 */

   NhlRLClear (rlist);
   NhlRLSetFloat   (rlist, NhlNvpXF, 0.20);
   NhlRLSetFloat   (rlist, NhlNvpYF, 0.40);
   NhlRLSetFloat   (rlist, NhlNvpWidthF, 0.6);
   NhlRLSetFloat   (rlist, NhlNvpHeightF, 0.2);
   NhlRLSetInteger (rlist, NhlNxyCoordData, field3);
   NhlRLSetString  (rlist, NhlNtrYReverse, "False");
   NhlRLSetFloat   (rlist, NhlNtrYMaxF,   20.0);
   NhlRLSetFloat   (rlist, NhlNtrYMinF,  -20.0);
   NhlRLSetFloat   (rlist, NhlNtrXMaxF,  360.0);
   NhlRLSetFloat   (rlist, NhlNtrXMinF,   0.0);
   NhlRLSetString  (rlist, NhlNtmYROn, "False");
   NhlRLSetString  (rlist, NhlNtmYUseLeft, "False");
   NhlRLSetString  (rlist, NhlNtmYLLabelsOn, "True");
   NhlRLSetString  (rlist, NhlNtmXBLabelsOn, "True");
   NhlRLSetString  (rlist, NhlNtmXMajorGrid, "True");
   NhlRLSetFloat   (rlist, NhlNtmYLMajorLengthF, 0.01);
   NhlRLSetFloat   (rlist, NhlNtmYLMajorOutwardLengthF, 0.0);
   NhlRLSetString  (rlist, NhlNtmYLMode, "Explicit");
   NhlRLSetString  (rlist, NhlNtmYLLabelsOn, "True");
   NhlRLSetString (rlist, NhlNtmYLLabelFontColor,"blue");
   NhlRLSetString  (rlist, NhlNtiYAxisString, "V (m/s)");
   NhlRLSetString  (rlist, NhlNtiXAxisString, "Longitude (Degs)");
   NhlRLSetFloat   (rlist, NhlNtiXAxisFontHeightF, 0.02);
   NhlRLSetFloat   (rlist, NhlNtiYAxisFontHeightF, 0.02);
   NhlRLSetString  (rlist, NhlNtiXAxisFont, "helvetica-bold");
   NhlRLSetString  (rlist, NhlNtiYAxisFont, "helvetica-bold");
   NhlRLSetString (rlist, NhlNtiYAxisFontColor,"blue");
   NhlRLSetString  (rlist, NhlNtmYRMinorOn, "False");
   NhlRLSetString  (rlist, NhlNtmYLMinorOn, "False");
   NhlRLSetFloatArray  (rlist, NhlNtmYLValues, y3val, 5);
   NhlRLSetStringArray (rlist, NhlNtmYLLabels, y3lab, 5);
   NhlCreate(&xy3, "xy3", NhlxyPlotClass, wks, rlist);

   grlist = NhlRLCreate (NhlGETRL);
   NhlRLClear (grlist);
   NhlRLGetIntegerArray(grlist,NhlNxyCoordDataSpec,&dspec,&num_dspec);
   NhlGetValues(xy1, grlist);

   NhlRLClear (rlist);
   NhlRLSetInteger (rlist, NhlNxyMonoLineColor, True);
   NhlRLSetString (rlist, NhlNxyLineColor,"red");
   NhlSetValues (dspec[0], rlist);

   NhlRLClear (grlist);
   NhlRLGetIntegerArray(grlist,NhlNxyCoordDataSpec,&dspec,&num_dspec);
   NhlGetValues(xy2, grlist);

   NhlRLClear (rlist);
   NhlRLSetInteger (rlist, NhlNxyMonoLineColor, True);
   NhlRLSetString (rlist, NhlNxyLineColor,"green");
   NhlSetValues (dspec[0], rlist);

   NhlRLClear (grlist);
   NhlRLGetIntegerArray(grlist,NhlNxyCoordDataSpec,&dspec,&num_dspec);
   NhlGetValues(xy3, grlist);

   NhlRLClear (rlist);
   NhlRLSetInteger (rlist, NhlNxyMonoLineColor, True);
   NhlRLSetString (rlist, NhlNxyLineColor,"blue");
   NhlSetValues (dspec[0], rlist);

   NhlDraw(xy1);
   NhlDraw(xy2);
   NhlDraw(xy3);
   NhlFrame(wks);

   NhlDestroy (wks);
   NhlClose();
   exit(0);
}