IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6662


Ignore:
Timestamp:
Mar 21, 2006, 1:40:01 PM (20 years ago)
Author:
jhoblitt
Message:

add -seen mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pztool.c

    r6659 r6662  
    66static bool pendingMode(pxConfig *config);
    77static bool copydoneMode(pxConfig *config);
     8bool summitExpPrint(FILE *stream, summitExpRow *summitExp);
    89
    910int main(int argc, char **argv)
     
    4344{
    4445    PS_ASSERT_PTR_NON_NULL(config, false);
     46
     47    psArray *summit = summitExpSelectRowObjects(config->dbh,
     48        config->where, MAX_ROWS);
     49    if (!summit) {
     50        psError(PS_ERR_UNKNOWN, false, "no summitExp rows found"); \
     51        return false;
     52    }
     53
     54    psArray *new = newExpSelectRowObjects(config->dbh,
     55        config->where, MAX_ROWS);
     56    if (!new) {
     57        psError(PS_ERR_UNKNOWN, false, "no newExp rows found"); \
     58    }
     59
     60    if (new) {
     61        for (long i = 0; i < summit->n; i++) {
     62            summitExpRow *summitExp = summit->data[i];
     63            for (long j = 0; j < summit->n; j++) {
     64                newExpRow *newExp = new->data[j];
     65                if (strcmp(summitExp->exp_id, newExp->exp_id) == 0) {
     66                    psArrayRemove(summit, summitExp);
     67                    // dec the counter as the array just got shorter
     68                    //and we don't want to skip elemnts
     69                    i--;
     70                    break;
     71                }
     72            }
     73        }
     74        psFree(new);
     75    }
     76
     77    for (long i = 0; i < summit->n; i++) {
     78        if (!summitExpPrint(stdout, summit->data[i])) {
     79            psError(PS_ERR_UNKNOWN, false,"summitExpPrint() failed");
     80            return false;
     81        }
     82    }
     83
     84    return true;
    4585}
    4686
     
    5494    PS_ASSERT_PTR_NON_NULL(config, false);
    5595}
     96
     97bool summitExpPrint(FILE *stream, summitExpRow *summitExp)
     98{
     99    PS_ASSERT_PTR_NON_NULL(stream, false);
     100    PS_ASSERT_PTR_NON_NULL(summitExp, false);
     101
     102    fprintf(stream, "%s %s %s %s %s\n",
     103        summitExp->exp_id,
     104        summitExp->camera,
     105        summitExp->telescope,
     106        summitExp->exp_type,
     107        summitExp->uri
     108    );
     109
     110    return true;
     111}
Note: See TracChangeset for help on using the changeset viewer.