IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42389


Ignore:
Timestamp:
Feb 8, 2023, 12:17:35 PM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. fixes for more pendantic gcc; add opihi memory stats; string vector improvements; use named macros for fixed string lengths

Location:
trunk/Ohana
Files:
2 deleted
176 edited
10 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/Makefile.Common

    r41492 r42389  
    8484        @echo ""
    8585
     86# USE THIS? -Wl,--allow-multiple-definition
     87
    8688$(LIB)/%.$(ARCH).so:
    8789        @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
    8890        rm -f $@
    89         gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc
     91#       gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc
     92        gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc -Wl,--allow-multiple-definition
    9093        @echo "compiled shared library $*"
    9194        @echo ""
  • trunk/Ohana/Makefile.System.in

    r12842 r42389  
    1717CFLAGS   = @CFLAGS@
    1818CPPFLAGS = @CPPFLAGS@
    19 LDFLAGS  = @LDFLAGS@
     19LDFLAGS  = @LDFLAGS@ -Wl,--allow-multiple-definition
    2020DLLTYPE  = @DLLTYPE@
    2121
  • trunk/Ohana/src/addstar/Makefile

    r41563 r42389  
    358358$(SRC)/loadukirt_uhs_readstars_ugps.$(ARCH).o \
    359359$(SRC)/loadukirt_uhs_readstars_ulas.$(ARCH).o \
     360$(SRC)/loadukirt_uhs_readstars_uhs2022.$(ARCH).o \
    360361$(SRC)/loadukirt_uhs_table.$(ARCH).o \
    361362$(SRC)/parse_csv.$(ARCH).o \
  • trunk/Ohana/src/addstar/include/WISE.h

    r42146 r42389  
    2121short WISE_W1, WISE_W2, WISE_W3, WISE_W4;
    2222
     23double  RA_SYS_OFFRAW;
     24double  DE_SYS_OFFSET;
     25double  uRA_SYS_OFFSET;
     26double  uDE_SYS_OFFSET;
     27
    2328enum {MODE_NONE, MODE_CATWISE, MODE_ALLWISE, MODE_ALLSKY, MODE_PRELIM};
    2429int MODE;
     
    3843int loadwise_star_allsky  (Measure *measure, char *line, int Nmax);
    3944int loadwise_star_allwise (Measure *measure, char *line, int Nmax);
    40 int loadwise_star_catwise (Measure *measure, char *line, int Nmax, double Rs, double Ds);
     45int loadwise_star_catwise (Average *average, Measure *measure, char *line, int Nmax, WISE_Stars *tstars);
    4146
    4247char *nextWISEfield (char *line);
  • trunk/Ohana/src/addstar/include/skycells.h

    r40528 r42389  
    3535
    3636/* globals which define database info / data sources (KEEP) */
    37 char   ImageCat[256];
     37char   ImageCat[512];
    3838char   GSCFILE[256];
    3939char   CATDIR[256];
  • trunk/Ohana/src/addstar/include/ukirt_uhs.h

    r42131 r42389  
    11
    2 typedef enum {UKIRT_MODE_NONE, UKIRT_MODE_UHS, UKIRT_MODE_UGCS, UKIRT_MODE_UGPS, UKIRT_MODE_ULAS} UkirtMode;
     2typedef enum {UKIRT_MODE_NONE, UKIRT_MODE_UHS, UKIRT_MODE_UGCS, UKIRT_MODE_UGPS, UKIRT_MODE_ULAS, UKIRT_MODE_UHS2022} UkirtMode;
    33
    44# define NSTARS_MAX 10000000
     
    5555UKIRT_Stars *loadukirt_uhs_readstars_ulas (FILE *f, char *buffer, int *nstart, AddstarClientOptions *options, int *nstars);
    5656UKIRT_Stars *loadukirt_uhs_readstars_uhs (FILE *f, char *buffer, int *nstart, AddstarClientOptions *options, int *nstars);
     57UKIRT_Stars *loadukirt_uhs_readstars_uhs2022 (FILE *f, char *buffer, int *nstart, AddstarClientOptions *options, int *nstars);
    5758
    5859
  • trunk/Ohana/src/addstar/src/ConfigInit_skycells.c

    r33719 r42389  
    66
    77  char *config, *file;
    8   char CatdirPhotcodeFile[256];
    9   char MasterPhotcodeFile[256];
     8  char CatdirPhotcodeFile[512];
     9  char MasterPhotcodeFile[512];
    1010
    1111  /*** load configuration info ***/
  • trunk/Ohana/src/addstar/src/LoadDataPMM.c

    r40291 r42389  
    163163  if (!PMM_CCD_TABLE) abort ();
    164164
    165   strncpy (fileID, datafile, 7);
    166   fileID[7] = 0;
     165  strncpy_nowarn (fileID, datafile, 7);
    167166
    168167  f = fopen (PMM_CCD_TABLE, "r");
     
    177176    if (strncmp (fileID, &line[FILE_ID_INDEX], 7)) continue;
    178177   
    179     strncpy (date, &line[DATE_INDEX], 9);
    180     date[9] = 0;
    181 
    182     strncpy (timestr, &line[TIME_INDEX], 5);
    183     timestr[5] = 0;
    184 
    185     strncpy (RA, &line[RA_INDEX], 6);
    186     RA[6] = 0;
    187 
    188     strncpy (DEC, &line[DEC_INDEX], 7);
    189     DEC[7] = 0;
    190 
    191     strncpy (emulsion, &line[EMULSION_INDEX], 5);
    192     emulsion[5] = 0;
    193 
    194     strncpy (filter, &line[FILTER_INDEX], 6);
    195     filter[6] = 0;
    196 
    197     strncpy (EXPTIME, &line[EXPTIME_INDEX], 3);
    198     EXPTIME[3] = 0;
     178    strncpy_nowarn (date, &line[DATE_INDEX], 9);
     179    strncpy_nowarn (timestr, &line[TIME_INDEX], 5);
     180    strncpy_nowarn (RA, &line[RA_INDEX], 6);
     181    strncpy_nowarn (DEC, &line[DEC_INDEX], 7);
     182    strncpy_nowarn (emulsion, &line[EMULSION_INDEX], 5);
     183    strncpy_nowarn (filter, &line[FILTER_INDEX], 6);
     184    strncpy_nowarn (EXPTIME, &line[EXPTIME_INDEX], 3);
    199185
    200186    image[0].tzero   = pmm_date_to_sec (date, timestr);
     
    357343  double h, m, s, ra;
    358344 
    359   strncpy (tmp, &RA[0], 2);
    360   tmp[2] = 0;
    361   h = atof (tmp);
    362 
    363   strncpy (tmp, &RA[2], 2);
    364   tmp[2] = 0;
    365   m = atof (tmp);
    366 
    367   strncpy (tmp, &RA[4], 2);
    368   tmp[2] = 0;
    369   s = atof (tmp);
     345  strncpy_nowarn (tmp, &RA[0], 2); h = atof (tmp);
     346  strncpy_nowarn (tmp, &RA[2], 2); m = atof (tmp);
     347  strncpy_nowarn (tmp, &RA[4], 2); s = atof (tmp);
    370348
    371349  ra = 15.0 * (h + m / 60.0 + s / 3600.0);
     
    379357  double d, m, s, dec;
    380358
    381   strncpy (tmp, &DEC[1], 2);
    382   tmp[2] = 0;
    383   d = atof (tmp);
    384 
    385   strncpy (tmp, &DEC[3], 2);
    386   tmp[2] = 0;
    387   m = atof (tmp);
    388 
    389   strncpy (tmp, &DEC[5], 2);
    390   tmp[2] = 0;
    391   s = atof (tmp);
     359  strncpy_nowarn (tmp, &DEC[1], 2); d = atof (tmp);
     360  strncpy_nowarn (tmp, &DEC[3], 2); m = atof (tmp);
     361  strncpy_nowarn (tmp, &DEC[5], 2); s = atof (tmp);
    392362
    393363  dec = d + m / 60.0 + s / 3600.0;
  • trunk/Ohana/src/addstar/src/ReadStarsUKIRT.c

    r40520 r42389  
    6666  }
    6767
    68   char filter[80];
     68  char filter[50];
    6969  if (!gfits_scan (header, "FILTER", "%s", 1, filter)) {
    7070    fprintf (stderr, "missing FILTER\n");
  • trunk/Ohana/src/addstar/src/SkyTableFromBSCIndex.c

    r39318 r42389  
    3535
    3636    memset (tycho[i].name, 0, 21);
    37     strncpy (tycho[i].name, line, 7);
    38     tycho[i].name[7] = 0;
     37    strncpy_nowarn (tycho[i].name, line, 7);
    3938  }
    4039  Ntycho = i;
  • trunk/Ohana/src/addstar/src/SkyTableFromTychoIndex.c

    r28241 r42389  
    3535
    3636    memset (tycho[i].name, 0, 21);
    37     strncpy (tycho[i].name, line, 7);
    38     tycho[i].name[7] = 0;
     37    strncpy_nowarn (tycho[i].name, line, 7);
    3938  }
    4039  Ntycho = i;
  • trunk/Ohana/src/addstar/src/args_loadukirt_uhs.c

    r41341 r42389  
    3434    UKIRT_MODE = UKIRT_MODE_ULAS;
    3535    UKIRT_NFILTER = 5;
     36    remove_argument (N, argc, argv);
     37  }
     38  if ((N = get_argument (*argc, argv, "-uhs2022"))) {
     39    UKIRT_MODE = UKIRT_MODE_UHS2022;
     40    UKIRT_NFILTER = 2;
    3641    remove_argument (N, argc, argv);
    3742  }
     
    152157static void help () {
    153158
    154   fprintf (stderr, "USAGE: loadukirt_uhs [options] (file) [-uhs | -ugcs | -ulas | -ugps] [..more files]\n");
     159  fprintf (stderr, "USAGE: loadukirt_uhs [options] (file) [-uhs | -ugcs | -ulas | -ugps | -uhs2022] [..more files]\n");
    155160  fprintf (stderr, "  add data from UKIRT CSV file to DVO\n");
    156   fprintf (stderr, "  mode is required : -uhs | -ugcs | -ulas | -ugps\n\n");
     161  fprintf (stderr, "  mode is required : -uhs | -ugcs | -ulas | -ugps | -uhs2022\n\n");
    157162
    158163  fprintf (stderr, "  optional flags:\n");
  • trunk/Ohana/src/addstar/src/args_loadwise.c

    r42146 r42389  
    5050  if ((N = get_argument (*argc, argv, "-v"))) {
    5151    VERBOSE = TRUE;
     52    remove_argument (N, argc, argv);
     53  }
     54
     55  /* accept proper-motion data from reference */
     56  ACCEPT_MOTION = FALSE;
     57  if ((N = get_argument (*argc, argv, "-accept-motion"))) {
     58    ACCEPT_MOTION = TRUE;
     59    remove_argument (N, argc, argv);
     60  }
     61
     62  /* accept proper-motion data from reference */
     63  RA_SYS_OFFRAW = 0.0;
     64  DE_SYS_OFFSET = 0.0;
     65  uRA_SYS_OFFSET = 0.0;
     66  uDE_SYS_OFFSET = 0.0;
     67  if ((N = get_argument (*argc, argv, "-sys-astrom-offsets"))) {
     68    if (*argc < N + 5) {
     69      fprintf (stderr, "missing args for -sys-astrom-offsets (RA) (DEC) (uRA) (uDEC)\n");
     70      exit (2);
     71    }
     72    remove_argument (N, argc, argv);
     73    RA_SYS_OFFRAW = atof(argv[N]);
     74    remove_argument (N, argc, argv);
     75    DE_SYS_OFFSET = atof(argv[N]);
     76    remove_argument (N, argc, argv);
     77    uRA_SYS_OFFSET = atof(argv[N]);
     78    remove_argument (N, argc, argv);
     79    uDE_SYS_OFFSET = atof(argv[N]);
    5280    remove_argument (N, argc, argv);
    5381  }
  • trunk/Ohana/src/addstar/src/fakeimage.c

    r40291 r42389  
    77  double Rmin, Rmax, Dmin, Dmax;
    88  double dX, dY, r, d;
    9   char chipname[80], chipdata[256], name[80];
     9  char chipname[16], chipdata[256], name[117];
    1010  char *config;
    1111  Image *image;
     
    6767  for (i = 0; i < Nchips; i++) {
    6868    /* this is the addstar name for the chip in the camera */
    69     sprintf (chipname, "CHIP.%03d", i);
     69    snprintf (chipname, 16, "CHIP.%03d", i);
    7070    ScanConfig (config, chipname, "%s", 0, chipdata);
    7171
     
    7474
    7575    /* this is the camera-specific name of a chip */
    76     sprintf (name, "%s.%s", rootname, chipname);
     76    snprintf (name, 117, "%s.%s", rootname, chipname);
    7777    strcpy (image[i+1].name, name);
    7878
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r39311 r42389  
    224224          tgtcat[0].average[n].P          = srccat->average[N].P;
    225225          tgtcat[0].average[n].dP         = srccat->average[N].dP;
     226          tgtcat[0].average[n].Tmean      = srccat->average[N].Tmean;
    226227        }
    227228
     
    305306      tgtcat[0].average[Nave].P            = srccat->average[i].P;
    306307      tgtcat[0].average[Nave].dP           = srccat->average[i].dP;
     308      tgtcat[0].average[Nave].Tmean        = srccat->average[i].Tmean;
    307309    }
    308310
  • trunk/Ohana/src/addstar/src/getusno.c

    r38986 r42389  
    1010  float hours[100];
    1111  int start[100], number[100], *buffer, *buf;
    12   char filename[128];
     12  char filename[300];
    1313  FILE *f;
    1414  int iRA0, iRA1, iDEC0, iDEC1;
  • trunk/Ohana/src/addstar/src/getusnob.c

    r38986 r42389  
    99  float hours[100];
    1010  int start[100], number[100], *buffer, *buf;
    11   char filename[128];
     11  char filename[300];
    1212  FILE *f;
    1313  double dec;
  • trunk/Ohana/src/addstar/src/loadatlas_readstars.c

    r41563 r42389  
    242242        // why do I need to copy temp here, does gprint modify the value of temp?
    243243        char temp[32];
    244         strncpy (temp, c0, 32);
    245         temp[31] = 0;
     244        strncpy_nowarn (temp, c0, 31);
    246245        gprint (GP_ERR, "skip line %s\n\n", temp);
    247246      }
  • trunk/Ohana/src/addstar/src/loadgaia_dr2_readstars.c

    r40543 r42389  
    238238        // why do I need to copy temp here, does gprint modify the value of temp?
    239239        char temp[32];
    240         strncpy (temp, c0, 32);
    241         temp[31] = 0;
     240        strncpy_nowarn (temp, c0, 31);
    242241        gprint (GP_ERR, "skip line %s\n\n", temp);
    243242      }
  • trunk/Ohana/src/addstar/src/loadgaia_edr3_readstars.c

    r41801 r42389  
    253253        // why do I need to copy temp here, does gprint modify the value of temp?
    254254        char temp[32];
    255         strncpy (temp, c0, 32);
    256         temp[31] = 0;
     255        strncpy_nowarn (temp, c0, 31);
    257256        gprint (GP_ERR, "skip line %s\n\n", temp);
    258257      }
  • trunk/Ohana/src/addstar/src/loadsupercos_ops.c

    r38986 r42389  
    3838
    3939  Nchar = p2 - p1 - 1;
    40   strncpy (emulsion, p1, Nchar);
    41   emulsion[Nchar] = 0;
     40  strncpy_nowarn (emulsion, p1, Nchar);
    4241  stripwhite (emulsion);
    4342       
    4443  Nchar = p3 - p2 - 1;
    45   strncpy (filterID, p2, Nchar);
    46   filterID[Nchar] = 0;
     44  strncpy_nowarn (filterID, p2, Nchar);
    4745  stripwhite (filterID);
    4846       
     
    6967
    7068  char hour[3], minute[3];
    71   strncpy(hour, p1, 2); hour[2] = 0;
    72   strncpy(minute, p1+2, 2); minute[2] = 0;
     69  strncpy_nowarn(hour, p1, 2);
     70  strncpy_nowarn(minute, p1+2, 2);
    7371
    7472  double minuteF = atof (minute);
  • trunk/Ohana/src/addstar/src/loadsupercos_plates.c

    r40291 r42389  
    7777    image[Nimage].dMcal     = 0.0;
    7878
    79     char photname[128];
    80     snprintf (photname, 128, "SCOS.%s.%s", emulsion, filterID);
     79    char photname[300];
     80    snprintf (photname, 300, "SCOS.%s.%s", emulsion, filterID);
    8181    image[Nimage].photcode = GetPhotcodeCodebyName (photname);
    8282    if (!image[Nimage].photcode) {
  • trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars.c

    r42077 r42389  
    2222    case UKIRT_MODE_ULAS: {
    2323      UKIRT_Stars *stars = loadukirt_uhs_readstars_ulas (f, buffer, nstart, options, nstars);
     24      return stars;
     25    }
     26     
     27    case UKIRT_MODE_UHS2022: {
     28      UKIRT_Stars *stars = loadukirt_uhs_readstars_uhs2022 (f, buffer, nstart, options, nstars);
    2429      return stars;
    2530    }
  • trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c

    r42131 r42389  
    458458        // why do I need to copy temp here, does gprint modify the value of temp?
    459459        char temp[32];
    460         strncpy (temp, c0, 32);
    461         temp[31] = 0;
     460        strncpy_nowarn (temp, c0, 31);
    462461        gprint (GP_ERR, "skip line %s\n\n", temp);
    463462      }
  • trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c

    r42131 r42389  
    379379        // why do I need to copy temp here, does gprint modify the value of temp?
    380380        char temp[32];
    381         strncpy (temp, c0, 32);
    382         temp[31] = 0;
     381        strncpy_nowarn (temp, c0, 31);
    383382        gprint (GP_ERR, "skip line %s\n\n", temp);
    384383      }
  • trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c

    r42131 r42389  
    201201        // why do I need to copy temp here, does gprint modify the value of temp?
    202202        char temp[32];
    203         strncpy (temp, c0, 32);
    204         temp[31] = 0;
     203        strncpy_nowarn (temp, c0, 31);
    205204        gprint (GP_ERR, "skip line %s\n\n", temp);
    206205      }
  • trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c

    r42131 r42389  
    406406        // why do I need to copy temp here, does gprint modify the value of temp?
    407407        char temp[32];
    408         strncpy (temp, c0, 32);
    409         temp[31] = 0;
     408        strncpy_nowarn (temp, c0, 31);
    410409        gprint (GP_ERR, "skip line %s\n\n", temp);
    411410      }
  • trunk/Ohana/src/addstar/src/loadwise_ops.c

    r42146 r42389  
    1919  if (MODE == MODE_CATWISE) {
    2020      // copy the string ranges and then use strtod (not necessary?)
    21       *R = strtod (&ptr[47], NULL); // safe to use the strtod on the line because it is white-space separated
    22       *D = strtod (&ptr[59], NULL);
     21      // *R = strtod (&ptr[47], NULL); // safe to use strtod on the line because it is white-space separated
     22      // *D = strtod (&ptr[59], NULL);
     23      // note we use ra_pm and dec_pm which are different from ra,dec when the object is moving
     24      *R = strtod (&ptr[1139], NULL); // safe to use strtod on the line because it is white-space separated
     25      *D = strtod (&ptr[1151], NULL);
    2326  } else {
    2427      ptr = skipNbounds (ptr, '|', 1, Nmax);
  • trunk/Ohana/src/addstar/src/loadwise_rawdata.c

    r42146 r42389  
    4242  while ((Nbyte = fread (&buffer[Nextra], 1, NBYTE-Nextra, f)) != 0) {
    4343    if (Nbyte == -1) Shutdown ("error reading from raw file %s", filename);
    44     if (DEBUG) fprintf (stderr, "read %d bytes", Nbyte);
     44    if (DEBUG) fprintf (stderr, "read %d bytes .. n", Nbyte);
    4545
    4646    Nbyte += Nextra;
     
    6969
    7070      if (skipHeader && (MODE == MODE_CATWISE)) {
    71         if (*p == '\\') goto skip_header;
     71        if (*p == 0x5C) goto skip_header; // back-slash char
    7272        if (*p == '|') goto skip_header;
    73       }
    74       if (skipHeader && (MODE == MODE_CATWISE)) {
    75         // once we get past the header, do not skip any more
    76         skipHeader = FALSE;
    77       }
    78 
     73        skipHeader = FALSE; // once we get past the header, do not skip any more
     74      }
     75
     76      // note CATWISE uses a different mapping
    7977      getWISE_coords (p, &tstars[Ntstars].R, &tstars[Ntstars].D, Nbyte - offset);
     78
    8079      tstars[Ntstars].offset = offset; // offset within scan
    8180      tstars[Ntstars].flag = FALSE;
     
    9493
    9594      /* start of the next line */
    96       p = q + 1;
     95      p = q + 1; // q is always RETURN char on this line
    9796      offset = p - buffer; // offset within this scan
    9897      if (offset == Nbyte) {
     
    104103      q = memchr (p, '\n', Nbyte - offset);
    105104      if (q == NULL) {
    106         // last, incomplete line in buffer
     105        // we are on the last, incomplete line in buffer
    107106        Nextra = Nbyte - offset;
    108107        break;
     
    183182            break;
    184183          case MODE_CATWISE:
    185             loadwise_star_catwise (&newcat->measure[Nmeas], &buffer[offset], Nbyte - offset, tstars[j].R, tstars[j].D);
     184            loadwise_star_catwise (&newcat->average[Nave], &newcat->measure[Nmeas], &buffer[offset], Nbyte - offset, &tstars[j]);
    186185            break;
    187186          default:
    188187            break;
    189188        }
     189
     190        if (DEBUG && (Nave < 10)) {
     191          fprintf (stderr, "pos: %12.6f %12.6f +/- %10.5f %10.5f : %12.6f %12.6f +/- %10.5f %10.5f\n",
     192                   newcat->average[Nave].R, newcat->average[Nave].D,
     193                   newcat->average[Nave].dR, newcat->average[Nave].dD,
     194                   newcat->average[Nave].uR, newcat->average[Nave].uD,
     195                   newcat->average[Nave].duR, newcat->average[Nave].duD);
     196        }
     197           
    190198
    191199        tstars[j].flag = TRUE;
  • trunk/Ohana/src/addstar/src/loadwise_star_full.c

    r42149 r42389  
    88int setWISE_blend_flag (Measure *measure, char *ptr);
    99
     10int setCatWISE_ab_flag (Measure *measure, char qual);
     11
     12# define CATWISE_EPOCH 1432771200 /* MJD 57170 */
     13
    1014// fill in the data for a CatWISE double star.  takes a pointer to the start of the line the
    1115// RA and DEC have already been set
    12 int loadwise_star_catwise (Measure *measure, char *line, int Nmax, double Rs, double Ds) {
     16int loadwise_star_catwise (Average *average, Measure *measure, char *line, int Nmax, WISE_Stars *tstars) {
    1317
    1418  if (line == NULL) Shutdown ("format error in WISE");
     
    2226  // already been extracted.
    2327
    24   measure[0].R    = Rs;
    25   measure[0].D    = Ds;
    26   measure[1].R    = Rs;
    27   measure[1].D    = Ds;
     28  // reference epoch for CATWise:
     29  average[0].Tmean = CATWISE_EPOCH;
     30
     31  // correct the position information for the systematic corrections
     32  double RA_SYS_OFFSET = RA_SYS_OFFRAW / cos(RAD_DEG*tstars->D);
     33
     34  average[0].R  = tstars->R + RA_SYS_OFFSET;
     35  average[0].D  = tstars->D + DE_SYS_OFFSET;
     36  average[0].dR = getDoubleNAN (line, 71, 79); // sig_ra -- add 5/1000 to avoid truncation
     37  average[0].dD = getDoubleNAN (line, 80, 88); // sig_dec
     38
     39  // P.M. values go on average:
     40  average[0].uR  = getDoubleNAN (line, 1194, 1203) + uRA_SYS_OFFSET; // PMRA
     41  average[0].uD  = getDoubleNAN (line, 1204, 1213) + uDE_SYS_OFFSET; // PMDec
     42  average[0].duR = getDoubleNAN (line, 1214, 1222); // sigPMRA
     43  average[0].duD = getDoubleNAN (line, 1223, 1231); // sigPMDec
     44
     45  measure[0].R     = average[0].R;
     46  measure[0].D     = average[0].D;
     47  measure[1].R     = average[0].R;
     48  measure[1].D     = average[0].D;
    2849
    2950  // I can assign dRA and dDEC to dX and dY if I can consistently set posangle and pltscale
    30   measure[0].dXccd = ToShortPixels(getDoubleRAW (line, 71, 79) + 0.005); // sig_ra -- add 5/1000 to avoid truncation
    31   measure[0].dYccd = ToShortPixels(getDoubleRAW (line, 80, 88) + 0.005); // sig_dec
     51  measure[0].dXccd = ToShortPixels(average[0].dR + 0.005); // sig_ra -- add 5/1000 to avoid truncation
     52  measure[0].dYccd = ToShortPixels(average[0].dD + 0.005); // sig_dec
    3253  measure[0].posangle = 0.0;
    3354  measure[0].pltscale = 1.0;
     
    3960  measure[1].pltscale = measure[0].pltscale;
    4061
    41   measure[0].Xccd = getDoubleRAW (line,  98, 106); // wx
    42   measure[0].Yccd = getDoubleRAW (line, 107, 115); // wy
     62  measure[0].Xccd = getDoubleNAN (line,  98, 106); // wx
     63  measure[0].Yccd = getDoubleNAN (line, 107, 115); // wy
    4364  measure[1].Xccd = measure[0].Xccd;
    4465  measure[1].Yccd = measure[0].Yccd;
     
    4768  measure[0].M         = getDoubleNAN (line, 248, 254); // w1mpro
    4869  measure[0].dM        = getDoubleNAN (line, 255, 264); // w1sigmpro
    49   measure[0].psfChisq  = getDoubleRAW (line, 265, 275); // w1rchi2
    50   measure[0].psfQF     = measure[0].psfChisq;
     70  measure[0].psfChisq  = getDoubleNAN (line, 265, 275); // w1rchi2
    5171  measure[0].photFlags = 0;
     72
     73  measure[0].Mkron     = getDoubleNAN (line, 563, 572); // w1mag_4
     74  measure[0].dMkron    = getDoubleNAN (line, 573, 582); // w1sigm_4
     75  measure[0].Map       = getDoubleNAN (line, 339, 345); // w1mag
     76  measure[0].dMap      = getDoubleNAN (line, 346, 352); // w1sigm
     77
     78  measure[0].Xfix      = getDoubleNAN (line, 880, 891); // w1k
     79  measure[0].Yfix      = getDoubleNAN (line, 989, 903); // w1mLQ
    5280
    5381  // W2
    5482  measure[1].M         = getDoubleNAN (line, 276, 282); // w2mpro
    5583  measure[1].dM        = getDoubleNAN (line, 283, 292); // w2sigmpro
    56   measure[1].psfChisq  = getDoubleRAW (line, 293, 303); // w2rchi2
    57   measure[1].psfQF     = measure[1].psfChisq;
     84  measure[1].psfChisq  = getDoubleNAN (line, 293, 303); // w2rchi2
    5885  measure[1].photFlags = 0;
    5986
    60   setCatWISE_blend_flag (measure, line); // w1sat
     87  measure[1].Mkron     = getDoubleNAN (line, 591, 600); // w2mag_4
     88  measure[1].dMkron    = getDoubleNAN (line, 601, 610); // w2sigm_4
     89  measure[1].Map       = getDoubleNAN (line, 367, 373); // w2mag
     90  measure[1].dMap      = getDoubleNAN (line, 374, 380); // w2sigm
     91
     92  measure[1].Xfix      = getDoubleNAN (line, 995,  1006); // w2k
     93  measure[1].Yfix      = getDoubleNAN (line, 1013, 1018); // w2mLQ
     94
     95  measure[0].psfQF     = getDoubleNAN (line, 304, 314); // rchi2
     96  measure[1].psfQF     = measure[0].psfQF;
     97
     98  setCatWISE_blend_flag (measure, line); // na & nb
    6199
    62100  setCatWISE_sat_flag (&measure[0], line, 323, 330); // w1sat
    63101  setCatWISE_sat_flag (&measure[1], line, 331, 338); // w2sat
    64102
    65   // cc_flags? 1642 - 1657
    66   // setWISE_cc_flag (&measure[0], ptr[i]); // cc_flags
    67 
    68   // set ext flags for all 4 measures
    69   // setCatWISE_ext_flag_allsky (measure, ptr[0]); // ext_flg
    70 
    71   // setWISE_var_flag_allsky (&measure[0], ptr[i]); // var_flg
    72 
    73   // setWISE_ph_qual (&measure[i], ptr[i]); // ph_qual
    74 
    75   double mjdmean = getDoubleRAW (line, 1126, 1138); // MeanObsMJD
     103  // cc_flags is a field which takes 15 chars, but only 4 are used
     104  // bytes 1653 - 1656 are the allWise cc_flag entries for W1, W2, W3, W4
     105  // skip lines for which the 4 chars have the value 'null'
     106  if (strncmp(&line[1653], "null", 4)) {
     107      setWISE_cc_flag (&measure[0], line[1653]); // W1 cc_flag
     108      setWISE_cc_flag (&measure[1], line[1654]); // W2 cc_flag
     109  }
     110
     111  // cc_flags is a field which takes 8 chars, but only 2 are used
     112  // bytes 1735 & 1736 are the ab_flag entries for W1 & W2
     113  // they use the same values as cc_flags
     114  setCatWISE_ab_flag (&measure[0], line[1735]); // W1 ab_flag
     115  setCatWISE_ab_flag (&measure[1], line[1736]); // W2 ab_flag
     116
     117  double mjdmean = getDoubleNAN (line, 1126, 1138); // MeanObsMJD
    76118 
    77119  // the release is based on data taken in the period 14 January 2010 to 29 April 2010
     
    575617  }
    576618  return TRUE;
     619}
     620
     621int setCatWISE_ab_flag (Measure *measure, char qual) {
     622
     623  switch (qual) {
     624    case 'P': measure[0].photFlags2 |= FLAG_CC_PERSIST | FLAG_CC_SPURIOUS; break;
     625    case 'H': measure[0].photFlags2 |= FLAG_CC_HALO    | FLAG_CC_SPURIOUS; break;
     626    case 'D': measure[0].photFlags2 |= FLAG_CC_SPIKE   | FLAG_CC_SPURIOUS; break;
     627    case 'O': measure[0].photFlags2 |= FLAG_CC_GHOST   | FLAG_CC_SPURIOUS; break;
     628
     629    case '0': break;
     630    default:
     631      fprintf (stderr, "error in ab_flag: %c\n", qual);
     632  }     
     633  return (TRUE);
    577634}
    578635
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r40291 r42389  
    559559    Ns = strlen (simple);
    560560    No = 80 - Ns;
    561     strncpy (header.buffer, simple, Ns);
     561    strncpy_nowarn (header.buffer, simple, Ns);
    562562    memset (&header.buffer[Ns], ' ', No);
    563563  }
  • trunk/Ohana/src/addstar/src/sky_tessalation.c

    r40528 r42389  
    5252  Ntotal = Nbase*pow(4.0, level);
    5353  Ndigit = (int)(log10(Ntotal)) + 1 ;
    54   snprintf (format, 16, "skytri.%%0%dd", Ndigit);
     54  snprintf_nowarn (format, 16, "skytri.%%0%dd", Ndigit);
    5555
    5656  // to what depth do we need to go to have only Nmax foreach subcell?
     
    9090    for (j = 0; j < Ntriangles; j++) {
    9191      sky_triangle_to_image (&image[j], &tri[j]);
    92       snprintf (image[j].name, DVO_IMAGE_NAME_LEN, format, Nout);
     92      snprintf_nowarn (image[j].name, DVO_IMAGE_NAME_LEN, format, Nout);
    9393      Nout++;
    9494    } 
     
    128128  Ntotal = Nbase*pow(4.0, level);
    129129  Ndigit = (int)(log10(Ntotal)) + 1 ;
    130   snprintf (format, 16, "skycell.%%0%dd", Ndigit);
     130  snprintf_nowarn (format, 16, "skycell.%%0%dd", Ndigit);
    131131
    132132  // to what depth do we need to go to have only Nmax foreach subcell?
     
    173173      if (!strcmp(rectangle[j].coords.ctype, "DROP")) continue;
    174174      memcpy (&subset[Nsubset], &rectangle[j], sizeof(SkyRectangle));
    175       snprintf (subset[Nsubset].name, DVO_IMAGE_NAME_LEN, format, Nname);
     175      snprintf_nowarn (subset[Nsubset].name, DVO_IMAGE_NAME_LEN, format, Nname);
    176176      Nname++;
    177177      Nsubset++;
     
    254254  for (double dec = -90.0; dec < +90.01; dec += CELLSIZE, Ndec ++) {
    255255
    256     snprintf (format, 32, "skycell.%%03d.%03d", Ndec);
     256    snprintf_nowarn (format, 32, "skycell.%%03d.%03d", Ndec);
    257257
    258258    int Nring;
     
    310310  Ntotal = 41254.2 / (dDEC*dDEC);
    311311  Ndigit = (int)(log10(Ntotal)) + 1 ;
    312   snprintf (format, 16, "skycell.%%0%dd", Ndigit);
     312  snprintf_nowarn (format, 16, "skycell.%%0%dd", Ndigit);
    313313
    314314  // generate the a collection of rectangles for each ring
     
    367367  Ntotal = 41254.2 / (dDEC*dDEC);
    368368  Ndigit = (int)(log10(Ntotal)) + 1 ;
    369   snprintf (format, 16, "skycell.%%0%dd", Ndigit);
     369  snprintf_nowarn (format, 16, "skycell.%%0%dd", Ndigit);
    370370
    371371  double d2r = M_PI / 180; // is RAD_DEG
     
    716716    // CFIS uses names with centers based on ra,dec
    717717    // format = skycell.%03d.%03d
    718     snprintf (ring[i].name, DVO_IMAGE_NAME_LEN, format, i);
     718    snprintf_nowarn (ring[i].name, DVO_IMAGE_NAME_LEN, format, i);
    719719  }
    720720
     
    826826    ring[i].photcode = 1; // this needs to be set more sensibly
    827827
    828     snprintf (ring[i].name, DVO_IMAGE_NAME_LEN, format, Nname);
     828    snprintf_nowarn (ring[i].name, DVO_IMAGE_NAME_LEN, format, Nname);
    829829    Nname++;
    830830
     
    897897      ring[N].photcode = 1; // this needs to be set more sensibly
    898898
    899       snprintf (ring[N].name, DVO_IMAGE_NAME_LEN, format, Nname);
     899      snprintf_nowarn (ring[N].name, DVO_IMAGE_NAME_LEN, format, Nname);
    900900      Nname++;
    901901    }
     
    927927  if (Nx * Ny > 1) {
    928928    Ndigit = (int)(log10(Nx*Ny)) + 1 ;
    929     snprintf (format, 80, "%s.%%0%dd", input[0].name, Ndigit);
     929    snprintf_nowarn (format, 80, "%s.%%0%dd", input[0].name, Ndigit);
    930930  } else {
    931     snprintf (format, 80, "%s", input[0].name);
     931    snprintf_nowarn (format, 80, "%s", input[0].name);
    932932  }
    933933
     
    944944
    945945      if (Nx + Ny > 1) {
    946         snprintf (output[N].name, DVO_IMAGE_NAME_LEN, format, N);
     946        snprintf_nowarn (output[N].name, DVO_IMAGE_NAME_LEN, format, N);
    947947      } else {
    948         snprintf (output[N].name, DVO_IMAGE_NAME_LEN, "%s", format);
     948        snprintf_nowarn (output[N].name, DVO_IMAGE_NAME_LEN, "%s", format);
    949949      }
    950950
  • trunk/Ohana/src/delstar/src/delete_duplicate_images.c

    r39457 r42389  
    108108    // set up the basic catalog info
    109109    char hostfile[1024];
    110     snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     110    snprintf_nowarn (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    111111
    112112    dvo_catalog_init (&catalog, TRUE);
     
    148148  // write out the subset table of image information
    149149  char imageFile[512];
    150   snprintf (imageFile, 512, "%s/ImageIDs.tmp.fits", CATDIR);
     150  snprintf_nowarn (imageFile, 512, "%s/ImageIDs.tmp.fits", CATDIR);
    151151
    152152  if (!ImageIDSave (imageFile, imageID)) {
     
    173173
    174174    char command[1024];
    175     snprintf (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -dup-images",
     175    snprintf_nowarn (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -dup-images",
    176176              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,
    177177              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    178178
    179179    char tmpline[1024];
    180     if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
    181     if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
     180    if (VERBOSE)       { snprintf_nowarn (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     181    if (VERBOSE2)      { snprintf_nowarn (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    182182
    183183    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/delstar/src/delete_fix_LAP.c

    r40549 r42389  
    4040    // set up the basic catalog info
    4141    char hostfile[1024];
    42     snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     42    snprintf_nowarn (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    4343
    4444    dvo_catalog_init (&catalog, TRUE);
     
    9292  // write out the subset table of image information
    9393  char imageFile[512];
    94   snprintf (imageFile, 512, "%s/delstar.fixLAP.%s.dat", CATDIR, uniquer);
     94  snprintf_nowarn (imageFile, 512, "%s/delstar.fixLAP.%s.dat", CATDIR, uniquer);
    9595
    9696  if (!ImageSubsetSave (imageFile, image, Nimage)) {
     
    132132
    133133    ALLOCATE (table->hosts[i].results, char, 1024);
    134     snprintf (table->hosts[i].results, 1024, "%s/delstar.fixLAP.imstats.%s.dat", table->hosts[i].pathname, uniquer);
     134    snprintf_nowarn (table->hosts[i].results, 1024, "%s/delstar.fixLAP.imstats.%s.dat", table->hosts[i].pathname, uniquer);
    135135
    136136    char command[1024];
    137     snprintf (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -images %s -imstats %s -region %f %f %f %f -fix-LAP",
     137    snprintf_nowarn (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -images %s -imstats %s -region %f %f %f %f -fix-LAP",
    138138              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, imageFile, table->hosts[i].results,
    139139              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    140140
    141141    char tmpline[1024];
    142     if (VERBOSE)    { snprintf (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
    143     if (VERBOSE2)   { snprintf (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
    144     if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
    145     if (UPDATE)     { snprintf (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
     142    if (VERBOSE)    { snprintf_nowarn (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
     143    if (VERBOSE2)   { snprintf_nowarn (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
     144    if (SINGLE_CPT) { snprintf_nowarn (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
     145    if (UPDATE)     { snprintf_nowarn (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
    146146
    147147    fprintf (stderr, "command: %s\n", command);
     
    210210  // write out the subset table of image information
    211211  char imageFile[512];
    212   snprintf (imageFile, 512, "%s/delstar.fixLAP.%s.dat", CATDIR, UNIQUER);
     212  snprintf_nowarn (imageFile, 512, "%s/delstar.fixLAP.%s.dat", CATDIR, UNIQUER);
    213213
    214214  // load the list of hosts
     
    228228
    229229    ALLOCATE (table->hosts[i].results, char, 1024);
    230     snprintf (table->hosts[i].results, 1024, "%s/delstar.fixLAP.imstats.%s.dat", table->hosts[i].pathname, UNIQUER);
     230    snprintf_nowarn (table->hosts[i].results, 1024, "%s/delstar.fixLAP.imstats.%s.dat", table->hosts[i].pathname, UNIQUER);
    231231
    232232    fprintf (stderr, "read %s\n", table->hosts[i].results);
  • trunk/Ohana/src/delstar/src/delete_fix_LAP_edges.c

    r40549 r42389  
    4848    // set up the basic catalog info
    4949    char hostfile[1024];
    50     snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     50    snprintf_nowarn (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    5151
    5252    dvo_catalog_init (&catalog, TRUE);
     
    122122
    123123    ALLOCATE (table->hosts[i].results, char, 1024);
    124     snprintf (table->hosts[i].results, 1024, "%s/delstar.fixLAPedges.measures.%s.dat", table->hosts[i].pathname, uniquer);
     124    snprintf_nowarn (table->hosts[i].results, 1024, "%s/delstar.fixLAPedges.measures.%s.dat", table->hosts[i].pathname, uniquer);
    125125
    126126    char command[1024];
    127     snprintf (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -measures %s -region %f %f %f %f -fix-LAP-edges",
     127    snprintf_nowarn (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -measures %s -region %f %f %f %f -fix-LAP-edges",
    128128              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, table->hosts[i].results,
    129129              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    130130
    131131    char tmpline[1024];
    132     if (VERBOSE)    { snprintf (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
    133     if (VERBOSE2)   { snprintf (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
    134     if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
    135     // if (UPDATE)     { snprintf (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
     132    if (VERBOSE)    { snprintf_nowarn (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
     133    if (VERBOSE2)   { snprintf_nowarn (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
     134    if (SINGLE_CPT) { snprintf_nowarn (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
     135    // if (UPDATE)     { snprintf_nowarn (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
    136136
    137137    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/delstar/src/delete_fix_LAP_edges_delete.c

    r40549 r42389  
    8888    // set up the basic catalog info
    8989    char hostfile[1024];
    90     snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     90    snprintf_nowarn (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    9191
    9292    dvo_catalog_init (&catalog, TRUE);
     
    180180
    181181    // ALLOCATE (table->hosts[i].results, char, 1024);
    182     // snprintf (table->hosts[i].results, 1024, "%s/delstar.fixLAPedges.measures.%s.dat", table->hosts[i].pathname, uniquer);
     182    // snprintf_nowarn (table->hosts[i].results, 1024, "%s/delstar.fixLAPedges.measures.%s.dat", table->hosts[i].pathname, uniquer);
    183183
    184184    char command[1024];
    185     snprintf (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -fix-LAP-edges-delete %s",
     185    snprintf_nowarn (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -fix-LAP-edges-delete %s",
    186186              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,
    187187              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax,
     
    189189
    190190    char tmpline[1024];
    191     if (VERBOSE)    { snprintf (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
    192     if (VERBOSE2)   { snprintf (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
    193     if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
    194     if (UPDATE)     { snprintf (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
     191    if (VERBOSE)    { snprintf_nowarn (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
     192    if (VERBOSE2)   { snprintf_nowarn (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
     193    if (SINGLE_CPT) { snprintf_nowarn (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
     194    if (UPDATE)     { snprintf_nowarn (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
    195195
    196196    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/delstar/src/delete_photcodes.c

    r38986 r42389  
    3838    // set up the basic catalog info
    3939    char hostfile[1024];
    40     snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     40    snprintf_nowarn (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
    4141
    4242    dvo_catalog_init (&catalog, TRUE);
     
    9494
    9595    char command[1024];
    96     snprintf (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -photcodes %s",
     96    snprintf_nowarn (command, 1024, "delstar_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -photcodes %s",
    9797              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,
    9898              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax,
     
    100100
    101101    char tmpline[1024];
    102     if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
    103     if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
     102    if (VERBOSE)       { snprintf_nowarn (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     103    if (VERBOSE2)      { snprintf_nowarn (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    104104
    105105    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/dvomerge/src/dvorepairFixStackIDs.c

    r39336 r42389  
    3333
    3434  while (fscanf (f, "%s", catdir) != EOF) {
    35     snprintf (imageFilenameOld, DVO_MAX_PATH, "%s/Images.dat", catdir);
    36     snprintf (imageFilenameNew, DVO_MAX_PATH, "%s/Images.dat.fixed", catdir);
     35    snprintf_nowarn (imageFilenameOld, DVO_MAX_PATH, "%s/Images.dat", catdir);
     36    snprintf_nowarn (imageFilenameNew, DVO_MAX_PATH, "%s/Images.dat.fixed", catdir);
    3737   
    3838    if ((image = LoadImages (&db, imageFilenameOld, &Nimage)) == NULL) {
  • trunk/Ohana/src/dvomerge/src/dvorepairFixWarpIDs.c

    r39329 r42389  
    4646
    4747  while (fscanf (f, "%s", catdir) != EOF) {
    48     snprintf (imageFilenameOld, DVO_MAX_PATH, "%s/Images.dat", catdir);
    49     snprintf (imageFilenameNew, DVO_MAX_PATH, "%s/Images.dat.fixed", catdir);
     48    snprintf_nowarn (imageFilenameOld, DVO_MAX_PATH, "%s/Images.dat", catdir);
     49    snprintf_nowarn (imageFilenameNew, DVO_MAX_PATH, "%s/Images.dat.fixed", catdir);
    5050   
    5151    if ((image = LoadImages (&db, imageFilenameOld, &Nimage)) == NULL) {
  • trunk/Ohana/src/dvomerge/src/dvosecfilt_catalogs.c

    r40378 r42389  
    3434
    3535    char hostfile[1024];
    36     snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
     36    snprintf_nowarn (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
    3737
    3838    dvo_catalog_init (&catalog, TRUE);
     
    116116    // options / arguments that can affect relastro_client -update-objects:
    117117    char command[DVO_MAX_PATH];
    118     snprintf (command, DVO_MAX_PATH, "dvosecfilt_client %s %d -hostID %d -hostdir %s -region %f %f %f %f",
     118    snprintf_nowarn (command, DVO_MAX_PATH, "dvosecfilt_client %s %d -hostID %d -hostdir %s -region %f %f %f %f",
    119119              abscatdir, Nsecfilt, table->hosts[i].hostID, table->hosts[i].pathname,
    120120              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax
     
    122122
    123123    char tmpline[DVO_MAX_PATH];
    124     if (VERBOSE)    { snprintf (tmpline, DVO_MAX_PATH, "%s -v",      command);             strcpy (command, tmpline); }
    125     if (SINGLE_CPT) { snprintf (tmpline, DVO_MAX_PATH, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
     124    if (VERBOSE)    { snprintf_nowarn (tmpline, DVO_MAX_PATH, "%s -v",      command);             strcpy (command, tmpline); }
     125    if (SINGLE_CPT) { snprintf_nowarn (tmpline, DVO_MAX_PATH, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
    126126
    127127    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/dvopsps/src/insert_FGshape_dvopsps.c

    r39564 r42389  
    4747
    4848    char localFilename[1024];
    49     snprintf (localFilename, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
     49    snprintf_nowarn (localFilename, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
    5050
    5151    // set up the basic catalog info
     
    125125
    126126    char command[1024];
    127     snprintf (command, 1024, "dvopsps_client forced_galaxy_shape -hostID %d -catdir %s -hostdir %s -region %f %f %f %f",
     127    snprintf_nowarn (command, 1024, "dvopsps_client forced_galaxy_shape -hostID %d -catdir %s -hostdir %s -region %f %f %f %f",
    128128              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,
    129129              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    130130
    131131    char tmpline[1024];
    132     snprintf (tmpline, 1024, "%s -dbhost %s", command, DATABASE_HOST); strcpy (command, tmpline);
    133     snprintf (tmpline, 1024, "%s -dbuser %s", command, DATABASE_USER); strcpy (command, tmpline);
    134     snprintf (tmpline, 1024, "%s -dbpass %s", command, DATABASE_PASS); strcpy (command, tmpline);
    135     snprintf (tmpline, 1024, "%s -dbname %s", command, DATABASE_NAME); strcpy (command, tmpline);
     132    snprintf_nowarn (tmpline, 1024, "%s -dbhost %s", command, DATABASE_HOST); strcpy (command, tmpline);
     133    snprintf_nowarn (tmpline, 1024, "%s -dbuser %s", command, DATABASE_USER); strcpy (command, tmpline);
     134    snprintf_nowarn (tmpline, 1024, "%s -dbpass %s", command, DATABASE_PASS); strcpy (command, tmpline);
     135    snprintf_nowarn (tmpline, 1024, "%s -dbname %s", command, DATABASE_NAME); strcpy (command, tmpline);
    136136
    137     if (VERBOSE)    { snprintf (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
    138     if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
     137    if (VERBOSE)    { snprintf_nowarn (tmpline, 1024, "%s -v",      command);             strcpy (command, tmpline); }
     138    if (SINGLE_CPT) { snprintf_nowarn (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
    139139
    140140    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/dvopsps/src/insert_FWobjects_dvopsps.c

    r40291 r42389  
    4747
    4848    char localFilename[1024];
    49     snprintf (localFilename, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
     49    snprintf_nowarn (localFilename, 1024, "%s/%s.cpt", HOSTDIR, skylist->regions[i]->name);
    5050
    5151    // set up the basic catalog info
     
    126126
    127127    char command[1024];
    128     snprintf (command, 1024, "dvopsps_client forced_warp_objects -hostID %d -catdir %s -hostdir %s -region %f %f %f %f",
     128    snprintf_nowarn (command, 1024, "dvopsps_client forced_warp_objects -hostID %d -catdir %s -hostdir %s -region %f %f %f %f",
    129129              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,
    130130              UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    131131
    132132    char tmpline[1024];
    133     snprintf (tmpline, 1024, "%s -dbhost %s", command, DATABASE_HOST); strcpy (command, tmpline);
    134     snprintf (tmpline, 1024, "%s -dbuser %s", command, DATABASE_USER); strcpy (command, tmpline);
    135     snprintf (tmpline, 1024, "%s -dbpass %s", command, DATABASE_PASS); strcpy (command, tmpline);
    136     snprintf (tmpline, 1024, "%s -dbname %s", command, DATABASE_NAME); strcpy (command, tmpline);
     133    snprintf_nowarn (tmpline, 1024, "%s -dbhost %s", command, DATABASE_HOST); strcpy (command, tmpline);
     134    snprintf_nowarn (tmpline, 1024, "%s -dbuser %s", command, DATABASE_USER); strcpy (command, tmpline);
     135    snprintf_nowarn (tmpline, 1024, "%s -dbpass %s", command, DATABASE_PASS); strcpy (command, tmpline);
     136    snprintf_nowarn (tmpline, 1024, "%s -dbname %s", command, DATABASE_NAME); strcpy (command, tmpline);
    137137
    138     if (VERBOSE)    { snprintf (tmpline, 1024, "%s -v",         command);             strcpy (command, tmpline); }
    139     if (TEST_MODE)  { snprintf (tmpline, 1024, "%s -test-mode", command);             strcpy (command, tmpline); }
    140     if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s",    command, SINGLE_CPT); strcpy (command, tmpline); }
     138    if (VERBOSE)    { snprintf_nowarn (tmpline, 1024, "%s -v",         command);             strcpy (command, tmpline); }
     139    if (TEST_MODE)  { snprintf_nowarn (tmpline, 1024, "%s -test-mode", command);             strcpy (command, tmpline); }
     140    if (SINGLE_CPT) { snprintf_nowarn (tmpline, 1024, "%s -cpt %s",    command, SINGLE_CPT); strcpy (command, tmpline); }
    141141
    142142    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/elixir/src/ConfigInit.c

    r16139 r42389  
    9898  if (config == (char *) NULL) {
    9999    fprintf (stderr, "ERROR: can't find configuration file %s\n", file);
    100     if (file != (char *) NULL) free (file);
     100    // XXX note: the test below fools gcc into thinking file could be NUL
     101    // even though the test above forces an exit if it is NULL.
     102    // if (file != (char *) NULL) free (file);
    101103    Shutdown (1);
     104    exit (2);
    102105  }
    103106  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
  • trunk/Ohana/src/elixir/src/Photcodes.c

    r10336 r42389  
    7272  char name[256], path[256], ccd[80], mode[80];
    7373  int i;
     74
     75  p = line;
     76  while ((p = strchr (p, ',')) != (char *) NULL) { *p = ' '; }
     77  sscanf (line, "%s %s %s %s", path, name, ccd, mode);
     78
     79  if (!strcasecmp (mode, "MEF")) {
     80    snprintf_nowarn (fullname, 256, "%s/%s.fits", path, name);
     81  } else {
     82    snprintf_nowarn (fullname, 256, "%s/%s/%s%s.fits", path, name, name, ccd);
     83  }
     84
     85  if (!gfits_read_header (fullname, &header)) {
     86    fprintf (stderr, "ERROR: can't find image file %s (1)\n", fullname);
     87    exit(0);
     88  }
     89  gfits_scan (&header, "DETECTOR", "%s", 1, detector);
     90  gfits_scan (&header, "FILTER",   "%s", 1, filter);
     91  gfits_free_header (&header);
     92 
     93  for (i = 0; i < strlen(detector); i++) { detector[i] = toupper (detector[i]); }
     94  for (i = 0; i < strlen(filter); i++) { filter[i] = toupper (filter[i]); }
     95
     96  ALLOCATE (code, char, 256);
     97  sprintf (code, "%s.%s.%s", detector, filter, ccd);
     98  return (code);
     99
     100}
     101
     102char *BuildName (char *line) {
     103
     104  char *fullname;
     105  char name[256], path[256], ccd[80], mode[80];
     106  char *p;
     107
     108  ALLOCATE (fullname, char, 256);
    74109
    75110  p = line;
     
    83118  }
    84119
    85   if (!gfits_read_header (fullname, &header)) {
    86     fprintf (stderr, "ERROR: can't find image file %s (1)\n", fullname);
    87     exit(0);
    88   }
    89   gfits_scan (&header, "DETECTOR", "%s", 1, detector);
    90   gfits_scan (&header, "FILTER",   "%s", 1, filter);
    91   gfits_free_header (&header);
    92  
    93   for (i = 0; i < strlen(detector); i++) { detector[i] = toupper (detector[i]); }
    94   for (i = 0; i < strlen(filter); i++) { filter[i] = toupper (filter[i]); }
    95 
    96   ALLOCATE (code, char, 256);
    97   sprintf (code, "%s.%s.%s", detector, filter, ccd);
    98   return (code);
    99 
    100 }
    101 
    102 char *BuildName (char *line) {
    103 
    104   char *fullname;
    105   char name[256], path[256], ccd[80], mode[80];
    106   char *p;
    107 
    108   ALLOCATE (fullname, char, 256);
    109 
    110   p = line;
    111   while ((p = strchr (p, ',')) != (char *) NULL) { *p = ' '; }
    112   sscanf (line, "%s %s %s %s", path, name, ccd, mode);
    113 
    114   if (!strcasecmp (mode, "MEF")) {
    115     sprintf (fullname, "%s/%s.fits", path, name);
    116   } else {
    117     sprintf (fullname, "%s/%s/%s%s.fits", path, name, name, ccd);
    118   }
    119 
    120120  return (fullname);
    121121
     
    172172
    173173  ALLOCATE (root, char, Nbyte + 1);
    174   strncpy (root, p1, Nbyte);
    175   root[Nbyte] = 0;
     174  strncpy_nowarn (root, p1, Nbyte);
    176175 
    177176  return (root);
     
    195194  Nbyte = p1-file;
    196195  ALLOCATE (path, char, Nbyte + 1);
    197   strncpy (path, file, Nbyte);
    198   path[Nbyte] = 0;
     196  strncpy_nowarn (path, file, Nbyte);
    199197 
    200198  return (path);
     
    232230  Nbyte = (p1 - p2);
    233231  ALLOCATE (path, char, Nbyte + 1);
    234   strncpy (path, p2, Nbyte);
    235   path[Nbyte] = 0;
     232  strncpy_nowarn (path, p2, Nbyte);
    236233 
    237234  return (path);
  • trunk/Ohana/src/elixir/src/ProcessOps.c

    r27435 r42389  
    6969        REALLOCATE (value, char, Nbyte);
    7070      }   
    71       strncpy (&value[Nout], p1, Ncpy);
     71      strncpy_nowarn (&value[Nout], p1, Ncpy);
    7272      Nout += Ncpy;
    7373      p2 ++;
     
    9090      REALLOCATE (value, char, Nbyte);
    9191    }   
    92     strncpy (&value[Nout], p1, Ncpy);
     92    strncpy_nowarn (&value[Nout], p1, Ncpy);
    9393    Nout += Ncpy;
    94     value[Nout] = 0;
    9594  }
    9695
  • trunk/Ohana/src/fakeastro/src/AstromOffsetMapOps.c

    r37807 r42389  
    66
    77  char mapfile[DVO_MAX_PATH];
    8   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
     8  snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
    99  AstromOffsetMapSave (table, mapfile);
    1010
  • trunk/Ohana/src/fakeastro/src/ConfigInit.c

    r39926 r42389  
    44
    55  char  *config, *file;
    6   char CatdirPhotcodeFile[256];
     6  char CatdirPhotcodeFile[DVO_MAX_PATH];
    77
    88  /*** load configuration info ***/
     
    9090
    9191  /* update master photcode table if not defined */
    92   sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR_CHECK);
     92  snprintf_nowarn (CatdirPhotcodeFile, DVO_MAX_PATH, "%s/Photcodes.dat", CATDIR_CHECK);
    9393  if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    9494    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
  • trunk/Ohana/src/fakeastro/src/save_fakestars.c

    r40549 r42389  
    1818    // save to a unique filename
    1919    char filename[1024]; // CATDIR/tmpdir/starpar.PID.index.fits
    20     snprintf (filename, 1024, "%s/tmpdir/starpar.%s.%05d.fits", CATDIR, uniquer, region->index);
     20    snprintf_nowarn (filename, 1024, "%s/tmpdir/starpar.%s.%05d.fits", CATDIR, uniquer, region->index);
    2121
    2222    // write the data to the given FITS file
  • trunk/Ohana/src/fixcat/src/aregion.c

    r27435 r42389  
    8484  Fread (buffer, 1, 48*NDecLines[NBigDec], f, "char");
    8585  for (i = 0; !done && (i < NDecLines[NBigDec]); i++) {
    86     strncpy (temp, &buffer[i*48], 48);
    87     temp[49] = 0;
     86    strncpy_nowarn (temp, &buffer[i*48], 48);
    8887    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    8988    if (RA1 < RA0) RA1 += 360.0;
  • trunk/Ohana/src/gastro/src/getusno.c

    r27611 r42389  
    99  1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10};
    1010
     11# define MY_MAX_PATH 256
     12
    1113USNOdata *getusno (USNOstats *usnostats, CatStats *catstats, int *Nusno) {
    1214
     
    1517  float hours[100];
    1618  int start[100], number[100], *buffer, *buf;
    17   char filename[128], c;
     19  char filename[MY_MAX_PATH], c;
    1820  FILE *f;
    1921  double DEC1;
     
    5254   
    5355    /* load accelerator file */
    54     sprintf (filename, "%s/zone%04d.acc", CDROM, spd);
     56    snprintf_nowarn (filename, MY_MAX_PATH, "%s/zone%04d.acc", CDROM, spd);
    5557    fprintf (stderr, "reading from %s\n", filename);
    5658    f = fopen (filename, "r");
     
    8284   
    8385    /* open data file */
    84     sprintf (filename, "%s/zone%04d.cat", CDROM, spd);
     86    snprintf_nowarn (filename, MY_MAX_PATH, "%s/zone%04d.cat", CDROM, spd);
    8587    fprintf (stderr, "reading from %s\n", filename);
    8688    f = fopen (filename, "r");
  • trunk/Ohana/src/gastro2/src/getusno.c

    r27435 r42389  
    99  1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10};
    1010
     11# define MY_MAX_PATH 256
     12
    1113int getusno (CatStats *catstats, RefCatalog *Ref) {
    1214
     
    1517  float hours[100];
    1618  int start[100], number[100], *buffer, *buf;
    17   char filename[128];
     19  char filename[MY_MAX_PATH];
    1820  FILE *f;
    1921  double DEC1;
     
    5456   
    5557    /* load accelerator file */
    56     sprintf (filename, "%s/zone%04d.acc", USNO_A_DIR, spd);
     58    snprintf_nowarn (filename, MY_MAX_PATH, "%s/zone%04d.acc", USNO_A_DIR, spd);
    5759    fprintf (stderr, "reading from %s\n", filename);
    5860    f = fopen (filename, "r");
     
    7779   
    7880    /* open data file */
    79     sprintf (filename, "%s/zone%04d.cat", USNO_A_DIR, spd);
     81    snprintf_nowarn (filename, MY_MAX_PATH, "%s/zone%04d.cat", USNO_A_DIR, spd);
    8082    fprintf (stderr, "reading from %s\n", filename);
    8183    f = fopen (filename, "r");
  • trunk/Ohana/src/gastro2/src/getusnob.c

    r34088 r42389  
    22# define NBYTE   4
    33# define NELEM  20
     4
     5# define MY_MAX_PATH 256
    46
    57int getusnob (CatStats *catstats, RefCatalog *Ref, double epoch) {
     
    911  float hours[100];
    1012  int start[100], number[100], *buffer, *buf;
    11   char filename[128];
     13  char filename[MY_MAX_PATH];
    1214  FILE *f;
    1315  double DEC1;
     
    4244   
    4345    /* load accelerator file */
    44     sprintf (filename, "%s/%03d/b%04d.acc", USNO_B_DIR, (int)(spd/10), spd);
     46    snprintf_nowarn (filename, MY_MAX_PATH, "%s/%03d/b%04d.acc", USNO_B_DIR, (int)(spd/10), spd);
    4547    if (VERBOSE) fprintf (stderr, "reading from %s\n", filename);
    4648    f = fopen (filename, "r");
     
    6567   
    6668    /* open data file */
    67     sprintf (filename, "%s/%03d/b%04d.cat", USNO_B_DIR, (int)(spd/10), spd);
     69    snprintf_nowarn (filename, MY_MAX_PATH, "%s/%03d/b%04d.cat", USNO_B_DIR, (int)(spd/10), spd);
    6870    if (VERBOSE) fprintf (stderr, "reading from %s\n", filename);
    6971    f = fopen (filename, "r");
  • trunk/Ohana/src/getstar/src/ConfigInit.c

    r34749 r42389  
    11# include "getstar.h"
     2
     3# define MY_MAX_PATH 256
    24
    35int ConfigInit (int *argc, char **argv) {
    46
    57  char *config, *file;
    6   char CatdirPhotcodeFile[256];
     8  char CatdirPhotcodeFile[MY_MAX_PATH];
    79
    810  /*** load configuration info ***/
     
    3133
    3234  /* XXX this does not yet write out the master photcode table */
    33   sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
     35  snprintf_nowarn (CatdirPhotcodeFile, MY_MAX_PATH, "%s/Photcodes.dat", CATDIR);
    3436  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
    3537    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
  • trunk/Ohana/src/getstar/src/ConfigInit_coords.c

    r39998 r42389  
    2525    SKY_TABLE[0] = 0;
    2626  }
    27   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     27  snprintf_nowarn (ImageCat, 256, "%s/Images.dat", CATDIR);
    2828
    2929  /* used by parse_time to find time-related keywords */
  • trunk/Ohana/src/getstar/src/ConfigInit_extract.c

    r27435 r42389  
    2525    SKY_TABLE[0] = 0;
    2626  }
    27   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     27  snprintf_nowarn (ImageCat, 256, "%s/Images.dat", CATDIR);
    2828
    2929  if (*CATMODE == 0) strcpy (CATMODE, "RAW");
  • trunk/Ohana/src/getstar/src/ConfigInit_overlaps.c

    r41891 r42389  
    2525    SKY_TABLE[0] = 0;
    2626  }
    27   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     27  snprintf_nowarn (ImageCat, 256, "%s/Images.dat", CATDIR);
    2828
    2929  /* used by parse_time to find time-related keywords */
  • trunk/Ohana/src/imregister/base/ConfigInit.c

    r25757 r42389  
    66
    77  int i, NDB;
    8   char *config, *file, ElixirBase[80], catdir[256];
    9   char CatdirPhotcodeFile[256];
    10   char MasterPhotcodeFile[256];
     8  char *config, *file, ElixirBase[80], catdir[MY_MAX_PATH];
     9  char CatdirPhotcodeFile[MY_MAX_PATH];
     10  char MasterPhotcodeFile[MY_MAX_PATH];
    1111
    1212  /*** load configuration info ***/
     
    2828  WarnConfig (config, "CATDIR",                      "%s", 0, catdir);
    2929  WarnConfig (config, "PHOTCODE_FILE",               "%s", 0, MasterPhotcodeFile);
    30   sprintf (ImPhotDB, "%s/Images.dat", catdir);
     30  snprintf_nowarn (ImPhotDB, MY_MAX_PATH, "%s/Images.dat", catdir);
    3131
    3232  /* small text databases: filters, camera defs */
     
    7575                                                   
    7676  WarnConfig (config, "imstats",                     "%s", 0, ElixirBase);
    77   sprintf (ImstatFifo, "%s.photcode", ElixirBase);   
     77  snprintf_nowarn (ImstatFifo, MY_MAX_PATH, "%s.photcode", ElixirBase);   
    7878  WarnConfig (config, "ptolemy",                     "%s", 0, ElixirBase);
    79   sprintf (PtolemyFifo, "%s.photcode", ElixirBase);
     79  snprintf_nowarn (PtolemyFifo, MY_MAX_PATH, "%s.photcode", ElixirBase);
    8080
    8181  if (!ScanConfig (config, "CONNECT", "%s",  0, CONNECT)) {
    82     sprintf (CONNECT, "/usr/bin/rsh");
     82    snprintf_nowarn (CONNECT, 64, "/usr/bin/rsh");
    8383  }
    8484
     
    8787  NDetrendAltDB = 0;
    8888  ALLOCATE (DetrendAltDB, char *, NDB);
    89   ALLOCATE (DetrendAltDB[NDetrendAltDB], char, 256);
     89  ALLOCATE (DetrendAltDB[NDetrendAltDB], char, MY_MAX_PATH);
    9090  for (i = 1; ScanConfig (config, "DETREND_ALT_DB", "%s", i, DetrendAltDB[NDetrendAltDB]); i++) {
    9191    NDetrendAltDB ++;
     
    9494      REALLOCATE (DetrendAltDB, char *, NDB);
    9595    }
    96     ALLOCATE (DetrendAltDB[NDetrendAltDB], char, 256);
     96    ALLOCATE (DetrendAltDB[NDetrendAltDB], char, MY_MAX_PATH);
    9797  }
    9898  free (DetrendAltDB[NDetrendAltDB]);
     
    104104
    105105  /* XXX this does not yet write out the master photcode table */
    106   sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir);
     106  snprintf_nowarn (CatdirPhotcodeFile, MY_MAX_PATH, "%s/Photcodes.dat", catdir);
    107107  if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) {
    108108    fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
  • trunk/Ohana/src/imregister/base/fits_scan_nchar.c

    r7080 r42389  
    2020
    2121  status = gfits_scan (header, field, "%s", N, tmpstr);
    22   strncpy (outstr, tmpstr, size - 1);
    23   outstr[size-1] = 0;
     22  strncpy_nowarn (outstr, tmpstr, size - 1);
    2423
    2524  return (status);
  • trunk/Ohana/src/imregister/detrend/entry.c

    r6674 r42389  
    3131  int status;
    3232  int found, Ntry, filestate;
    33   char path[256], fullpath[256], filename[256], rootname[256], fullname[256], line[512];
     33  char path[MY_MAX_PATH], fullpath[MY_MAX_PATH], filename[MY_MAX_PATH];
     34  char rootname[MY_MAX_PATH], fullname[MY_MAX_PATH], line[512];
    3435  char *dBPath;
    3536  char *filter_basename;
     
    4142
    4243  if (newdata[0].type == T_FLAT) {
    43     sprintf (path, "%s/%s", get_type_name(newdata[0].type), filter_basename);
     44    snprintf_nowarn (path, MY_MAX_PATH, "%s/%s", get_type_name(newdata[0].type), filter_basename);
    4445  } else {
    45     sprintf (path, "%s", get_type_name(newdata[0].type));
     46    snprintf_nowarn (path, MY_MAX_PATH, "%s", get_type_name(newdata[0].type));
    4647  }   
    47   sprintf (fullpath, "%s/%s", dBPath, path);
     48  snprintf_nowarn (fullpath, MY_MAX_PATH, "%s/%s", dBPath, path);
    4849
    4950  status = stat (fullpath, &statbuf);
     
    6566  case T_BIAS:
    6667  case T_MASK:
    67     sprintf (rootname, "%s.%s.%d.%02d", ID, get_type_name(newdata[0].type), (int)newdata[0].exptime, newdata[0].ccd);
     68    snprintf_nowarn (rootname, MY_MAX_PATH, "%s.%s.%d.%02d", ID, get_type_name(newdata[0].type), (int)newdata[0].exptime, newdata[0].ccd);
    6869    break;
    6970  default:
    70     sprintf (rootname, "%s.%s.%s.%02d", ID, get_type_name(newdata[0].type), filter_basename, newdata[0].ccd);
     71    snprintf_nowarn (rootname, MY_MAX_PATH, "%s.%s.%s.%02d", ID, get_type_name(newdata[0].type), filter_basename, newdata[0].ccd);
    7172  }
    7273
     
    7475  found = FALSE;
    7576  for (Ntry = 0; !found && (Ntry < 100); Ntry++) {
    76     sprintf (filename, "%s/%s.%02d.fits", path, rootname, Ntry);
    77     sprintf (fullname, "%s/%s", dBPath, filename);
     77    snprintf_nowarn (filename, MY_MAX_PATH, "%s/%s.%02d.fits", path, rootname, Ntry);
     78    snprintf_nowarn (fullname, MY_MAX_PATH, "%s/%s", dBPath, filename);
    7879    f = fsetlockfile (fullname, 2.0, LCK_XCLD, &filestate);
    7980    /* if there is an error, it may just mean file is locked. */
  • trunk/Ohana/src/imregister/detrend/output.c

    r40501 r42389  
    148148    }
    149149    bzero (key, 33);
    150     strncpy (key, p, 32);
     150    strncpy_nowarn (key, p, 32);
    151151    if ((p = strrchr (key, '.')) != (char *) NULL) *p = 0;
    152152
  • trunk/Ohana/src/imregister/imreg/args.imregister.c

    r2823 r42389  
    7373
    7474    /* create db.log and db.bfr */
    75     sprintf (TempDB, "%s.bfr", ImageDB);
    76     sprintf (LogFile, "%s.log", ImageDB);
     75    snprintf_nowarn (TempDB, MY_MAX_PATH, "%s.bfr", ImageDB);
     76    snprintf_nowarn (LogFile, MY_MAX_PATH, "%s.log", ImageDB);
    7777   
    7878    /* check for daemon mode */
  • trunk/Ohana/src/imregister/imreg/iminfo.c

    r27590 r42389  
    9191  /* force strings to fit in available space (32 bytes) */
    9292  gfits_scan (&header, CameraKeyword,     "%s", 1, line);
    93   strncpy (image[0].instrument, line, 31);
    94   image[0].instrument[31] = 0;
     93  strncpy_nowarn (image[0].instrument, line, 31);
    9594
    9695  gfits_scan (&header, FilterKeyword, "%s", 1, line);
    9796  MatchFilterList (line);
    98   strncpy (image[0].filter, line, 31);
    99   image[0].filter[31] = 0;
     97  strncpy_nowarn (image[0].filter, line, 31);
    10098
    10199  /* header has RA & DEC in decimal degrees */
  • trunk/Ohana/src/imregister/imreg/modify.c

    r34088 r42389  
    6969
    7070    if (output.modify_filter) {
    71       strncpy (image[i].filter, output.filter, 31);
     71      strncpy_nowarn (image[i].filter, output.filter, 31);
    7272    }
    7373
  • trunk/Ohana/src/imregister/include/imregister.h

    r27435 r42389  
    1111*/
    1212
    13 char ImstatFifo[256];
    14 char PtolemyFifo[256];
     13# define MY_MAX_PATH 256
    1514
    16 char ImageDB[256];
    17 char DetrendDB[256];
    18 char PhotDB[256];
    19 char TransDB[256];
    20 char ImPhotDB[256];
    21 char TempDB[256];
    22 char LogFile[256];
     15char ImstatFifo[MY_MAX_PATH];
     16char PtolemyFifo[MY_MAX_PATH];
     17
     18char ImageDB[MY_MAX_PATH];
     19char DetrendDB[MY_MAX_PATH];
     20char PhotDB[MY_MAX_PATH];
     21char TransDB[MY_MAX_PATH];
     22char ImPhotDB[MY_MAX_PATH];
     23char TempDB[MY_MAX_PATH];
     24char LogFile[MY_MAX_PATH];
    2325char CONNECT[64];
    2426
     
    2628char **DetrendAltDB;
    2729
    28 char PhotCodeFile[256];
    29 char TempLogFile[256];
    30 char FilterList[256];
    31 char CameraConfig[256];
    32 char RecipeFile[256];
     30char PhotCodeFile[MY_MAX_PATH];
     31char TempLogFile[MY_MAX_PATH];
     32char FilterList[MY_MAX_PATH];
     33char CameraConfig[MY_MAX_PATH];
     34char RecipeFile[MY_MAX_PATH];
    3335
    3436char DateKeyword[64];
  • trunk/Ohana/src/imregister/photreg/getImageData.c

    r12332 r42389  
    6060  }
    6161
    62   sprintf (photcode, "%s.%s.%02d", detector, filter, ccd);
     62  snprintf_nowarn (photcode, 64, "%s.%s.%02d", detector, filter, ccd);
    6363  if (!(criteria.photcode = GetPhotcodeCodebyName (photcode))) {
    6464    fprintf (stderr, "ERR: photcode not found table\n");
  • trunk/Ohana/src/imregister/src/photcode-table.c

    r12332 r42389  
    6060
    6161  char *config, *file;
    62   char CATDIR[256];
     62  char CATDIR[MY_MAX_PATH];
    6363
    6464  /*** load configuration info ***/
     
    7676 
    7777  // set the CATDIR version based on CATDIR
    78   sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
     78  snprintf_nowarn (CatdirPhotcodeFile, MY_MAX_PATH, "%s/Photcodes.dat", CATDIR);
    7979
    8080  free (config);
  • trunk/Ohana/src/kapa2/src/LoadLabels.c

    r41341 r42389  
    2323
    2424  Nbytes = MIN (strlen(label), LABEL_MAXLEN - 1);
    25   strncpy (graph[0].label[mode].text, label, Nbytes);
    26   label[Nbytes] = 0;
     25  strncpy_nowarn (graph[0].label[mode].text, label, Nbytes);
    2726 
    2827  FREE (label);
  • trunk/Ohana/src/kapa2/src/LoadTickmarks.c

    r16011 r42389  
    4747      line[128] = 0;
    4848      ALLOCATE (image[0].tickmarks.objects[Nobjects].text, char, (int) dx + 1);
    49       strncpy (image[0].tickmarks.objects[Nobjects].text, line, (int) dx);
    50       image[0].tickmarks.objects[Nobjects].text[(int)dx] = 0;
     49      strncpy_nowarn (image[0].tickmarks.objects[Nobjects].text, line, (int) dx);
    5150    }     
    5251   
  • trunk/Ohana/src/libdvo/include/dvodb.h

    r42075 r42389  
    150150
    151151/* measure fields */
    152 enum {MEAS_ZERO,
     152typedef enum {MEAS_ZERO,
    153153      MEAS_GLON,
    154154      MEAS_GLAT,
     
    312312
    313313/* average fields */
    314 enum {AVE_ZERO,
     314typedef enum {AVE_ZERO,
    315315      AVE_RA,
    316316      AVE_DEC,
     
    376376//       AVE_Xm,
    377377
    378 enum {IMAGE_ZERO,
     378typedef enum {IMAGE_ZERO,
    379379      IMAGE_RA,
    380380      IMAGE_DEC,
  • trunk/Ohana/src/libdvo/src/coordops.c

    r42075 r42389  
    888888 
    889889  int OldAIPS;
    890   char csys[16], ctype[16];
     890  char csys[16], ctype[32];
    891891  double rotate, Lambda;
    892892
     
    906906    if (!strncmp (coords[0].ctype, "SLAT", 4)) strcpy (csys, "SLON");
    907907    if (!strcmp (csys, "NONE")) return (FALSE);
    908     snprintf (ctype, 16, "%s-%s", csys, &coords[0].ctype[5]);
     908    snprintf (ctype, 32, "%s-%s", csys, &coords[0].ctype[5]);
    909909    gfits_modify (header, "CTYPE1",   "%s",  1, ctype);
    910910  }   
  • trunk/Ohana/src/libdvo/src/dbFields.c

    r42102 r42389  
    640640  if (!strcasecmp (fieldName, "PSF_QF"))         ESCAPE (MEAS_PSF_QF,         OPIHI_FLT);
    641641  if (!strcasecmp (fieldName, "PSF_QF_PERFECT")) ESCAPE (MEAS_PSF_QF_PERFECT, OPIHI_FLT);
     642  if (!strcasecmp (fieldName, "PSFQF"))          ESCAPE (MEAS_PSF_QF,         OPIHI_FLT);
     643  if (!strcasecmp (fieldName, "PSFQF_PERFECT"))  ESCAPE (MEAS_PSF_QF_PERFECT, OPIHI_FLT);
     644  if (!strcasecmp (fieldName, "PSFQFPERFECT"))   ESCAPE (MEAS_PSF_QF_PERFECT, OPIHI_FLT);
    642645  if (!strcasecmp (fieldName, "PSF_CHISQ"))      ESCAPE (MEAS_PSF_CHISQ,      OPIHI_FLT);
    643646  if (!strcasecmp (fieldName, "PSF_NDOF"))       ESCAPE (MEAS_PSF_NDOF,       OPIHI_INT);
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r40291 r42389  
    230230
    231231    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    232     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    233     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     232    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    234233
    235234    out[i].tzero            = in[i].tzero;
     
    302301
    303302    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    304     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    305     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     303    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    306304
    307305    out[i].tzero            = in[i].tzero;
     
    358356
    359357  for (i = 0; i < Nvalues; i++) {
    360     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    361     out[i].name[31] = 0; // force termination
     358    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    362359
    363360    out[i].code  = in[i].code;         
     
    397394
    398395  for (i = 0; i < Nvalues; i++) {
    399     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    400     out[i].name[31] = 0; // force termination
     396    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    401397
    402398    out[i].code = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r40291 r42389  
    225225
    226226    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    227     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    228     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     227    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    229228
    230229    out[i].tzero            = in[i].tzero;
     
    294293
    295294    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    296     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    297     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     295    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    298296
    299297    out[i].tzero            = in[i].tzero;
     
    353351
    354352  for (i = 0; i < Nvalues; i++) {
    355     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    356     out[i].name[31] = 0; // force termination
     353    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    357354
    358355    out[i].code  = in[i].code;         
     
    390387
    391388  for (i = 0; i < Nvalues; i++) {
    392     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    393     out[i].name[31] = 0; // force termination
     389    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    394390
    395391    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c

    r40291 r42389  
    2424
    2525    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    26     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    27     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     26    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    2827
    2928    out[i].tzero            = in[i].tzero;
     
    8887
    8988    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    90     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    91     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     89    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    9290
    9391    out[i].tzero            = in[i].tzero;
     
    146144
    147145  for (i = 0; i < Nvalues; i++) {
    148     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    149     out[i].name[31] = 0; // force termination
     146    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    150147
    151148    out[i].code  = in[i].code;         
     
    182179
    183180  for (i = 0; i < Nvalues; i++) {
    184     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    185     out[i].name[31] = 0; // force termination
     181    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    186182
    187183    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c

    r40291 r42389  
    153153
    154154    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    155     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    156     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     155    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    157156
    158157    out[i].tzero            = in[i].tzero;
     
    220219
    221220    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    222     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    223     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     221    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    224222
    225223    out[i].tzero            = in[i].tzero;
     
    277275
    278276  for (i = 0; i < Nvalues; i++) {
    279     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    280     out[i].name[31] = 0; // force termination
     277    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    281278
    282279    out[i].code  = in[i].code;         
     
    313310
    314311  for (i = 0; i < Nvalues; i++) {
    315     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    316     out[i].name[31] = 0; // force termination
     312    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    317313
    318314    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c

    r40291 r42389  
    313313
    314314    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    315     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    316     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     315    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    317316
    318317    out[i].tzero            = in[i].tzero;
     
    382381
    383382    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    384     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    385     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     383    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    386384
    387385    out[i].tzero            = in[i].tzero;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c

    r40291 r42389  
    249249
    250250    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    251     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    252     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     251    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    253252
    254253    out[i].tzero            = in[i].tzero;
     
    317316
    318317    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    319     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    320     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     318    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    321319
    322320    out[i].tzero            = in[i].tzero;
     
    375373
    376374  for (i = 0; i < Nvalues; i++) {
    377     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    378     out[i].name[31] = 0; // force termination
     375    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    379376
    380377    out[i].code  = in[i].code;         
     
    411408
    412409  for (i = 0; i < Nvalues; i++) {
    413     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    414     out[i].name[31] = 0; // force termination
     410    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    415411
    416412    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c

    r40291 r42389  
    260260
    261261    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    262     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    263     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     262    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    264263
    265264    out[i].tzero            = in[i].tzero;
     
    328327
    329328    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    330     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    331     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     329    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    332330
    333331    out[i].tzero            = in[i].tzero;
     
    391389
    392390  for (i = 0; i < Nvalues; i++) {
    393     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    394     out[i].name[31] = 0; // force termination
     391    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    395392
    396393    out[i].code  = in[i].code;         
     
    427424
    428425  for (i = 0; i < Nvalues; i++) {
    429     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    430     out[i].name[31] = 0; // force termination
     426    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    431427
    432428    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c

    r40291 r42389  
    270270
    271271    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    272     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    273     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     272    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    274273
    275274    out[i].tzero            = in[i].tzero;
     
    338337
    339338    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    340     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    341     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     339    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    342340
    343341    out[i].tzero            = in[i].tzero;
     
    401399
    402400  for (i = 0; i < Nvalues; i++) {
    403     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    404     out[i].name[31] = 0; // force termination
     401    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    405402
    406403    out[i].code  = in[i].code;         
     
    437434
    438435  for (i = 0; i < Nvalues; i++) {
    439     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    440     out[i].name[31] = 0; // force termination
     436    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    441437
    442438    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c

    r40291 r42389  
    308308
    309309    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    310     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    311     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     310    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    312311
    313312    out[i].tzero            = in[i].tzero;
     
    376375
    377376    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    378     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    379     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     377    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    380378
    381379    out[i].tzero            = in[i].tzero;
     
    439437
    440438  for (i = 0; i < Nvalues; i++) {
    441     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    442     out[i].name[31] = 0; // force termination
     439    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    443440
    444441    out[i].code  = in[i].code;         
     
    475472
    476473  for (i = 0; i < Nvalues; i++) {
    477     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    478     out[i].name[31] = 0; // force termination
     474    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    479475
    480476    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r40291 r42389  
    11341134
    11351135    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    1136     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    1137     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     1136    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    11381137
    11391138    out[i].tzero            = in[i].tzero;
     
    12031202
    12041203    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    1205     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    1206     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     1204    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    12071205
    12081206    out[i].tzero            = in[i].tzero;
     
    12671265
    12681266  for (i = 0; i < Nvalues; i++) {
    1269     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    1270     out[i].name[31] = 0; // force termination
     1267    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    12711268
    12721269    out[i].code  = in[i].code;         
     
    13031300
    13041301  for (i = 0; i < Nvalues; i++) {
    1305     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    1306     out[i].name[31] = 0; // force termination
     1302    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    13071303
    13081304    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c

    r40291 r42389  
    645645
    646646    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    647     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    648     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     647    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    649648
    650649    out[i].tzero            = in[i].tzero;
     
    714713
    715714    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    716     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    717     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     715    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    718716
    719717    out[i].tzero            = in[i].tzero;
     
    778776
    779777  for (i = 0; i < Nvalues; i++) {
    780     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    781     out[i].name[31] = 0; // force termination
     778    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    782779
    783780    out[i].code  = in[i].code;         
     
    814811
    815812  for (i = 0; i < Nvalues; i++) {
    816     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    817     out[i].name[31] = 0; // force termination
     813    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    818814
    819815    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V6.c

    r40291 r42389  
    860860
    861861    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    862     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    863     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     862    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    864863
    865864    out[i].tzero            = in[i].tzero;
     
    927926
    928927    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    929     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    930     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     928    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    931929
    932930    out[i].tzero            = in[i].tzero;
     
    990988
    991989  for (i = 0; i < Nvalues; i++) {
    992     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    993     out[i].name[31] = 0; // force termination
     990    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    994991
    995992    out[i].code  = in[i].code;         
     
    10261023
    10271024  for (i = 0; i < Nvalues; i++) {
    1028     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    1029     out[i].name[31] = 0; // force termination
     1025    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    10301026
    10311027    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r40291 r42389  
    217217
    218218    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    219     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    220     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     219    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    221220
    222221    out[i].tzero            = in[i].tzero;
     
    291290
    292291    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    293     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    294     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     292    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    295293
    296294    out[i].tzero            = in[i].tzero;
     
    346344
    347345  for (i = 0; i < Nvalues; i++) {
    348     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    349     out[i].name[31] = 0; // force termination
     346    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    350347
    351348    out[i].code  = in[i].code;         
     
    386383
    387384  for (i = 0; i < Nvalues; i++) {
    388     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    389     out[i].name[31] = 0; // force termination
     385    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    390386
    391387    out[i].code  = in[i].code;         
  • trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r40291 r42389  
    195195
    196196    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    197     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    198     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     197    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    199198
    200199    out[i].tzero            = in[i].tzero;
     
    270269
    271270    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    272     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    273     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     271    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    274272
    275273    out[i].tzero            = in[i].tzero;
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r40291 r42389  
    238238
    239239    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    240     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    241     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     240    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    242241
    243242    out[i].tzero            = in[i].tzero;
     
    312311
    313312    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    314     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    315     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     313    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    316314
    317315    out[i].tzero            = in[i].tzero;
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r40291 r42389  
    238238
    239239    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    240     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    241     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     240    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    242241
    243242    out[i].tzero            = in[i].tzero;
     
    312311
    313312    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    314     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    315     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     313    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    316314
    317315    out[i].tzero            = in[i].tzero;
  • trunk/Ohana/src/libdvo/src/skydb.c

    r38553 r42389  
    275275      new[Nnew].depth = 2;
    276276      new[Nnew].child = FALSE;
    277       strncpy (root, db[i].name, 5); root[5] = 0;
     277      strncpy_nowarn (root, db[i].name, 5);
    278278      myAssert (snprintf (new[Nnew].name, 18, "%s/r%04d.cpt", root, Rnumber) < 18, "overflow");
    279279      Rnumber ++;     
     
    364364        db[N].depth = 3;
    365365        db[N].child = FALSE;
    366         strncpy (root, db[i].name, 10); root[10] = 0;
     366        strncpy_nowarn (root, db[i].name, 10);
    367367        myAssert (snprintf (db[N].name, 18, "%s.%02d.cpt", root, Rnumber) < 18, "overflow");
    368368        Rnumber ++;
  • trunk/Ohana/src/libdvo/src/skyregion_gsc.c

    r41738 r42389  
    247247  int i;
    248248  double Rmin, Rmax, Dmin, Dmax;
    249   char temp[80], name[80];
     249  char temp[50], name[80];
    250250  SkyTable *band;
    251251  SkyRegion *regions;
     
    254254  ALLOCATE (regions, SkyRegion, Nregions);
    255255  for (i = 0; i < Nregions; i++) {
    256     strncpy (temp, &buffer[i*48], 48);
    257     temp[48] = 0;
     256    strncpy_nowarn (temp, &buffer[i*48], 48);
    258257    hstgsc_hms_to_deg (&Rmin, &Rmax, &Dmin, &Dmax, &temp[7]);
    259258    if (Dmax < Dmin) SWAP (Dmin, Dmax);
  • trunk/Ohana/src/libfits/header/F_convert_H.c

    r15487 r42389  
    1111  Ns = strlen (line);
    1212  No = 80 - Ns;
    13   strncpy (header->buffer, line, Ns);
     13  strncpy_nowarn (header->buffer, line, Ns);
    1414  memset (&header->buffer[Ns], ' ', No);
    1515
     
    2727  Ns = strlen (line);
    2828  No = 80 - Ns;
    29   strncpy (header->buffer, line, Ns);
     29  strncpy_nowarn (header->buffer, line, Ns);
    3030  memset (&header->buffer[Ns], ' ', No);
    3131
     
    4646  Ns = strlen (line);
    4747  No = 80 - Ns;
    48   strncpy (header->buffer, line, Ns);
     48  strncpy_nowarn (header->buffer, line, Ns);
    4949  memset (&header->buffer[Ns], ' ', No);
    5050
  • trunk/Ohana/src/libfits/header/F_create_H.c

    r34577 r42389  
    1212
    1313  ALLOCATE (header[0].buffer, char, NBYTES);
     14  bzero (header[0].buffer, NBYTES);
    1415
    15   for (i = 0; i < NBYTES; i++)
    16     header[0].buffer[i] = ' ';
    17   strncpy (header[0].buffer, "END", 3);
     16  for (i = 0; i < NBYTES; i++) header[0].buffer[i] = ' ';
     17  header[0].buffer[0] = 'E';
     18  header[0].buffer[1] = 'N';
     19  header[0].buffer[2] = 'D';
    1820
    1921  gfits_modify_alt (header, "SIMPLE", "%t", 1, header[0].simple);
     
    2224                                       
    2325  for (i = 0; i < header[0].Naxes; i++) {
    24     snprintf (axis, 10, "NAXIS%d", i + 1);
     26    snprintf_nowarn (axis, 10, "NAXIS%d", i + 1);
    2527    gfits_modify (header,  axis, OFF_T_FMT, 1,  header[0].Naxis[i]);
    2628  }
  • trunk/Ohana/src/libfits/header/F_modify.c

    r38441 r42389  
    88  /* this function is extremely similar to gfits_print, except it allows for changing an existing field. */
    99
    10   char comment[82], string[82], data[82];
     10  // the output string needs to be long enough to keep the compiler from
     11  // complaining, even though the string cannot be more than 80 chars
     12  char comment[82], string[200], data[82];
    1113  char *p, *qe;
    1214  va_list argp;
     
    1416  va_start (argp, N);
    1517  bzero (data, 82);
    16   bzero (string, 82);
     18  bzero (string, 200);
    1719  bzero (comment, 82);
    1820
     
    4648    qe += 3;
    4749    qe = MIN (p + 80, qe);
    48     strncpy (comment, qe, p + 80 - qe);
     50    strncpy_nowarn (comment, qe, p + 80 - qe);
    4951  }
    5052  gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
    5153
    5254  /* write the numeric modes */
    53   if (!strcmp (mode, "%d"))   { snprintf (string, 81, "%-8s= %20d / %-s ",    field, va_arg (argp, int),                comment); goto found_it; }
    54   if (!strcmp (mode, "%ld"))  { snprintf (string, 81, "%-8s= %20ld / %-s ",   field, va_arg (argp, long),               comment); goto found_it; }
    55   if (!strcmp (mode, "%lld")) { snprintf (string, 81, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long),          comment); goto found_it; }
    56   if (!strcmp (mode, "%Ld"))  { snprintf (string, 81, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long),          comment); goto found_it; }
    57   if (!strcmp (mode, "%u"))   { snprintf (string, 81, "%-8s= %20u / %-s ",    field, va_arg (argp, unsigned),           comment); goto found_it; }
    58   if (!strcmp (mode, "%lu"))  { snprintf (string, 81, "%-8s= %20lu / %-s ",   field, va_arg (argp, unsigned long),      comment); goto found_it; }
    59   if (!strcmp (mode, "%llu")) { snprintf (string, 81, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
    60   if (!strcmp (mode, "%Lu"))  { snprintf (string, 81, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
    61   if (!strcmp (mode, "%hd"))  { snprintf (string, 81, "%-8s= %20d / %-s ",    field, va_arg (argp, int),                comment); goto found_it; }
    62   if (!strcmp (mode, "%f"))   { snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
    63   if (!strcmp (mode, "%lf"))  { snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
    64   if (!strcmp (mode, "%e"))   { snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
    65   if (!strcmp (mode, "%le"))  { snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
    66   if (!strcmp (mode, "%g"))   { snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
    67   if (!strcmp (mode, "%lg"))  { snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
    68   if (!strcmp (mode, "%jd"))  { snprintf (string, 81, "%-8s= %20jd / %-s ",   field, va_arg (argp, intmax_t),           comment); goto found_it; }
     55  if (!strcmp (mode, "%d"))   { snprintf (string, 200, "%-8s= %20d / %-s ",    field, va_arg (argp, int),                comment); goto found_it; }
     56  if (!strcmp (mode, "%ld"))  { snprintf (string, 200, "%-8s= %20ld / %-s ",   field, va_arg (argp, long),               comment); goto found_it; }
     57  if (!strcmp (mode, "%lld")) { snprintf (string, 200, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long),          comment); goto found_it; }
     58  if (!strcmp (mode, "%Ld"))  { snprintf (string, 200, "%-8s= %20lld / %-s ",  field, va_arg (argp, long long),          comment); goto found_it; }
     59  if (!strcmp (mode, "%u"))   { snprintf (string, 200, "%-8s= %20u / %-s ",    field, va_arg (argp, unsigned),           comment); goto found_it; }
     60  if (!strcmp (mode, "%lu"))  { snprintf (string, 200, "%-8s= %20lu / %-s ",   field, va_arg (argp, unsigned long),      comment); goto found_it; }
     61  if (!strcmp (mode, "%llu")) { snprintf (string, 200, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
     62  if (!strcmp (mode, "%Lu"))  { snprintf (string, 200, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
     63  if (!strcmp (mode, "%hd"))  { snprintf (string, 200, "%-8s= %20d / %-s ",    field, va_arg (argp, int),                comment); goto found_it; }
     64  if (!strcmp (mode, "%f"))   { snprintf (string, 200, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
     65  if (!strcmp (mode, "%lf"))  { snprintf (string, 200, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
     66  if (!strcmp (mode, "%e"))   { snprintf (string, 200, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
     67  if (!strcmp (mode, "%le"))  { snprintf (string, 200, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
     68  if (!strcmp (mode, "%g"))   { snprintf (string, 200, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
     69  if (!strcmp (mode, "%lg"))  { snprintf (string, 200, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),             comment); goto found_it; }
     70  if (!strcmp (mode, "%jd"))  { snprintf (string, 200, "%-8s= %20jd / %-s ",   field, va_arg (argp, intmax_t),           comment); goto found_it; }
    6971
    7072  /* string value.  Quotes must be at least 8 chars apart */
     
    7274    char *ptr = va_arg (argp, char *);
    7375    if (!ptr) goto invalid;
    74     strncpy (data, ptr, 68);
    75     snprintf (string, 81, "%-8s= '%-8s' / %-s ", field, data, comment);
     76    strncpy_nowarn (data, ptr, 68);
     77    snprintf (string, 200, "%-8s= '%-8s' / %-s ", field, data, comment);
    7678    goto found_it;
    7779  }
     
    8385
    8486found_it:
    85   strncpy (p, string, 80);
     87  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8688  va_end (argp);
    8789  return (TRUE);
     
    9496  /* this function is extremely similar to gfits_print, except it allows for changing an existing field. */
    9597
    96   char comment[82], string[82], data[82];
     98  char comment[82], string[200], data[82];
    9799  char *p, *qs, *qe;
    98100  va_list argp;
     
    100102  va_start (argp, N);
    101103  bzero (data, 82);
    102   bzero (string, 82);
    103104  bzero (comment, 82);
     105  bzero (string, 200);
    104106
    105107  if (mode[0] != '%') {
     
    132134    qe += 3;
    133135    qe = MIN (p + 80, qe);
    134     strncpy (comment, qe, p + 80 - qe);
     136    strncpy_nowarn (comment, qe, p + 80 - qe);
    135137  }
    136138  gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
     
    139141  if (!strcmp (mode, "%t")) {
    140142    if (va_arg (argp, int))
    141       snprintf (string, 81, "%-8s= %18s T / %-s ", field, " ", comment);
     143      snprintf (string, 200, "%-8s= %18s T / %-s ", field, " ", comment);
    142144    else
    143       snprintf (string, 81, "%-8s= %18s F / %-s ", field, " ", comment);
     145      snprintf (string, 200, "%-8s= %18s F / %-s ", field, " ", comment);
    144146  }
    145147
     
    148150    char *ptr = va_arg (argp, char *);
    149151    if (!ptr) goto invalid;
    150     strncpy (data, ptr, 71);
    151     snprintf (string, 81, "%-8s %-71s", field, data);
     152    strncpy_nowarn (data, ptr, 71);
     153    snprintf (string, 200, "%-8s %-71s", field, data);
    152154  } 
    153155
     
    161163    if (qs[-1] == 0x27) qs --;
    162164
    163     strncpy (data, qs, MAX (MIN (qe - qs, 71), 0));
     165    strncpy_nowarn (data, qs, MAX (MIN (qe - qs, 71), 0));
    164166
    165167    char *ptr = va_arg (argp, char *);
    166168    if (!ptr) goto invalid;
    167     strncpy (comment, ptr, 80);
     169    strncpy_nowarn (comment, ptr, 80);
    168170    gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
    169     snprintf (string, 81, "%-8s= %s / %-s", field, data, comment);
     171    snprintf (string, 200, "%-8s= %s / %-s", field, data, comment);
    170172    /* this will keep the original line, but truncate the comment */
    171173  }
    172174
    173   strncpy (p, string, 80);
     175  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    174176  va_end (argp);
    175177  return (TRUE);
  • trunk/Ohana/src/libfits/header/F_print.c

    r34577 r42389  
    88
    99  static char blank[] = " ";
    10   char string[82], line[80];
     10  char string[200], line[80];
    1111  char *p;
    1212  va_list argp; 
     
    4646
    4747  /* write the numeric modes */
    48   if (!strcmp (mode, "%d"))  { snprintf (string, 81, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); goto found_it; }
    49   if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %46s ",   field, va_arg (argp, long),               blank); goto found_it; }
    50   if (!strcmp (mode, "%lld")){ snprintf (string, 81, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); goto found_it; }
    51   if (!strcmp (mode, "%Ld")) { snprintf (string, 81, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); goto found_it; }
    52   if (!strcmp (mode, "%u"))  { snprintf (string, 81, "%-8s= %20u / %46s ",    field, va_arg (argp, unsigned),           blank); goto found_it; }
    53   if (!strcmp (mode, "%lu")) { snprintf (string, 81, "%-8s= %20lu / %46s ",   field, va_arg (argp, unsigned long),      blank); goto found_it; }
    54   if (!strcmp (mode, "%llu")){ snprintf (string, 81, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); goto found_it; }
    55   if (!strcmp (mode, "%Lu")) { snprintf (string, 81, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); goto found_it; }
    56   if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); goto found_it; }
    57   if (!strcmp (mode, "%f"))  { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
    58   if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
    59   if (!strcmp (mode, "%e"))  { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
    60   if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
    61   if (!strcmp (mode, "%g"))  { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
    62   if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
    63   if (!strcmp (mode, "%jd")) { snprintf (string, 81, "%-8s= %20jd / %46s ",   field, va_arg (argp, intmax_t),           blank); goto found_it; }
     48  if (!strcmp (mode, "%d"))  { snprintf (string, 200, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); goto found_it; }
     49  if (!strcmp (mode, "%ld")) { snprintf (string, 200, "%-8s= %20ld / %46s ",   field, va_arg (argp, long),               blank); goto found_it; }
     50  if (!strcmp (mode, "%lld")){ snprintf (string, 200, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); goto found_it; }
     51  if (!strcmp (mode, "%Ld")) { snprintf (string, 200, "%-8s= %20lld / %46s ",  field, va_arg (argp, long long),          blank); goto found_it; }
     52  if (!strcmp (mode, "%u"))  { snprintf (string, 200, "%-8s= %20u / %46s ",    field, va_arg (argp, unsigned),           blank); goto found_it; }
     53  if (!strcmp (mode, "%lu")) { snprintf (string, 200, "%-8s= %20lu / %46s ",   field, va_arg (argp, unsigned long),      blank); goto found_it; }
     54  if (!strcmp (mode, "%llu")){ snprintf (string, 200, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); goto found_it; }
     55  if (!strcmp (mode, "%Lu")) { snprintf (string, 200, "%-8s= %20llu / %46s ",  field, va_arg (argp, unsigned long long), blank); goto found_it; }
     56  if (!strcmp (mode, "%hd")) { snprintf (string, 200, "%-8s= %20d / %46s ",    field, va_arg (argp, int),                blank); goto found_it; }
     57  if (!strcmp (mode, "%f"))  { snprintf (string, 200, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
     58  if (!strcmp (mode, "%lf")) { snprintf (string, 200, "%-8s= %20.10f / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
     59  if (!strcmp (mode, "%e"))  { snprintf (string, 200, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
     60  if (!strcmp (mode, "%le")) { snprintf (string, 200, "%-8s= %20.10E / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
     61  if (!strcmp (mode, "%g"))  { snprintf (string, 200, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
     62  if (!strcmp (mode, "%lg")) { snprintf (string, 200, "%-8s= %20.10G / %46s ", field, va_arg (argp, double),             blank); goto found_it; }
     63  if (!strcmp (mode, "%jd")) { snprintf (string, 200, "%-8s= %20jd / %46s ",   field, va_arg (argp, intmax_t),           blank); goto found_it; }
    6464
    6565  /* string value.  Quotes must be at least 8 chars apart.  Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */
     
    6969    strcpy (line, ptr);
    7070    line[68] = 0;
    71     snprintf (string, 81, "%-8s= '%-8s' / %46s ", field, line, blank);
     71    snprintf (string, 200, "%-8s= '%-8s' / %46s ", field, line, blank);
    7272    goto found_it;
    7373  }
     
    7878
    7979found_it:
    80   strncpy (p, string, 80);
     80  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8181  va_end (argp);
    8282  return (TRUE);
     
    8989
    9090  static char blank[] = " ";
    91   char string[82], line[80];
     91  char string[200], line[80];
    9292  char *p, a;
    9393  va_list argp; 
     
    126126    a = va_arg (argp, int);
    127127    if (a == 1)
    128       snprintf (string, 81, "%-8s= %18s T / %46s ", field, blank, blank);
     128      snprintf (string, 200, "%-8s= %18s T / %46s ", field, blank, blank);
    129129    else
    130       snprintf (string, 81, "%-8s= %18s F / %46s ", field, blank, blank);
     130      snprintf (string, 200, "%-8s= %18s F / %46s ", field, blank, blank);
    131131  }
    132132
     
    137137    if (!ptr) goto invalid;
    138138    bzero (line, 80);
    139     strncpy (line, ptr, 71);
    140     snprintf (string, 81, "%-8s %-71s", field, line);
     139    strncpy_nowarn (line, ptr, 71);
     140    snprintf (string, 200, "%-8s %-71s", field, line);
    141141  } 
    142142
     
    154154  if (!strcmp (mode, "%C")) goto invalid;
    155155
    156   strncpy (p, string, 80);
     156  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    157157 
    158158  va_end (argp);
  • trunk/Ohana/src/libfits/header/F_scan.c

    r39324 r42389  
    111111  /* non-data entry (COMMENT, HISTORY) */
    112112  if (!strcmp (mode, "%S")) {
    113     strncpy (va_arg (argp, char *), p + 8, FT_HISTORY_LENGTH);
     113    strncpy_nowarn (va_arg (argp, char *), p + 8, FT_HISTORY_LENGTH);
    114114    return (TRUE);
    115115  }
  • trunk/Ohana/src/libfits/matrix/F_compress_M.c

    r41739 r42389  
    8686  char keyword[11];
    8787  for (i = 0; i < header[0].Naxes; i++) {
    88     snprintf (keyword, 10, "ZNAXIS%d", i + 1);
     88    snprintf_nowarn (keyword, 10, "ZNAXIS%d", i + 1);
    8989    if (!gfits_modify (theader, keyword, OFF_T_FMT, 1,  header[0].Naxis[i])) ESCAPE;
    9090  }
    9191
    9292  for (i = 0; i < header->Naxes; i++) {
    93     snprintf (keyword, 10, "ZTILE%d", i + 1);
     93    snprintf_nowarn (keyword, 10, "ZTILE%d", i + 1);
    9494    if (!gfits_modify (theader, keyword, "%lu", 1, ztile[i])) ESCAPE;
    9595  }
     
    131131  // note the difference between the keywords (1 indexed) and the variables (0 indexed)
    132132  for (i = 0; i < Noptions; i++) {
    133     snprintf (key, 10, "ZNAME%d", i + 1);
     133    snprintf_nowarn (key, 10, "ZNAME%d", i + 1);
    134134    if (!gfits_modify (header, key, "%s", 1, optname[i])) break;
    135135
    136     snprintf (key, 10, "ZVAL%d", i + 1);
     136    snprintf_nowarn (key, 10, "ZVAL%d", i + 1);
    137137    if (!gfits_modify (header, key, "%s", 1, optvalue[i])) break;
    138138  }
  • trunk/Ohana/src/libfits/matrix/F_uncompress_M.c

    r41474 r42389  
    9090  int axis;
    9191  for (axis = 0; axis < header->Naxes; axis++) {
    92     snprintf (zaxis, 10, "ZNAXIS%d", axis + 1);
    93     snprintf (naxis, 10, "NAXIS%d", axis + 1);
     92    snprintf_nowarn (zaxis, 10, "ZNAXIS%d", axis + 1);
     93    snprintf_nowarn (naxis, 10, "NAXIS%d", axis + 1);
    9494    MOD_KEYWORD_REQUIRED (zaxis,  naxis,  OFF_T_FMT,  &header->Naxis[axis],  header->Naxis[axis]);
    9595  }   
     
    108108    // if ZTILE1 exists, all ZTILEn must exist:
    109109    for (axis = 1; axis < header->Naxes; axis++) {
    110       snprintf (key, 10, "ZTILE%d", axis + 1);
     110      snprintf_nowarn (key, 10, "ZTILE%d", axis + 1);
    111111      if (!gfits_scan (header, key, "%lu", 1, &ztile[axis])) ESCAPE;
    112112      gfits_delete (header, key, 1);
  • trunk/Ohana/src/libfits/table/F_create_TH.c

    r38989 r42389  
    1717  myAssert (!header->buffer, "failed to init header or free buffer?");
    1818  ALLOCATE (header[0].buffer, char, NBYTES);
     19  bzero (header[0].buffer, NBYTES);
    1920 
    20   for (i = 0; i < NBYTES; i++)
    21   header[0].buffer[i] = ' ';
    22   strncpy (header[0].buffer, "END", 3);
     21  for (i = 0; i < NBYTES; i++) header[0].buffer[i] = ' ';
     22  header[0].buffer[0] = 'E';
     23  header[0].buffer[1] = 'N';
     24  header[0].buffer[2] = 'D';
    2325 
    2426  gfits_modify (header, "XTENSION", "%s", 1, type);
  • trunk/Ohana/src/libfits/table/F_get_T_column.c

    r38553 r42389  
    3232    ALLOCATE (Ivalues, int, table[0].Naxis[1]);
    3333    for (i = 0; i < table[0].Naxis[1]; i++) {
    34       strncpy (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar);
    35       tmp[Nchar] = 0;
     34      strncpy_nowarn (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar);
    3635      Ivalues[i] = atof (tmp);
    3736    }
     
    4140    ALLOCATE (Dvalues, double, table[0].Naxis[1]);
    4241    for (i = 0; i < table[0].Naxis[1]; i++) {
    43       strncpy (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar);
    44       tmp[Nchar] = 0;
     42      strncpy_nowarn (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar);
    4543      Dvalues[i] = atof (tmp);
    4644    }
     
    5351    for (i = 0; i < table[0].Naxis[1]; i++) {
    5452      ALLOCATE (Cvalues[i], char, N + 1);
    55       strncpy (Cvalues[i], &table[0].buffer[i*table[0].Naxis[0] + start], N);
    56       Cvalues[i][N] = 0;
     53      strncpy_nowarn (Cvalues[i], &table[0].buffer[i*table[0].Naxis[0] + start], N);
    5754    }
    5855    values[0] = (char *) Cvalues;
  • trunk/Ohana/src/libfits/table/F_get_T_value.c

    r38553 r42389  
    2626 
    2727  byte = Y*table[0].Naxis[0] + start;
    28   strncpy (tmp, &table[0].buffer[byte], Nchar);
    29   tmp[Nchar] = 0;
     28  strncpy_nowarn (tmp, &table[0].buffer[byte], Nchar);
    3029
    3130  if (!strcmp (mode, "%d"))  *(int      *) value = (int)      atof (tmp);
  • trunk/Ohana/src/libfits/table/F_table_column.c

    r38553 r42389  
    7272
    7373  for (i = 0; i < table[0].Naxis[1]; i++) {
    74     strncpy (temp, &table[0].buffer[i*table[0].Naxis[0] + start - 1], width);
    75     temp[width] = 0;
     74    strncpy_nowarn (temp, &table[0].buffer[i*table[0].Naxis[0] + start - 1], width);
    7675    switch (M) {
    7776    case 0:
  • trunk/Ohana/src/libkapa/src/RotFont.c

    r41341 r42389  
    3030  currentfont = RotFonts[DEFFONT].font;
    3131  currentscale = 1.0;
    32   strncpy (currentname, RotFonts[DEFFONT].name, 63); currentname[63] = 0;
     32  strncpy_nowarn (currentname, RotFonts[DEFFONT].name, 63);
    3333  currentsize = RotFonts[DEFFONT].size;
    3434}
     
    7979    currentsize = size;
    8080    if (name != currentname) {
    81       strncpy (currentname, name, 63); currentname[63] = 0;
     81      strncpy_nowarn (currentname, name, 63);
    8282    }
    8383    return (TRUE);
  • trunk/Ohana/src/libohana/include/ohana.h

    r41468 r42389  
    296296char   *strcreate              PROTO((char *string));
    297297char   *strncreate             PROTO((char *string, int n));
     298char   *strncpy_nowarn         PROTO((char *dest, char *src, size_t n));
    298299int     strextend              PROTO((char **input, char *format,...)) OHANA_FORMAT(printf, 2, 3);
    299300int     scan_line              PROTO((FILE *f, char *line));
  • trunk/Ohana/src/libohana/src/findexec.c

    r39457 r42389  
    256256}
    257257
     258# define OHANA_MAX_PATH 1024
     259# define OHANA_MAX_NAME 1280
    258260char *findexec (int argc, char **argv) {
    259261
    260262  int i, N, done, status;
    261   char *c, *e, *dir, path[1024], name[1024];
     263  char *c, *e, *dir, path[OHANA_MAX_PATH], name[OHANA_MAX_NAME];
    262264
    263265  /* if given an absolute or relative path, use it */
     
    286288    i = 0;
    287289    while (!done) {
    288       bzero (path, 1024);
     290      bzero (path, OHANA_MAX_PATH);
    289291      if (e == (char *) NULL) {
    290292        done = TRUE;
    291         strncpy (path, c, strlen(c));
     293        strncpy_nowarn (path, c, strlen(c));
    292294      } else {
    293         strncpy (path, c, e-c);
     295        strncpy_nowarn (path, c, e-c);
    294296        c = e+1;
    295297        e = strchr (c, ':');
    296298      }
    297       snprintf (name, 1024, "%s/%s", path, argv[0]);
     299      snprintf (name, OHANA_MAX_NAME, "%s/%s", path, argv[0]);
    298300      status = check_file_exec (name);
    299301
  • trunk/Ohana/src/libohana/src/string.c

    r40549 r42389  
    4242 
    4343  return (value);
     44}
     45
     46// gcc (Ubuntu 20.04) complains when strncpy is used to copy a fraction of a buffer,
     47// potentially skipping the ending NULL.  To avoid the error, manually copy
     48// and (to ensure the buffer ends in a NULL) set the last + 1 byte to NUL:
     49// WARNING : len(dest) must be >= n + 1
     50char *strncpy_nowarn (char *dest, char *src, size_t n) {
     51
     52  size_t i;
     53 
     54  char *d = dest;
     55  char *s = src;
     56  for (i = 0; i < n && *s != 0; i++, d++, s++) { *d = *s; }
     57  for ( ; i <= n; i++, d++) { *d = 0; }
     58 
     59  return dest;
    4460}
    4561
     
    125141  ALLOCATE (out, char, N1 + N2 + N3 + 1);
    126142
    127   strncpy (out, string, N1);
    128   strncpy (&out[N1], with, N2);
    129   strncpy (&out[N1+N2], ext, N3);
    130   out[N1+N2+N3] = 0;
     143  strncpy_nowarn (&out[0],     string, N1);
     144  strncpy_nowarn (&out[N1],    with,   N2);
     145  strncpy_nowarn (&out[N1+N2], ext,    N3);
    131146
    132147  return out;
  • trunk/Ohana/src/misc/src/cfhtlog.c

    r18 r42389  
    303303                           year, month,day,hour,min);
    304304                    for (j = 0; j < nprobes; j++) {
    305                         strncpy(bufstr, data + (14 + probes[j]*9), 9);
    306                         bufstr[9] =0;
     305                        strncpy_nowarn(bufstr, data + (14 + probes[j]*9), 9);
    307306                        printf("%s ", bufstr);
    308307                    }
  • trunk/Ohana/src/misc/src/fakecmp.c

    r27435 r42389  
    8181    line[80] = 0;
    8282    bzero (keyword, 10);
    83     strncpy (keyword, line, 8);
     83    strncpy_nowarn (keyword, line, 8);
    8484   
    8585    /* replace existing keywords, unless this is a COMMENT or HISTORY field */
     
    8787      p = gfits_header_field (&header, keyword, 1);
    8888      if (p != (char *) NULL) {
    89         strncpy (p, line, 80);
     89        strncpy_nowarn (p, line, 80);
    9090        continue;
    9191      }
     
    106106
    107107    /* insert the new line here */
    108     strncpy (p, line, 80);
     108    strncpy_nowarn (p, line, 80);
    109109  }
    110110
  • trunk/Ohana/src/misc/src/gtfringetable.c

    r7080 r42389  
    7272      N = strlen (p);
    7373
    74     strncpy (line, p, N);
     74    strncpy_nowarn (line, p, N);
    7575
    7676    fprintf (stderr, "%s\n", line);
  • trunk/Ohana/src/misc/src/mkfringetable.c

    r14590 r42389  
    200200      N = strlen (p);
    201201
    202     strncpy (line, p, N);
     202    strncpy_nowarn (line, p, N);
    203203
    204204    fprintf (stderr, "%s\n", line);
  • trunk/Ohana/src/mosastro/src/getstone.c

    r3323 r42389  
    2828            &regions[Nregion].RA[0], &regions[Nregion].RA[1],
    2929            &regions[Nregion].DEC[0], &regions[Nregion].DEC[1]);
    30     sprintf (line, "%s/%s", StoneRegions, filename);
     30    snprintf_nowarn (line, 1024, "%s/%s", StoneRegions, filename);
    3131    regname[Nregion] = strcreate (line);
    3232    Nregion ++;
  • trunk/Ohana/src/mosastro/src/getusno.c

    r27435 r42389  
    99  1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10};
    1010
     11# define MY_MAX_PATH 256
     12
    1113StarData *getusno (CatStats *catstats, int *Nstars) {
    1214
     
    1517  float hours[100];
    1618  int start[100], number[100], *buffer, *buf;
    17   char filename[128];
     19  char filename[MY_MAX_PATH];
    1820  FILE *f;
    1921  int iRA0, iRA1, iDEC0, iDEC1;
     
    5961   
    6062    /* load accelerator file */
    61     sprintf (filename, "%s/zone%04d.acc", USNO_A_DIR, spd);
     63    snprintf_nowarn (filename, MY_MAX_PATH, "%s/zone%04d.acc", USNO_A_DIR, spd);
    6264    if (VERBOSE) fprintf (stderr, "reading from %s\n", filename);
    6365    f = fopen (filename, "r");
     
    8284   
    8385    /* open data file */
    84     sprintf (filename, "%s/zone%04d.cat", USNO_A_DIR, spd);
     86    snprintf_nowarn (filename, MY_MAX_PATH, "%s/zone%04d.cat", USNO_A_DIR, spd);
    8587    if (VERBOSE) fprintf (stderr, "reading from %s\n", filename);
    8688    f = fopen (filename, "r");
  • trunk/Ohana/src/mosastro/src/getusnob.c

    r34088 r42389  
    22# define NBYTE   4
    33# define NELEM  20
     4
     5# define MY_MAX_PATH 256
    46
    57StarData *getusnob (CatStats *catstats, int *Nstars) {
     
    911  float hours[100];
    1012  int start[100], number[100], *buffer, *buf;
    11   char filename[128];
     13  char filename[MY_MAX_PATH];
    1214  FILE *f;
    1315  double DEC1;
     
    4244   
    4345    /* load accelerator file */
    44     sprintf (filename, "%s/%03d/b%04d.acc", USNO_B_DIR, (int)(spd/10), spd);
     46    snprintf_nowarn (filename, MY_MAX_PATH, "%s/%03d/b%04d.acc", USNO_B_DIR, (int)(spd/10), spd);
    4547    fprintf (stderr, "reading from %s\n", filename);
    4648    f = fopen (filename, "r");
     
    6567   
    6668    /* open data file */
    67     sprintf (filename, "%s/%03d/b%04d.cat", USNO_B_DIR, (int)(spd/10), spd);
     69    snprintf_nowarn (filename, MY_MAX_PATH, "%s/%03d/b%04d.cat", USNO_B_DIR, (int)(spd/10), spd);
    6870    fprintf (stderr, "reading from %s\n", filename);
    6971    f = fopen (filename, "r");
  • trunk/Ohana/src/mosastro/src/output.c

    r27435 r42389  
    1717
    1818    bzero (outname, 256);
    19     strncpy (outname, chip[i].file, N);
     19    strncpy_nowarn (outname, chip[i].file, N);
    2020
    2121    strcat (outname, ext);
  • trunk/Ohana/src/nightd/include/nightd.h

    r21153 r42389  
    33# include <errno.h>
    44
     5# define MY_MAX_PATH 256
     6
    57FILE *LogFile;
    68char *Program;
    79
    8 char logfile[256];
     10char logfile[MY_MAX_PATH];
    911char **MainCommand;
    1012char **InitCommand;
    1113char **DoneCommand;
    1214
    13 char TestCommand[256];
     15char TestCommand[MY_MAX_PATH];
    1416
    15 char DateStr[256];
    16 char TimeStr[256];
     17char DateStr[MY_MAX_PATH];
     18char TimeStr[MY_MAX_PATH];
    1719
    18 char PIDFile[256];
     20char PIDFile[MY_MAX_PATH];
    1921
    2022float NightStart;
  • trunk/Ohana/src/nightd/src/GetStatus.c

    r27611 r42389  
    2323int ResetConfig () {
    2424
    25   char user[256], machine[256], line[256];
     25  char user[MY_MAX_PATH], machine[MY_MAX_PATH], line[MY_MAX_PATH];
    2626  pid_t pid;
    2727
     
    3232  }
    3333
    34   sprintf (line, "rsh %s kill -USR1 %d", machine, pid);
     34  snprintf_nowarn (line, MY_MAX_PATH, "rsh %s kill -USR1 %d", machine, pid);
    3535  if (system (line) == -1) {
    3636    fprintf (stderr, "failed to send signal\n");
     
    4242int SendShutdown () {
    4343
    44   char user[256], machine[256], line[256];
     44  char user[MY_MAX_PATH], machine[MY_MAX_PATH], line[MY_MAX_PATH];
    4545  pid_t pid;
    4646
     
    5151  }
    5252
    53   sprintf (line, "rsh %s kill -TERM %d", machine, pid);
     53  snprintf_nowarn (line, MY_MAX_PATH, "rsh %s kill -TERM %d", machine, pid);
    5454  if (system (line) == -1) {
    5555    fprintf (stderr, "failed to send signal\n");
  • trunk/Ohana/src/nightd/src/misc.c

    r27611 r42389  
    208208    Nchar = e - p;
    209209    ALLOCATE (args[N], char, Nchar + 1);
    210     strncpy (args[N], p, Nchar);
    211     args[N][Nchar] = 0;
     210    strncpy_nowarn (args[N], p, Nchar);
    212211    p = e;
    213212    for (; isspace (*p); p++);
  • trunk/Ohana/src/opihi/Makefile.Common

    r13615 r42389  
    4242        @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
    4343        rm -f $@
    44         gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc
     44#       gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc
     45        gcc -shared -Wl,-soname,$*.so -o $@ $^ -lc -Wl,--allow-multiple-definition
    4546
    4647$(DESTLIB)/%.so: $(LIB)/%.$(ARCH).so
  • trunk/Ohana/src/opihi/cmd.basic/list.c

    r42081 r42389  
    111111      set_str_variable (line, argv[i+3]);
    112112    }
    113     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     113    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    114114    set_int_variable (line, i);
    115115
     
    133133    int isFound;
    134134
    135     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     135    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    136136    int nList = get_int_variable (line, &isFound);
    137137    if (!isFound) {
     
    145145
    146146    for (i = start; i < nList; i++) {
    147       snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
     147      snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
    148148      char *word = get_variable (line);
    149149      if (!word) break;
    150150      if (i > 0) {
    151         snprintf (output, MAX_LINE_LENGTH, "%s %s", tmpline, word);
     151        snprintf_nowarn (output, MAX_LINE_LENGTH, "%s %s", tmpline, word);
    152152      } else {
    153         snprintf (output, MAX_LINE_LENGTH, "%s", word);
     153        snprintf_nowarn (output, MAX_LINE_LENGTH, "%s", word);
    154154      }
    155155      strcpy (tmpline, output);
     
    179179   
    180180    // old list must exist, or give an error
    181     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[3]);
     181    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[3]);
    182182    N = get_int_variable (line, &found);
    183183    if (!found) {
     
    188188     
    189189
    190     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     190    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    191191    set_int_variable (line, N);
    192192    for (i = 0; i < N; i++) {
    193       snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[3], i);
     193      snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[3], i);
    194194      value = get_variable (line);
    195       // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
     195      // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
    196196      set_list_varname (line, argv[1], i, EXCEL_STYLE);
    197197      set_str_variable (line, value);
     
    207207    }
    208208   
    209     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     209    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    210210    N = get_int_variable (line, &found);
    211211    for (i = 0; i < argc - 3; i++) {
    212       // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], N + i);
     212      // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], N + i);
    213213      set_list_varname (line, argv[1], N + i, EXCEL_STYLE);
    214214      set_str_variable (line, argv[i+3]);
    215215    }
    216     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     216    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    217217    set_int_variable (line, N + i);
    218218
     
    231231    char line2[MAX_LINE_LENGTH];
    232232
    233     snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n
     233    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n
    234234    N = get_int_variable (line, &found);
    235235
    236236    // loop over all list elements:
    237237    for (i = 0; i < N; i++) {
    238       // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
     238      // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
    239239      set_list_varname (line, argv[1], i, EXCEL_STYLE); // line = LIST:i
    240240      value = get_variable (line);
     
    245245        free (value);
    246246        for (j = i + 1; j < N; j++) {
    247           // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], j);
     247          // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], j);
    248248          set_list_varname (line2, argv[1], j, EXCEL_STYLE); // line2 = LIST:j
    249249          next_value = get_variable (line2);
     
    252252        }
    253253        DeleteNamedScalar (line); // line = LIST:(N-1)
    254         snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n (new value of n)
     254        snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]); // line = LIST:n (new value of n)
    255255        set_int_variable (line, N - 1);
    256256        return (TRUE);
     
    309309      depth --;
    310310      if (depth < 0) { /* we hit the last "END", loop is done */
    311         snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     311        snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    312312        set_int_variable (line, i);
    313313        free (input);
     
    317317
    318318    if (*input) {
    319       // snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
     319      // snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
    320320      set_list_varname (line, argv[1], i, EXCEL_STYLE);
    321321      set_str_variable (line, input);
     
    381381  free (val);
    382382   
    383   snprintf (line, MAX_LINE_LENGTH, "%s:n", listname);
     383  snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", listname);
    384384  set_int_variable (line, i);
    385385  return (TRUE);
     
    399399  // otherwise save all glob matches
    400400  if (globList.gl_pathc == 0) {
    401     snprintf (line, MAX_LINE_LENGTH, "%s:n", listname);
     401    snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", listname);
    402402    set_int_variable (line, 0);
    403403    return TRUE;
     
    409409    set_str_variable (line, globList.gl_pathv[i]);
    410410  }
    411   snprintf (line, MAX_LINE_LENGTH, "%s:n", listname);
     411  snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", listname);
    412412  set_int_variable (line, Nfile);
    413413  return (TRUE);
     
    430430    Nline ++;
    431431  }
    432   snprintf (varname, MAX_LINE_LENGTH, "%s:n", listname);
     432  snprintf_nowarn (varname, MAX_LINE_LENGTH, "%s:n", listname);
    433433  set_int_variable (varname, Nline);
    434434  return TRUE;
     
    463463    FREE (new);
    464464  }
    465   snprintf (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
     465  snprintf_nowarn (line, MAX_LINE_LENGTH, "%s:n", argv[1]);
    466466  set_int_variable (line, nWords);
    467467
  • trunk/Ohana/src/opihi/cmd.basic/memory.c

    r41341 r42389  
    2727  if (!strcasecmp (argv[1], "checkfree")) {
    2828    ohana_memcheck (1);
     29    return (TRUE);
     30  }
     31  if (!strcasecmp (argv[1], "stats")) {
     32    OhanaMemstats memstats = ohana_memstats (0);
     33    set_variable ("memory:Ntotal", memstats.Ntotal);
     34    set_variable ("memory:Nbytes", memstats.Nbytes);
     35    set_variable ("memory:Ngood",  memstats.Ngood);
     36    set_variable ("memory:Nbad",   memstats.Nbad);
    2937    return (TRUE);
    3038  }
  • trunk/Ohana/src/opihi/cmd.basic/run_while.c

    r31667 r42389  
    7272  // test the logic once before running the loop
    7373  logic_line = strcreate (argv[1]);
    74   logic_line = expand_vars (logic_line);
     74  logic_line = expand_vars (logic_line); // recalculates scalar elements
     75  logic_line = expand_vectors (logic_line); // recalculates vector/matrix elements (e.g., vec[])
    7576  val = dvomath (1, &logic_line, &size, 0);
    7677  free (logic_line);
     
    9091
    9192    logic_line = strcreate (argv[1]);
    92     logic_line = expand_vars (logic_line);
     93    logic_line = expand_vars (logic_line); // recalculates scalar elements
     94    logic_line = expand_vectors (logic_line); // recalculates vector/matrix elements (e.g., vec[])
    9395    val = dvomath (1, &logic_line, &size, 0);
    9496    free (logic_line);
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r42128 r42389  
    140140$(SRC)/radial.$(ARCH).o \
    141141$(SRC)/rd.$(ARCH).o             \
     142$(SRC)/rdjpg.$(ARCH).o          \
    142143$(SRC)/rdseg.$(ARCH).o          \
    143144$(SRC)/read_vectors.$(ARCH).o   \
     
    154155$(SRC)/set.$(ARCH).o            \
    155156$(SRC)/shift.$(ARCH).o          \
     157$(SRC)/opihi_size.$(ARCH).o        \
    156158$(SRC)/sort.$(ARCH).o           \
    157159$(SRC)/spline.$(ARCH).o         \
  • trunk/Ohana/src/opihi/cmd.data/cursor.c

    r39457 r42389  
    4242    KiiCursorRead (kapa, &X, &Y, &Z, &R, &D, key);
    4343
    44     sprintf (string, "X%s", key);
    45     set_variable (string, X);
    46     sprintf (string, "Y%s", key);
    47     set_variable (string, Y);
    48     sprintf (string, "Z%s", key);
    49     set_variable (string, Z);
    50     sprintf (string, "R%s", key);
    51     set_variable (string, R);
    52     sprintf (string, "D%s", key);
    53     set_variable (string, D);
     44    snprintf_nowarn (string, 20, "X%s", key);    set_variable (string, X);
     45    snprintf_nowarn (string, 20, "Y%s", key);    set_variable (string, Y);
     46    snprintf_nowarn (string, 20, "Z%s", key);    set_variable (string, Z);
     47    snprintf_nowarn (string, 20, "R%s", key);    set_variable (string, R);
     48    snprintf_nowarn (string, 20, "D%s", key);    set_variable (string, D);
    5449
    5550    set_str_variable ("KEY", key);
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r42128 r42389  
    126126int queue2book       PROTO((int, char **));
    127127int rd               PROTO((int, char **));
     128int rdjpg            PROTO((int, char **));
    128129int rdseg            PROTO((int, char **));
    129130int read_vectors     PROTO((int, char **));
     
    160161int tvgrid           PROTO((int, char **));
    161162int opihi_type       PROTO((int, char **));
     163int opihi_size       PROTO((int, char **));
    162164int uniq             PROTO((int, char **));
    163165int uniqpair         PROTO((int, char **));
     
    336338  {1, "ipptool2book", queue2book,       "convert queue with ipptool output to book"},
    337339  {1, "rd",           rd,               "load fits image"},
     340  {1, "rdjpg",        rdjpg,            "load jpeg image"},
    338341  {1, "rdseg",        rdseg,            "read a segment of an image from a file"},
    339342  {1, "read",         read_vectors,     "read vectors from datafile"},
     
    350353  {1, "set",          set,              "image and vector math"},
    351354  {1, "shift",        shift,            "shift data in an image"},
     355  {1, "size",         opihi_size,       "get vector/matrix dimension/size information"},
    352356  {1, "sort",         sort_vectors,     "sort list of vectors"},
    353357  {1, "spline",       spline_command,   "shift data in an image"},
  • trunk/Ohana/src/opihi/cmd.data/limits.c

    r40291 r42389  
    6161    APPLY = TRUE;
    6262  }
     63
    6364  char *name = NULL;
    6465  if ((N = get_argument (argc, argv, "-n"))) {
     
    6768    remove_argument (N, &argc, argv);
    6869  }
    69 
    7070  if (!GetGraph (&graphmode, &kapa, name)) return (FALSE);
    7171  FREE (name);
     72
     73  // this is not super intuitive
     74  if ((N = get_argument (argc, argv, "-boxsize"))) {
     75    remove_argument (N, &argc, argv);
     76    float dx, dy;
     77    // ask kapa for the size of the graph region in pixels
     78    KapaGetLimits (kapa, &dx, &dy);
     79    set_variable ("KAPA_XPIX", fabs(dx));
     80    set_variable ("KAPA_YPIX", fabs(dy));
     81  }
    7282
    7383  // XXX need an option to set the limits based on the current image bounds
     
    169179  return (TRUE);
    170180}
     181
     182/* -minX value : the minimum X axis value will be no higher than this value
     183   -maxX value : the maximum X axis value will be no lower than this value
     184   -delX value : the range of the X axis will be at least this value
     185
     186   These can be used to prevent the range from collapsing. 
     187   These are only used if the -a option is supplied, otherwise the supplied or auto-calculated
     188   ranges are used (this seems like an poor choice)
     189
     190*/
     191
     192
     193   
  • trunk/Ohana/src/opihi/cmd.data/read_vectors.c

    r42082 r42389  
    385385      if (!lineStatus && VERBOSE) {
    386386        char temp[32];
    387         strncpy (temp, c0, 32);
    388         temp[31] = 0;
     387        strncpy_nowarn (temp, c0, 31);
    389388        gprint (GP_ERR, "skip line %s\n\n", temp);
    390389      }
  • trunk/Ohana/src/opihi/cmd.data/reindex.c

    r42082 r42389  
    7272    }
    7373  }
     74  if (ivec->type == OPIHI_STR) {
     75    opihi_int *vx = xvec[0].elements.Int;
     76    for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) {
     77      if (Npts >= NPTS) {
     78        NPTS += 2000;
     79        REALLOCATE (ovec[0].elements.Str, char *, NPTS);
     80      }
     81      if (*vx < 0) {
     82        if (KEEP_UNMATCH) {
     83          ovec[0].elements.Str[Npts] = strcreate(""); // XXX use a different or a specified value?
     84          Npts++;
     85        }
     86        continue;
     87      }
     88      if (*vx > Nmax) ESCAPE("unexpected value in index: "OPIHI_INT_FMT" (%d)\n", *vx, i);
     89      ovec[0].elements.Str[Npts] = strcreate(ivec->elements.Str[*vx]);
     90      Npts++;
     91    }
     92  }
    7493
    7594  // free up unused memory
  • trunk/Ohana/src/opihi/cmd.data/subset.c

    r42311 r42389  
    4444  ResetVector (ovec, ivec->type, tvec[0].Nelements);
    4545
    46   // we have four cases: (ivec == flt or int) and (tvec == flt or int)
     46  // we have size cases: (ivec == flt, int, str) and (tvec == flt or int)
    4747  if ((ivec->type == OPIHI_FLT) && (tvec->type == OPIHI_FLT)) {
    4848    opihi_flt *vi = ivec[0].elements.Flt;
     
    8181    }
    8282  }
     83  // XXX if ivec is an existing vector, this step will
     84  // leak (existing elements need to be freed if they
     85  // have been allocated).
    8386  if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_FLT)) {
    8487    opihi_flt *vt = tvec[0].elements.Flt;
    8588    for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) {
    8689      if (!*vt) continue;
    87       ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);
     90      ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]);
    8891      Npts++;
    8992    }
     
    9396    for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) {
    9497      if (!*vt) continue;
    95       ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);
     98      ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]);
    9699      Npts++;
    97100    }
  • trunk/Ohana/src/opihi/cmd.data/svd.c

    r29540 r42389  
    5858
    5959  // try C.R. Bond's version -- requires matrices in the form A[row][col] not A[row*Ncol + col]
    60   if (1) {
     60  if (0) {
    6161      int j;
    6262      double **a, **u, **v, *q;
  • trunk/Ohana/src/opihi/cmd.data/test/histogram.sh

    r20936 r42389  
    3535 local i
    3636
    37  list word -x "ps -p $PID -o rss"
    38  $startmem = $word:1
     37 create xhis 0 10 0.1
     38 $i = 1
     39
     40 memory stats
     41 $startmem = $memory:Ntotal
    3942
    4043 for i 0 1000
     
    4245 end
    4346 
    44  list word -x "ps -p $PID -o rss"
    45  $endmem = $word:1
     47 memory stats
     48 $endmem = $memory:Ntotal
    4649
    4750 $PASS = 1
  • trunk/Ohana/src/opihi/cmd.data/test/join.sh

    r36084 r42389  
    2121
    2222 join ID1 ID2
    23 
    24 mana: for i 0 index1[]
    25 >> echo index1[$i] index2[$i]
    26 >> end
    27 0 2
    28 2 1
    29 4 0
    30 5 3
    31 mana: join ID1 ID2 -outer
    32 mana: vectors
    33     N       name      size
    34     0        ID1          6 (INT)
    35     1       val1          6 (FLT)
    36     2        ID2          4 (INT)
    37     3        val          4 (FLT)
    38     4     index1          6 (INT)
    39     5     index2          4 (INT)
    40 mana: for i 0 index1[]
    41 >> echo index1[$i]
    42 >> end
    43 2
    44 -1
    45 1
    46 -1
    47 0
    48 3
    49 mana: echo ID1[2]
    50 3
    51 mana: echo ID1[0] ID2[2]
    52 1 1
    53 mana: for i 0 index1[]
    54 >> if (index1[$i] == -1) continue
    55 >> $N = index1[$i]
    56 >> echo $i index1[$i] ID1[$i] ID2[$N]
    57 >> end
    58 0 2 1 1
    59 2 1 3 3
    60 4 0 5 5
    61 5 3 6 6
    62 mana: for i 0 index2[]
    63 >> if (index2[$i] == -1) continue
    64 >> $N = index2[$i]
    65 >> echo $i index2[$i] ID2[$i] ID1[$N]
    66 >> end
    67 0 4 5 5
    68 1 2 3 3
    69 2 0 1 1
    70 3 5 6 6
    71 mana:
    72 
    73  # if ((xvec[1024] != 17) || (yvec[1024] != 100))
    74  #  $PASS = 0
    75  #  echo "Value mismatch: xvec[1024] yvec[1024] (should be 17,100)"
    76  # end
    77  #
    78  # imhist -q buff xvec yvec -region 40 0 25 10 -range 0 10
    79  #
    80  # if ((xvec[1024] != 10) || (yvec[1024] != 100))
    81  #  $PASS = 0
    82  #  echo "Value mismatch: xvec[1024] yvec[1024] (should be 10,100)"
    83  # end
    8423
    8524end
  • trunk/Ohana/src/opihi/cmd.data/threshold.c

    r42277 r42389  
    33int QUIET = FALSE;
    44
    5 void _threshold_set_values (double value, int Nbin, double level) {
     5void _threshold_set_values (double value, int Nbin, double level, int thresherr) {
    66
    77  set_variable ("threshval", value);
    88  set_int_variable ("threshbin", Nbin);
    99  set_variable ("threshold", level);
     10  set_int_variable ("thresherr", thresherr);
    1011
    1112  if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", level, Nbin, value);
     
    117118    if (vecy[0].elements.Flt[BinMin] > value) {
    118119      if (SATURATE) {
    119         _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin]);
     120        _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1);
    120121        return TRUE;
    121122      } else {
    122123        gprint (GP_ERR, "ERROR: all values above threshold\n");
    123         _threshold_set_values (NAN, -1, NAN);
     124        _threshold_set_values (NAN, -1, NAN, 1);
    124125        return FALSE;
    125126      }
     
    127128    if (vecy[0].elements.Flt[BinMax] < value) {
    128129      if (SATURATE) {
    129         _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax]);
     130        _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1);
    130131        return TRUE;
    131132      } else {
    132133        gprint (GP_ERR, "ERROR: all values below threshold\n");
    133         _threshold_set_values (NAN, -1, NAN);
     134        _threshold_set_values (NAN, -1, NAN, 1);
    134135        return FALSE;
    135136      }
     
    156157    if (vecy[0].elements.Flt[BinMin] < value) {
    157158      if (SATURATE) {
    158         _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin]);
     159        _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1);
    159160        return TRUE;
    160161      } else {
    161162        gprint (GP_ERR, "ERROR: all values below threshold\n");
    162         _threshold_set_values (NAN, -1, NAN);
     163        _threshold_set_values (NAN, -1, NAN, 1);
    163164        return FALSE;
    164165      }
     
    166167    if (vecy[0].elements.Flt[BinMax] > value) {
    167168      if (SATURATE) {
    168         _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax]);
     169        _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1);
    169170        return TRUE;
    170171      } else {
    171172        gprint (GP_ERR, "ERROR: all values above threshold\n");
    172         _threshold_set_values (NAN, -1, NAN);
     173        _threshold_set_values (NAN, -1, NAN, 1);
    173174        return FALSE;
    174175      }
     
    219220  }
    220221
    221   _threshold_set_values (y1, Nhi, Xvalue);
     222  _threshold_set_values (y1, Nhi, Xvalue, 0);
    222223  return (TRUE);
    223224}
  • trunk/Ohana/src/opihi/cmd.data/tvcolors.c

    r41341 r42389  
    4141    gprint (GP_ERR, "   f: 0 - 1 defines the scale value for the transition\n");
    4242    gprint (GP_ERR, "   R,G,B: 0 - 1 define the value of the color at the transition point\n");
     43
     44    gprint (GP_ERR, "   There are 5 colormap file format options:\n");
     45    gprint (GP_ERR, "   * file:filename : index Red Green Blue\n");
     46    gprint (GP_ERR, "   * lgcy:filename : index Red Blue Green\n");
     47    gprint (GP_ERR, "   * csvf:filename : index,Red,Green,Blue\n");
     48    gprint (GP_ERR, "   * cetf:filename : fRed,fGreen,fBlue \n");
     49    gprint (GP_ERR, "   * cetr:filename : fRed,fGreen,fBlue \n\n");
     50    gprint (GP_ERR, "   The index value goes from 0.0 to 1.0 and sets transitions (must be monotonic).\n");
     51    gprint (GP_ERR, "   In the CET cases, the index is implicit, with 256 entries expected.\n");
     52    gprint (GP_ERR, "   For cetr: the index is reversed.\n");
     53
    4354    return (FALSE);
    4455  }
  • trunk/Ohana/src/opihi/cmd.data/wd.c

    r41674 r42389  
    115115      Ns = strlen (simple);
    116116      No = 80 - Ns;
    117       strncpy (temp_header.buffer, simple, Ns);
     117      strncpy_nowarn (temp_header.buffer, simple, Ns);
    118118      memset (&temp_header.buffer[Ns], ' ', No);
    119119    }
     
    275275  return (f);
    276276}
    277 
    278 
    279 ///    /* fix up header */
    280 ///    {
    281 ///      static char simple[] = "XTENSION= 'IMAGE  '            / Image extension";
    282 ///      int Ns, No;
    283 ///      Ns = strlen (simple);
    284 ///      No = 80 - Ns;
    285 ///      strncpy (temp_header.buffer, simple, Ns);
    286 ///      memset (&temp_header.buffer[Ns], ' ', No);
    287 ///    }
    288 ///
    289 ///    /* position to end of file to write new extend */
    290 ///    fseeko (f, 0LL, SEEK_END);
    291 ///    nbytes = fwrite (temp_header.buffer, 1, temp_header.datasize, f);
    292 ///    fclose (f);
    293 ///    if (nbytes != temp_header.datasize) {
    294 ///      gprint (GP_ERR, "failed to write file\n");
    295 ///      status = FALSE;
    296 ///      goto done1;
    297 ///    }
    298 ///
    299 ///  }
  • trunk/Ohana/src/opihi/cmd.data/write_vectors.c

    r42127 r42389  
    214214    /* identify type (%NNNNd %NNNNf) */
    215215    for (p2 = p1 + 1; (*p2 == '.') || (*p2 == '-') || (*p2 == '+') || (*p2 == ' ') || isdigit(*p2); p2++);
    216     strncpy (fmtlist[j], p0, p2 - p0 + 1);
     216    strncpy_nowarn (fmtlist[j], p0, p2 - p0 + 1);
    217217    switch (*p2) {
    218218      case 'e':
  • trunk/Ohana/src/opihi/dvo/aregion.c

    r27435 r42389  
    4949  fread (buffer, 1, 48*NDecLines[NBigDec], f);
    5050  for (i = 0; !done && (i < NDecLines[NBigDec]); i++) {
    51     strncpy (temp, &buffer[i*48], 48);
    52     temp[49] = 0;
     51    strncpy_nowarn (temp, &buffer[i*48], 48);
    5352    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    5453    if (RA1 < RA0) RA1 += 360.0;
  • trunk/Ohana/src/opihi/dvo/coordmosaic.c

    r39233 r42389  
    311311     
    312312      memset (segment, 0, 16); memcpy  (segment, &SEGMENT[i*Nsegment], 4);
    313       snprintf (name, 16, "%s_L_CX%dY%d", segment, XORDER[i], YORDER[i]);
     313      snprintf_nowarn (name, 16, "%s_L_CX%dY%d", segment, XORDER[i], YORDER[i]);
    314314      double xvalue = get_double_variable (name, &found);
    315315      xmask = !found;
    316316     
    317317      memset (segment, 0, 16); memcpy  (segment, &SEGMENT[i*Nsegment], 4);
    318       snprintf (name, 16, "%s_M_CX%dY%d", segment, XORDER[i], YORDER[i]);
     318      snprintf_nowarn (name, 16, "%s_M_CX%dY%d", segment, XORDER[i], YORDER[i]);
    319319      double yvalue = get_double_variable (name, &found);
    320320      ymask = !found;
     
    437437
    438438        int found, xmask, ymask;
    439         snprintf (name, 16, "L_X%dY%d", ix, iy);
     439        snprintf_nowarn (name, 16, "L_X%dY%d", ix, iy);
    440440        double xvalue = get_double_variable (name, &found);
    441441        xmask = !found;
    442442
    443         snprintf (name, 16, "M_X%dY%d", ix, iy);
     443        snprintf_nowarn (name, 16, "M_X%dY%d", ix, iy);
    444444        double yvalue = get_double_variable (name, &found);
    445445        ymask = !found;
  • trunk/Ohana/src/opihi/dvo/elixir.c

    r27611 r42389  
    44int ReadMsg (char *fifo, char **message);
    55
     6# define MY_MAX_PATH 256
     7
    68int elixir (int argc, char **argv) {
    79 
    8   char message[256], cmd[256], ElixirBase[256];
    9   char fifo[256], fifodir[256], msgfile[256];
     10  char message[MY_MAX_PATH], cmd[MY_MAX_PATH], ElixirBase[MY_MAX_PATH];
     11  char fifo[MY_MAX_PATH], fifodir[MY_MAX_PATH], msgfile[MY_MAX_PATH];
    1012  char *answer;
    1113  int N;
     
    3840    return (FALSE);
    3941  }
    40   sprintf (fifo, "%s.msg", ElixirBase);
     42  snprintf_nowarn (fifo, MY_MAX_PATH, "%s.msg", ElixirBase);
    4143  if (!VarConfig ("FIFOS", "%s", fifodir)) {
    4244    gprint (GP_ERR, "FIFOS not in config, using local /tmp\n");
    4345    strcpy (fifodir, "/tmp");
    4446  }
    45   sprintf (fifo, "%s.msg", ElixirBase);
     47  snprintf_nowarn (fifo, MY_MAX_PATH, "%s.msg", ElixirBase);
    4648
    47   sprintf (msgfile, "%s/EMsg.XXXXXX", fifodir);
     49  snprintf_nowarn (msgfile, MY_MAX_PATH, "%s/EMsg.XXXXXX", fifodir);
    4850  if (mkstemp (msgfile) == -1) {
    4951    gprint (GP_ERR, "can't create fifo\n");
    5052    return (FALSE);
    5153  }
    52   sprintf (message, "%s %s", cmd, msgfile);
     54  snprintf_nowarn (message, MY_MAX_PATH, "%s %s", cmd, msgfile);
    5355  unlink (msgfile);
    5456
  • trunk/Ohana/src/opihi/dvo/find_regions.c

    r27435 r42389  
    100100    fread (buffer, 48*NDecLines[NBigDec + j], 1, f);
    101101    for (i = 0; (i < NDecLines[NBigDec + j]); i++) {
    102       strncpy (temp, &buffer[i*48], 48);
    103       temp[49] = 0;
     102      strncpy_nowarn (temp, &buffer[i*48], 48);
    104103      hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    105104      if (RA1 < RA0) RA1 += 360.0;
  • trunk/Ohana/src/opihi/include/dvomath.h

    r42083 r42389  
    125125int           M_unary               PROTO((StackVar *OUT, StackVar *V1, char *op));
    126126int           W_unary               PROTO((StackVar *OUT, StackVar *V1, char *op));
     127int           L_unary               PROTO((StackVar *OUT, StackVar *V1, char *op));
    127128
    128129/* variable handling */
  • trunk/Ohana/src/opihi/include/pcontrol.h

    r36623 r42389  
    341341
    342342void pcontrol_exit (int n);
     343void QuitCheckSystemThread (void);
    343344
    344345// Job   *FindJobByID (IDtype JobID, int *StackID);
  • trunk/Ohana/src/opihi/lib.data/svdcmp.c

    r34088 r42389  
    2323  l = nm = 0;
    2424  ALLOCATE (rv1, float, Nx);
     25
    2526  for (i = 0; i < Nx; i++) {
    2627    l = i + 1;
     
    2930    if (i < Ny) {
    3031      for (k = i; k < Ny; k++) scale += fabs(a[k*Nx + i]);
    31       if (scale) {
     32      if (scale > 0.0) {
    3233        for (k = i; k < Ny; k++) {
    3334          a[k*Nx + i] /= scale;
     
    3536        }
    3637        f = a[i*Nx + i];
    37         g  = -FSIGN(sqrt(s), f);
     38        g = sqrt(s);
     39        if (f > 0.0) { g = -g; }
    3840        h = f*g - s;
    3941        a[i*Nx + i] = f-g;
    4042        if (i != Nx - 1) {
    4143          for (j = l; j < Nx; j++) {
    42             for (s = 0.0, k = i; k < Ny; k++) s += a[k*Nx + i]*a[k*Nx + j];
     44            s = 0.0;
     45            for (k = i; k < Ny; k++) { s += a[k*Nx + i]*a[k*Nx + j]; }
    4346            f = s/h;
    44             for (k = i; k < Ny; k++) a[k*Nx + j] += f*a[k*Nx + i];
     47            for (k = i; k < Ny; k++) { a[k*Nx + j] += f*a[k*Nx + i]; }
    4548          }
    4649        }
    47         for (k = i; k < Ny; k++) a[k*Nx + i] *= scale;
     50        for (k = i; k < Ny; k++) { a[k*Nx + i] *= scale; }
    4851      }
    4952    }
     
    5154    g = s = scale = 0.0;
    5255    if ((i < Ny) && (i != (Nx - 1))) {
    53       for (k = l; k < Nx; k++) scale += fabs(a[i*Nx + k]);
    54       if (scale) {
     56      for (k = l; k < Nx; k++) { scale += fabs(a[i*Nx + k]); }
     57      if (scale > 0.0) {
    5558        for (k = l; k < Nx; k++) {
    5659          a[i*Nx + k] /= scale;
     
    5861        }
    5962        f = a[i*Nx + l];
    60         g = -FSIGN(sqrt(s), f);
     63        g = sqrt(s);
     64        if (f > 0.0) { g = -g; }
    6165        h = f*g - s;
    6266        a[i*Nx + l] = f-g;
    63         for (k = l; k < Nx; k++) rv1[k] = a[i*Nx + k]/h;
     67        for (k = l; k < Nx; k++) { rv1[k] = a[i*Nx + k]/h; }
    6468        if (i != Ny - 1) {
    6569          for (j = l; j < Ny; j++) {
    66             for (s = 0.0, k = l; k < Nx; k++) s += a[j*Nx + k]*a[i*Nx + k];
    67             for (k = l; k < Nx; k++) a[j*Nx + k] += s*rv1[k];
     70            s = 0.0;
     71            for (k = l; k < Nx; k++) { s += a[j*Nx + k]*a[i*Nx + k];}
     72            for (k = l; k < Nx; k++) { a[j*Nx + k] += s*rv1[k]; }
    6873          }
    6974        }
    70         for (k = l; k < Nx; k++) a[i*Nx + k] *= scale;
     75        for (k = l; k < Nx; k++) { a[i*Nx + k] *= scale; }
    7176      }
    7277    }
     
    7681  for (i = Nx - 1; i >= 0; i--) {
    7782    if (i < Nx - 1) {
    78       if (g) {
     83      if (g != 0.0) {
    7984        /* isn't l == n to start?? */
    8085        for (j = l; j < Nx; j++) v[j*Nx + i] = (a[i*Nx + j]/a[i*Nx + l])/g;
    8186        for (j = l; j < Nx; j++) {
    82           for (s = 0.0, k = l; k < Nx; k++) s += a[i*Nx + k]*v[k*Nx + j];
     87          s = 0.0;
     88          for (k = l; k < Nx; k++) s += a[i*Nx + k]*v[k*Nx + j];
    8389          for (k = l; k < Nx; k++) v[k*Nx + j] += s*v[k*Nx + i];
    8490        }
    8591      }
    86       for (j = l; j < Nx; j++) v[i*Nx + j] = v[j*Nx + i] = 0.0;
     92      for (j = l; j < Nx; j++) { v[i*Nx + j] = v[j*Nx + i] = 0.0; }
    8793    }
    8894    v[i*Nx + i] = 1.0;
     
    9399    l = i + 1;
    94100    g = w[i];
    95     if (i < Nx - 1)
    96       for (j = l; j < Nx; j++) a[i*Nx + j] = 0.0;
    97     if (g) {
     101    if (i < Nx - 1) { for (j = l; j < Nx; j++) {a[i*Nx + j] = 0.0; }}
     102    if (g != 0.0) {
    98103      g = 1.0/g;
    99104      if (i != Nx - 1) {
    100105        for (j = l; j < Nx; j++) {
    101           for (s = 0.0, k = l; k < Ny; k++) s += a[k*Nx + i]*a[k*Nx + j];
     106          s = 0.0;
     107          for (k = l; k < Ny; k++) { s += a[k*Nx + i]*a[k*Nx + j];}
    102108          f = (s/a[i*Nx + i])*g;
    103           for (k = i; k < Ny; k++) a[k*Nx + j] += f*a[k*Nx + i];
    104         }
    105       }
    106       for (j = i; j < Ny; j++) a[j*Nx + i] *= g;
     109          for (k = i; k < Ny; k++) { a[k*Nx + j] += f*a[k*Nx + i]; }
     110        }
     111      }
     112      for (j = i; j < Ny; j++) { a[j*Nx + i] *= g; }
    107113    } else {
    108       for (j = i; j < Ny; j++) a[j*Nx + i] = 0.0;
    109     }
    110     ++a[i*Nx + i];
     114      for (j = i; j < Ny; j++) { a[j*Nx + i] = 0.0; }
     115    }
     116    a[i*Nx + i] ++;
    111117  }
    112118
     
    126132        c = 0.0;
    127133        s = 1.0;
    128         for (i = l; i < k; i++) {
     134        for (i = l; i <= k; i++) {
    129135          f = s*rv1[i];
    130136          if (fabs(f)+anorm != anorm) {
     
    160166      f = ((y-z)*(y+z) + (g-h)*(g+h))/(2.0*h*y);
    161167      g = hypot (f, 1.0);
    162       f = ((x-z)*(x+z) + h*((y/(f+FSIGN(g, f)))-h))/x;
     168     
     169      float tmp = g;
     170      if (f < 0.0) { tmp = - tmp; }
     171
     172      f = ((x-z)*(x+z) + h*((y/(f+tmp))-h))/x;
     173
    163174      c = s = 1.0;
    164       for (j = l; j < nm; j++) {
     175      for (j = l; j <= nm; j++) {
    165176        i = j+1;
    166177        g = rv1[i];
     
    184195        z = hypot(f, h);
    185196        w[j] = z;
    186         if (z) {
     197        if (z != 0.0) {
    187198          z = 1.0/z;
    188199          c = f*z;
  • trunk/Ohana/src/opihi/lib.data/svdcmp_bond_new.c

    r29540 r42389  
    6363                        g = 0.0;
    6464                else {
    65                         f = u[i][i+1];
     65                    f = u[i][i+1]; // XXXX this line will overrun the memory of u[][i+1] : i+1
    6666                        g = (f < 0) ? sqrt(s) : -sqrt(s);
    6767                        h = f * g - s;
  • trunk/Ohana/src/opihi/lib.shell/VectorIO.c

    r42126 r42389  
    261261  memset (endptr, ' ', FT_LINE_LENGTH);
    262262
    263   strncpy (endptr, newline, 80);
     263  strncpy_nowarn (endptr, newline, 80);
    264264  endptr += FT_LINE_LENGTH;
    265265
  • trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c

    r42080 r42389  
    6767    if (stack[0].type == ST_VECTOR) {
    6868      /* need to make a copy so we set output value? */
    69       V_unary (&tmp_stack, &stack[0], "=");
     69      if (stack->vector->type == OPIHI_STR) {
     70        L_unary (&tmp_stack, &stack[0], "=");
     71      } else {
     72        V_unary (&tmp_stack, &stack[0], "=");
     73      }
    7074      move_stack (&stack[0], &tmp_stack);
    7175      return (TRUE);
  • trunk/Ohana/src/opihi/lib.shell/expand_vectors.c

    r42080 r42389  
    2828  ALLOCATE (newline, char, NLINE);
    2929
     30  // special case: don't expand vectors in while () statement
     31  char *V0 = thiscomm (line);
     32  if (V0 && !strncmp ("while", V0, strlen(V0))) {
     33      strcpy (newline, line);
     34      free (line);
     35      return (newline);
     36  }
     37  free (V0);
     38
    3039  /* look for form fred[stuff] */
    31   /* skip first word (command) */
    32   L = nextword (line);
     40  if (*line == '(') {
     41    // if line is "(stuff)" then do not skip first word
     42      L = line;
     43  } else {
     44    /* skip first word (command) */
     45    L = nextword (line);
     46  }
    3347  if (L == NULL) {
    3448    free (newline);
     
    3751
    3852  n = L - line;
    39   strncpy (newline, line, n);
     53  strncpy_nowarn (newline, line, n);
    4054  N = newline + n;
    4155  J = 0;
     
    242256
    243257    n = (int) (w - L);
    244     strncpy (N, L, n);
     258    strncpy_nowarn (N, L, n);
    245259    N += n;
    246260    n = strlen (strValue);
    247     strncpy (N, strValue, n);
     261    strncpy_nowarn (N, strValue, n);
    248262    N += n;
    249263    L = q + 1;
     
    260274
    261275  n = strlen (L);
    262   strncpy (N, L, n);
    263   N[n] = 0;
     276  strncpy_nowarn (N, L, n);
    264277  free (line);
    265278  return (newline);
  • trunk/Ohana/src/opihi/lib.shell/stack_math.c

    r42311 r42389  
    17141714  char line[512]; // this is only used to report an error
    17151715  snprintf (line, 512, "error: op %s not defined as unary vector op!", op);
     1716  push_error (line);
     1717  return (FALSE);
     1718
     1719escape:
     1720
     1721  if (V1[0].type == ST_VECTOR_TMP) {
     1722    free (V1[0].vector[0].elements.Ptr);
     1723    free (V1[0].vector);
     1724    V1[0].vector = NULL;
     1725  } 
     1726
     1727  clear_stack (V1);
     1728  return (TRUE);
     1729
     1730}
     1731
     1732// vector string operations
     1733int L_unary (StackVar *OUT, StackVar *V1, char *op) {
     1734
     1735  int Nx = V1[0].vector[0].Nelements;
     1736
     1737  OUT[0].vector = InitVector ();
     1738  OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/
     1739
     1740  ResetVector (OUT[0].vector, OPIHI_STR, V1[0].vector[0].Nelements);
     1741  char **Iv =  V1[0].vector[0].elements.Str;
     1742  char **Ov = OUT[0].vector[0].elements.Str;
     1743  if (!strcmp (op, "=")) {
     1744    for (int i = 0; i < Nx; i++) {                     
     1745      Ov[i] = strcreate (Iv[i]);
     1746    }                                                                   
     1747    goto escape;                                                       
     1748  }
     1749
     1750  // free the temp vector if needed
     1751  if (V1[0].type == ST_VECTOR_TMP) {
     1752    // XXX this probably does not free the strings
     1753    free (V1[0].vector[0].elements.Ptr);
     1754    free (V1[0].vector);
     1755    V1[0].vector = NULL;
     1756  } 
     1757
     1758  clear_stack (V1);
     1759
     1760  char line[512]; // this is only used to report an error
     1761  snprintf (line, 512, "error: op %s not defined as unary string vector op!", op);
    17161762  push_error (line);
    17171763  return (FALSE);
  • trunk/Ohana/src/opihi/pantasks/controller_status.c

    r37807 r42389  
    2626  }
    2727
    28   snprintf (command, 1024, "status");
     28  snprintf_nowarn (command, 1024, "status");
    2929  for (i = 1; i < argc; i++) {
    30     snprintf (tmpline, 1024, "%s %s", command, argv[i]);
     30    snprintf_nowarn (tmpline, 1024, "%s %s", command, argv[i]);
    3131    strcpy (command, tmpline);
    3232  }
  • trunk/Ohana/src/opihi/pantasks/pantasks_server.c.in

    r41483 r42389  
    138138  ConfigFree ();
    139139
     140  // XXX this function is currently called by the thread running ListenClients, but
     141  // it should be called by the main above.  have this function trigger the
     142  // thread shutdown
     143
    140144  QuitJobsAndTasksThread(); pthread_join (JobsAndTasksThread, NULL);
    141145  QuitControllerThread();   pthread_join (controllerThread, NULL);
  • trunk/Ohana/src/opihi/pcontrol/CheckSystem.c

    r39457 r42389  
    44static struct timeval lastlive = {0, 0};
    55static RunLevels RunLevel = PCONTROL_RUN_NONE;
     6
     7static int CheckSystemThreadRuns = TRUE;
     8
     9void QuitCheckSystemThread (void) {
     10  CheckSystemThreadRuns = FALSE; 
     11}
     12
    613
    714RunLevels SetRunLevel (RunLevels level) {
     
    6774  gprintInit ();
    6875
    69   while (1) {
     76  while (CheckSystemThreadRuns) {
    7077    // stop here if the user-thread requests (no objects in flight)
    7178    TestCheckPoint ();
  • trunk/Ohana/src/opihi/pcontrol/pcontrol.c.in

    r39457 r42389  
    99# define opihi_rcfile ".pcontrolrc"
    1010
     11# ifdef THREADED 
     12  static pthread_t clientsThread;
     13# endif
     14
    1115/* program-dependent initialization */
    1216void program_init (int *argc, char **argv) {
     
    1418  OHANA_UNUSED_PARAM(argv);
    1519 
    16 # ifdef THREADED 
    17   pthread_t clientsThread;
    18 # endif
    19 
    2020  auto_break = TRUE;
    2121
     
    8383  SetRunLevel (PCONTROL_RUN_HOSTS);
    8484  DownHosts ();
     85
     86  QuitCheckSystemThread(); pthread_join (clientsThread, NULL);
     87
    8588  ConfigFree ();
    86 
    8789  FreeBasic ();
    8890  FreePcontrol ();
  • trunk/Ohana/src/opihi/pcontrol/test/linesize.sh

    r18114 r42389  
    2727
    2828  for i 1 10
    29     job echo $inline7
     29    job echo $inline6
    3030  end
    3131
     
    3434  for i 1 10
    3535    stdout $i -var outline
    36     strlen "$inline7" Nin
     36    strlen "$inline6" Nin
    3737    strlen "$outline" Nout
    3838
  • trunk/Ohana/src/opihi/test/tests.sh

    r41470 r42389  
    5353  for Tj 0 $testscripts:n
    5454    if ($VERBOSE > 1)
    55       echo " running $testscripts:$Tj"
     55      echo " ----- running $testscripts:$Tj -----"
    5656    end
    5757    runtests $testscripts:$Tj     
  • trunk/Ohana/src/photdbc/src/ConfigInit.c

    r38441 r42389  
    1313
    1414  char *config, *file;
    15   char CatdirPhotcodeFile[256];
     15  char CatdirPhotcodeFile[DVO_MAX_PATH];
    1616
    1717  /*** load configuration info ***/
     
    5959  free (tmpcatdir);
    6060
    61   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     61  snprintf_nowarn (ImageCat, DVO_MAX_PATH, "%s/Images.dat", CATDIR);
    6262
    6363  WarnConfig (config, "ZERO_PT",                "%lf", 0, &ZERO_POINT);
     
    7272
    7373  /* XXX this does not yet write out the master photcode table */
    74   sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR);
     74  snprintf_nowarn (CatdirPhotcodeFile, DVO_MAX_PATH, "%s/Photcodes.dat", CATDIR);
    7575  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
    7676    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
  • trunk/Ohana/src/photdbc/src/copy_images.c

    r38986 r42389  
    5858
    5959  char mapfile[DVO_MAX_PATH];
    60   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
     60  snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
    6161  AstromOffsetTable *table_src = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);
    6262
     
    7777      AstromOffsetTableAddMapFromImage (table_tgt, &subset[i]);
    7878    }
    79     snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", outdir);
     79    snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", outdir);
    8080    AstromOffsetMapSave (table_tgt, mapfile);
    8181    free (table_tgt->imageIDtoTableSeq);
  • trunk/Ohana/src/relastro/src

  • trunk/Ohana/src/relastro/src/ConfigInit.c

    r39926 r42389  
    6161  ScanConfig(config, "WHERE_B",                "%s",  0, WHERE_B);
    6262
    63   snprintf (ImageCat, DVO_MAX_PATH, "%s/Images.dat", CATDIR);
     63  snprintf_nowarn (ImageCat, DVO_MAX_PATH, "%s/Images.dat", CATDIR);
    6464
    6565  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) SKY_DEPTH = 2;
     
    7777
    7878  /* update master photcode table if not defined */
    79   snprintf (CatdirPhotcodeFile, DVO_MAX_PATH, "%s/Photcodes.dat", CATDIR);
     79  snprintf_nowarn (CatdirPhotcodeFile, DVO_MAX_PATH, "%s/Photcodes.dat", CATDIR);
    8080  if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {
    8181    fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile);
  • trunk/Ohana/src/relastro/src/FrameCorrection.c

    r38986 r42389  
    8080  static int version = 0;
    8181  char filename[1024];
    82   snprintf (filename, 1024, "%s/frame.%03d.corr.fits", CATDIR, version);
     82  snprintf_nowarn (filename, 1024, "%s/frame.%03d.corr.fits", CATDIR, version);
    8383  FrameCorrectionSetSave (filename, set);
    8484  version ++;
     
    217217    static int version = 0;
    218218    char filename[1024];
    219     snprintf (filename, 1024, "%s/sh.%02d.dat", CATDIR, version);
     219    snprintf_nowarn (filename, 1024, "%s/sh.%02d.dat", CATDIR, version);
    220220    FILE *f = fopen (filename, "w");
    221221    myAssert (f, "oops");
     
    519519    static int version = 0;
    520520    char filename[1024];
    521     snprintf (filename, 1024, "%s/map.%02d.dat", CATDIR, version);
     521    snprintf_nowarn (filename, 1024, "%s/map.%02d.dat", CATDIR, version);
    522522    FILE *f = fopen (filename, "w");
    523523    version ++;
  • trunk/Ohana/src/relastro/src/ICRF.c

    r39375 r42389  
    5656
    5757  char filename[1024];
    58   snprintf (filename, 1024, "%s/test.icrf.dat", CATDIR);
     58  snprintf_nowarn (filename, 1024, "%s/test.icrf.dat", CATDIR);
    5959  FILE *f = fopen (filename, "w");
    6060
  • trunk/Ohana/src/relastro/src/assign_images.c

    r39926 r42389  
    2525
    2626  char mapfile[DVO_MAX_PATH];
    27   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
     27  snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
    2828  AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);
    2929
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r39995 r42389  
    6464  if (VERBOSE2 && ExcludeBogus && (fbogus == NULL)) {
    6565    char name[1024];
    66     snprintf (name, 1024, "%s/bogus.%02d.dat", CATDIR, HOST_ID);
     66    snprintf_nowarn (name, 1024, "%s/bogus.%02d.dat", CATDIR, HOST_ID);
    6767    fbogus = fopen (name, "w");
    6868    if (!fbogus) {
     
    533533  if (dumpit) {
    534534    char name[64];
    535     snprintf (name, 64, "cat.%05d.dump.dat", oldcatalog[0].catID);
     535    snprintf_nowarn (name, 64, "cat.%05d.dump.dat", oldcatalog[0].catID);
    536536    FILE *fdump = fopen (name, "w");
    537537    for (i = 0; i < Nkeep; i++) {
  • trunk/Ohana/src/relastro/src/launch_region_hosts.c

    r40415 r42389  
    6363    // subset images per host : CATDIR/Image.HOSTNAME.fits
    6464    char filename[1024];
    65     snprintf (filename, 1024, "%s/Image.%d.fits", CATDIR, host->hostID);
     65    snprintf_nowarn (filename, 1024, "%s/Image.%d.fits", CATDIR, host->hostID);
    6666    if (unlink (filename)) fprintf (stderr, "trouble clearing image %s\n", filename);
    6767
     
    7171    if (host->astromTable) {
    7272      char mapname[1024];
    73       snprintf (mapname, 1024, "%s/AstroMap.%d.fits", CATDIR, host->hostID);
     73      snprintf_nowarn (mapname, 1024, "%s/AstroMap.%d.fits", CATDIR, host->hostID);
    7474
    7575      // write the image subset for this host
  • trunk/Ohana/src/relastro/src/load_images.c

    r39926 r42389  
    5656
    5757  char mapfile[DVO_MAX_PATH];
    58   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
     58  snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
    5959  table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);
    6060
     
    9696
    9797  char mapfile[DVO_MAX_PATH];
    98   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
     98  snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
    9999  AstromOffsetMapSave (table, mapfile);
    100100
  • trunk/Ohana/src/relastro/src/relastro_parallel_images.c

    r40415 r42389  
    4343
    4444  char mapfile[DVO_MAX_PATH];
    45   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.%d.fits", CATDIR, REGION_HOST_ID);
     45  snprintf_nowarn (mapfile, DVO_MAX_PATH, "%s/AstroMap.%d.fits", CATDIR, REGION_HOST_ID);
    4646  AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);
    4747
  • trunk/Ohana/src/relastro/src/share_images_pos.c

    r39457 r42389  
    3838  if (table) {
    3939    char mapname[1024];
    40     snprintf (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, REGION_HOST_ID);
     40    snprintf_nowarn (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, REGION_HOST_ID);
    4141   
    4242    // write the image subset for this host
     
    113113
    114114    char mapname[1024];
    115     snprintf (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, regionHosts->hosts[i].hostID);
     115    snprintf_nowarn (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, regionHosts->hosts[i].hostID);
    116116   
    117117    AstromOffsetTable *table = AstromOffsetMapLoad (mapname, 100000, VERBOSE);
  • trunk/Ohana/src/relphot

  • trunk/Ohana/src/relphot/include/relphot.h

    r42135 r42389  
    470470int    PRESERVE_PS1;
    471471int    REQUIRE_PSFFIT;
     472int    USE_APER_FOR_STARGAL;
    472473int    UPDATE;
    473474int    SAVE_IMAGE_UPDATES;
  • trunk/Ohana/src/relphot/src/args.c

    r42135 r42389  
    247247    REQUIRE_PSFFIT = TRUE;
    248248  }
     249  USE_APER_FOR_STARGAL = FALSE;
     250  if ((N = get_argument (argc, argv, "-use-aper-for-stargal"))) {
     251    remove_argument (N, &argc, argv);
     252    USE_APER_FOR_STARGAL = TRUE;
     253  }
    249254
    250255  UPDATE = FALSE;
  • trunk/Ohana/src/relphot/src/bcatalog.c

    r41647 r42389  
    8282      if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { Ndophot ++; continue; }
    8383
     84      float Maper = USE_APER_FOR_STARGAL ? catalog[0].measure[offset].Map : catalog[0].measure[offset].Mkron;
     85
    8486      // skip garbage measurements
    8587      if (isnan(catalog[0].measure[offset].psfQF)     || (catalog[0].measure[offset].psfQF < 0.95))     { Npsfqf ++; continue; }
    8688      if (isnan(catalog[0].measure[offset].psfQFperf) || (catalog[0].measure[offset].psfQFperf < 0.95)) { Npsfqf ++; continue; }
    8789      if (isnan(catalog[0].measure[offset].M)) { Nnan ++; continue; }
    88       if (isnan(catalog[0].measure[offset].Mkron)) { Nnan ++; continue; }
     90      if (isnan(Maper)) { Nnan ++; continue; }
    8991
    9092      // require 0x01 in photFlags (fitted with a PSF) -- add to the test data
    9193      if (REQUIRE_PSFFIT && (catalog[0].measure[offset].photFlags & 0x01) == 0) { Nbad ++; continue; }
    9294
    93       // very loose cut on PSF - Kron
    94       float Mkp = catalog[0].measure[offset].M - catalog[0].measure[offset].Mkron;
     95      // very loose cut on PSF - APER mag (Map or Mkron) -- this lightly rejects galaxies & other oddities
     96      float Mkp = catalog[0].measure[offset].M - Maper;
    9597      if (fabs(Mkp) > 1.0) { Nbad ++; continue; }
    9698
     
    101103      if (catalog[0].measure[offset].photFlags & code->photomPoorMask) { Npoor++; continue;}
    102104
    103       // check for galaxies (XXX skip for now)
    104       if (FALSE && !isnan(catalog[0].measure[offset].Map)) {
    105         if (catalog[0].measure[offset].M - catalog[0].measure[offset].Map > 0.15) {
    106           nEXT ++;
    107         } else {
    108           nPSF ++;
    109         }
     105      // weak test for galaxies
     106      if (Mkp > 0.5) {
     107        nEXT ++;
     108      } else {
     109        nPSF ++;
    110110      }
    111111
     
    145145
    146146    // skip object if it is likely to be a galaxy
    147     if (FALSE && (nEXT >= nPSF)) {
     147    if (nEXT >= nPSF) {
    148148      Nmeasure -= Nm;
    149149      Ngalaxy ++;
  • trunk/Ohana/src/relphot/src/save_images.c

    r41556 r42389  
    1919
    2020  char filename[1024];
    21   snprintf (filename, 1024, "%s.bck", ImageCat); // ImageCat is global
     21  snprintf_nowarn (filename, 1024, "%s.bck", ImageCat); // ImageCat is global
    2222  if (!gfits_db_lock (&dbX, filename)) {
    2323    fprintf (stderr, "can't lock backup image image catalog\n");
     
    8585  dbX.format    = db->format;
    8686
    87   snprintf (filename, 1024, "%s.bck", ImageCat);
     87  snprintf_nowarn (filename, 1024, "%s.bck", ImageCat);
    8888  if (!gfits_db_lock (&dbX, filename)) {
    8989    fprintf (stderr, "can't lock backup image image catalog\n");
  • trunk/Ohana/src/tools/src/findexec.c

    r12333 r42389  
    101101        done = TRUE;
    102102        bzero (path, 256);
    103         strncpy (path, c, strlen(c));
     103        strncpy_nowarn (path, c, strlen(c));
    104104      } else {
    105105        bzero (path, 256);
    106         strncpy (path, c, e-c);
     106        strncpy_nowarn (path, c, e-c);
    107107        c = e+1;
    108108        e = strchr (c, ':');
  • trunk/Ohana/src/tools/src/fits_insert.c

    r27491 r42389  
    8585    p = gfits_header_field (&header, "COMMENT", Cnumber);
    8686    if (p != (char *) NULL) {
    87       strncpy (p, line, 80);
     87      memcpy (p, line, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8888    }
    8989  }
     
    108108    line[80] = 0;
    109109    bzero (keyword, 10);
    110     strncpy (keyword, line, 8);
     110    strncpy_nowarn (keyword, line, 8);
    111111   
    112112    /* replace existing keywords, unless this is a COMMENT or HISTORY field */
     
    114114      p = gfits_header_field (&header, keyword, 1);
    115115      if (p != (char *) NULL) {
    116         strncpy (p, line, 80);
     116        strncpy_nowarn (p, line, 80);
    117117        continue;
    118118      }
     
    151151        exit (1);
    152152      }
    153       strncpy (p+80, "END", 3);
     153      memcpy (p+80, "END", 3); // do not use strncpy_nowarn, do NOT set last byte to NULL
    154154      for (i = 3; i < 80; i++) { p[80+i] = ' '; }
    155155    }
    156156    /* insert the new line here */
    157     strncpy (p, line, 80);
     157    memcpy (p, line, 80); // do not use strncpy_nowarn, do NOT set last byte to NULL
    158158  }
    159159  if (fclose (f)) {
  • trunk/Ohana/src/tools/src/fits_to_mysql.c

    r39093 r42389  
    252252
    253253    char field[256], tlabel[256], format[256];
    254     snprintf (field, 256, "TTYPE%d", i+1);
     254    snprintf_nowarn (field, 256, "TTYPE%d", i+1);
    255255    gfits_scan (header, field, "%s", 1, tlabel);
    256256
    257     snprintf (field, 256, "TFORM%d", i+1);
     257    snprintf_nowarn (field, 256, "TFORM%d", i+1);
    258258    gfits_scan (header, field, "%s", 1, format);
    259259
     
    270270    if (Ndup) {
    271271      char tmpname[256];
    272       snprintf (tmpname, 256, "%s_%d", tlabel, Ndup);
     272      snprintf_nowarn (tmpname, 256, "%s_%d", tlabel, Ndup);
    273273      column[Ncolumn].colname = strcreate (tmpname);
    274274    } else {
     
    357357    char colname[64];
    358358    for (j = 0; j < Nval; j++) {
    359       snprintf (colname, 64, "%s_%d", rootname, j + 1);
     359      snprintf_nowarn (colname, 64, "%s_%d", rootname, j + 1);
    360360      PrintIOBuffer (buffer, "%s %s", colname, typename);
    361361      if (j < Nval - 1) {
     
    455455      char colname[64];
    456456      for (j = 0; j < columns[i].Nval; j++) {
    457         snprintf (colname, 64, "%s_%d", columns[i].colname, j + 1);
     457        snprintf_nowarn (colname, 64, "%s_%d", columns[i].colname, j + 1);
    458458        PrintIOBuffer (insert, "%s", colname);
    459459        if (j < columns[i].Nval - 1) {
     
    649649
    650650  /* get column keywords */
    651   snprintf (field, 256, "TTYPE%d", Nfield);
     651  snprintf_nowarn (field, 256, "TTYPE%d", Nfield);
    652652  gfits_scan (header, field, "%s", 1, tlabel);
    653   snprintf (field, 256, "TSCAL%d", Nfield);
     653  snprintf_nowarn (field, 256, "TSCAL%d", Nfield);
    654654  gfits_scan (header, field, "%lf", 1, &Bscale);
    655   snprintf (field, 256, "TZERO%d", Nfield);
     655  snprintf_nowarn (field, 256, "TZERO%d", Nfield);
    656656  gfits_scan (header, field, "%lf", 1, &Bzero);
    657   snprintf (field, 256, "TFORM%d", Nfield);
     657  snprintf_nowarn (field, 256, "TFORM%d", Nfield);
    658658  gfits_scan (header, field, "%s", 1, format);
    659659
     
    669669  int Nstart = 0;
    670670  for (i = 1; i < Nfield; i++) {
    671     snprintf (field, 256, "TFORM%d", i);
     671    snprintf_nowarn (field, 256, "TFORM%d", i);
    672672    gfits_scan (header, field, "%s", 1, format);
    673673    int Nv, Nb;
  • trunk/Ohana/src/tools/src/mpcorb_predict.c

    r42076 r42389  
    775775  // set the byte after the range to NULL and scanf the values.  or just use strtod as needed:
    776776
    777   strncpy (planet->ID, line, 7); planet->ID[7] = 0;
     777  strncpy_nowarn (planet->ID, line, 7);
    778778
    779779  char *endptr;
  • trunk/Ohana/src/tools/src/mpcorb_predict_tests.c

    r41713 r42389  
    10591059  // set the byte after the range to NULL and scanf the values.  or just use strtod as needed:
    10601060
    1061   strncpy (planet->ID, line, 7); planet->ID[7] = 0;
     1061  strncpy_nowarn (planet->ID, line, 7);
    10621062
    10631063  MPC_DOUBLE (planet->mean_anomaly, 27, 35);
  • trunk/Ohana/src/uniphot/src/ConfigInit.c

    r33654 r42389  
    2222  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
    2323
    24   sprintf (ImageCat, "%s/Images.dat", CATDIR);
     24  snprintf_nowarn (ImageCat, 256, "%s/Images.dat", CATDIR);
    2525
    2626  GetConfig (config, "GSCFILE",                 "%s",  0, GSCFILE);
  • trunk/Ohana/src/uniphot/src/load_zpt_table.c

    r40549 r42389  
    323323          // photcode name
    324324          char photname[64];
    325           snprintf (photname, 64, "GPC1.%s.XY%d%d", filter, ix, iy);
     325          snprintf_nowarn (photname, 64, "GPC1.%s.XY%d%d", filter, ix, iy);
    326326          // note that the XY00, XY07, etc, chips will have photcode values of 0
    327327
Note: See TracChangeset for help on using the changeset viewer.