SeqMsgID support files
This commit is contained in:
parent
1e4aa0ad90
commit
6d4938356e
57
golded3/gemsgid.cpp
Executable file
57
golded3/gemsgid.cpp
Executable file
@ -0,0 +1,57 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// GoldED+
|
||||
// Copyright (C) 2003 Alexander Reznikov, 2:4600/220@fidonet,
|
||||
// <homebrewer@yandex.ru>
|
||||
// ------------------------------------------------------------------
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
// MA 02111-1307 USA
|
||||
// ------------------------------------------------------------------
|
||||
// $Id$
|
||||
// ------------------------------------------------------------------
|
||||
// Generate MSGID.
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
#include <golded.h>
|
||||
#include <genmsgid.h>
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
static ulong msgcount = 0;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
ulong getClassicMsgId() {
|
||||
|
||||
return time(NULL)+(msgcount++);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
ulong getMsgId() {
|
||||
|
||||
ulong id;
|
||||
char *err;
|
||||
|
||||
if(CFG->seqmsgid and not (CFG->seqmsgid == MAYBE and *CFG->seqdir == NUL)) {
|
||||
id = GenMsgIdEx(CFG->seqdir, CFG->seqoutrun, getClassicMsgId, &err);
|
||||
if(err) {
|
||||
LOG.printf("* Warning, SeqMsgId failed: %s, fall to classic algorythm!", err);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
return getClassicMsgId();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
628
goldlib/msgidlib/License.txt
Executable file
628
goldlib/msgidlib/License.txt
Executable file
@ -0,0 +1,628 @@
|
||||
----- scott-dudley.txt begins -----
|
||||
From sdudley@idiom.com Wed Feb 12 02:32:00 2003
|
||||
Return-Path: <sdudley@idiom.com>
|
||||
Received: from server3.fastmail.fm (server3.internal [10.202.2.134])
|
||||
by server2.fastmail.fm (Cyrus v2.1.9) with LMTP; Tue, 11 Feb 2003
|
||||
20:32:00 -0500
|
||||
X-Sieve: CMU Sieve 2.2
|
||||
Received: from server3.fastmail.fm (server3.internal [10.202.2.134])
|
||||
by server3.fastmail.fm (Cyrus v2.1.9) with LMTP; Tue, 11 Feb 2003
|
||||
20:32:01 -0500
|
||||
Received: from server3.fastmail.fm (localhost [127.0.0.1])
|
||||
by fastmail.fm (Postfix) with ESMTP id A8C6C3E9CB
|
||||
for <tobias_ernst@eml.cc>; Tue, 11 Feb 2003 20:32:01 -0500 (EST)
|
||||
X-Attached: smime.p7s
|
||||
Received: from 127.0.0.1 ([127.0.0.1] helo=server3.fastmail.fm) by fastmail.fm
|
||||
with SMTP; Tue, 11 Feb 2003 20:32:01 -0500
|
||||
X-Mail-from: sdudley@idiom.com
|
||||
X-Delivered-to: <tobias_ernst@eml.cc>
|
||||
Received: from idiom.com (idiom.com [216.240.32.1])
|
||||
by server3.fastmail.fm (Postfix) with ESMTP id 4401D3CE82
|
||||
for <tobias_ernst@eml.cc>; Tue, 11 Feb 2003 20:32:01 -0500 (EST)
|
||||
Received: from idiom.com (1Cust11.tnt16.sfo8.da.uu.net [63.11.211.11])
|
||||
by idiom.com (8.12.6/8.12.6) with ESMTP id h1C1VtAE098669
|
||||
for <tobias_ernst@eml.cc>; Tue, 11 Feb 2003 17:31:56 -0800 (PST)
|
||||
(envelope-from sdudley@idiom.com)
|
||||
Message-ID: <3E49A3D4.1060905@idiom.com>
|
||||
Date: Tue, 11 Feb 2003 17:31:00 -0800
|
||||
From: Scott Dudley <sdudley@idiom.com>
|
||||
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1)
|
||||
Gecko/20021130
|
||||
X-Accept-Language: en-us, en
|
||||
MIME-Version: 1.0
|
||||
To: Tobias Ernst <tobias_ernst@eml.cc>
|
||||
Subject: MsgAPI licensing change notification
|
||||
References: <20747336-3D1F-11D7-A3EB-0003931DA274@eml.cc>
|
||||
In-Reply-To: <20747336-3D1F-11D7-A3EB-0003931DA274@eml.cc>
|
||||
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";
|
||||
micalg=sha1; boundary="------------ms050204080905050402000901"
|
||||
Status: RO
|
||||
Content-Length: 32323
|
||||
Lines: 584
|
||||
|
||||
This is a cryptographically signed message in MIME format.
|
||||
|
||||
--------------ms050204080905050402000901
|
||||
Content-Type: text/plain; charset=KOI8-R; format=flowed
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Tobias,
|
||||
|
||||
That sounds reasonable. I hereby notify you that the terms and
|
||||
conditions of the MsgAPI source code release are changed to those of the
|
||||
GNU Lesser General Public License, the text of which is included below.
|
||||
You are free to use and redistribute any of the MsgAPI code (or its
|
||||
derivatives) in a manner which is consistent with the aforementioned
|
||||
license agreement.
|
||||
|
||||
This message is digitally signed to verify its authenticity.
|
||||
|
||||
Scott Dudley
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
|
||||
|
||||
--------------ms050204080905050402000901
|
||||
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Disposition: attachment; filename="smime.p7s"
|
||||
Content-Description: S/MIME Cryptographic Signature
|
||||
|
||||
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIPtDCC
|
||||
BMgwggQxoAMCAQICBAIAApswDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCVVMxGDAWBgNV
|
||||
BAoTD0dURSBDb3Jwb3JhdGlvbjEcMBoGA1UEAxMTR1RFIEN5YmVyVHJ1c3QgUm9vdDAeFw0w
|
||||
MjA4MjcxOTA3MDBaFw0wNjAyMjMyMzU5MDBaMIHcMQswCQYDVQQGEwJHQjEXMBUGA1UEChMO
|
||||
Q29tb2RvIExpbWl0ZWQxHTAbBgNVBAsTFENvbW9kbyBUcnVzdCBOZXR3b3JrMUYwRAYDVQQL
|
||||
Ez1UZXJtcyBhbmQgQ29uZGl0aW9ucyBvZiB1c2U6IGh0dHA6Ly93d3cuY29tb2RvLm5ldC9y
|
||||
ZXBvc2l0b3J5MR8wHQYDVQQLExYoYykyMDAyIENvbW9kbyBMaW1pdGVkMSwwKgYDVQQDEyND
|
||||
b21vZG8gQ2xhc3MgMyBTZWN1cml0eSBTZXJ2aWNlcyBDQTCCASIwDQYJKoZIhvcNAQEBBQAD
|
||||
ggEPADCCAQoCggEBALEeYGbgQwaeJ2gvApnHiN+F69tl7NRJZ3ouH83cFSzWHqzynUY6XQPA
|
||||
PQUsWhgNWSVCo3LArSjSrTwx4ksH+16Y66gz1mmyWp7qLEmmJi5M8MyrQNKq3ixOgbW6e7hc
|
||||
0H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2l0b3J5MR8wHQYDVQQLExYoYykyMDAy
|
||||
IENvbW9kbyBMaW1pdGVkMSwwKgYDVQQDEyNDb21vZG8gQ2xhc3MgMyBTZWN1cml0eSBTZXJ2
|
||||
aWNlcyBDQQIRAIKoea8JTb7vwa4yHGSjzgQwDQYJKoZIhvcNAQEBBQAEgYAJA2vXBvQcmYe1
|
||||
b17Nb9SjSmSnGNQ35W3F88Mg8SDQY0coMjSfLRV29jxl34bwhX4LxK/r/i+K3mtQ0ijTBabG
|
||||
ncLTZD9b2NLpG8v0fVH8C4vWsVioKgpb1UZHmc8G2ZBva8706uZ8vkwiki/xASelNS4mZmnt
|
||||
NHd0CauVQ/mUzgAAAAAAAA==
|
||||
--------------ms050204080905050402000901--
|
||||
|
||||
|
||||
|
||||
----- scott-dudley.txt ends -----
|
354
goldlib/msgidlib/fexist.c
Executable file
354
goldlib/msgidlib/fexist.c
Executable file
@ -0,0 +1,354 @@
|
||||
/* This is modifyed part of HUSKY project */
|
||||
/*
|
||||
* SMAPI; Modified Squish MSGAPI
|
||||
*
|
||||
* Squish MSGAPI0 is copyright 1991 by Scott J. Dudley. All rights reserved.
|
||||
* Modifications released to the public domain.
|
||||
*
|
||||
* Use of this file is subject to the restrictions contain in the Squish
|
||||
* MSGAPI0 licence agreement. Please refer to licence.txt for complete
|
||||
* details of the licencing restrictions. If you do not find the text
|
||||
* of this agreement in licence.txt, or if you do not have this file,
|
||||
* you should contact Scott Dudley at FidoNet node 1:249/106 or Internet
|
||||
* e-mail Scott.Dudley@f106.n249.z1.fidonet.org.
|
||||
*
|
||||
* In no event should you proceed to use any of the source files in this
|
||||
* archive without having accepted the terms of the MSGAPI0 licensing
|
||||
* agreement, or such other agreement as you are able to reach with the
|
||||
* author.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(UNIX) || defined(__MINGW32__) || defined(EMX) || defined(RSXNT) || defined(__DJGPP__) || defined(_MSC_VER)
|
||||
/* These are compilers that have both a working stat() and (important!) the
|
||||
S_ISREG and S_ISDIR macros. The problem is that while stat() is POSIX, those
|
||||
macros are not. For compilers that do not provide these macros, we revert to
|
||||
the old "ffind" method. */
|
||||
#define USE_STAT_MACROS
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(UNIX) || defined(__MINGW32__) || defined(__EMX__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef USE_STAT_MACROS
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#if !defined(__IBMC__) && !defined(MSDOS) && !defined(UNIX) && !defined(__MINGW32__) && !(defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
#include <dos.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "hsksupp.h"
|
||||
#include "ffind.h"
|
||||
|
||||
#ifdef USE_STAT_MACROS
|
||||
|
||||
/* This is the nice code that works on UNIX and every other decent platform.
|
||||
It has been contributed by Alex S. Aganichev */
|
||||
|
||||
int fexist(const char *filename)
|
||||
{
|
||||
struct stat s;
|
||||
|
||||
if (stat (filename, &s))
|
||||
return FALSE;
|
||||
return S_ISREG(s.st_mode);
|
||||
}
|
||||
|
||||
long fsize(const char *filename)
|
||||
{
|
||||
struct stat s;
|
||||
|
||||
if (stat (filename, &s))
|
||||
return -1L;
|
||||
return s.st_size;
|
||||
}
|
||||
|
||||
int direxist(const char *directory)
|
||||
{
|
||||
struct stat s;
|
||||
int rc;
|
||||
|
||||
#if !defined(__WATCOMC__) && !(defined(_MSC_VER) && (_MSC_VER >= 1200)) && !defined(__MINGW32__)
|
||||
rc = stat (directory, &s);
|
||||
#else
|
||||
char *tempstr, *p;
|
||||
size_t l;
|
||||
tempstr = strdup(directory);
|
||||
if (tempstr == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Root directory of any drive always exists! */
|
||||
|
||||
if ((isalpha((int)tempstr[0]) && tempstr[1] == ':' && (tempstr[2] == '\\' || tempstr[2] == '/') &&
|
||||
!tempstr[3]) || eqstr(tempstr, "\\")) {
|
||||
free(tempstr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
l = strlen(tempstr);
|
||||
if (tempstr[l - 1] == '\\' || tempstr[l - 1] == '/')
|
||||
{
|
||||
/* remove trailing backslash */
|
||||
tempstr[l - 1] = '\0';
|
||||
}
|
||||
|
||||
for (p=tempstr; *p; p++)
|
||||
{
|
||||
if (*p == '/')
|
||||
*p='\\';
|
||||
}
|
||||
|
||||
rc = stat (tempstr, &s);
|
||||
|
||||
free(tempstr);
|
||||
#endif
|
||||
if (rc)
|
||||
return FALSE;
|
||||
return S_ISDIR(s.st_mode);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Here comes the ugly platform specific and sometimes even slow code. */
|
||||
|
||||
int fexist(const char *filename)
|
||||
{
|
||||
FFIND *ff;
|
||||
|
||||
ff = FFindOpen(filename, 0);
|
||||
|
||||
if (ff)
|
||||
{
|
||||
FFindClose(ff);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
long fsize(const char *filename)
|
||||
{
|
||||
FFIND *ff;
|
||||
FILE *fp;
|
||||
long ret = -1L;
|
||||
|
||||
ff = FFindOpen(filename, 0);
|
||||
|
||||
if (ff)
|
||||
{
|
||||
#ifndef UNIX
|
||||
ret = ff->ff_fsize;
|
||||
if (ret != -1L) {
|
||||
#endif
|
||||
fp = fopen(filename, "rb");
|
||||
fseek(fp, 0, SEEK_END);
|
||||
ret = ftell(fp);
|
||||
fclose(fp);
|
||||
#ifndef UNIX
|
||||
};
|
||||
#endif
|
||||
FFindClose(ff);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(MSDOS) || defined(__DJGPP__) || (defined(__FLAT__) && defined(__WATCOMC__))
|
||||
|
||||
int direxist(const char *directory)
|
||||
{
|
||||
FFIND *ff;
|
||||
char *tempstr;
|
||||
int ret;
|
||||
|
||||
tempstr = (char *)malloc(strlen(directory) + 5);
|
||||
if (tempstr == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
strcpy(tempstr, directory);
|
||||
|
||||
Add_Trailing(tempstr, '\\');
|
||||
|
||||
/* Root directory of any drive always exists! */
|
||||
|
||||
if ((isalpha(tempstr[0]) && tempstr[1] == ':' && ((tempstr[2] == '\0') || ((tempstr[2] == '\\' ||
|
||||
tempstr[2] == '/') && tempstr[3] == '\0'))) || eqstri(tempstr, "\\"))
|
||||
{
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Strip_Trailing(tempstr, '\\');
|
||||
|
||||
ff = FFindOpen(tempstr, MSDOS_SUBDIR | MSDOS_HIDDEN | MSDOS_READONLY);
|
||||
|
||||
ret = ff != NULL && (ff->ff_attrib & MSDOS_SUBDIR);
|
||||
|
||||
if (ff)
|
||||
{
|
||||
FFindClose(ff);
|
||||
}
|
||||
}
|
||||
|
||||
free(tempstr);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
#elif defined(OS2) || defined(__NT__) || defined(__MINGW32__)
|
||||
|
||||
#ifdef OS2
|
||||
#define INCL_DOSFILEMGR
|
||||
#include <os2.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#define NOUSER
|
||||
#define NOMSG
|
||||
/* mingw32 warnings */
|
||||
#define NONAMELESSUNION
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
int _fast direxist(const char *directory)
|
||||
{
|
||||
char *tempstr, *p;
|
||||
size_t l;
|
||||
#if defined(__NT__) || defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
DWORD attr;
|
||||
#else
|
||||
FILESTATUS3 s;
|
||||
#endif
|
||||
|
||||
|
||||
tempstr = strdup(directory);
|
||||
if (tempstr == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Root directory of any drive always exists! */
|
||||
|
||||
if ((isalpha((int)tempstr[0]) && tempstr[1] == ':' && (tempstr[2] == '\\' || tempstr[2] == '/') &&
|
||||
!tempstr[3]) || eqstr(tempstr, "\\"))
|
||||
{
|
||||
free(tempstr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
l = strlen(tempstr);
|
||||
if (tempstr[l - 1] == '\\' || tempstr[l - 1] == '/')
|
||||
{
|
||||
/* remove trailing backslash */
|
||||
tempstr[l - 1] = '\0';
|
||||
}
|
||||
|
||||
for (p=tempstr; *p; p++)
|
||||
{
|
||||
if (*p == '/')
|
||||
*p='\\';
|
||||
}
|
||||
|
||||
#ifdef OS2
|
||||
if (DosQueryPathInfo((PSZ)tempstr, FIL_STANDARD,
|
||||
(PVOID)&s, sizeof(s)) == 0)
|
||||
{
|
||||
free (tempstr);
|
||||
if (s.attrFile & FILE_DIRECTORY)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
free (tempstr);
|
||||
return FALSE;
|
||||
#else
|
||||
attr = GetFileAttributes(tempstr);
|
||||
free(tempstr);
|
||||
if ((attr != 0xFFFFFFFF) && (attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(UNIX) || defined(SASC)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int _fast direxist(const char *directory)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(directory, "rb");
|
||||
if (fp != NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error Unknown compiler!
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
int _createDirectoryTree(const char *pathName) {
|
||||
|
||||
char *start, *slash;
|
||||
char limiter=PATH_DELIM;
|
||||
int i;
|
||||
|
||||
start = (char *) malloc(strlen(pathName)+2);
|
||||
strcpy(start, pathName);
|
||||
i = strlen(start)-1;
|
||||
if (start[i] != limiter) {
|
||||
start[i+1] = limiter;
|
||||
start[i+2] = '\0';
|
||||
}
|
||||
slash = start;
|
||||
|
||||
#ifndef UNIX
|
||||
/* if there is a drivename, jump over it */
|
||||
if (slash[1] == ':') slash += 2;
|
||||
#endif
|
||||
|
||||
/* jump over first limiter */
|
||||
slash++;
|
||||
|
||||
while ((slash = strchr(slash, limiter)) != NULL) {
|
||||
*slash = '\0';
|
||||
|
||||
if (!direxist(start)) {
|
||||
if (!fexist(start)) {
|
||||
/* this part of the path does not exist, create it */
|
||||
if (mymkdir(start) != 0) {
|
||||
free(start);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
free(start);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
*slash++ = limiter;
|
||||
}
|
||||
|
||||
free(start);
|
||||
|
||||
return 0;
|
||||
}
|
491
goldlib/msgidlib/ffind.c
Executable file
491
goldlib/msgidlib/ffind.c
Executable file
@ -0,0 +1,491 @@
|
||||
/* This is modifyed part of HUSKY project */
|
||||
/*
|
||||
* SMAPI; Modified Squish MSGAPI
|
||||
*
|
||||
* Squish MSGAPI0 is copyright 1991 by Scott J. Dudley. All rights reserved.
|
||||
* Modifications released to the public domain.
|
||||
*
|
||||
* Use of this file is subject to the restrictions contain in the Squish
|
||||
* MSGAPI0 licence agreement. Please refer to licence.txt for complete
|
||||
* details of the licencing restrictions. If you do not find the text
|
||||
* of this agreement in licence.txt, or if you do not have this file,
|
||||
* you should contact Scott Dudley at FidoNet node 1:249/106 or Internet
|
||||
* e-mail Scott.Dudley@f106.n249.z1.fidonet.org.
|
||||
*
|
||||
* In no event should you proceed to use any of the source files in this
|
||||
* archive without having accepted the terms of the MSGAPI0 licensing
|
||||
* agreement, or such other agreement as you are able to reach with the
|
||||
* author.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "hsksupp.h"
|
||||
|
||||
#if defined(__TURBOC__) || defined(__DJGPP__)
|
||||
#include <dir.h>
|
||||
#endif
|
||||
|
||||
#if !defined( __IBMC__) && !defined(UNIX) && !defined(__MINGW32__) && !(defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
#include "ffind.h"
|
||||
|
||||
#ifdef OS2
|
||||
#define INCL_NOPM
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
#if defined(__386__) || defined(__FLAT__)
|
||||
#undef DosQPathInfo
|
||||
#define DosQPathInfo(a,b,c,d,e) DosQueryPathInfo(a,b,c,d)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#include "patmat.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FFindOpen; Use like MSDOS "find first" function, except be sure to
|
||||
* release allocated system resources by caling FFindClose() with the
|
||||
* handle returned by this function.
|
||||
*
|
||||
* Returns: NULL == File not found.
|
||||
*/
|
||||
|
||||
FFIND *FFindOpen(const char *filespec, unsigned short attribute)
|
||||
{
|
||||
FFIND *ff;
|
||||
|
||||
ff = malloc(sizeof(FFIND));
|
||||
|
||||
if (ff != NULL)
|
||||
{
|
||||
#if defined(__TURBOC__) || defined(__DJGPP__)
|
||||
|
||||
if (findfirst(filespec, &(ff->ffbuf), attribute) != 0)
|
||||
{
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ff->ff_attrib = ff->ffbuf.ff_attrib;
|
||||
ff->ff_ftime = ff->ffbuf.ff_ftime;
|
||||
ff->ff_fdate = ff->ffbuf.ff_fdate;
|
||||
ff->ff_fsize = ff->ffbuf.ff_fsize;
|
||||
memcpy(ff->ff_name, ff->ffbuf.ff_name, sizeof(ff->ff_name));
|
||||
ff->ff_name[sizeof(ff->ff_name) - 1] = '\0';
|
||||
}
|
||||
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER < 1200)) || defined(__WATCOMC__)
|
||||
|
||||
if (_dos_findfirst(filespec, attribute, &(ff->ffbuf)) != 0)
|
||||
{
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ff->ff_attrib = ff->ffbuf.attrib;
|
||||
ff->ff_ftime = ff->ffbuf.wr_time;
|
||||
ff->ff_fdate = ff->ffbuf.wr_date;
|
||||
ff->ff_fsize = ff->ffbuf.size;
|
||||
memcpy(ff->ff_name, ff->ffbuf.name, sizeof(ff->ff_name));
|
||||
ff->ff_name[sizeof(ff->ff_name) - 1] = '\0';
|
||||
}
|
||||
|
||||
#elif defined(OS2)
|
||||
|
||||
#if defined(__386__) || defined(__FLAT__)
|
||||
ULONG SearchCount = 1;
|
||||
FILEFINDBUF3 findbuf;
|
||||
#else
|
||||
USHORT SearchCount = 1;
|
||||
FILEFINDBUF findbuf;
|
||||
#endif
|
||||
|
||||
ff->hdir = HDIR_CREATE;
|
||||
|
||||
if (!DosFindFirst((PBYTE) filespec, &ff->hdir, attribute, &findbuf, sizeof(findbuf), &SearchCount, 1L))
|
||||
{
|
||||
ff->ff_attrib = (char)findbuf.attrFile;
|
||||
ff->ff_fsize = findbuf.cbFile;
|
||||
|
||||
ff->ff_ftime = *((USHORT *) & findbuf.ftimeLastWrite);
|
||||
ff->ff_fdate = *((USHORT *) & findbuf.fdateLastWrite);
|
||||
|
||||
strncpy(ff->ff_name, findbuf.achName, sizeof(ff->ff_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
|
||||
#elif defined(UNIX)
|
||||
|
||||
char *p;
|
||||
int fin = 0;
|
||||
struct dirent *de;
|
||||
|
||||
p = strrchr(filespec, '/');
|
||||
if (p == NULL)
|
||||
{
|
||||
strcpy(ff->firstbit, ".");
|
||||
strcpy(ff->lastbit, filespec);
|
||||
}
|
||||
else if (p == filespec)
|
||||
{
|
||||
strcpy(ff->firstbit, "/");
|
||||
strcpy(ff->lastbit, filespec+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(ff->firstbit, filespec, p - filespec);
|
||||
ff->firstbit[p - filespec] = '\0';
|
||||
strcpy(ff->lastbit, p + 1);
|
||||
}
|
||||
ff->dir = opendir(ff->firstbit);
|
||||
if (ff->dir != NULL)
|
||||
{
|
||||
while (!fin)
|
||||
{
|
||||
de = readdir(ff->dir);
|
||||
if (de == NULL)
|
||||
{
|
||||
closedir(ff->dir);
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
fin = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patmat(de->d_name, ff->lastbit))
|
||||
{
|
||||
strncpy(ff->ff_name, de->d_name, sizeof ff->ff_name);
|
||||
ff->ff_fsize = -1L; /* All who wants to know it's size
|
||||
* must read it by himself
|
||||
*/
|
||||
fin = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
|
||||
#elif defined(SASC)
|
||||
|
||||
char *temp;
|
||||
int error;
|
||||
|
||||
temp = strrchr(filespec, '/');
|
||||
if (temp == NULL)
|
||||
{
|
||||
temp = strrchr(filespec, '\\');
|
||||
}
|
||||
if (temp == NULL)
|
||||
{
|
||||
temp = strrchr(filespec, ':');
|
||||
}
|
||||
if (temp == NULL)
|
||||
{
|
||||
strcpy(ff->prefix, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(ff->prefix, filespec, temp - filespec + 1);
|
||||
*(ff->prefix + (temp - filespec + 1)) = '\0';
|
||||
}
|
||||
error = dfind(&ff->info, filespec, 0);
|
||||
if (error == 0)
|
||||
{
|
||||
strcpy(ff->ff_name, ff->prefix);
|
||||
strcat(ff->ff_name, ff->info.fib_FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
|
||||
#elif defined(__RSXNT__) || defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
|
||||
ff->hDirA = FindFirstFile(filespec, &(ff->InfoBuf));
|
||||
ff->attrib_srch = (char)attribute;
|
||||
while (ff->hDirA != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (strlen(ff->InfoBuf.cFileName) < sizeof(ff->ff_name))
|
||||
{
|
||||
if ((!(ff->InfoBuf.dwFileAttributes &
|
||||
FILE_ATTRIBUTE_DIRECTORY)) ||
|
||||
(ff->attrib_srch & MSDOS_SUBDIR))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* skip file for some reason */
|
||||
if (!FindNextFile(ff->hDirA, &(ff->InfoBuf)))
|
||||
{
|
||||
if (ff->hDirA != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose(ff->hDirA);
|
||||
}
|
||||
ff->hDirA = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
if (ff->hDirA != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
strcpy(ff->ff_name, ff->InfoBuf.cFileName);
|
||||
ff->ff_fsize = ff->InfoBuf.nFileSizeLow;
|
||||
ff->ff_attrib = 0;
|
||||
if (ff->InfoBuf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
ff->ff_attrib |= MSDOS_SUBDIR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
free(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return ff;
|
||||
}
|
||||
|
||||
/*
|
||||
* FFindNext: Returns 0 if next file was found, non-zero if it was not.
|
||||
*/
|
||||
|
||||
int FFindNext(FFIND * ff)
|
||||
{
|
||||
int rc = -1;
|
||||
|
||||
if (ff != NULL)
|
||||
{
|
||||
#if defined(__TURBOC__) || defined(__DJGPP__)
|
||||
|
||||
rc = findnext(&(ff->ffbuf));
|
||||
|
||||
ff->ff_attrib = ff->ffbuf.ff_attrib;
|
||||
ff->ff_ftime = ff->ffbuf.ff_ftime;
|
||||
ff->ff_fdate = ff->ffbuf.ff_fdate;
|
||||
ff->ff_fsize = ff->ffbuf.ff_fsize;
|
||||
memcpy(ff->ff_name, ff->ffbuf.ff_name, sizeof(ff->ff_name));
|
||||
ff->ff_name[sizeof(ff->ff_name) - 1] = '\0';
|
||||
|
||||
#elif (defined(_MSC_VER) && (_MSC_VER < 1200)) || defined(__WATCOMC__)
|
||||
|
||||
rc = _dos_findnext(&(ff->ffbuf));
|
||||
|
||||
ff->ff_attrib = ff->ffbuf.attrib;
|
||||
ff->ff_ftime = ff->ffbuf.wr_time;
|
||||
ff->ff_fdate = ff->ffbuf.wr_date;
|
||||
ff->ff_fsize = ff->ffbuf.size;
|
||||
memcpy(ff->ff_name, ff->ffbuf.name, sizeof(ff->ff_name));
|
||||
ff->ff_name[sizeof(ff->ff_name) - 1] = '\0';
|
||||
|
||||
#elif defined(OS2)
|
||||
|
||||
#if defined(__386__) || defined(__FLAT__)
|
||||
ULONG SearchCount = 1;
|
||||
FILEFINDBUF3 findbuf;
|
||||
#else
|
||||
USHORT SearchCount = 1;
|
||||
FILEFINDBUF findbuf;
|
||||
#endif
|
||||
|
||||
if (ff->hdir && !DosFindNext(ff->hdir, &findbuf, sizeof(findbuf),
|
||||
&SearchCount))
|
||||
{
|
||||
ff->ff_attrib = (char)findbuf.attrFile;
|
||||
ff->ff_ftime = *((USHORT *) & findbuf.ftimeLastWrite);
|
||||
ff->ff_fdate = *((USHORT *) & findbuf.fdateLastWrite);
|
||||
ff->ff_fsize = findbuf.cbFile;
|
||||
strncpy(ff->ff_name, findbuf.achName, sizeof(ff->ff_name));
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
#elif defined(UNIX)
|
||||
|
||||
int fin = 0;
|
||||
struct dirent *de;
|
||||
|
||||
while (!fin)
|
||||
{
|
||||
de = readdir(ff->dir);
|
||||
if (de == NULL)
|
||||
{
|
||||
closedir(ff->dir);
|
||||
ff->dir = NULL;
|
||||
fin = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patmat(de->d_name, ff->lastbit))
|
||||
{
|
||||
strncpy(ff->ff_name, de->d_name, sizeof ff->ff_name);
|
||||
ff->ff_fsize = -1L; /* All who wants to know it's size
|
||||
* must read it by himself
|
||||
*/
|
||||
fin = 1;
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(SASC)
|
||||
int error = 0;
|
||||
|
||||
error = dnext(&ff->info);
|
||||
if (error == 0)
|
||||
{
|
||||
strcpy(ff->ff_name, ff->prefix);
|
||||
strcat(ff->ff_name, ff->info.fib_FileName);
|
||||
rc = 0;
|
||||
}
|
||||
#elif defined(__RSXNT__) || defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
|
||||
do
|
||||
{
|
||||
if (!FindNextFile(ff->hDirA, &(ff->InfoBuf)))
|
||||
{
|
||||
if (ff->hDirA != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose(ff->hDirA);
|
||||
}
|
||||
ff->hDirA = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (strlen(ff->InfoBuf.cFileName) < sizeof(ff->ff_name))
|
||||
{
|
||||
if ((!(ff->InfoBuf.dwFileAttributes &
|
||||
FILE_ATTRIBUTE_DIRECTORY)) ||
|
||||
(ff->attrib_srch & MSDOS_SUBDIR))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (ff->hDirA != INVALID_HANDLE_VALUE);
|
||||
|
||||
if (ff->hDirA != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
||||
strcpy(ff->ff_name, ff->InfoBuf.cFileName);
|
||||
ff->ff_fsize = ff->InfoBuf.nFileSizeLow;
|
||||
ff->ff_attrib = 0;
|
||||
if (ff->InfoBuf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
ff->ff_attrib |= MSDOS_SUBDIR;
|
||||
}
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unable to determine compiler and target operating system!
|
||||
#endif
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* FFindClose: End a directory search. Failure to call this function
|
||||
* will result in unclosed file handles under OS/2, and unreleased
|
||||
* memory in both DOS and OS/2.
|
||||
*/
|
||||
|
||||
void FFindClose(FFIND * ff)
|
||||
{
|
||||
if (ff != NULL)
|
||||
{
|
||||
#if defined(__TURBOC__) || defined(__DJGPP__)
|
||||
#elif (defined(__WATCOMC__) && defined (__NT__)) || (defined(_MSC_VER) && (_MSC_VER < 1200) && !defined(MSDOS))
|
||||
_dos_findclose(&(ff->ffbuf));
|
||||
#elif defined(OS2)
|
||||
if (ff->hdir)
|
||||
{
|
||||
DosFindClose(ff->hdir);
|
||||
}
|
||||
#elif defined(UNIX)
|
||||
if (ff->dir)
|
||||
{
|
||||
closedir(ff->dir);
|
||||
}
|
||||
#elif defined(SASC)
|
||||
#elif defined(__RSXNT__) || defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
if (ff->hDirA != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose(ff->hDirA);
|
||||
}
|
||||
#endif
|
||||
free(ff);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* FindInfo: This function was added because it is SIGNIFICANTLY faster
|
||||
* under OS/2 to call DosQPathInfo() rather than DosFindFirst() if all
|
||||
* you are interested in is getting a specific file's date/time/size.
|
||||
*
|
||||
* PLF Thu 10-17-1991 18:12:37
|
||||
*/
|
||||
|
||||
FFIND *FindInfo(const char *filespec)
|
||||
{
|
||||
#if !defined(OS2) && !defined(__OS2__)
|
||||
return FFindOpen(filespec, 0);
|
||||
#else
|
||||
FFIND *ff;
|
||||
FILESTATUS fs;
|
||||
const char *f;
|
||||
|
||||
ff = malloc(sizeof *ff);
|
||||
if (ff == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(ff, 0, sizeof *ff);
|
||||
if (!DosQPathInfo((PBYTE) filespec, FIL_STANDARD, (PBYTE) &fs, sizeof fs, 0L))
|
||||
{
|
||||
ff->ff_attrib = (char)fs.attrFile;
|
||||
ff->ff_ftime = *((USHORT *) & fs.ftimeLastWrite);
|
||||
ff->ff_fdate = *((USHORT *) & fs.fdateLastWrite);
|
||||
ff->ff_fsize = fs.cbFile;
|
||||
|
||||
/* isolate file name */
|
||||
f = strrchr(filespec, '\\');
|
||||
if (f == NULL)
|
||||
{
|
||||
f = filespec;
|
||||
}
|
||||
else
|
||||
{
|
||||
f++;
|
||||
}
|
||||
strncpy(ff->ff_name, f, sizeof(ff->ff_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
free(ff);
|
||||
return NULL;
|
||||
}
|
||||
return ff;
|
||||
#endif
|
||||
}
|
145
goldlib/msgidlib/ffind.h
Executable file
145
goldlib/msgidlib/ffind.h
Executable file
@ -0,0 +1,145 @@
|
||||
/* This is modifyed part of HUSKY project */
|
||||
/*
|
||||
* SMAPI; Modified Squish MSGAPI
|
||||
*
|
||||
* Squish MSGAPI0 is copyright 1991 by Scott J. Dudley. All rights reserved.
|
||||
* Modifications released to the public domain.
|
||||
*
|
||||
* Use of this file is subject to the restrictions contain in the Squish
|
||||
* MSGAPI0 licence agreement. Please refer to licence.txt for complete
|
||||
* details of the licencing restrictions. If you do not find the text
|
||||
* of this agreement in licence.txt, or if you do not have this file,
|
||||
* you should contact Scott Dudley at FidoNet node 1:249/106 or Internet
|
||||
* e-mail Scott.Dudley@f106.n249.z1.fidonet.org.
|
||||
*
|
||||
* In no event should you proceed to use any of the source files in this
|
||||
* archive without having accepted the terms of the MSGAPI0 licensing
|
||||
* agreement, or such other agreement as you are able to reach with the
|
||||
* author.
|
||||
*/
|
||||
|
||||
#ifndef __FFIND_H__
|
||||
#define __FFIND_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "hsksupp.h"
|
||||
|
||||
#ifdef UNIX
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef SASC
|
||||
#include <stdio.h>
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
#if defined(__RSXNT__) || defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#define NOUSER
|
||||
#define NOMSG
|
||||
|
||||
#ifdef __RSXNT__
|
||||
/* The RSXNT winsock.h conflicts with EMX
|
||||
io.h. As we do not need sockets anyway, we
|
||||
just prevent their inclusion. */
|
||||
#define _WINSOCK_H
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
/* For HTick compatibility */
|
||||
#define _WINUSER_H
|
||||
/* mingw32 warnings */
|
||||
#define NONAMELESSUNION
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define FFIND struct ffind
|
||||
|
||||
#if defined(__DJGPP__) || defined(__TURBOC__)
|
||||
#include <dir.h>
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__) || defined(_MSC_VER)
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
|
||||
struct ffind
|
||||
{
|
||||
/* this is the public area of the struct */
|
||||
char ff_attrib;
|
||||
unsigned short ff_ftime;
|
||||
unsigned short ff_fdate;
|
||||
long ff_fsize;
|
||||
char ff_name[256];
|
||||
|
||||
/* now comes the privat area where search handles or similiar are stored */
|
||||
|
||||
#if defined(__TURBOC__) || defined(__DJGPP__)
|
||||
struct ffblk ffbuf;
|
||||
|
||||
#elif defined(__WATCOMC__) || (defined(_MSC_VER) && (_MSC_VER < 1200))
|
||||
struct find_t ffbuf;
|
||||
unsigned long hdir; /* directory handle from DosFindFirst */
|
||||
|
||||
#elif defined(OS2)
|
||||
#if defined(__386__) || defined(__FLAT__)
|
||||
unsigned long hdir; /* directory handle from DosFindFirst */
|
||||
#else
|
||||
unsigned short hdir; /* directory handle from DosFindFirst */
|
||||
#endif
|
||||
|
||||
#elif defined(UNIX)
|
||||
DIR *dir;
|
||||
char firstbit[FILENAME_MAX];
|
||||
char lastbit[FILENAME_MAX];
|
||||
|
||||
#elif defined(SASC)
|
||||
struct FileInfoBlock info;
|
||||
char newfile[FILENAME_MAX];
|
||||
char prefix[FILENAME_MAX];
|
||||
|
||||
#elif defined(__RSXNT__) || defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1200))
|
||||
WIN32_FIND_DATA InfoBuf;
|
||||
HANDLE hDirA;
|
||||
char attrib_srch;
|
||||
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* I prefixed the functions below with an additional F in order to
|
||||
* prevent name clashes with the Win32 API
|
||||
*/
|
||||
|
||||
FFIND *FFindOpen(const char *filespec, unsigned short attribute);
|
||||
FFIND *FFindInfo(const char *filespec);
|
||||
int FFindNext(FFIND * ff);
|
||||
void FFindClose(FFIND * ff);
|
||||
|
||||
#define MSDOS_READONLY 0x01
|
||||
#define MSDOS_HIDDEN 0x02
|
||||
#define MSDOS_SYSTEM 0x04
|
||||
#define MSDOS_VOLUME 0x08
|
||||
#define MSDOS_SUBDIR 0x10
|
||||
#define MSDOS_ARCHIVE 0x20
|
||||
#define MSDOS_RSVD1 0x40
|
||||
#define MSDOS_RSVD2 0x80
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
182
goldlib/msgidlib/genmsgid.c
Executable file
182
goldlib/msgidlib/genmsgid.c
Executable file
@ -0,0 +1,182 @@
|
||||
/* This is modifyed part of HUSKY project */
|
||||
/*
|
||||
* HUSKYLIB: common defines, types and functions for HUSKY
|
||||
*
|
||||
* This is part of The HUSKY Fidonet Software project:
|
||||
* see http://husky.sourceforge.net for details
|
||||
*
|
||||
*
|
||||
* HUSKYLIB is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* HUSKYLIB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see file COPYING. If not, write to the
|
||||
* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* See also http://www.gnu.org, license may be found here.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if !defined(UNIX) && !defined(SASC)
|
||||
# include <io.h>
|
||||
#endif
|
||||
#if defined(UNIX) || defined(__DJGPP__) || defined(EMX)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "hsksupp.h"
|
||||
#include "ffind.h"
|
||||
|
||||
#define MAX_OUTRUN (3ul*365*24*60*60) /* 3 year */
|
||||
|
||||
#define GenMsgIdErr(a) { if (errstr!=NULL) { *errstr = a; } }
|
||||
|
||||
dword oldGenMsgId(void)
|
||||
{
|
||||
dword seq = (dword)time(NULL);
|
||||
sleep(1);
|
||||
return seq;
|
||||
}
|
||||
|
||||
dword GenMsgIdEx(char *seqdir, unsigned long max_outrun, dword (*altGenMsgId)(void), char **errstr)
|
||||
{
|
||||
dword seq, n, curtime;
|
||||
FFIND *ff;
|
||||
char *seqpath, max_fname[13], *new_fname, *pname, *p;
|
||||
int h, try;
|
||||
|
||||
if (altGenMsgId == NULL)
|
||||
altGenMsgId = oldGenMsgId;
|
||||
GenMsgIdErr(NULL);
|
||||
|
||||
if (seqdir == NULL || *seqdir == '\0') {
|
||||
seqdir = getenv("SEQDIR");
|
||||
if (seqdir == NULL || *seqdir == '\0') {
|
||||
/* warning: no SEQDIR defined, fall to ugly old algorythm */
|
||||
GenMsgIdErr("no SEQDIR defined");
|
||||
return (*altGenMsgId)();
|
||||
}
|
||||
}
|
||||
seqpath = malloc(strlen(seqdir)+13);
|
||||
strcpy(seqpath, seqdir);
|
||||
pname = seqpath + strlen(seqpath);
|
||||
if (*seqpath && strchr("/\\", seqpath[strlen(seqpath)-1]) == NULL)
|
||||
*pname++ = PATH_DELIM;
|
||||
new_fname = NULL;
|
||||
if (max_outrun == 0) {
|
||||
p = getenv("SEQOUT");
|
||||
if ( p && isdigit((int)(*p)) ) {
|
||||
max_outrun = (unsigned long)atol(p);
|
||||
switch (tolower(p[strlen(p) - 1])) {
|
||||
case 'y': max_outrun *= 365;
|
||||
case 'd': max_outrun *= 24;
|
||||
case 'h': max_outrun *= 60*60;
|
||||
break;
|
||||
case 'w': max_outrun *= (7l*24*60*60);
|
||||
break;
|
||||
case 'm': max_outrun *= (31l*24*60*60);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else max_outrun = MAX_OUTRUN;
|
||||
}
|
||||
for (try=0;;try++) {
|
||||
curtime = (dword)time(NULL);
|
||||
seq = 0;
|
||||
max_fname[0] = '\0';
|
||||
strcpy(pname, "*.*");
|
||||
ff = FFindOpen(seqpath, 0);
|
||||
if (ff == NULL) { /* file not found */
|
||||
*pname = '\0';
|
||||
if (try == 0) {
|
||||
if (direxist(seqpath))
|
||||
goto emptydir; /* directory exist & empty */
|
||||
else if (_createDirectoryTree(seqpath) == 0)
|
||||
goto emptydir; /* directory created */
|
||||
} /* if directory not created at 1st time then use old alghorithm */
|
||||
free(seqpath);
|
||||
if (new_fname) free(new_fname);
|
||||
GenMsgIdErr("can't open/create SEQDIR directory");
|
||||
return (*altGenMsgId)();
|
||||
}
|
||||
do {
|
||||
for (p=ff->ff_name; isxdigit((int)(*p)); p++);
|
||||
if (stricmp(p, ".seq") != 0) continue;
|
||||
if (strlen(ff->ff_name) > 12) continue;
|
||||
n = strtol(ff->ff_name, NULL, 16);
|
||||
if (n > curtime && n - curtime > max_outrun) {
|
||||
/* counter too large, remove */
|
||||
strcpy(pname, ff->ff_name);
|
||||
unlink(seqpath);
|
||||
continue;
|
||||
}
|
||||
if (n >= seq) {
|
||||
if (max_fname[0]) {
|
||||
strcpy(pname, max_fname);
|
||||
unlink(seqpath);
|
||||
}
|
||||
strcpy(max_fname, ff->ff_name);
|
||||
seq = n;
|
||||
} else {
|
||||
strcpy(pname, ff->ff_name);
|
||||
unlink(seqpath);
|
||||
}
|
||||
} while (FFindNext(ff) == 0);
|
||||
if (ff) FFindClose(ff);
|
||||
emptydir:
|
||||
if (seq < curtime) seq = curtime;
|
||||
if (new_fname == NULL)
|
||||
new_fname = malloc(strlen(seqpath) + 13);
|
||||
*pname = '\0';
|
||||
sprintf(new_fname, "%s%08lx.seq", seqpath, (unsigned long)(seq + 1));
|
||||
if (max_fname[0] == '\0') {
|
||||
/* No files found, create new */
|
||||
h = open(new_fname, O_CREAT|O_BINARY|O_EXCL, 0666);
|
||||
if (h != -1) {
|
||||
/* ok, scan again */
|
||||
close(h);
|
||||
continue;
|
||||
}
|
||||
/* error creating file */
|
||||
if (errno == EEXIST) continue;
|
||||
free(seqpath);
|
||||
free(new_fname);
|
||||
GenMsgIdErr("error creating file in SEQDIR directory");
|
||||
return (*altGenMsgId)();
|
||||
}
|
||||
/* rename max_fname to new_fname */
|
||||
strcpy(pname, max_fname);
|
||||
if (rename(seqpath, new_fname) == 0) {
|
||||
free(seqpath);
|
||||
free(new_fname);
|
||||
return seq;
|
||||
}
|
||||
if (errno == ENOENT || errno == EEXIST ||
|
||||
((errno == EPERM || errno == EACCES) && try < 16))
|
||||
continue;
|
||||
free(seqpath);
|
||||
free(new_fname);
|
||||
GenMsgIdErr("can't rename .seq file");
|
||||
return (*altGenMsgId)();
|
||||
}
|
||||
}
|
||||
|
||||
dword GenMsgId(char *seqdir, unsigned long max_outrun)
|
||||
{
|
||||
return GenMsgIdEx(seqdir, max_outrun, NULL, NULL);
|
||||
}
|
16
goldlib/msgidlib/genmsgid.h
Executable file
16
goldlib/msgidlib/genmsgid.h
Executable file
@ -0,0 +1,16 @@
|
||||
#ifndef __GENMSGID_H_
|
||||
#define __GENMSGID_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
ulong GenMsgId(char *seqdir, ulong max_outrun);
|
||||
ulong GenMsgIdEx(char *seqdir, ulong max_outrun, ulong (*altGenMsgId)(void), char **errstr);
|
||||
ulong oldGenMsgId(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GENMSGID_H_ */
|
47
goldlib/msgidlib/hsksupp.h
Executable file
47
goldlib/msgidlib/hsksupp.h
Executable file
@ -0,0 +1,47 @@
|
||||
#ifndef __HSKSUPP_H_
|
||||
#define __HSKSUPP_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "typedefs.h"
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
/* mingw32 warnings */
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#define sleep(sec) _sleep((sec)*1000l)
|
||||
#endif
|
||||
|
||||
#if defined(SASC) || defined(UNIX)
|
||||
#define PATH_DELIM '/'
|
||||
#else
|
||||
#define PATH_DELIM '\\'
|
||||
#endif
|
||||
|
||||
#define eqstr(str1,str2) (strcmp(str1,str2)==0)
|
||||
|
||||
#if !defined(__GNUC__) || defined(__MINGW32__)
|
||||
#define mymkdir(path) mkdir(path)
|
||||
#else
|
||||
#define mymkdir(path) mkdir(path, 0)
|
||||
#endif
|
||||
|
||||
/* fexists.c */
|
||||
int fexist(const char *filename);
|
||||
long fsize(const char *filename);
|
||||
int direxist(const char *directory);
|
||||
int _createDirectoryTree(const char *pathName);
|
||||
|
||||
/* patmat.c */
|
||||
#ifdef UNIX
|
||||
int patmat(char *raw, char *pat);
|
||||
#endif
|
||||
|
||||
#endif /* __HSKSUPP_H_ */
|
7
goldlib/msgidlib/msgidlib.all
Executable file
7
goldlib/msgidlib/msgidlib.all
Executable file
@ -0,0 +1,7 @@
|
||||
## ------------------------------------------------------------------
|
||||
## Master build file.
|
||||
## ------------------------------------------------------------------
|
||||
genmsgid c all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
|
||||
ffind c all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
|
||||
fexist c all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
|
||||
patmat c all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx
|
153
goldlib/msgidlib/patmat.c
Executable file
153
goldlib/msgidlib/patmat.c
Executable file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* PATMAT.C - Pattern matching. Taken from sh sources
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Kenneth Almquist.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define CTLESC '\\'
|
||||
|
||||
/*
|
||||
* Returns true if the pattern matches the string.
|
||||
*/
|
||||
|
||||
int patmat(char *string, char *pattern)
|
||||
{
|
||||
register char *p, *q;
|
||||
register char c;
|
||||
|
||||
p = pattern;
|
||||
q = string;
|
||||
for (;;) {
|
||||
switch (c = *p++) {
|
||||
case '\0':
|
||||
goto breakloop;
|
||||
case CTLESC:
|
||||
if (*q++ != *p++)
|
||||
return 0;
|
||||
break;
|
||||
case '?':
|
||||
if (*q++ == '\0')
|
||||
return 0;
|
||||
break;
|
||||
case '*':
|
||||
c = *p;
|
||||
if (c != CTLESC && c != '?' && c != '*' && c != '[') {
|
||||
while (*q != c) {
|
||||
if (*q == '\0')
|
||||
return 0;
|
||||
q++;
|
||||
}
|
||||
}
|
||||
do {
|
||||
if (patmat(q, p))
|
||||
return 1;
|
||||
} while (*q++ != '\0');
|
||||
return 0;
|
||||
case '[': {
|
||||
char *endp;
|
||||
int invert, found;
|
||||
char chr;
|
||||
|
||||
endp = p;
|
||||
if (*endp == '!')
|
||||
endp++;
|
||||
for (;;) {
|
||||
if (*endp == '\0')
|
||||
goto dft; /* no matching ] */
|
||||
if (*endp == CTLESC)
|
||||
endp++;
|
||||
if (*++endp == ']')
|
||||
break;
|
||||
}
|
||||
invert = 0;
|
||||
if (*p == '!') {
|
||||
invert++;
|
||||
p++;
|
||||
}
|
||||
found = 0;
|
||||
chr = *q++;
|
||||
c = *p++;
|
||||
do {
|
||||
if (c == CTLESC)
|
||||
c = *p++;
|
||||
if (*p == '-' && p[1] != ']') {
|
||||
p++;
|
||||
if (*p == CTLESC)
|
||||
p++;
|
||||
if (chr >= c && chr <= *p)
|
||||
found = 1;
|
||||
p++;
|
||||
} else {
|
||||
if (chr == c)
|
||||
found = 1;
|
||||
}
|
||||
} while ((c = *p++) != ']');
|
||||
if (found == invert)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
dft: default:
|
||||
if (*q++ != c)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
breakloop:
|
||||
if (*q != '\0')
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("patmat(\"abcdefghi\", \"*ghi\"): %d\n", patmat("abcdefghi", "*ghi"));
|
||||
printf("patmat(\"abcdefghi\", \"??c??f*\"): %d\n", patmat("abcdefghi", "??c??f*"));
|
||||
printf("patmat(\"abcdefghi\", \"*dh*\"): %d\n", patmat("abcdefghi", "*dh*"));
|
||||
printf("patmat(\"abcdefghi\", \"*def\"): %d\n", patmat("abcdefghi", "*def"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
59
goldlib/msgidlib/typedefs.h
Executable file
59
goldlib/msgidlib/typedefs.h
Executable file
@ -0,0 +1,59 @@
|
||||
/* This is modifyed part of HUSKY project */
|
||||
/*
|
||||
* SMAPI; Modified Squish MSGAPI
|
||||
*
|
||||
* Squish MSGAPI0 is copyright 1991 by Scott J. Dudley. All rights reserved.
|
||||
* Modifications released to the public domain.
|
||||
*
|
||||
* Use of this file is subject to the restrictions contain in the Squish
|
||||
* MSGAPI0 licence agreement. Please refer to licence.txt for complete
|
||||
* details of the licencing restrictions. If you do not find the text
|
||||
* of this agreement in licence.txt, or if you do not have this file,
|
||||
* you should contact Scott Dudley at FidoNet node 1:249/106 or Internet
|
||||
* e-mail Scott.Dudley@f106.n249.z1.fidonet.org.
|
||||
*
|
||||
* In no event should you proceed to use any of the source files in this
|
||||
* archive without having accepted the terms of the MSGAPI0 licensing
|
||||
* agreement, or such other agreement as you are able to reach with the
|
||||
* author.
|
||||
*/
|
||||
|
||||
#ifndef __TYPEDEFS_H__
|
||||
#define __TYPEDEFS_H__
|
||||
|
||||
#ifdef SASC
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
typedef unsigned bit;
|
||||
|
||||
#ifndef SASC
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
|
||||
typedef signed char sbyte;
|
||||
|
||||
typedef unsigned short word;
|
||||
typedef signed short sword;
|
||||
|
||||
#ifdef __alpha /* add other 64 bit systems here */
|
||||
typedef unsigned int dword;
|
||||
typedef signed int sdword;
|
||||
#else /* 32 and 16 bit machines */
|
||||
typedef unsigned long dword;
|
||||
typedef signed long sdword;
|
||||
#endif
|
||||
|
||||
#if !defined(UNIX) && !defined(SASC) && !defined(__MINGW32__)
|
||||
typedef unsigned short ushort;
|
||||
#endif
|
||||
|
||||
typedef signed short sshort;
|
||||
|
||||
#ifndef UNIX
|
||||
typedef unsigned long ulong;
|
||||
#endif
|
||||
|
||||
typedef signed long slong;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user