Fix CR/LF problem

This commit is contained in:
Alexander S. Aganichev 2003-02-27 08:24:23 +00:00
parent ce1e6eadea
commit 2bbcabe2a8
6 changed files with 7531 additions and 7531 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,168 +1,168 @@
// This may look like C code, but it is really -*- C++ -*- // This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// The Goldware Library // The Goldware Library
// Copyright (C) 1999 Alexander S. Aganichev // Copyright (C) 1999 Alexander S. Aganichev
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the Free // License along with this program; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307, USA // MA 02111-1307, USA
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// $Id$ // $Id$
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Midnight Commander compatible clipboard. // Midnight Commander compatible clipboard.
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include <gstrall.h> #include <gstrall.h>
#include <gmemdbg.h> #include <gmemdbg.h>
#include <gutlos.h> #include <gutlos.h>
#include <gmemi86.h> #include <gmemi86.h>
#include <gfilutil.h> #include <gfilutil.h>
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#define CLIPDIR "~/.cedit" #define CLIPDIR "~/.cedit"
#define CLIPFILE "~/.cedit/cooledit.clip" #define CLIPFILE "~/.cedit/cooledit.clip"
// ------------------------------------------------------------------ // ------------------------------------------------------------------
int g_init_os(int flags) { int g_init_os(int flags) {
NW(flags); NW(flags);
return 0; return 0;
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_deinit_os(void) { void g_deinit_os(void) {
// do nothing // do nothing
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_init_title(char *tasktitle, int titlestatus) { void g_init_title(char *tasktitle, int titlestatus) {
NW(tasktitle); NW(titlestatus); NW(tasktitle); NW(titlestatus);
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_increase_priority(void) { void g_increase_priority(void) {
// Do nothing // Do nothing
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_set_ostitle(char* title, word dx) { void g_set_ostitle(char* title, word dx) {
NW(title); NW(dx); NW(title); NW(dx);
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_set_osicon(void) { void g_set_osicon(void) {
// do nothing // do nothing
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
bool g_is_clip_available(void) { bool g_is_clip_available(void) {
std::string clipdir = CLIPDIR; std::string clipdir = CLIPDIR;
strschg_environ(clipdir); strschg_environ(clipdir);
return is_dir(clipdir); return is_dir(clipdir);
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
char* g_get_clip_text(void) { char* g_get_clip_text(void) {
std::string clipfile = CLIPFILE; std::string clipfile = CLIPFILE;
strschg_environ(clipfile); strschg_environ(clipfile);
size_t size = GetFilesize(clipfile.c_str()); size_t size = GetFilesize(clipfile.c_str());
if(size != -1) { if(size != -1) {
char *text = (char *)throw_malloc(size+1); char *text = (char *)throw_malloc(size+1);
*text = NUL; *text = NUL;
FILE *f = fopen(clipfile.c_str(), "rt"); FILE *f = fopen(clipfile.c_str(), "rt");
if(f != NULL) { if(f != NULL) {
fread(text, 1, size, f); fread(text, 1, size, f);
text[size] = NUL; text[size] = NUL;
fclose(f); fclose(f);
} }
return text; return text;
} }
return NULL; return NULL;
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
int g_put_clip_text(const char* buf) { int g_put_clip_text(const char* buf) {
std::string clipfile = CLIPFILE; std::string clipfile = CLIPFILE;
strschg_environ(clipfile); strschg_environ(clipfile);
FILE *f = fopen(clipfile.c_str(), "wt"); FILE *f = fopen(clipfile.c_str(), "wt");
if(f != NULL) { if(f != NULL) {
fwrite(buf, 1, strlen(buf), f); fwrite(buf, 1, strlen(buf), f);
fclose(f); fclose(f);
return 0; return 0;
} }
return -1; return -1;
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_get_ostitle_name(char* title) { void g_get_ostitle_name(char* title) {
*title = NUL; *title = NUL;
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void g_set_ostitle_name(char* title, int mode) { void g_set_ostitle_name(char* title, int mode) {
NW(title); NW(mode); NW(title); NW(mode);
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
int g_send_mci_string(char* str, char* his_buffer) { int g_send_mci_string(char* str, char* his_buffer) {
NW(str); NW(his_buffer); NW(str); NW(his_buffer);
return 1; return 1;
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -1,114 +1,114 @@
// This may look like C code, but it is really -*- C++ -*- // This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// The Goldware Library // The Goldware Library
// Copyright (C) 2002 Alexander S. Aganichev // Copyright (C) 2002 Alexander S. Aganichev
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the Free // License along with this program; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307, USA // MA 02111-1307, USA
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// $Id$ // $Id$
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Read areas from Synchronet BBS // Read areas from Synchronet BBS
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#include <cstdlib> #include <cstdlib>
#include <gcrcall.h> #include <gcrcall.h>
#include <gstrall.h> #include <gstrall.h>
#undef GCFG_NOSYNCHRONET #undef GCFG_NOSYNCHRONET
#include <gedacfg.h> #include <gedacfg.h>
#include <gs_sync.h> #include <gs_sync.h>
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Synchronet configuration reader // Synchronet configuration reader
void gareafile::ReadSynchronet(char* tag) { void gareafile::ReadSynchronet(char* tag) {
Path file, path; Path file, path;
char options[80]; char options[80];
ushort shrt, i; ushort shrt, i;
grp_t grp; grp_t grp;
sub_t sub; sub_t sub;
strcpy(options, tag); strcpy(options, tag);
char* ptr = strtok(tag, " \t"); char* ptr = strtok(tag, " \t");
while(ptr) { while(ptr) {
if(*ptr != '-') { if(*ptr != '-') {
strcpy(file, ptr); strcpy(file, ptr);
strschg_environ(file); strschg_environ(file);
} }
ptr = strtok(NULL, " \t"); ptr = strtok(NULL, " \t");
} }
if(not fexist(file)) { if(not fexist(file)) {
AddBackslash(file); AddBackslash(file);
strcat(file, "msgs.cnf"); strcat(file, "msgs.cnf");
} }
extractdirname(path, file); extractdirname(path, file);
FILE* in = fsopen(file, "rb", sharemode); FILE* in = fsopen(file, "rb", sharemode);
if(in) { if(in) {
setvbuf(in, NULL, _IOFBF, 8192); setvbuf(in, NULL, _IOFBF, 8192);
if(not quiet) if(not quiet)
std::cout << "* Reading " << file << std::endl; std::cout << "* Reading " << file << std::endl;
// Skip header: // Skip header:
// max_qwkmsgs 4 // max_qwkmsgs 4
// mail_maxcrcs 4 // mail_maxcrcs 4
// mail_maxage 2 // mail_maxage 2
// unused (NULL) 512 // unused (NULL) 512
// unused (0xff) 512 // unused (0xff) 512
fseek(in, 1034, SEEK_CUR); fseek(in, 1034, SEEK_CUR);
if(fread(&shrt, sizeof(ushort), 1, in) == 1) { if(fread(&shrt, sizeof(ushort), 1, in) == 1) {
for(i = 0; i < shrt; i++) { for(i = 0; i < shrt; i++) {
if(fread(&grp, sizeof(grp_t), 1, in) != 1) if(fread(&grp, sizeof(grp_t), 1, in) != 1)
break; break;
} }
} }
if(fread(&shrt, sizeof(ushort), 1, in) == 1) { if(fread(&shrt, sizeof(ushort), 1, in) == 1) {
for(i = 0; i < shrt; i++) { for(i = 0; i < shrt; i++) {
if(fread(&sub, sizeof(sub_t), 1, in) != 1) if(fread(&sub, sizeof(sub_t), 1, in) != 1)
break; break;
AreaCfg aa; AreaCfg aa;
aa.reset(); aa.reset();
aa.type = GMB_ECHO; aa.type = GMB_ECHO;
aa.attr = attribsecho; aa.attr = attribsecho;
aa.msgbase = GMB_SMB; aa.msgbase = GMB_SMB;
aa.setechoid((sub.misc & SUB_FIDO) ? sub.sname : sub.code); aa.setechoid((sub.misc & SUB_FIDO) ? sub.sname : sub.code);
aa.setdesc(sub.lname); aa.setdesc(sub.lname);
aa.groupid = 0x8000 + sub.grp; aa.groupid = 0x8000 + sub.grp;
if(*sub.data_dir) if(*sub.data_dir)
MakePathname(file, sub.data_dir, strlwr(sub.code)); MakePathname(file, sub.data_dir, strlwr(sub.code));
else else
MakePathname(file, path, strlwr(sub.code)); MakePathname(file, path, strlwr(sub.code));
aa.setpath(file); aa.setpath(file);
aa.aka = primary_aka; aa.aka = primary_aka;
aa.aka.set(sub.faddr); aa.aka.set(sub.faddr);
if(*sub.origline) if(*sub.origline)
aa.setorigin(sub.origline); aa.setorigin(sub.origline);
AddNewArea(aa); AddNewArea(aa);
} }
} }
} }
fclose(in); fclose(in);
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------

File diff suppressed because it is too large Load Diff