File: bug-22828.c

package info (click to toggle)
avr-libc 1%3A1.6.2.cvs20080610-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,848 kB
  • ctags: 55,619
  • sloc: ansic: 92,267; asm: 6,692; sh: 4,131; makefile: 2,481; python: 976; pascal: 426; perl: 116
file content (27 lines) | stat: -rw-r--r-- 652 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* bug #22828: eeprom_write_block(): incompatibility in args order
   $Id: bug-22828.c,v 1.1.2.2 2008/04/04 08:14:46 dmix Exp $	*/

#include <string.h>

#ifdef	__AVR__
# include <avr/eeprom.h>
# define EEPROM_ADDR	(void *)1
#else
# define eeprom_write_block(src, dst, size)	memcpy (dst, src, size)
# define eeprom_read_block(dst, src, size)	memcpy (dst, src, size)
char EEPROM_ADDR[20];
#endif

const char s[] = "Apple";
char t[sizeof(s)];

int main ()
{

    eeprom_write_block (s, EEPROM_ADDR, sizeof(s));
    memset (t, 0, sizeof(t));
    eeprom_read_block (t, EEPROM_ADDR, sizeof(t));
    if (strcmp (t, "Apple")) return __LINE__;

    return 0;
}