IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 74


Ignore:
Timestamp:
May 15, 2003, 11:21:54 PM (23 years ago)
Author:
eugene
Message:

support for -daemon

Location:
trunk/Ohana/src/imregister/imreg
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/imregister/imreg/ConfigPID.c

    r69 r74  
    1 # include ".h"
     1# include "imregister.h"
     2# include "imreg.h"
    23
    34static char *PIDMaster = (char *) NULL;
     
    7778  return (TRUE);
    7879}
     80
     81int Shutdown (int status) {
     82
     83  RemovePID ();
     84  exit (status);
     85}
  • trunk/Ohana/src/imregister/imreg/SetSignals.c

    r69 r74  
    1 # include "controller.h"
     1# include "imregister.h"
     2# include "imreg.h"
    23
    34void SIG_DIE (int sig) {
     
    109110  if (!LoadPID (pidfile, &pid, username, machine)) {
    110111    fprintf (stderr, "imstatreg is not running\n");
    111     exit (0);
     112    exit (2);
    112113  }
    113114
  • trunk/Ohana/src/imregister/imreg/args.imregister.c

    r70 r74  
    2020    remove_argument (N, &argc, argv);
    2121    NoReg = TRUE;
     22  }
     23
     24  NeedType = FALSE;
     25  if (N = get_argument (argc, argv, "-needtype")) {
     26    remove_argument (N, &argc, argv);
     27    NeedType = TRUE;
    2228  }
    2329
  • trunk/Ohana/src/imregister/imreg/args.imsearch.c

    r70 r74  
    2929  /* image type (dark, flat, bias, etc) */
    3030  criteria.TypeSelect = FALSE;
    31   criteria.Type = T_NONE;
     31  criteria.Type = T_UNDEF;
    3232  if (N = get_argument (argc, argv, "-type")) {
    3333    remove_argument (N, &argc, argv);
    34     for (i = 0; (i < NTYPE) && (criteria.Type == T_NONE); i++) {
     34    for (i = 0; (i < NTYPE) && (criteria.Type == T_UNDEF); i++) {
    3535      if (!strncasecmp (argv[N], typename[i], strlen(argv[N]))) criteria.Type = i;
    3636    }
    37     if (criteria.Type == T_NONE) {
     37    if (criteria.Type == T_UNDEF) {
    3838      fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);
    3939      exit (1);
     
    251251      output.modify_type = TRUE;
    252252      remove_argument (N, &argc, argv);
    253       output.type == T_NONE;
    254       for (i = 0; (i < NTYPE) && (output.type == T_NONE); i++) {
     253      output.type == T_UNDEF;
     254      for (i = 0; (i < NTYPE) && (output.type == T_UNDEF); i++) {
    255255        if (!strncasecmp (argv[N], typename[i], strlen(argv[N]))) output.type = i;
    256256      }
    257       if (output.type == T_NONE) {
     257      if (output.type == T_UNDEF) {
    258258        fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);
    259259        exit (1);
  • trunk/Ohana/src/imregister/imreg/iminfo.c

    r70 r74  
    3636  Naxes = 2;
    3737  extend = FALSE;
    38   image[0].mode = MODE_SINGLE;
     38  image[0].mode = M_SINGLE;
    3939  image[0].flag = 0;
    4040  image[0].ccd  = 0;
     
    4545  if (extend) { /* MEF file */
    4646    fits_scan (&header, "NEXTEND",  "%d", 1, &Nextend);
    47     image[0].mode = MODE_MEF;
     47    image[0].mode = M_MEF;
    4848    image[0].ccd  = Nextend;
    4949  }
    5050  if (Naxes == 3) { /* data cube */
    5151    fits_scan (&header, "NAXIS3",  "%d", 1, &Nextend);
    52     image[0].mode = MODE_CUBE;
     52    image[0].mode = M_CUBE;
    5353    image[0].ccd  = Nextend;
    5454    dtime = (float *)&image[0].junk[0];
    5555    fits_scan (&header, "SEQTIME", "%f", 1, dtime);
    5656  }
    57   if (SingleIsSplit && (image[0].mode == MODE_SINGLE)) {
    58     image[0].mode = MODE_SPLIT;
     57  if (SingleIsSplit && (image[0].mode == M_SINGLE)) {
     58    image[0].mode = M_SPLIT;
    5959    image[0].ccd  = MatchCCDNameHeader (&header);
    6060  }
     
    6464  fits_scan (&header, ImagetypeKeyword,  "%s", 1, &Imagetype);
    6565
    66   image[0].type = TYPE_NONE;
     66  image[0].type = T_NONE;
    6767  if (!strcasecmp (Imagetype, "OBJECT")) {
    68     image[0].type = TYPE_OBJECT;
     68    image[0].type = T_OBJECT;
    6969  }
    7070  if (!strcasecmp (Imagetype, "DARK")) {
    71     image[0].type = TYPE_DARK;
     71    image[0].type = T_DARK;
    7272  }
    7373  if (!strcasecmp (Imagetype, "BIAS")) {
    74     image[0].type = TYPE_BIAS;
     74    image[0].type = T_BIAS;
    7575  }
    7676  if (!strcasecmp (Imagetype, "FLAT")) {
    77     image[0].type = TYPE_FLAT;
     77    image[0].type = T_FLAT;
    7878  }
    7979  if (!strcasecmp (Imagetype, "SKYFLAT")) {
    80     image[0].type = TYPE_FLAT;
     80    image[0].type = T_FLAT;
     81  }
     82  if (NeedType && (image[0].type == T_NONE)) {
     83    fprintf (stderr, "ERROR: skipping unknown image type\n");
     84    exit (1);
    8185  }
    8286
  • trunk/Ohana/src/imregister/imreg/imregclient.c

    r69 r74  
    1818  /* get stats file (has sky, bias, etc) */
    1919  switch (image[0].mode) {
    20   case MODE_MEF:
    21   case MODE_SPLIT:
     20  case M_MEF:
     21  case M_SPLIT:
    2222    f = fopen (statfile, "r");
    2323    if (f == (FILE *) NULL) {
     
    3030    Nentry = 1;
    3131    break;
    32   case MODE_SINGLE:
     32  case M_SINGLE:
    3333    f = fopen (statfile, "r");
    3434    if (f == (FILE *) NULL) {
     
    4040    Nentry = 1;
    4141    break;
    42   case MODE_CUBE:
     42  case M_CUBE:
    4343    f = fopen (statfile, "r");
    4444    if (f == (FILE *) NULL) {
  • trunk/Ohana/src/imregister/imreg/modify.c

    r70 r74  
    3434
    3535    if (output.mef2split) {
    36       if (image[i].mode == MODE_MEF) {
     36      if (image[i].mode == M_MEF) {
    3737        root = filerootname (image[i].filename);
    3838        ext = fileextname (image[i].filename);
     
    4141        snprintf (image[i].pathname, 128, "%s/%s", path, root);
    4242        snprintf (image[i].filename, 64,  "%s%02d.%s", root, image[i].ccd, ext);
    43         image[i].mode = MODE_SPLIT;
     43        image[i].mode = M_SPLIT;
    4444        free (root);
    4545        free (ext);
     
    4949
    5050    if (output.split2mef) {
    51       if (image[i].mode == MODE_SPLIT) {
     51      if (image[i].mode == M_SPLIT) {
    5252        ext  = fileextname (image[i].filename);
    5353        root = filebasename (image[i].pathname);
     
    5656        snprintf (image[i].pathname, 128, "%s", path);
    5757        snprintf (image[i].filename, 64,  "%s.%s", root, ext);
    58         image[i].mode = MODE_MEF;
     58        image[i].mode = M_MEF;
    5959        free (root);
    6060        free (ext);
  • trunk/Ohana/src/imregister/imreg/output.c

    r70 r74  
    178178  char ccdstr[64]; 
    179179  int i, j;
    180   char *pmode, *ptype, *timestr, *root, *path;
     180  char *modestr, *typestr, *timestr, *root, *path;
    181181
    182182  /* print the selected entries */
     
    185185    i = match[j];
    186186
    187     if ((image[i].mode < 0) || (image[i].mode >= NMODE))
    188       pmode = modename[0];
    189     else
    190       pmode = modename[(int)image[i].mode];
    191 
    192     if ((image[i].type < 0) || (image[i].type >= NTYPE))
    193       ptype = typename[0];
    194     else
    195       ptype = typename[(int)image[i].type];
    196 
    197     if (RegTimeMode)
    198       timestr = sec_to_date (image[i].regtime);
    199     else
    200       timestr = sec_to_date (image[i].obstime);
     187    modestr = ((image[i].mode < 0) || (image[i].mode >= NMODE)) ? modename[0] : modename[(int)image[i].mode];
     188    typestr = ((image[i].type < 0) || (image[i].type >= NTYPE)) ? typename[0] : typename[(int)image[i].type];
     189    timestr = RegTimeMode ? sec_to_date (image[i].regtime) : sec_to_date (image[i].obstime);
    201190
    202191    if (CCDSeq) {
     
    214203
    215204      /* do i want ccdstr? add a dot? 654321o.ccd00.ext */
    216       if (image[i].mode == MODE_MEF) {
    217         fprintf (stdout, "%s/%s %s/%s%02d %s %s\n", image[i].pathname, image[i].filename, root, root, image[i].ccd, ccdstr, pmode);
    218       }
    219 
    220       if (image[i].mode == MODE_SPLIT) {
     205      if (image[i].mode == M_MEF) {
     206        fprintf (stdout, "%s/%s %s/%s%02d %s %s\n", image[i].pathname, image[i].filename, root, root, image[i].ccd, ccdstr, modestr);
     207      }
     208
     209      if (image[i].mode == M_SPLIT) {
    221210        path = basename (image[i].pathname);
    222211        fprintf (stdout, "%s/%s %s/%s %s %s\n", image[i].pathname, image[i].filename, path, root, ccdstr, "SPLIT");
    223212      }
    224213
    225       if ((image[i].mode == MODE_SINGLE) || (image[i].mode == MODE_CUBE)) {
    226         fprintf (stdout, "%s/%s %s 0 %s\n", image[i].pathname, image[i].filename, root, pmode);
     214      if ((image[i].mode == M_SINGLE) || (image[i].mode == M_CUBE)) {
     215        fprintf (stdout, "%s/%s %s 0 %s\n", image[i].pathname, image[i].filename, root, modestr);
    227216      }
    228217    } else {
    229218      /* this is somewhat poor: I have predefined a subset of value, and I can't guarantee that 'filter' has no spaces */
    230       fprintf (stdout, "%5d %6s %6s %s  ", i, ptype, pmode, ccdstr);
     219      fprintf (stdout, "%5d %6s %6s %s  ", i, typestr, modestr, ccdstr);
    231220      fprintf (stdout, "%s %s  ", image[i].pathname, image[i].filename);
    232221      fprintf (stdout, "%s %f %s %f %f %f\n", image[i].filter, image[i].exptime,
  • trunk/Ohana/src/imregister/imreg/submit.c

    r68 r74  
    1717  */
    1818
    19   if (image[0].mode == MODE_MEF) {
     19  if (image[0].mode == M_MEF) {
    2020    for (i = 0; i < image[0].ccd; i++) {
    2121      root = filerootname (image[0].filename);
    2222      sprintf (line, "%s/%s %s/%s%s %s %s", image[0].pathname, image[0].filename, root, root, ccdn[i], ccds[i], "MEF");
    2323      if (!WriteFIFO (ImstatFifo, line)) return (FALSE);
    24       if (image[0].type == TYPE_OBJECT) {
     24      if (image[0].type == T_OBJECT) {
    2525        if (!WriteFIFO (PtolemyFifo, line)) return (FALSE);
    2626      }
     
    2828  }
    2929
    30   if (image[0].mode == MODE_SINGLE) {
     30  if (image[0].mode == M_SINGLE) {
    3131    root = filerootname (image[0].filename);
    3232    sprintf (line, "%s/%s %s %02d %s", image[0].pathname, image[0].filename, root, 0, "SINGLE");
    3333    if (!WriteFIFO (ImstatFifo, line)) return (FALSE);
    34     if (image[0].type == TYPE_OBJECT) {
     34    if (image[0].type == T_OBJECT) {
    3535      if (!WriteFIFO (PtolemyFifo, line)) return (FALSE);
    3636    }
    3737  }
    3838
    39   if (image[0].mode == MODE_CUBE) {
     39  if (image[0].mode == M_CUBE) {
    4040    root = filerootname (image[0].filename);
    4141    sprintf (line, "%s/%s %s %02d %s", image[0].pathname, image[0].filename, root, 0, "CUBE");
    4242    if (!WriteFIFO (ImstatFifo, line)) return (FALSE);
    43     if (image[0].type == TYPE_OBJECT) {
     43    if (image[0].type == T_OBJECT) {
    4444      if (!WriteFIFO (PtolemyFifo, line)) return (FALSE);
    4545    }
    4646  }
    4747
    48   if (image[0].mode == MODE_SPLIT) {
     48  if (image[0].mode == M_SPLIT) {
    4949    path = basename (image[0].pathname);
    5050    root = filerootname (image[0].filename);
    5151    sprintf (line, "%s/%s %s/%s %02d %s", image[0].pathname, image[0].filename, path, root, image[0].ccd, "SPLIT");
    5252    if (!WriteFIFO (ImstatFifo, line)) return (FALSE);
    53     if (image[0].type == TYPE_OBJECT) {
     53    if (image[0].type == T_OBJECT) {
    5454      if (!WriteFIFO (PtolemyFifo, line)) return (FALSE);
    5555    }
Note: See TracChangeset for help on using the changeset viewer.