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";
|
prnacc = "wt";
|
||||||
|
|
||||||
strcpy(fnam, "PRN");
|
strcpy(fnam, "PRN");
|
||||||
if(mode == MODE_WRITE and streql(savefile, "\001PRN")) {
|
if(mode == MODE_WRITE and streql(savefile, "\001PRN"))
|
||||||
prn = YES;
|
prn = YES;
|
||||||
#ifdef __UNIX__
|
|
||||||
if(prnfp == NULL)
|
|
||||||
prnfp = popen(fnam, "w");
|
|
||||||
#else
|
|
||||||
if(prnfp == NULL)
|
|
||||||
prnfp = fsopen(fnam, prnacc, CFG->sharemode);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
strcpy(fnam, savefile);
|
strcpy(fnam, savefile);
|
||||||
strschg_environ(fnam);
|
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))) {
|
(not prn and not clip and CFG->switches.get(formfeedseparator))) {
|
||||||
fwrite("\f", 1, 1, prnfp);
|
fwrite("\f", 1, 1, prnfp);
|
||||||
}
|
}
|
||||||
if(not prn)
|
if(not prn) {
|
||||||
fclose(prnfp);
|
fclose(prnfp);
|
||||||
|
prnfp = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char buf[256];
|
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)
|
if(AA->Msgn.Tags() == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +109,6 @@ char* get_informative_string(char* buf);
|
|||||||
void CmfMsgs(GMsg* msg);
|
void CmfMsgs(GMsg* msg);
|
||||||
void LoadText(GMsg* msg, const char* textfile);
|
void LoadText(GMsg* msg, const char* textfile);
|
||||||
void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip=false);
|
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)
|
#define mkdir(path,unused) mkdir(path)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __EMX__ // untested !!!
|
||||||
|
#define getcwd _getcwd2
|
||||||
|
#define chdir _chdir2
|
||||||
|
#endif
|
||||||
|
|
||||||
FILE* fsopen(const char* path, const char* type, int shflag);
|
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); }
|
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