source: soft/giet_vm/giet_libs/string.c @ 304

Last change on this file since 304 was 258, checked in by alain, 11 years ago

This is a major release, including a deep restructuration of code.
The main evolutions are

  • use of the Tsar preloader to load the GIET boot-loader from disk
  • introduction of a FAT32 file system library,
  • use of this fat32 library by the boot-loader to load the map.bin data structure, and the various .elf files
  • reorganisation of drivers (one file per peripheral).
  • introduction of drivers for new peripherals: vci_chbuf_dma and vci_multi_ahci.
  • introduction of a new physical memory allocator in the boot code.

This release has been tested on the tsar_generic_iob architecture,
for the two following mappings: 4c_1p_iob_four.xml and 4c_1p_iob_sort.xml

  • Property svn:executable set to *
File size: 1.4 KB
RevLine 
[258]1//////////////////////////////////////////////////////////////////////////////////
2// File     : string.c
3// Date     : 23/05/2013
4// Author   : Alexandre JOANNOU, Laurent LAMBERT
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8///////////////////////////////////////////////////////////////////////////////////
9// char * strcpy ( char * destination, const char * source )
10///////////////////////////////////////////////////////////////////////////////////
11char * strcpy ( char * destination, const char * source )
12{
13    if (!destination || !source)
14        return destination;
15
16    while (*source)
17        *(destination++) = *(source++);
18
19    return destination;
20}
21
22///////////////////////////////////////////////////////////////////////////////////
23// int strcmp ( const char * str1, const char * str2 )
24///////////////////////////////////////////////////////////////////////////////////
25int strcmp ( const char * str1, const char * str2 )
26{
27    if (!str1 || !str2)
28        return -123456; // return a value out of the char's bounds
29
30    while (*str1 && *str1 == *str2)
31    {
32        str1++;
33        str2++;
34    }
35
36    return (*str1 - *str2);
37}
38
39// Local Variables:
40// tab-width: 4
41// c-basic-offset: 4
42// c-file-offsets:((innamespace . 0)(inline-open . 0))
43// indent-tabs-mode: nil
44// End:
45// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
Note: See TracBrowser for help on using the repository browser.