suspend.cpp (bed-3.0.3.src.tar.xz) | : | suspend.cpp (bed-3.1.0.src.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
extern void stophandler(int signum) ; | extern void stophandler(int signum) ; | |||
#endif | #endif | |||
#undef ERR | #undef ERR | |||
#include <signal.h> | #include <signal.h> | |||
#undef ERR | #undef ERR | |||
#ifdef GETOTHERTERM | #ifdef GETOTHERTERM | |||
extern int piddenlen; | extern int piddenlen; | |||
extern pid_t *pidden; | extern pid_t *pidden; | |||
#endif | #endif | |||
#include "cursesinit.h" | #include "cursesinit.h" | |||
#if defined(__MINGW32__)&&!defined(SIGTSTP) | ||||
#include "signalnums.h" | ||||
#endif | ||||
#ifndef HAVE_SETENV | ||||
int setenv(const char *var,const char *value, int overwrite) { | ||||
if(overwrite==1||!getenv(var)) { | ||||
char buf[1024]; | ||||
snprintf(buf,1024,"%s=%s",var,value); | ||||
return _putenv(buf); | ||||
} | ||||
return 0; | ||||
} | ||||
int unsetenv(const char *var) { | ||||
char buf[512]; | ||||
snprintf(buf,512,"%s=",var); | ||||
return _putenv(buf); | ||||
} | ||||
#endif | ||||
char * file2buf(const char *name,int *len) { | char * file2buf(const char *name,int *len) { | |||
char *buf; | char *buf; | |||
int end; | int end; | |||
int fd=open(name,O_RDONLY BINARY_FLAG); | int fd=open(name,O_RDONLY BINARY_FLAG); | |||
if(fd<0) | if(fd<0) | |||
return NULL; | return NULL; | |||
end=lseek(fd,0,SEEK_END); | end=lseek(fd,0,SEEK_END); | |||
buf= (char *)malloc(end); | buf= (char *)malloc(end); | |||
lseek(fd,0,SEEK_SET); | lseek(fd,0,SEEK_SET); | |||
if(read(fd,buf,end)<end) { | if(read(fd,buf,end)<end) { | |||
skipping to change at line 59 | skipping to change at line 78 | |||
return end; | return end; | |||
} | } | |||
#include "shell.h" | #include "shell.h" | |||
#ifndef HAS_GETUSERSHELL | #ifndef HAS_GETUSERSHELL | |||
#ifndef __ANDROID__ | #ifndef __ANDROID__ | |||
char **openshells(int *nr) { | char **openshells(int *nr) { | |||
int len; | int len; | |||
char *shells= file2buf("/etc/shells",&len); | char *shells= file2buf("/etc/shells",&len); | |||
if(!shells) { | if(!shells) { | |||
*nr=0 | *nr=0; | |||
return NULL; | return NULL; | |||
} | } | |||
char *shelp; | char *shelp; | |||
int i; | int i; | |||
char *endshell=shells+len; | char *endshell=shells+len; | |||
for(i=0,shelp=shells;shelp<endshell;i++) { | for(i=0,shelp=shells;shelp<endshell;i++) { | |||
if(!(shelp=(char*)memchr(shelp, '\n', endshell-shelp))) { | if(!(shelp=(char*)memchr(shelp, '\n', endshell-shelp))) { | |||
i++; | i++; | |||
break; | break; | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 20 lines changed or added |