strstr_P() with reversed progmemness of parameters

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In avr-libc, strstr_P() is an equivalent of <string.h>-prototyped strstr(), where the second parameter is in FLASH. It's supposed usage is to search a keyword (stored in FLASH) in an incoming buffer (in RAM).


On a local forum, somebody asked for a variant of this function where the first parameter is in FLASH, i.e. to search a user-entered token (stored in RAM) in a list of tokens (in FLASH).


I have modified strstr_P() into strstr_P2() (with some rudimentary usage example - and sectionname.h simply copied from avr-libc/common), but I haven't actively programmed AVRs for quite some time.


Can somebody please review and perhaps comment?




Jan Waclawek