Changeset ec81221 in mainline for uspace/lib/hound/src/client.c


Ignore:
Timestamp:
2013-03-24T14:09:11Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2ba4d45
Parents:
7294b5b
Message:

libhound: Handle default target

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/src/client.c

    r7294b5b rec81221  
    160160{
    161161        assert(hound);
    162         if (hound->record)
    163                 return hound_service_connect_source_sink(
     162        assert(target);
     163
     164        const char **tgt = NULL;
     165        size_t count = 1;
     166        int ret = EOK;
     167        if (str_cmp(target, HOUND_DEFAULT_TARGET) == 0) {
     168                ret = hound_context_get_available_targets(hound, &tgt, &count);
     169                if (ret != EOK)
     170                        return ret;
     171                target = tgt[0];
     172        }
     173        //TODO handle all-targets
     174
     175        if (hound->record) {
     176                ret = hound_service_connect_source_sink(
    164177                    hound->session, target, hound->name);
    165         else
    166                 return hound_service_connect_source_sink(
     178        } else {
     179                ret = hound_service_connect_source_sink(
    167180                    hound->session, hound->name, target);
     181        }
     182        if (tgt)
     183                free(tgt[0]);
     184        free(tgt);
     185        return ret;
    168186}
    169187
     
    171189{
    172190        assert(hound);
    173         if (hound->record)
     191        assert(target);
     192        if (hound->record) {
    174193                return hound_service_disconnect_source_sink(
    175194                    hound->session, target, hound->name);
    176         else
     195        } else {
    177196                return hound_service_disconnect_source_sink(
    178197                    hound->session, hound->name, target);
     198        }
    179199}
    180200
Note: See TracChangeset for help on using the changeset viewer.