Changeset 5832e9b in mainline


Ignore:
Timestamp:
2007-12-13T00:04:16Z (16 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc76be3
Parents:
9119d25
Message:

Function strncmp() added to libc.

Location:
uspace/lib/libc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/string.c

    r9119d25 r5832e9b  
    145145}
    146146
     147int strncmp(const char *a, const char *b, size_t n)
     148{
     149        size_t c = 0;
     150
     151        while (c < n && a[c] && b[c] && (!(a[c] - b[c])))
     152                c++;
     153       
     154        return ( c < n ? a[c] - b[c] : 0);
     155       
     156}
    147157
    148158/** Return pointer to the first occurence of character c in string
  • uspace/lib/libc/include/string.h

    r9119d25 r5832e9b  
    4747
    4848int strcmp(const char *, const char *);
     49int strncmp(const char *, const char *, size_t n);
    4950
    5051char *strcpy(char *dest, const char *src);
Note: See TracChangeset for help on using the changeset viewer.