Changeset 0c8e692 in mainline for generic/src/lib/func.c


Ignore:
Timestamp:
2005-12-11T19:55:56Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3550c393
Parents:
54aff98
Message:

Added some readline functionality to kconsole.
Arrows editing, history, tab completion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/lib/func.c

    r54aff98 r0c8e692  
    8080 * @param len Maximal length for comparison.
    8181 *
    82  * @return 0 if the strings are equal, 1 otherwise.
     82 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller.
    8383 *
    8484 */
     
    8888       
    8989        i = 0;
    90         while ((i < len) && (src[i] == dst[i])) {
    91                 if ((i == len - 1) || (src[i] == '\0'))
    92                         return 0;
    93                 i++;
     90        for (;*src && *dst && i < len;src++,dst++,i++) {
     91                if (*src < *dst)
     92                        return -1;
     93                if (*src > *dst)
     94                        return 1;
    9495        }
     96        if (i == len || *src == *dst)
     97                return 0;
     98        if (*src < *dst)
     99                return -1;
    95100        return 1;
    96101}
Note: See TracChangeset for help on using the changeset viewer.