Changeset 86fe9d1 in mainline


Ignore:
Timestamp:
2012-08-19T16:11:31Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad1aedc
Parents:
1ba95ba
Message:

wavplay: Add usage help.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/wavplay/main.c

    r1ba95ba r86fe9d1  
    6767}
    6868
    69 
    7069static void data_callback(void* arg, void *buffer, ssize_t size)
    7170{
     
    124123        {"device", required_argument, 0, 'd'},
    125124        {"record", no_argument, 0, 'r'},
     125        {"help", no_argument, 0, 'h'},
    126126        {0, 0, 0, 0}
    127127};
    128128
     129static void print_help(const char* name)
     130{
     131        printf("Usage: %s [options] file\n", name);
     132        printf("supported options:\n");
     133        printf("\t -h, --help\t Print this help.\n");
     134        printf("\t -r, --record\t Start recording instead of playback.\n");
     135        printf("\t -d, --device\t Use specified device instead of sound "
     136            "service. Use location path or special device `default'\n");
     137}
    129138
    130139int main(int argc, char *argv[])
     
    136145        int ret = 0;
    137146        while (ret != -1) {
    138                 ret = getopt_long(argc, argv, "d:r", opts, &idx);
     147                ret = getopt_long(argc, argv, "d:rh", opts, &idx);
    139148                switch (ret) {
    140149                case 'd':
     
    145154                        record = true;
    146155                        break;
     156                case 'h':
     157                        print_help(*argv);
     158                        return 0;
    147159                };
    148160        }
     
    150162        if (optind == argc) {
    151163                printf("Not enough arguments.\n");
     164                print_help(*argv);
    152165                return 1;
    153166        }
Note: See TracChangeset for help on using the changeset viewer.