
/*
 * menuitem.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <string.h>

#include <vdr/eit.h>
#include <vdr/channels.h>
#include <vdr/font.h>

#include "menuitem.h"


// --- cMenuDVDItem ------------------------------------------------------

cMenuDVDItem::cMenuDVDItem(char *name,char *dir) {

  asprintf(&dateiname,"%s", name);
  SetText(substring(name,strlen(dir)+1,strlen(name)-1), true);
}


cMenuDVDItem::~cMenuDVDItem(){

}


char * cMenuDVDItem::substring(char * data, int First, int Last)
{
 int i;
 char * local;
 if ((First<0) | (Last> (signed int) strlen(data) - 1) | (First>Last) )
  return NULL;
 else
 {
  local = (char*)calloc(Last-First+2, sizeof(char));
  for (i=0; i<Last-First+1; ++i)
   *(local+i) = *(data+First+i);
  *(local+i)='\0';
  return local;
 }
}


