"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/examples/title.cc" between
bed-3.0.3.src.tar.xz and bed-3.1.0.src.tar.xz

About: bed is an adjustable data format binary editor.

title.cc  (bed-3.0.3.src.tar.xz):title.cc  (bed-3.1.0.src.tar.xz)
#include <sys/unistd.h>
#include "global.h" #include "global.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include "config.h" #include "config.h"
#include CURSES_HEADER #include CURSES_HEADER
extern char * ttyname (int __fildes);
#ifdef _WIN32 #ifdef _WIN32
#ifdef PDCURSES #ifdef PDCURSES
#undef MOUSE_MOVED #undef MOUSE_MOVED
#endif #endif
#include <windows.h> #include <windows.h>
#endif #endif
BEDPLUGIN BEDPLUGIN
extern int withinxterm; extern int withinxterm;
#if !defined(PDCURSES) #if !defined(PDCURSES)
static const char titlestart[]="\033]0;"; static const char titlestart[]="\033]0;";
skipping to change at line 154 skipping to change at line 155
else { else {
#endif #endif
len=ptr-hostname; len=ptr-hostname;
*ptr='\0'; *ptr='\0';
} }
}; };
inline char *name() {return hostname;}; inline char *name() {return hostname;};
inline int size() {return len;}; inline int size() {return len;};
}; };
static Host host; static Host host;
#ifdef HAVE_MEMCCPY
memccpy(titlebuf+nr,host.name(),'\0',MAXTITLE-nr); memccpy(titlebuf+nr,host.name(),'\0',MAXTITLE-nr);
#else
strncpy(titlebuf+nr,host.name(),MAXTITLE-nr);
#endif
nr+=host.size(); nr+=host.size();
titlebuf[nr++]='-'; titlebuf[nr++]='-';
} }
#endif #endif
#ifdef TTYNAME #ifdef TTYNAME
#ifdef _WIN32 #ifdef _WIN32
extern int dosconsole(void) ; extern int dosconsole(void) ;
if(!dosconsole()) if(!dosconsole())
#endif #endif
{ {
skipping to change at line 188 skipping to change at line 193
if((len=readlink(procname, nametty, 15))>0&&len<15) { if((len=readlink(procname, nametty, 15))>0&&len<15) {
nametty[len]='\0'; nametty[len]='\0';
#else #else
#ifdef HAS_TTYNAME_R #ifdef HAS_TTYNAME_R
if(!ttyname_r(STDOUT_FILENO,nametty,15)) { if(!ttyname_r(STDOUT_FILENO,nametty,15)) {
#else #else
if((nametty=ttyname(STDOUT_FILENO))) { if((nametty=ttyname(STDOUT_FILENO))) {
#endif #endif
#endif #endif
if(MAXTITLE>nr) { if(MAXTITLE>nr) {
#ifdef HAVE_MEMCCPY
memccpy(titlebuf+nr,nametty+5,'\0',MAXTITLE-nr); memccpy(titlebuf+nr,nametty+5,'\0',MAXTITLE-nr);
#else
strncpy(titlebuf+nr,nametty+5,MAXTITLE-nr);
#endif
nr+=strlen(titlebuf+nr); nr+=strlen(titlebuf+nr);
} }
} }
} }
if(nr<MAXTITLE) if(nr<MAXTITLE)
titlebuf[nr++]=' '; titlebuf[nr++]=' ';
} }
#endif #endif
if(MAXTITLE>nr) { if(MAXTITLE>nr) {
#ifdef HAVE_MEMCCPY
memccpy(titlebuf+nr,getfilename(NULL),'\0',MAXTITLE-nr); memccpy(titlebuf+nr,getfilename(NULL),'\0',MAXTITLE-nr);
#else
strncpy(titlebuf+nr,getfilename(NULL),MAXTITLE-nr);
#endif
} }
titlebuf[MAXTITLE]='\0'; titlebuf[MAXTITLE]='\0';
settitle(titlebuf); settitle(titlebuf);
return 0; return 0;
}; };
}; };
call(titleset) call(titleset)
 End of changes. 8 change blocks. 
1 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)