Changeset b828907 in mainline for uspace/app


Ignore:
Timestamp:
2012-07-20T20:29:54Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
34bc2fe
Parents:
4cdac68 (diff), 6de2d766 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with mainline

Location:
uspace/app
Files:
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r4cdac68 rb828907  
    176176
    177177        bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
    178 
     178       
    179179        if (reading_stdin) {
    180180                fd = fileno(stdin);
    181181                /* Allow storing the whole UTF-8 character. */
    182182                blen = STR_BOUNDS(1);
    183         } else {
     183        } else
    184184                fd = open(fname, O_RDONLY);
    185         }
     185       
    186186        if (fd < 0) {
    187187                printf("Unable to open %s\n", fname);
     
    222222                        bytes_to_read = 1;
    223223                } else {
    224                         if ((length != CAT_FULL_FILE)
    225                             && (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
     224                        if ((length != CAT_FULL_FILE) &&
     225                            (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
    226226                                bytes_to_read = (size_t) (length - count);
    227227                        } else {
     
    229229                        }
    230230                }
     231               
    231232                bytes = read(fd, buff + copied_bytes, bytes_to_read);
    232233                bytes += copied_bytes;
     
    261262                        reads++;
    262263                }
    263 
    264                 if (reading_stdin) {
     264               
     265                if (reading_stdin)
    265266                        fflush(stdout);
    266                 }
    267267        } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
    268268
  • uspace/app/usbinfo/Makefile

    r4cdac68 rb828907  
    4747        hid.c \
    4848        info.c \
     49        list.c \
    4950        main.c
    5051
  • uspace/app/usbinfo/list.c

    r4cdac68 rb828907  
    4747#include <usb/hc.h>
    4848
    49 #define NAME "lsusb"
     49#include "usbinfo.h"
    5050
    5151#define MAX_USB_ADDRESS USB11_ADDRESS_MAX
     
    9090}
    9191
    92 int main(int argc, char *argv[])
     92void list(void)
    9393{
    9494        category_id_t usbhc_cat;
     
    102102                printf(NAME ": Error resolving category '%s'",
    103103                    USB_HC_CATEGORY);
    104                 return 1;
     104                return;
    105105        }
    106106
     
    108108        if (rc != EOK) {
    109109                printf(NAME ": Error getting list of host controllers.\n");
    110                 return 1;
     110                return;
    111111        }
    112112
     
    131131
    132132        free(svcs);
    133 
    134         return 0;
    135133}
    136134
  • uspace/app/usbinfo/main.c

    r4cdac68 rb828907  
    6262
    6363        _OPTION("-h --help", "Print this help and exit.");
     64        _OPTION("-l --list", "Print a list of host controllers and devices.");
    6465        _OPTION("-i --identification", "Brief device identification.");
    6566        _OPTION("-m --match-ids", "Print match ids generated for the device.");
     
    8283        {"help", no_argument, NULL, 'h'},
    8384        {"identification", no_argument, NULL, 'i'},
     85        {"list", no_argument, NULL, 'l'},
    8486        {"match-ids", no_argument, NULL, 'm'},
    8587        {"descriptor-tree", no_argument, NULL, 't'},
     
    9193        {0, 0, NULL, 0}
    9294};
    93 static const char *short_options = "himtTsSrR";
     95static const char *short_options = "hilmtTsSrR";
    9496
    9597static usbinfo_action_t actions[] = {
     
    146148        }
    147149
     150        bool something_active = false;
    148151        /*
    149152         * Process command-line options. They determine what shall be
     
    156159                switch (opt) {
    157160                        case -1:
     161                                break;
     162                        case 'l':
     163                                list();
    158164                                break;
    159165                        case '?':
     
    168174                                        if (actions[idx].opt == opt) {
    169175                                                actions[idx].active = true;
     176                                                something_active = true;
    170177                                                break;
    171178                                        }
     
    178185
    179186        /* Set the default action. */
    180         int idx = 0;
    181         bool something_active = false;
    182         while (actions[idx].opt != 0) {
    183                 if (actions[idx].active) {
    184                         something_active = true;
    185                         break;
    186                 }
    187                 idx++;
    188         }
    189187        if (!something_active) {
    190188                actions[0].active = true;
  • uspace/app/usbinfo/usbinfo.h

    r4cdac68 rb828907  
    7979    dump_descriptor_in_tree_t, size_t, void *);
    8080
     81void list(void);
    8182
    8283void dump_short_device_identification(usbinfo_device_t *);
Note: See TracChangeset for help on using the changeset viewer.