"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main.cpp" 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.

main.cpp  (bed-3.0.3.src.tar.xz):main.cpp  (bed-3.1.0.src.tar.xz)
skipping to change at line 30 skipping to change at line 30
#include "setenv.h" #include "setenv.h"
#endif #endif
#include "desturbe.h" #include "desturbe.h"
#include "offtypes.h" #include "offtypes.h"
#include <alloca.h> #include <alloca.h>
#include <signal.h> #include <signal.h>
#ifndef NOSIGNALS #ifndef NOSIGNALS
#else #else
#define DONTINTCURSES
#define DONTKILL
#define DONTINTCURSES 1
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include "win.h" #include "win.h"
#if defined(__MINGW32__)&&!defined(SIGTSTP)
#include "signalnums.h"
#endif
#endif #endif
#undef ERR #undef ERR
#include <features.h> #include <features.h>
#include "editor.h" #include "editor.h"
#include "main.h" #include "main.h"
#include "screen.h" #include "screen.h"
#include "readconfig.h" #include "readconfig.h"
#include "dialog.h" #include "dialog.h"
#include "system.h" #include "system.h"
#include "trace.h" #include "trace.h"
skipping to change at line 367 skipping to change at line 374
int wantsignal=0; int wantsignal=0;
#include "macros.h" #include "macros.h"
#if defined(PDCURSES) && defined(_WIN32) #if defined(PDCURSES) && defined(_WIN32)
#ifndef SIGUSR1 #ifndef SIGUSR1
#define SIGUSR1 SIG_GET #define SIGUSR1 SIG_GET
#endif #endif
CALLBACK BOOL ctrlhandler(DWORD sig) { CALLBACK BOOL ctrlhandler(DWORD sig) {
#ifndef DONTKILL
if(!ISPDDEST()) if(!ISPDDEST())
kill(pid,SIGUSR1); kill(pid,SIGUSR1);
else else
#endif
wantsignal=SIGUSR1; wantsignal=SIGUSR1;
return TRUE; return TRUE;
} }
#endif #endif
//#define UNBLOCKSIGNALS //#define UNBLOCKSIGNALS
// //
#ifndef NOSIGNALS #if !defined(NOSIGNALS) && !defined(NOUNBLOCKSIGNALS)
#ifdef NOUNBLOCKSIGNALS
void unblock(int signum) { void unblock(int signum) {
sigset_t mask; sigset_t mask;
sigemptyset(&mask); sigemptyset(&mask);
sigaddset(&mask,signum); sigaddset(&mask,signum);
sigprocmask(SIG_UNBLOCK, &mask, NULL); sigprocmask(SIG_UNBLOCK, &mask, NULL);
} }
#else #else
#define unblock(x) #define unblock(x)
#endif
void omnihandler(int signum) { void omnihandler(int signum) {
wantsignal=0; wantsignal=0;
signal(signum,omnihandler); signal(signum,omnihandler);
playkeys.flush(); playkeys.flush();
if(ISDEST()) { if(ISDEST()) {
wantsignal=signum; wantsignal=signum;
return; return;
} }
#ifdef USETHREADS #ifdef USETHREADS
#ifdef HAS_GETVALUE #ifdef HAS_GETVALUE
skipping to change at line 418 skipping to change at line 425
} }
#endif #endif
GSTOPUSELSEEK((&(edits[editfocus]->mem))); GSTOPUSELSEEK((&(edits[editfocus]->mem)));
#endif #endif
unblock(signum); unblock(signum);
siglongjmp(screenjmp,signum); siglongjmp(screenjmp,signum);
}; };
//sigset_t blockallmask,oldmask; //sigset_t blockallmask,oldmask;
#endif
#ifndef NOSIGNALS
void realtermhandler(int signum) { void realtermhandler(int signum) {
signal(signum,realtermhandler); signal(signum,realtermhandler);
if(ISDEST()) { if(ISDEST()) {
wantsignal=signum; wantsignal=signum;
return; return;
} }
// sigprocmask (SIG_BLOCK, &blockallmask, NULL); // sigprocmask (SIG_BLOCK, &blockallmask, NULL);
waitinput=0; waitinput=0;
INCDEST(); INCDEST();
GSTOPUSELSEEK(&(edits[editfocus]->mem)); GSTOPUSELSEEK(&(edits[editfocus]->mem));
skipping to change at line 499 skipping to change at line 508
unblock(signum); unblock(signum);
} }
// kill(pid,SIGWINCH); // kill(pid,SIGWINCH);
void quithandler(int signum) { void quithandler(int signum) {
ungetch(28); ungetch(28);
signal(SIGQUIT,quithandler); signal(SIGQUIT,quithandler);
}; };
#endif #endif
int margc,miter=1; int margc,miter=1;
//char *const *margv;
char **margv; char **margv;
extern const char NEWFILENAME[]; extern const char NEWFILENAME[];
extern const int newfilenamelen; extern const int newfilenamelen;
extern int newfilesize; extern int newfilesize;
static Editor *newempty(void ) ; static Editor *newempty(void ) ;
Editor *emptyfile(void) { Editor *emptyfile(void) {
Editor *ed; Editor *ed;
static int nr=1; static int nr=1;
skipping to change at line 1065 skipping to change at line 1076
fprintf(stderr,"Unknown signal %d\n",sig); fprintf(stderr,"Unknown signal %d\n",sig);
}; };
} }
#endif #endif
Editor **deathcells; Editor **deathcells;
int maxdeath=5,gossip=0; int maxdeath=5,gossip=0;
extern void doargs(void); extern void doargs(void);
extern int fillhelp(void); extern int fillhelp(void);
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#define _FILE_OFFSET_BITS 64 #define _FILE_OFFSET_BITS 64
#ifndef __MINGW32__
#include <sys/resource.h> #include <sys/resource.h>
#endif
#ifdef MEMORY_TRACE #ifdef MEMORY_TRACE
#include <mcheck.h> #include <mcheck.h>
#endif #endif
extern int waitforsigwinch(void) ; extern int waitforsigwinch(void) ;
#ifdef SEGMENMESSAGE /*I wonder if it always went alright this way */ #ifdef SEGMENMESSAGE /*I wonder if it always went alright this way */
struct sigaction segmentationact; struct sigaction segmentationact;
#define prognamesize 512 #define prognamesize 512
void segm_handler(int signr) { void segm_handler(int signr) {
pid_t pid= getpid(); pid_t pid= getpid();
char *cwdpath=get_current_dir_name(); char *cwdpath=get_current_dir_name();
skipping to change at line 1100 skipping to change at line 1114
#endif #endif
{ {
segmentationact.sa_handler = segm_handler; segmentationact.sa_handler = segm_handler;
sigemptyset(&segmentationact.sa_mask); sigemptyset(&segmentationact.sa_mask);
segmentationact.sa_flags = SA_ONESHOT; segmentationact.sa_flags = SA_ONESHOT;
sigaction(SIGSEGV,&segmentationact,NULL); sigaction(SIGSEGV,&segmentationact,NULL);
#else #else
#ifdef _WIN32 #ifdef _WIN32
OSVERSIONINFO WindowsVersion; OSVERSIONINFO WindowsVersion;
/*
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
{
fprintf(stderr,"CtrlHandler %d\n", fdwCtrlType);
switch (fdwCtrlType)
{
// Handle the CTRL-C signal.
case CTRL_C_EVENT:
case CTRL_BREAK_EVENT:
omnihandler(SIGINT);
return true;
};
return false;
}
*/
#endif #endif
int main(int argc, char **argv) int main(int argc, char **argv)
#ifdef TRYCATCH #ifdef TRYCATCH
try try
#endif #endif
{ {
/* /*
if(!FreeConsole()) { if(!FreeConsole()) {
fprintf(stderr,"FreeConsole failed\n"); fprintf(stderr,"FreeConsole failed\n");
skipping to change at line 1196 skipping to change at line 1225
extern int keyconfig(char *filename=NULL) ; extern int keyconfig(char *filename=NULL) ;
extern int dokeyconfig; extern int dokeyconfig;
if(dokeyconfig) { if(dokeyconfig) {
return keyconfig((char*)((dokeyconfig<margc)?margv[dokeyconfig]:N ULL)); return keyconfig((char*)((dokeyconfig<margc)?margv[dokeyconfig]:N ULL));
} }
#endif #endif
edits[editfocus]->menus(); edits[editfocus]->menus();
#ifdef DEBUGFLAG #ifdef DEBUGFLAG
char pidstr[10]; char pidstr[10];
showstatestate(pidstr,sprintf(pidstr,"%d",pid)); showstatestate(pidstr,sprintf(pidstr,"%ld",pid));
wrefresh(stdscr ); wrefresh(stdscr );
#endif #endif
#ifndef NOSIGNALS #ifndef NOSIGNALS
actionsignal( mysigsetjmp ( screenjmp,1 ) ); actionsignal( mysigsetjmp ( screenjmp,1 ) );
#endif #endif
int ret; int ret;
#if 0 #if 0
{ {
skipping to change at line 1228 skipping to change at line 1257
if(getrlimit(RLIMIT_STACK ,&rlim)!=0) if(getrlimit(RLIMIT_STACK ,&rlim)!=0)
perror("getrlimit"); perror("getrlimit");
fprintf(stderr,"cur=%llu\n",(unsigned long long)rlim.rlim_cur); fprintf(stderr,"cur=%llu\n",(unsigned long long)rlim.rlim_cur);
fprintf(stderr,"max=%llu\n",(unsigned long long)rlim.rlim_max); fprintf(stderr,"max=%llu\n",(unsigned long long)rlim.rlim_max);
}; };
#endif #endif
extern void getstarttime() ; extern void getstarttime() ;
getstarttime() ; getstarttime() ;
#ifdef _WIN32
//SetConsoleCtrlHandler(CtrlHandler, TRUE);
#endif
while(1) { while(1) {
#ifdef TRYCATCH #ifdef TRYCATCH
try try
#endif #endif
{ {
if((ret=edits[editfocus]->fileok())!=0) { if((ret=edits[editfocus]->fileok())!=0) {
Editor *ed=edits[editfocus]; Editor *ed=edits[editfocus];
endedit(ed); endedit(ed);
if(ret>0) if(ret>0)
newfile(ed->mem.filename); newfile(ed->mem.filename);
 End of changes. 13 change blocks. 
5 lines changed or deleted 38 lines changed or added

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