Guest User

Untitled

a guest
Nov 18th, 2015
136
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "plugin.h"
  2.  
  3.  
  4. void print_text_formatted(char * text)
  5. {
  6.     char * word, *saveptr;
  7.     word = rb->strtok_r(text, " ", &saveptr);
  8.     while( word != NULL )
  9.     {
  10.         rb->lcd_puts(0,0, word);
  11.         word = rb->strtok_r(NULL, " ", &saveptr);
  12.     }
  13.     return;
  14. }
  15.  
  16. enum plugin_status plugin_start(const void* parameter)
  17. {
  18.     (void)parameter;
  19.     int content_file = rb->open("/wp.wkc", O_RDONLY);
  20.     int index_file = rb->open("/wp.wki", O_RDONLY);
  21.     char idx_entry[80];
  22.     rb->read_line(index_file, idx_entry, 80);
  23.  
  24.     int offset_to_page, page_len;
  25.     char title[30];
  26.     sscanf( idx_entry, "%s %d %d", title, &offset_to_page, &page_len);
  27.  
  28.     rb->lcd_set_background(LCD_WHITE);
  29.     rb->lcd_set_foreground(LCD_BLACK);
  30.     rb->lcd_clear_display();
  31.     print_text_formatted("some text is");
  32.     rb->lcd_update();
  33.     sleep(500);
  34.  
  35.     rb->close(content_file);
  36.     rb->close(index_file);
  37.     return PLUGIN_OK;
  38. }
RAW Paste Data