IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 6, 2005, 4:08:12 PM (21 years ago)
Author:
jhoblitt
Message:

remove unused var (n) from nebCull()
change nebDelete() to return bool
change nebDelete() param key to const
fill in nebDelete()
fix segfault in nebDeleteInstance()
change nebParseURI to check if URI is NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/nebclient/src/nebclient.c

    r4467 r4492  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.c,v 1.9 2005-07-07 00:16:11 jhoblitt Exp $
     6 * $Id: nebclient.c,v 1.10 2005-07-07 02:08:12 jhoblitt Exp $
    77 */
    88
     
    149149{
    150150    char            **locations;
    151     int             n;
    152151
    153152    if (nebFindInstances(server, (char *)key, NULL, &locations) < 2) {
     
    252251}
    253252
    254 int nebDelete(nebServer *server, char *key )
    255 {
    256 
    257     return 0;
     253bool nebDelete(nebServer *server, const char *key)
     254{
     255    char            **locations;
     256    int             n;
     257    int             i;
     258
     259    n = nebFindInstances(server, (char *)key, NULL, &locations);
     260
     261    if (n < 0) {
     262        fprintf(stderr, "no instances found\n");
     263        nebFree(locations);
     264
     265        return false;
     266    }
     267
     268    for (i = 0; i < n; i++) {
     269        printf("nebDelete location is: %s\n", locations[i]);
     270
     271        if (!nebDeleteInstance(server, locations[i])) {
     272            nebFree(locations);
     273
     274            return false;
     275        }
     276    }
     277
     278    nebFree(locations);
     279
     280    return true;
    258281}
    259282
     
    272295bool nebDeleteInstance(nebServer *server, const char *URI)
    273296{
    274     int             *response;
     297    int             response;
    275298    char            *filename;
    276299    bool            status;
     
    282305    }
    283306
    284     if (soap_call_ns1__delete_USCOREinstance(server, NULL, NULL, (char *)URI, response) != SOAP_OK) {
     307    if (soap_call_ns1__delete_USCOREinstance(server, NULL, NULL, (char *)URI, &response) != SOAP_OK) {
    285308        nebFree(filename);
    286309
     
    288311    }
    289312
    290     if (*response > 0) {
     313    if (response > 0) {
    291314        status = nebNukeFile(filename);
    292315    } else {
     
    321344    int             matchLength;
    322345
     346    if (!URI) {
     347        return 0;
     348    }
     349
    323350    status = regcomp(&myregex, pattern, REG_EXTENDED);
    324351    if (status != 0) {
Note: See TracChangeset for help on using the changeset viewer.