Fixed saving message to text file under Linux/FreeBSD.
This commit is contained in:
parent
f14b2f3742
commit
c931b13421
@ -52,16 +52,8 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
|
||||
prnacc = "wt";
|
||||
|
||||
strcpy(fnam, "PRN");
|
||||
if(mode == MODE_WRITE and streql(savefile, "\001PRN")) {
|
||||
if(mode == MODE_WRITE and streql(savefile, "\001PRN"))
|
||||
prn = YES;
|
||||
#ifdef __UNIX__
|
||||
if(prnfp == NULL)
|
||||
prnfp = popen(fnam, "w");
|
||||
#else
|
||||
if(prnfp == NULL)
|
||||
prnfp = fsopen(fnam, prnacc, CFG->sharemode);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
strcpy(fnam, savefile);
|
||||
strschg_environ(fnam);
|
||||
@ -126,8 +118,10 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
|
||||
(not prn and not clip and CFG->switches.get(formfeedseparator))) {
|
||||
fwrite("\f", 1, 1, prnfp);
|
||||
}
|
||||
if(not prn)
|
||||
if(not prn) {
|
||||
fclose(prnfp);
|
||||
prnfp = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
char buf[256];
|
||||
@ -141,7 +135,7 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void WriteMsgs(GMsg* msg) {
|
||||
static void WriteMsgs(GMsg* msg) {
|
||||
|
||||
if(AA->Msgn.Tags() == 0)
|
||||
return;
|
||||
|
@ -109,7 +109,6 @@ char* get_informative_string(char* buf);
|
||||
void CmfMsgs(GMsg* msg);
|
||||
void LoadText(GMsg* msg, const char* textfile);
|
||||
void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip=false);
|
||||
void WriteMsgs(GMsg* msg);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -127,6 +127,11 @@ struct Stamp {
|
||||
#define mkdir(path,unused) mkdir(path)
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__ // untested !!!
|
||||
#define getcwd _getcwd2
|
||||
#define chdir _chdir2
|
||||
#endif
|
||||
|
||||
FILE* fsopen(const char* path, const char* type, int shflag);
|
||||
inline FILE* fsopen(const string& path, const char* type, int shflag) { return fsopen(path.c_str(), type, shflag); }
|
||||
|
||||
|
Reference in New Issue
Block a user