IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38381


Ignore:
Timestamp:
Jun 5, 2015, 12:09:09 PM (11 years ago)
Author:
eugene
Message:

convert to libohana strextend

Location:
branches/eam_branches/ohana.20150429/src/addstar
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/addstar/include/addstar.h

    r38346 r38381  
    327327void *memrchr(const void *s, int c, size_t n);
    328328int addstar_create_ID ();
    329 int strextend (char *input, char *format,...);
    330329
    331330void initMosaicCoords ();
  • branches/eam_branches/ohana.20150429/src/addstar/src/args.c

    r37807 r38381  
    480480}
    481481
    482 int strextend (char *input, char *format,...) {
    483 
    484   char tmpextra[1024], tmpline[1024];
    485   va_list argp;
    486 
    487   va_start (argp, format);
    488   vsnprintf (tmpextra, 1024, format, argp);
    489   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    490   strcpy (input, tmpline);
    491 
    492   return TRUE;
    493 }
    494 
    495482/** addstar modes:
    496483 
  • branches/eam_branches/ohana.20150429/src/addstar/src/args_parallel_client.c

    r37116 r38381  
    125125}
    126126
    127 int strextend (char *input, char *format,...) {
    128 
    129   char tmpextra[1024], tmpline[1024];
    130   va_list argp;
    131 
    132   va_start (argp, format);
    133   vsnprintf (tmpextra, 1024, format, argp);
    134   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    135   strcpy (input, tmpline);
    136 
    137   return TRUE;
    138 }
    139 
  • branches/eam_branches/ohana.20150429/src/addstar/src/loadICRF_save_remote.c

    r37807 r38381  
    22# include "loadICRF.h"
    33# define DEBUG 1
    4 
    5 int strextend (char *input, char *format,...) {
    6 
    7   char tmpextra[1024], tmpline[1024];
    8   va_list argp;
    9 
    10   va_start (argp, format);
    11   vsnprintf (tmpextra, 1024, format, argp);
    12   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    13   strcpy (input, tmpline);
    14 
    15   return TRUE;
    16 }
    174
    185int loadICRF_save_remote (ICRF_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname, AddstarClientOptions *options) {
     
    6451
    6552    // need to generate the remote command
    66     char command[1024];
    67     snprintf (command, 1024, "loadICRF_client");
    68     strextend (command, "-hostID %d", host->hostID);
    69     strextend (command, "-D CATDIR %s", CATDIR);
    70     strextend (command, "-hostdir %s", host->pathname);
    71     strextend (command, "-cpt %s", region->name);
    72     strextend (command, "-input %s", filename);
    73     strextend (command, "-D ADDSTAR_RADIUS %f", options->radius);
     53    char *command = NULL;
     54    strextend (&command, "loadICRF_client");
     55    strextend (&command, "-hostID %d", host->hostID);
     56    strextend (&command, "-D CATDIR %s", CATDIR);
     57    strextend (&command, "-hostdir %s", host->pathname);
     58    strextend (&command, "-cpt %s", region->name);
     59    strextend (&command, "-input %s", filename);
     60    strextend (&command, "-D ADDSTAR_RADIUS %f", options->radius);
    7461
    7562    fprintf (stderr, "command: %s\n", command);
  • branches/eam_branches/ohana.20150429/src/addstar/src/loadstarpar_save_remote.c

    r37807 r38381  
    22# include "loadstarpar.h"
    33# define DEBUG 1
    4 
    5 int strextend (char *input, char *format,...) {
    6 
    7   char tmpextra[1024], tmpline[1024];
    8   va_list argp;
    9 
    10   va_start (argp, format);
    11   vsnprintf (tmpextra, 1024, format, argp);
    12   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    13   strcpy (input, tmpline);
    14 
    15   return TRUE;
    16 }
    174
    185int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname, AddstarClientOptions *options) {
     
    6249
    6350    // need to generate the remote command
    64     char command[1024];
    65     snprintf (command, 1024, "loadstarpar_client");
    66     strextend (command, "-hostID %d", host->hostID);
    67     strextend (command, "-D CATDIR %s", CATDIR);
    68     strextend (command, "-hostdir %s", host->pathname);
    69     strextend (command, "-cpt %s", region->name);
    70     strextend (command, "-input %s", filename);
     51    char *command = NULL;
     52    strextend (&command, "loadstarpar_client");
     53    strextend (&command, "-hostID %d", host->hostID);
     54    strextend (&command, "-D CATDIR %s", CATDIR);
     55    strextend (&command, "-hostdir %s", host->pathname);
     56    strextend (&command, "-cpt %s", region->name);
     57    strextend (&command, "-input %s", filename);
    7158
    7259    // launch the job on the remote machine (no handshake)
     
    7865    }
    7966    host->pid = pid; // save for future reference
     67    free (command);
    8068   
    8169    save_remote_host (host);
  • branches/eam_branches/ohana.20150429/src/addstar/src/resort_catalogs.c

    r37116 r38381  
    7474    table->hosts[i].pathname = tmppath;
    7575
    76     char command[1024];
    77     snprintf (command, 1024, "addstar_client -resort");
    78     strextend (command, "-D CATDIR %s", CATDIR);
    79     strextend (command, "-hostID %d", table->hosts[i].hostID);
    80     strextend (command, "-hostdir %s", table->hosts[i].pathname);
    81     strextend (command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     76    char *command = NULL;
     77    strextend (&command, "addstar_client -resort");
     78    strextend (&command, "-D CATDIR %s", CATDIR);
     79    strextend (&command, "-hostID %d", table->hosts[i].hostID);
     80    strextend (&command, "-hostdir %s", table->hosts[i].pathname);
     81    strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    8282
    83     if (VERBOSE)                   strextend (command, "%s -v");
    84     if (NTHREADS)                  strextend (command, "%s -threads %d", NTHREADS);
    85     if (OLD_RESORT)                strextend (command, "%s -old-resort");
    86     if (options->nosort == 3)      strextend (command, "%s -force-sort");
    87     if (options->existing_regions) strextend (command, "%s -existing-regions");
     83    if (VERBOSE)                   strextend (&command, "-v");
     84    if (NTHREADS)                  strextend (&command, "-threads %d", NTHREADS);
     85    if (OLD_RESORT)                strextend (&command, "-old-resort");
     86    if (options->nosort == 3)      strextend (&command, "-force-sort");
     87    if (options->existing_regions) strextend (&command, "-existing-regions");
    8888
    8989    fprintf (stderr, "command: %s\n", command);
Note: See TracChangeset for help on using the changeset viewer.