Changeset 5c769d54 in mainline for uspace/app/devctl/devctl.c


Ignore:
Timestamp:
2017-09-22T17:06:08Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd1745f
Parents:
207d5da
Message:

devctl list-drv can use io/table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/devctl/devctl.c

    r207d5da r5c769d54  
    3535#include <devman.h>
    3636#include <errno.h>
     37#include <io/table.h>
    3738#include <stdbool.h>
    3839#include <stdio.h>
     
    205206        size_t ndevs;
    206207        size_t i;
     208        table_t *table = NULL;
    207209        int rc;
    208210
     
    210212        if (rc != EOK)
    211213                return rc;
     214
     215        rc = table_create(&table);
     216        if (rc != EOK) {
     217                assert(rc == ENOMEM);
     218                goto out;
     219        }
     220
     221        table_header_row(table);
     222        table_printf(table, "Driver\t" "Devs\t" "State\n");
    212223
    213224        for (i = 0; i < ndrvs; i++) {
     
    226237                sstate = drv_state_str(state);
    227238
    228                 printf("%-11s %3zu %s\n", sstate, ndevs, drv_name);
     239                table_printf(table, "%s\t" "%zu\t" "%s\n", drv_name, ndevs, sstate);
    229240skip:
    230241                free(devs);
    231242        }
     243
     244        rc = table_print_out(table, stdout);
     245        if (rc != EOK)
     246                printf("Error printing driver table.\n");
     247out:
    232248        free(drvs);
    233 
    234         return EOK;
     249        table_destroy(table);
     250
     251        return rc;
    235252}
    236253
Note: See TracChangeset for help on using the changeset viewer.