Switching to crashmail Jamlib

This commit is contained in:
Andrew Pamment 2016-03-25 10:58:57 +10:00
parent a8e28ee751
commit de14c1ba69
82 changed files with 1920 additions and 30144 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ doors/*
last10.dat last10.dat
ansis/* ansis/*
config/* config/*
illusion/*
*.a

View File

@ -1,7 +1,7 @@
CC=cc CC=cc
CFLAGS=-I/usr/local/include CFLAGS=-I/usr/local/include
DEPS = bbs.h DEPS = bbs.h
JAMLIB = /usr/local/lib/libjam.a JAMLIB = jamlib/jamlib.a
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)

View File

@ -24,15 +24,11 @@ If you want to install Magicka BBS, follow these steps.
2. Clone the repo `git clone https://github.com/apamment/MagickaBBS` 2. Clone the repo `git clone https://github.com/apamment/MagickaBBS`
3. Build JamLib 3. Build JamLib
`cd MagickaBBS/jamlib-1.4.7` `cd MagickaBBS/jamlib`
`./configure`
`make` `make -f Makefile.linux`
`su`
`make install`
4. Build the BBS (You may have to adjust the Makefile for your system) 4. Build the BBS (You may have to adjust the Makefile for your system)

View File

@ -1,8 +0,0 @@
The jamlib itself:
Bj”rn Stenberg <Bjorn.Stenberg@sth.frontec.se>
Some modification an bugfixes:
Johan Billing <billing@df.lth.se>
RPM version and autoconf/automake/libtool adaptations:
Sir Raorn <raorn@binec.ru>

View File

@ -1,122 +0,0 @@
2003-03-17 11:07 raorn
* .cvsignore, Makefile.am, configure.ac, configure.in,
jamlib.qpg.in, doc/.cvsignore, include/.cvsignore,
include/jamlib/.cvsignore, src/mbase.c, win32/.cvsignore,
win32/Makefile.am, win32/jamlib/.cvsignore,
win32/jamlib/Makefile.am: Moved to autoconf 2.5. Some autotools
fixes (missing files, etc...). QNX support by Mike Gorchak
<mike@malva.ua>
2002-12-19 23:42 raorn
* src/: mbase.c, subpack.c: Use calloc instead of malloc/memset
2002-12-04 16:09 cyrilm
* configure.in, include/jamlib/jam.h: MacOSX Support
2002-11-22 22:13 cyrilm
* src/jamlib.def: Win32 Updates
2002-11-22 22:10 cyrilm
* win32/jamlib/: .cvsignore, jamlib.dsp, jamlib.dsp, jamlib.dsp:
Win32 Updates
2002-11-22 21:56 cyrilm
* .cvsignore, jamlib.def, jamlib.dep, jamlib.dsp, jamlib.mak: Win32
Updates
2002-11-19 20:02 cyrilm
* jamlib.dep: Win32 MSVC make dependency file
2002-11-19 20:00 cyrilm
* src/mbase.c: Win32 MSVC errors fixed
2002-11-19 19:37 cyrilm
* .cvsignore: Update Win32 ignore files
2002-11-18 22:18 cyrilm
* jamlib.dsp, jamlib.mak: Win32 project defenition file
2002-11-18 22:16 cyrilm
* jamlib.def: Win32 export functions definition file
2002-11-18 14:08 raorn
* configure.in, src/Makefile.am: 1.4.6 released
2002-11-18 13:57 cyrilm
* include/jamlib/jam.h: Downgraded FreeBSD version check to
4.4-Release
2002-11-09 03:44 raorn
* Makefile.am: Forgot to add Changes to distfiles
2002-11-09 03:40 raorn
* Makefile.am, configure.in: First attemp to translate jamlib.doc
to man pages.
2002-11-09 03:37 raorn
* doc/: JAM_AddEmptyMessage.3, JAM_AddMessage.3,
JAM_ChangeMsgHeader.3, JAM_ClearMsgHeader.3, JAM_CloseMB.3,
JAM_Crc32.3, JAM_CreateMB.3, JAM_DelSubPacket.3,
JAM_DeleteMessage.3, JAM_Errno.3, JAM_FindUser.3, JAM_GetMBSize.3,
JAM_GetSubfield.3, JAM_GetSubfield_R.3, JAM_LockMB.3,
JAM_NewSubPacket.3, JAM_OpenMB.3, JAM_PutSubfield.3,
JAM_ReadLastRead.3, JAM_ReadMBHeader.3, JAM_ReadMsgHeader.3,
JAM_ReadMsgText.3, JAM_RemoveMB.3, JAM_UnlockMB.3,
JAM_WriteLastRead.3, JAM_WriteMBHeader.3, Makefile.am, jamlib.3:
First attemp to translate jamlib.doc to man pages.
2002-11-09 02:05 raorn
* Changes: Ripped out of jamlib.doc, updated and added to cvs tree
2002-11-06 14:19 raorn
* include/jamlib/jam.h: /sbin/fsck /dev/FreeBSD!
2002-11-06 14:15 raorn
* include/jamlib/jam.h: Added #include <sys/param.h>
2002-11-04 17:46 raorn
* include/jamlib/jam.h: Another try to fix FreeBSD compilation and
remove compiler warnings...
2002-11-04 17:45 raorn
* ChangeLog: Removed
2002-10-28 23:03 raorn
* README, configure.in, jamlib.doc, INSTALL, Makefile.am,
.cvsignore, AUTHORS, COPYING, ChangeLog, NEWS, autogen.sh,
src/Makefile.am, src/crc32.c, src/lastread.c, src/mbase.c,
src/message.c, src/subpack.c, include/Makefile.am,
include/jamlib/Makefile.am, include/jamlib/jam.h, src/.cvsignore,
src/structrw.c, src/structrw.h: Initial revision
2002-10-28 23:03 raorn
* README, configure.in, jamlib.doc, INSTALL, Makefile.am,
.cvsignore, AUTHORS, COPYING, ChangeLog, NEWS, autogen.sh,
src/Makefile.am, src/crc32.c, src/lastread.c, src/mbase.c,
src/message.c, src/subpack.c, include/Makefile.am,
include/jamlib/Makefile.am, include/jamlib/jam.h, src/.cvsignore,
src/structrw.c, src/structrw.h: Initial CVS import

View File

@ -1,71 +0,0 @@
Changes since version 1.4:
* Fixed memory leaks in messagebase and subfields operations
* Added some sanity checks. Documentation updated.
* Compile-time configurable file locking method - lockf(3) vs. fcntl(2).
* Fixed infinite loop in JAM_CreateMB that happens if newly
created messagebase can not be locked.
* Eliminated (I hope) compiler warnings about uchar/ulong/ushort
on FreeBSD.
* QNX support.
Changes since version 1.3:
* Win32 support via autoconf
* JAM_ChangeMsgHeader() now updates UserCRC in index and ActiveMsgs
in header if message's Attribute contains MSG_DELETED.
* New function JAM_DeleteMessage() - delete message from
messagebase by setting HdrOffset and UserCRC to 0xFFFFFFFF.
Changes since version 1.2:
* JAM_AddMessage() would fail when trying to add an empty message
to the messagebase under Linux. Fixed.
* Moved to GNU autotools
Changes since version 1.1:
* Since JAM_GetSubField() is not reentrant and cannot be used in
multi-threaded applications, JAM_GetSubField_R() was added as a
replacement for cases where a reentrant function is needed.
Changes since varsion 1.0:
* Added support for Win32 and Linux
* Added JAM_AddEmptyMessage()
* Rewrote the Makefiles
* Rewrote the CRC32 routine
* Fixed broken JAM_FindUser()
* Fixed broken JAM_GetSubfield()
* Changed JAM_OpenMB so that files are opened in binary mode. This is
necessary to use JAMLIB under Windows.
* Improved JAM_ReadMsgHeader() to give the error JAM_NO_MESSAGE if
the message no longer exists in the messagebase and JAM_CORRUPT_MSG
if the subfields of the message have been corrupted.
* Improved portability by changing JAMLIB so that it no longer reads
and writes stuctures directly using fread() and fwrite().
* Improved ANSI-C compatibilty by no longer including the non-ANSI
header file memory.h and using feof() to check for EOF instead of
errno == EPASTEOF.
* Added an #ifdef so that ushort and ulong are no longer defined in
jam.h when compiling under Linux. These are normally already defined
in the standard header files.

View File

@ -1,182 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -1,7 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
SUBDIRS = include src doc win32
EXTRA_DIST = Changes autogen.sh jamlib.doc

View File

@ -1,539 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = include src doc win32
EXTRA_DIST = Changes autogen.sh jamlib.doc
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = jamlib.qpg
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \
configure configure.ac depcomp install-sh jamlib.qpg.in \
ltmain.sh missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): configure.ac
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
touch $(srcdir)/config.h.in
distclean-hdr:
-rm -f config.h stamp-h1
jamlib.qpg: $(top_builddir)/config.status jamlib.qpg.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
distdir = $(PACKAGE)-$(VERSION)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkinstalldirs) $(distdir)/.
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive ctags \
ctags-recursive dist dist-all dist-gzip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

View File

@ -1,30 +0,0 @@
This is the JAMLIB library by Björn Stenberg with some minor modifications
made by Johan Billing and Sir Raorn. You can find the documentation for
JAMLIB in the file jamlib.doc.
These are the modifications done by Johan Billing:
* Support for Win32 and Linux added
* JAM_ReadMsgHeader() now gives the error JAM_NO_MESSAGE if the
message has been removed from the messagebase (both offset and
crc are -1 in the index file).
* The function JAM_AddEmptyMessage() has been added
* Improved ANSI-C compatibilty by changing the header files
included and using feof() to check for EOF.
* JAMLIB been rewritten so that it no longer reads or writes structs
directly from or to disk. This makes JAMLIB more portable and ensures
that the Intel byte-order is used on all platforms.
* Some other bugfixes
These are the modifications done by Sir Raorn:
* All non-linux code dropped out (patches for mingw/djgpp/etc are welcome)
* Moved to autoconf/automake/libtool
Have a nice programming! :-)

4277
jamlib-1.4.7/aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
#!/bin/sh
libtoolize --copy --force && aclocal && autoheader && automake --copy --add-missing --force-missing && autoconf --force

File diff suppressed because it is too large Load Diff

View File

@ -1,70 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you want to use lockf(3) instead of fcntl(2) for file locking */
#undef USE_LOCKF
/* Version number of package */
#undef VERSION
/* Define if you have POSIX-compilant OS */
#undef __UNIX__
/* Define if you do not have POSIX-compilant OS ;-) */
#undef __WIN32__

1411
jamlib-1.4.7/config.sub vendored

File diff suppressed because it is too large Load Diff

9514
jamlib-1.4.7/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,77 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([jamlib], [1.4.7], [raorn@altlinux.ru])
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR([src/mbase.c])
AC_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
#AC_VALIDATE_CACHED_SYSTEM_TUPLE(
# rm -f $cache_file
# echo Please rerun configure
# exit 1
#)
AM_INIT_AUTOMAKE
case $host_os in
linux*)
AC_DEFINE([__UNIX__], 1, [Define if you have POSIX-compilant OS])
;;
freebsd*)
AC_DEFINE([__UNIX__], 1, [Define if you have POSIX-compilant OS])
;;
darwin*)
AC_DEFINE([__UNIX__], 1, [Define if you have POSIX-compilant OS])
;;
nto-qnx*)
AC_DEFINE([__UNIX__], 1, [Define if you have POSIX-compilant OS])
;;
mingw32*)
if test "$host" != "$build"; then
case "$build_os" in
cygwin*)
CFLAGS="$CFLAGS -mno-cygwin -mconsole"
CPPFLAGS="$CPPFLAGS $CFLAGS"
;;
*)
CC="$host_cpu-$host_os-gcc"
AS="$CC"
AR="$host_cpu-$host_os-ar"
RANLIB="$host_cpu-$host_os-ranlib"
;;
esac
fi
AC_DEFINE([__WIN32__], 1, [Define if you do not have POSIX-compilant OS ;-)])
;;
esac
AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h sys/file.h unistd.h])
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_ARG_ENABLE([lockf], AC_HELP_STRING([--enable-lockf], [use lockf(3) for locking instead of fcntl(2)]),
AC_DEFINE([USE_LOCKF], 1, [Define if you want to use lockf(3) instead of fcntl(2) for file locking]))
AC_CONFIG_FILES([jamlib.qpg
include/Makefile
include/jamlib/Makefile
src/Makefile
doc/Makefile
win32/Makefile
win32/jamlib/Makefile
Makefile])
AC_OUTPUT

View File

@ -1,423 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# 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, 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

View File

@ -1,40 +0,0 @@
.\" $Id: JAM_AddEmptyMessage.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_AddEmptyMessage 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_AddEmptyMessage \- Add a empty message entry to a message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_AddEmptyMessage(s_JamBase* " Base_PS ");"
.RE
.fi
.SH DESCRIPTION
Adds an empty message header to the message base. Useful when writing a
messagebase maintenance utility.
.SS Arguments
.TP
.I Base_PS
The message base to use
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_NOT_LOCKED
if the message base is not locked
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_AddMessage (3),
.BR JAM_LockMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,123 +0,0 @@
.\" $Id: JAM_AddMessage.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_AddMessage 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_AddMessage \- Add a message to message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_AddMessage(s_JamBase* " Base_PS ","
.BI " s_JamMsgHeader* " Header_PS ","
.BI " s_JamSubPacket* " SubPack_PS ","
.BI " uchar* " Text_PC ","
.BI " ulong " TextLen_I ");"
.RE
.fi
.SH DESCRIPTION
Adds a message to the message base. Fully automatic.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I Header_PS
A pointer to the message header struct. The function will set the following
header fields: \fISignature\fP, \fIRevision\fP, \fITxtOffset\fP, \fITxtLen\fP,
\fISubfieldLen\fP and \fIMsgNum\fP. Whatever you set these fields to will be
overwritten.
.TP
.I SubPack_PS
A subfield packet handler, containing all subfields for the message.
.TP
.I Text_PC
A pointer to the first byte of the message text.
.TP
.I TextLen_I
The length of the message text, excluding any zero termination characters.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_NOT_LOCKED
if the message base is not locked
.SH EXAMPLES
.nf
s_JamSubPacket* SubPacket_PS;
s_JamSubfield Subfield_S;
s_JamMsgHeader Header_S;
uchar Text_AC[64];
uchar Field_AC[64];
/*
** Fix message header
*/
JAM_ClearMsgHeader(&Header_S);
Header_S.DateWritten = time(NULL);
/*
** Create subfield packet
*/
SubPacket_PS = JAM_NewSubPacket();
if (!SubPacket_PS) {
printf("JAM_NewSubPacket returned NULL.\\n");
return;
}
/* set up subfield 1 */
strcpy(Field_AC, "This is field #1");
Subfield_S.LoID = JAMSFLD_SENDERNAME;
Subfield_S.HiID = 0;
Subfield_S.DatLen = strlen(Field_AC);
Subfield_S.Buffer = Field_AC;
JAM_PutSubfield(SubPacket_PS, &Subfield_S);
/* set up subfield 2 */
strcpy(Field_AC, "This is field #2");
Subfield_S.LoID = JAMSFLD_RECVRNAME;
Subfield_S.HiID = 0;
Subfield_S.DatLen = strlen(Field_AC);
Subfield_S.Buffer = Field_AC;
JAM_PutSubfield(SubPacket_PS, &Subfield_S);
/*
** Add message
*/
strcpy(Text_AC, "Hello world!\\rThis is a test.");
/* [lock the message base] */
Result_I = JAM_AddMessage(Base_PS, &Header_S, SubPacket_PS,
Text_AC, strlen(Text_AC));
if (Result_I) {
printf("JAM_AddMessage returned %d.\\n", Result_I);
return;
}
/* [unlock the message base] */
JAM_DelSubPacket(SubPacket_PS);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_AddEmptyMessage (3),
.BR JAM_DeleteMessage (3),
.BR JAM_DelSubPacket (3),
.BR JAM_NewSubPacket (3),
.BR JAM_PutSubfield (3),
.BR JAM_LockMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,75 +0,0 @@
.\" $Id: JAM_ChangeMsgHeader.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_ChangeMsgHeader 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_ChangeMsgHeader \- Change a message's header
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_ChangeMsgHeader(s_JamBase* " Base_PS ","
.BI " ulong " MsgNo_I ","
.BI " s_JamMsgHeader* " Header_PS ");"
.RE
.fi
.SH DESCRIPTION
Writes over an old message header with a new one. Only the header \-
not the subfields \- can be changed due to the subfields\' dynamic
size.
.PP
If message have \fBMSG_DELETED\fP attribute set, \fIUserCRC\fP field in index
and \fIActiveMsgs\fP in base header are also updated.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I MsgNo_I
The absolute message number. Message #0 is the first in the message base.
.TP
.I Header_PS
A pointer to the header structure to write.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_NOT_LOCKED
if the message base is not locked
.SH EXAMPLES
.nf
s_JamMsgHeader Header_S;
int Result_I;
/* [lock the message base] */
Result_I = JAM_ReadMsgHeader(Base_PS, 0, &Header_S, NULL);
if (Result_I)
printf("JAM_ReadMsgHeader returned %d.\\n", Result_I);
Header_S.TimesRead++;
Result_I = JAM_ChangeMsgHeader(Base_PS, 0, &Header_S);
if (Result_I)
printf("JAM_ChangeMsgHeader returned %d.\\n", Result_I);
/* [unlock the message base] */
.fi
.SH NOTES
Use this function with caution. It is easy to corrupt a
message by giving it an incorrect header.
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_ReadMsgHeader (3),
.BR JAM_ClearMsgHeader (3),
.BR JAM_LockMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,36 +0,0 @@
.\" $Id: JAM_ClearMsgHeader.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_ClearMsgHeader 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_ClearMsgHeader \- Clear a message header structure
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_ClearMsgHeader(s_JamMsgHeader* " Header_PS ");"
.RE
.fi
.SH DESCRIPTION
Clears a message header structure and prepares it for use. This
includes setting \fISignature\fP and \fIRevision\fP fields to
their correct values, and setting CRC fields to \fBJAM_NO_CRC\fP.
.SS Arguments
.TP
.I Header_PS
A pointer to the structure to prepare.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_BAD_PARAM
if Header_PS is NULL
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_ReadMsgHeader (3),
.BR JAM_ChangeMsgHeader (3)
.\" vim: ft=nroff

View File

@ -1,50 +0,0 @@
.\" $Id: JAM_CloseMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_CloseMB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_CloseMB \- Close message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_CloseMB(s_JamBase* " Base_PS ");"
.RE
.fi
.SH DESCRIPTION
Unlocks (if locked) and closes the currently open message base.
.SS Arguments
.TP
.I Base_PS
The message base to close. Note, that you must
.BR free (3)
this memory upon successful messagebase closing.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. see
.BR JAM_Errno (3)
.TP
.B JAM_LOCK_FAILED
if the message base could not be unlocked
.PP
.SH EXAMPLES
.nf
int Result_I;
Result_I = JAM_CloseMB(Base_PS);
if ( Result_I )
printf("JAM_CloseMB returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_OpenMB (3),
.BR JAM_CreateMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,42 +0,0 @@
.\" $Id: JAM_Crc32.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_Crc32 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_Crc32 \- Calculate CRC32 on a block of data
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "ulong JAM_Crc32(uchar* " Buffer_PC ","
.BI " ulong " Length_I ");"
.RE
.fi
.SH DESCRIPTION
Calculates the Crc32 value for a block of data. All ASCII
characters are converted to lowercase before calculating
the CRC (the input data is unchanged).
.SS Arguments
.TP
.I Buffer_PC
A pointer to the first byte of the data block
.TP
.I Length_I
The number of bytes in the data block
.SH "RETURN VALUE"
The Crc32 value
.SH EXAMPLES
.nf
ulong Crc_I;
uchar Text_AC[32];
strcpy(Text_AC, "Hello world!\\n");
Crc_I = JAM_Crc32(Text_AC, strlen(Text_AC));
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3)
.\" vim: ft=nroff

View File

@ -1,69 +0,0 @@
.\" $Id: JAM_CreateMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_CreateMB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_CreateMB \- Create a new message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_CreateMB(uchar* " Basename_PC ","
.BI " ulong " BaseMsg_I ","
.BI " s_JamBase** " NewBase_PPS ");"
.RE
.fi
.SH DESCRIPTION
Creates the necessary files for a new message base and writes a
new message base header.
.PP
If the message base already exists, its contents are destroyed.
.SS Arguments
.TP
.I Basename_PC
The path and base filename of the new message base.
.TP
.I BaseMsg_I
The base message number (first message #) for the new message base. This number
is used when calculating new messages\' unique message number. It should not be
set to 0.
.TP
.I NewBase_PPS
A pointer to a message base handle where the new message base handle will be
written. On error you must
.BR free (3)
this memory if (*\fINewBase_PPS\fP) not NULL.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B
JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_LOCK_FAILED
if the newly created message base can not be locked.
See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if \fIBaseMsg_I\fR is 0 or \fINewBase_PPS\fR is NULL
.SH EXAMPLES
.nf
int Result_I;
Result_I = JAM_CreateMB("/some/where/mybase", 1, &Base_PS);
if (Result_I)
printf("JAM_CreateMB returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_OpenMB (3),
.BR JAM_CloseMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,54 +0,0 @@
.\" $Id: JAM_DelSubPacket.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_DelSubPacket 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_DelSubPacket \- Delete a subfield packet
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_DelSubPacket(s_JamSubPacket* " SubPack_PS ");"
.RE
.fi
.SH DESCRIPTION
Frees all memory used by a subfield packet. All subfields in the
packet will be lost and the packet handle will not be valid any
more.
.SS Arguments
.TP
.I SubPack_PS
The subfield packet to delete
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_BAD_PARAM
if \fISubPack_PS\fP is NULL.
.SH EXAMPLES
.nf
s_JamSubPacket* SubPacket_PS;
SubPacket_PS = JAM_NewSubPacket();
if (!SubPacket_PS) {
printf("JAM_NewSubPacket returned NULL.\\n");
return;
}
SubPacket_PS = JAM_DelSubPacket();
if (!SubPacket_PS) {
printf("JAM_DelSubPacket returned NULL.\\n");
return;
}
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_NewSubPacket (3),
.BR JAM_GetSubfield (3),
.BR JAM_GetSubfield_R (3),
.BR JAM_PutSubfield (3)
.\" vim: ft=nroff

View File

@ -1,46 +0,0 @@
.\" $Id: JAM_DeleteMessage.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_DeleteMessage 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_DeleteMessage \- Delete message from messagebase
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_DeleteMessage(s_JamBase* " Base_PS ","
.BI " ulong " MsgNo_I ");"
.RE
.fi
.SH DESCRIPTION
Deletes message from messagebase by setting \fIHdrOffset\fP and \fIUserCRC\fP
in index to 0xFFFFFFFF. \fIActiveMsgs\fP in base header also updated.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I MsgNo_I
The absolute message number. Message #0 is the first in the message base.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_NOT_LOCKED
if the message base is not locked
.SH NOTES
This funtion is available since JAMlib 1.4.0.
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_AddMessage (3),
.BR JAM_AddEmptyMessage (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,43 +0,0 @@
.\" $Id: JAM_Errno.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_Errno 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_Errno \- Specify I/O error
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_Errno(s_JamBase* " Base_PS ");"
.RE
.fi
.SH DESCRIPTION
When any of these library routines return \fBJAM_IO_ERROR\fP, you can
call this function to find out exactly what went wrong.
.SS Arguments
.TP
.I Base_PS
The message base to use
.SH "RETURN VALUE"
Standard \'errno\' values, as the C compiler generated them, or if
the I/O error was system specific, the return code is (10000 +
system status code).
.SH EXAMPLES
.nf
int Result_I;
uchar Text_AC[10];
/* generate an I/O error */
Result_I = JAM_ReadMsgText(0xffffffff, 10, Text_AC);
if (Result_I) {
errno = JAM_Errno(Base_PS);
perror("JAM I/O error");
}
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR errno (3)
.\" vim: ft=nroff

View File

@ -1,80 +0,0 @@
.\" $Id: JAM_FindUser.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_FindUser 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_FindUser \- Find message to a user
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_FindUser(s_JamBase* " Base_PS ","
.BI " ulong " UserCrc_I ","
.BI " ulong " StartMsg_I ","
.BI " ulong* " MsgNo_PI ");"
.RE
.fi
.SH DESCRIPTION
Scans the message base looking for a message written to a specific
user.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I UserCrc_I
The CRC32 value for the searched name
.TP
.I StartMsg_I
The first message number to look at. This value is
not the message\'s unique number, but rather the
absolute position of the message in the message
base. Message 0 therefore means the first message.
.TP
.I MsgNo_PI
A pointer to a variable where the message number
for the found message will be stored. This number
is the absolute message position in the message
base. Message 0 means the first message.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_NO_USER
if no message was found
.SH EXAMPLES
.nf
uchar Name_AC[32];
int Result_I;
ulong Crc_I;
ulong Msg_I;
strcpy(Name_AC, "Bjorn Stenberg");
Crc_I = JAM_Crc32(Name_AC, strlen(Name_AC));
Result_I = JAM_FindUser(Base_PS, Crc_I, 0, &Msg_I);
switch (Result_I) {
case JAM_NO_USER:
printf("No message for me.\\n");
break;
case JAM_IO_ERROR:
printf("IO error %d\\n", JAM_Errno());
break;
}
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_Crc32 (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,49 +0,0 @@
.\" $Id: JAM_GetMBSize.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_GetMBSize 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_GetMBSize \- Get the number of messages in message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_GetMBSize(s_JamBase* " Base_PS ","
.BI " ulong* " Messages_PI ");"
.RE
.fi
.SH DESCRIPTION
Finds out the number of messages (deleted and undeleted) in the
message base.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I Messages_PI
A pointer to a variable where the number of
messages will be stored.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.SH EXAMPLES
.nf
int Result_I;
ulong Size_I;
Result_I = JAM_GetMBSize(Base_PS, &Size_I);
if (Result_I)
printf("JAM_GetMBSize returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,57 +0,0 @@
.\" $Id: JAM_GetSubfield.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_GetSubfield 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_GetSubfield \- Get a subfield from a subfield packet (not reentrant)
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "s_JamSubfield* JAM_GetSubfield(s_JamSubPacket* " SubPack_PS ");"
.RE
.fi
.SH DESCRIPTION
Returns a pointer to the first/next subfield struct in the subfield packet.
.SS Arguments
.TP
.I SubPack_PS
The subfield packet to use. If this parameter is NULL, the next subfield from
the subfield packet previously scanned will be returned.
.SH "RETURN VALUE"
A pointer to a subfield, if successful, or NULL if there are no
more subfields in the packet.
.SH EXAMPLES
.nf
s_JamSubPacket* SubPack_PS;
s_JamSubfield* Subfield_PS;
s_JamMsgHeader Header_S;
int Result_I;
Result_I = JAM_ReadMsgHeader(0, &Header_S, &SubPack_PS);
if (Result_I)
printf("JAM_ReadMsgHeader returned %d.\\n", Result_I);
for (Subfield_PS = JAM_GetSubfield(SubPack_PS); Subfield_PS;
Subfield_PS = JAM_GetSubfield(NULL))
printf("Subfield id %d\\n", Subfield_PS\->LoID);
JAM_DelSubPacket(SubPack_PS);
.fi
.SH BUGS
This function is not reentrant and should not be used in
multi\-threaded applications unless you know what you are doing.
.PP
Use
.BR JAM_GetSubfield_R (3)
instead when a reentrant function is needed.
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_GetSubfield_R (3),
.BR JAM_PutSubfield (3),
.BR JAM_NewSubPacket (3),
.BR JAM_DelSubPacket (3)
.\" vim: ft=nroff

View File

@ -1,58 +0,0 @@
.\" $Id: JAM_GetSubfield_R.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_GetSubfield_R 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_GetSubfield_R \- Get a subfield from a subfield packet (reentrant)
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "s_JamSubfield* JAM_GetSubfield(s_JamSubPacket* " SubPack_PS ","
.BI " ulong* " Count_PI ");"
.RE
.fi
.SH DESCRIPTION
Returns a pointer to the first/next subfield struct in the subfield
packet.
.PP
This function is a reentrant replacement for
.BR JAM_GetSubfield (3).
.SS Arguments
.TP
.I SubPack_PS
The subfield packet to use.
.TP
.I Count_PI
Pointer to a variable that contains the number of the subfield to retrieve. The
variable should be set to zero the first time the function is called and is
then automatically increased by the function for any subsequent calls.
.SH "RETURN VALUE"
A pointer to a subfield, if successful, or NULL if there are no
more subfields in the packet.
.SH EXAMPLES
.nf
s_JamSubPacket* SubPack_PS;
s_JamSubfield* Subfield_PS;
s_JamMsgHeader Header_S;
ulong Count_I;
int Result_I;
Result_I = JAM_ReadMsgHeader(0, &Header_S, &SubPack_PS);
if (Result_I)
printf("JAM_ReadMsgHeader returned %d.\\n", Result_I);
Count_I = 0;
while((Subfield_PS = JAM_GetSubfield_R(SubPack_PS , &Count_I)))
printf("Subfield id %d\\n", Subfield_PS\->LoID);
JAM_DelSubPacket(SubPack_PS);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_GetSubfield (3)
.\" vim: ft=nroff

View File

@ -1,65 +0,0 @@
.\" $Id: JAM_LockMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_LockMB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_LockMB \- Lock message base for exclusive access
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_LockMB(s_JamBase* " Base_PS ");"
.RE
.fi
.SH DESCRIPTION
Locks the currently open message base so that no other programs may
modify it. The message base should be locked for only small periods
of time, or the performance of tossers and other software may be
affected.
.SS Arguments
.TP
.I Base_PS
The message base to lock
.SH RETURN VALUE
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. see
.BR JAM_Errno (3)
.TP
.B JAM_LOCK_FAILED
if the message base is currently locked by another
process
.TP
.B JAM_BAD_PARAM
if \fIBase_PS\fP is NULL
.SH EXAMPLES
.nf
int Result_I;
while (1) {
Result_I = JAM_LockMB(Base_PS);
if (Result_I) {
if (Result_I == JAM_LOCK_FAILED)
/* base locked by someone else, wait for unlock */
sleep(1);
else {
/* error */
printf("JAM_LockMB returned %d.\\n", Result_I);
return \-1;
}
}
}
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_UnlockMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,39 +0,0 @@
.\" $Id: JAM_NewSubPacket.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_NewSubPacket 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_NewSubPacket \- Create a new subfield packet
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "s_JamSubPacket* JAM_NewSubPacket(void);"
.RE
.fi
.SH DESCRIPTION
Creates a new, empty, subfield packet.
.SS Arguments
None
.SH "RETURN VALUE"
The subpacket handle, if successful, or NULL if a memory allocation failed.
.SH EXAMPLES
.nf
s_JamSubPacket* SubPacket_PS;
SubPacket_PS = JAM_NewSubPacket();
if (!SubPacket_PS) {
printf("JAM_NewSubPacket returned NULL.\\n");
return;
}
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_DelSubPacket (3),
.BR JAM_GetSubfield (3),
.BR JAM_GetSubfield_R (3),
.BR JAM_PutSubfield (3)
.\" vim: ft=nroff

View File

@ -1,57 +0,0 @@
.\" $Id: JAM_OpenMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_OpenMB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_OpenMB \- Open a message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.sp
.BI "int JAM_OpenMB(uchar* " Basename_PC ", s_JamBase** " NewBase_PPS ");"
.RE
.fi
.SH DESCRIPTION
Opens a message base. Only one message base can be open at one
call to this function.
.SS Arguments
.TP
.I Basename_PC
The path and base filename of the message base. "Base filename"
means the filename without the JAM\-specific extension.
.TP
.I NewBase_PPS
A pointer to a message base handle where the new message base
handle will be written. On error you must
.BR free (3)
this memory if (*\fINewBase_PPS\fR) not NULL.
.SH RETURN VALUE
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. see
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if
.I NewBas_PPS
is NULL
.SH EXAMPLES
.nf
int Result_I;
Result_I = JAM_OpenMB("/some/where/mybase", &Base_PS);
if (Result_I)
printf("JAM_OpenMB returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_CreateMB (3),
.BR JAM_CloseMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,71 +0,0 @@
.\" $Id: JAM_PutSubfield.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_PutSubfield 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_PutSubfield \- Put a subfield into a subfield packet
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_PutSubfield(s_JamSubPacket* " SubPack_PS ","
.BI " s_JamSubfield* " Subfield_PS ");"
.RE
.fi
.SH DESCRIPTION
Puts a subfield into a subfield packet. The subfield is copied
before being put into the subfield packet.
.SS Arguments
.TP
.I SubPack_PS
The subfield packet to add to
.TP
.I Subfield_PS
The subfield to put in the packet
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_NO_MEMORY
if a memory allocation failed
.SH EXAMPLES
.nf
s_JamSubPacket* SubPacket_PS;
s_JamSubfield Subfield_S;
uchar Field_AC[64];
SubPacket_PS = JAM_NewSubPacket();
if (!SubPacket_PS) {
printf("JAM_NewSubPacket returned NULL.\\n");
return;
}
/* set up subfield 1 */
strcpy(Field_AC, "This is field #1");
Subfield_S.LoID = JAMSFLD_SENDERNAME;
Subfield_S.HiID = 0;
Subfield_S.DatLen = strlen(Field_AC);
Subfield_S.Buffer = Field_AC;
JAM_PutSubfield(SubPacket_PS, &Subfield_S);
/* set up subfield 2 */
strcpy(Field_AC, "This is field #2");
Subfield_S.LoID = JAMSFLD_RECVRNAME;
Subfield_S.HiID = 0;
Subfield_S.DatLen = strlen(Field_AC);
Subfield_S.Buffer = Field_AC;
JAM_PutSubfield(SubPacket_PS, &Subfield_S);
JAM_DelSubPacket(SubPacket_PS);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_GetSubfield (3),
.BR JAM_GetSubfield_R (3),
.BR JAM_NewSubPacket (3),
.BR JAM_DelSubPacket (3)
.\" vim: ft=nroff

View File

@ -1,58 +0,0 @@
.\" $Id: JAM_ReadLastRead.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_ReadLastRead 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_ReadLastRead \- Read a lastread record
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_ReadLastRead(s_JamBase* " Base_PS ","
.BI " ulong " User_I ","
.BI " s_JamLastRead* " Record_PS ");"
.RE
.fi
.SH DESCRIPTION
Reads a lastread record from the lastread file.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I User_I
A system\-unique user number.
.TP
.I Record_PS
A pointer to the lastread struct where the record will be stored.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if Record_PS is NULL
.TP
.B JAM_NO_USER
if the user number was not found
.SH EXAMPLES
.nf
int Result_I;
s_JamLastRead LastRead_S;
Result_I = JAM_ReadLastRead( Base_PS, 4711, &LastRead_S);
if (Result_I)
printf("JAM_ReadLastRead returned %d\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_WriteLastRead (3)
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,52 +0,0 @@
.\" $Id: JAM_ReadMBHeader.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_ReadMBHeader 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_ReadMBHeader \- Read message base header
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_ReadMBHeader(s_JamBase* " Base_PS ","
.BI " s_JamBaseHeader* " Header_PS ");"
.RE
.fi
.SH DESCRIPTION
Reads the message base header from the start of the JAM header
file.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I Header_PS
A pointer to a base header structure where the base header will be stored.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if \fIBase_PS\fP or \fIHeader_PS\fP is NULL
.SH EXAMPLES
.nf
s_JamBaseHeader BaseHeader_S;
int Result_I;
Result_I = JAM_ReadMBHeader(Base_PS, &BaseHeader_S);
if (Result_I)
printf("JAM_ReadMBHeader returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_WriteMBHeader (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,72 +0,0 @@
.\" $Id: JAM_ReadMsgHeader.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_ReadMsgHeader 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_ReadMsgHeader \- Read a message\'s header and its subfields
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_ReadMsgHeader(s_JamBase* " Base_PS ","
.BI " ulong " MsgNo_I ","
.BI " s_JamMsgHeader* " Header_PS ","
.BI " s_JamSubPacket** " Subfields_PPS ");"
.RE
.fi
.SH DESCRIPTION
Reads a message header and (optionally) the message header
subfields.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I MsgNo_I
The message number, i.e. the absolute position of the message in the message
base. Message 0 is the first message.
.TP
.I Header_PS
A pointer to a message header structure where the message header will be
stored.
.TP
.I Subfields_PPS
A pointer to a subpacket pointer, where the subfield packet handle will be
stored. If this parameter is NULL, no subfields are read.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_NO_MEMORY
if a memory allocation failed
.TP
.B JAM_NO_MESSAGE
if message has been removed
.TP
.B JAM_CORRUPT_MSG
if message subfields are corrupted
.SH EXAMPLES
.nf
s_JamMsgHeader Header_S;
s_JamSubPacket* SubPack_PS
int Result_I;
Result_I = JAM_ReadMsgHeader(0, &Header_S, &SubPack_PS);
if (Result_I)
printf("JAM_ReadMsgHeader returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_AddMessage (3),
.BR JAM_AddEmptyMessage (3),
.BR JAM_ChangeMsgHeader (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,78 +0,0 @@
.\" $Id: JAM_ReadMsgText.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_ReadMsgText 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_ReadMsgText \- Read a message\'s text
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_ReadMsgText(s_JamBase* " Base_PS ","
.BI " ulong " Offset_I ","
.BI " ulong " Length_I ","
.BI " uchar* " Buffer_PC ");"
.RE
.fi
.SH DESCRIPTION
Reads the body text associated with a message.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I Offset_I
The text position in the text file. This information is stored in the message
header.
.TP
.I Length_I
The text length. This information is stored in the message header.
.TP
.I Buffer_PC
A pointer to where the text should be stored.
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.SH EXAMPLES
.nf
s_JamMsgHeader Header_S;
uchar* Buffer_PC;
int Result_I;
/* read msg header */
Result_I = JAM_ReadMsgHeader(Base_PS, 0, &Header_S, &SubPack_PS);
if (Result_I) {
printf("JAM_ReadMsgHeader returned %d.\\n", Result_I);
return;
}
/* allocate buffer text */
Buffer_PC = (uchar*) malloc(Header_S.TxtLen);
if (!Buffer_PC) {
printf("malloc failed.\\n");
return;
}
/* read text */
Result_I = JAM_ReadMsgText(Base_PS,
Header_S.TxtOffset,
Header_S.TxtLen,
Buffer_PC);
if (Result_I)
printf("JAM_ReadMsgText returned %d.\\n", Result_I);
free(Buffer_PC);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_ReadMsgHeader (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,56 +0,0 @@
.\" $Id: JAM_RemoveMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_RemoveMB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_RemoveMB \- Remove a message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_RemoveMB(s_JamBase* " ErrorBase_PS ", uchar* " Basename_PC ");"
.RE
.fi
.SH DESCRIPTION
Deletes all files associated with a message base. No checking is
done as to whether the message base is currently open or not.
.SS Arguments
.TP
.I ErrorBase_PS
The message base in which to store the I/O error, if any. This parameter does
\fBNOT\fP specify the message to be removed, it is only used for error tracking
purposes. If an I/O error occurs when removing the message base files, this
message base handler will simply hold the error code.
.TP
.I Basename_PC
The path and base filename of the message base to remove.
.SH RETURN VALUE
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if \fIErrorBase_PS\fP is NULL
.SH EXAMPLES
.nf
int Result_I;
Result_I = JAM_RemoveMB(Base_PS, "/some/where/mynase");
if (Result_I) {
printf("JAM_RemoveMB returned %d.\n", Result_I);
if (Result_I == JAM_IO_ERROR)
printf("I/O error %d\\n", JAM_Errno(ErrorBase_PS));
}
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_CreateMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,46 +0,0 @@
.\" $Id: JAM_UnlockMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_UnlockMB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_UnlockMB \- Unlock message base
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_UnlockMB(s_JamBase* " Base_PS ");"
.RE
.fi
.SH DESCRIPTION
Unlocks message base, allowing other programs to modify it.
.SS Arguments
.TP
.I Base_PS
The message base to unlock
.SH RETURN VALUE
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if Base_PS is NULL
.SH EXAMPLES
.nf
int Result_I;
Result_I = JAM_UnlockMB(Base_PS);
if (Result_I)
printf("JAM_UnlockMB returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_LockMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,57 +0,0 @@
.\" $Id: JAM_WriteLastRead.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_WriteLastRead 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_WriteLastRead \- Write a lastread record
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_WriteLastRead(s_JamBase* " Base_PS ","
.BI " ulong " User_I ","
.BI " s_JamLastRead* " Record_PS ");"
.RE
.fi
.SH DESCRIPTION
Writes a lastread record to the lastread file. If the user number
could not be found, the record will be appended to the end of the
file.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I User_I
A system\-unique user number
.TP
.I Record_PS
A pointer to the lastread struct to be written
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if \fIRecord_PS\fP is NULL
.SH EXAMPLES
.nf
int Result_I;
s_JamLastRead LastRead_S;
Result_I = JAM_WriteLastRead(Base_PS, 4711, &LastRead_S);
if (Result_I)
printf("JAM_WriteLastRead returned %d\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_ReadLastRead (3)
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,59 +0,0 @@
.\" $Id: JAM_WriteMBHeader.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.TH JAM_WriteMBHeader 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
JAM_WriteMBHeader \- Write message base header
.SH SYNOPSIS
.nf
.B #include <jamlib/jam.h>
.BI "int JAM_WriteMBHeader(s_JamBase* " Base_PS ","
.BI " s_JamBaseHeader* " Header_PS ");"
.RE
.fi
.SH DESCRIPTION
Increases the ModCounter field by one, resets the header signature
and writes the message base header to the start of the JAM header
file.
.SS Arguments
.TP
.I Base_PS
The message base to use
.TP
.I Header_PS
A pointer to the base header to be stored
.SH "RETURN VALUE"
.TP
.B 0
if successful
.TP
.B JAM_IO_ERROR
if an I/O error occured. See
.BR JAM_Errno (3)
.TP
.B JAM_BAD_PARAM
if Base_PS or Header_PS is NULL
.TP
.B JAM_NOT_LOCKED
if the message base is not locked
.SH EXAMPLES
.nf
s_JamBaseHeader BaseHeader_S;
int Result_I;
/* modify header here */
Result_I = JAM_WriteMBHeader(&BaseHeader_S);
if (Result_I)
printf("JAM_WriteMBHeader returned %d.\\n", Result_I);
.fi
.SH AUTHOR
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH SEE ALSO
.BR jamlib (3),
.BR JAM_ReadMBHeader (3),
.BR JAM_LockMB (3),
.BR JAM_Errno (3)
.\" vim: ft=nroff

View File

@ -1,21 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
man_MANS = jamlib.3 \
JAM_OpenMB.3 JAM_CloseMB.3 JAM_CreateMB.3 JAM_RemoveMB.3 \
JAM_LockMB.3 JAM_UnlockMB.3 JAM_ReadMBHeader.3 \
JAM_WriteMBHeader.3 JAM_FindUser.3 JAM_GetMBSize.3 \
\
JAM_ReadMsgHeader.3 JAM_ReadMsgText.3 JAM_AddMessage.3 \
JAM_AddEmptyMessage.3 JAM_ChangeMsgHeader.3 JAM_ClearMsgHeader.3 \
JAM_DeleteMessage.3 \
\
JAM_NewSubPacket.3 JAM_DelSubPacket.3 JAM_GetSubfield.3 \
JAM_GetSubfield_R.3 JAM_PutSubfield.3 \
\
JAM_ReadLastRead.3 JAM_WriteLastRead.3 \
\
JAM_Crc32.3 JAM_Errno.3
EXTRA_DIST = $(man_MANS)

View File

@ -1,347 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
man_MANS = jamlib.3 \
JAM_OpenMB.3 JAM_CloseMB.3 JAM_CreateMB.3 JAM_RemoveMB.3 \
JAM_LockMB.3 JAM_UnlockMB.3 JAM_ReadMBHeader.3 \
JAM_WriteMBHeader.3 JAM_FindUser.3 JAM_GetMBSize.3 \
\
JAM_ReadMsgHeader.3 JAM_ReadMsgText.3 JAM_AddMessage.3 \
JAM_AddEmptyMessage.3 JAM_ChangeMsgHeader.3 JAM_ClearMsgHeader.3 \
JAM_DeleteMessage.3 \
\
JAM_NewSubPacket.3 JAM_DelSubPacket.3 JAM_GetSubfield.3 \
JAM_GetSubfield_R.3 JAM_PutSubfield.3 \
\
JAM_ReadLastRead.3 JAM_WriteLastRead.3 \
\
JAM_Crc32.3 JAM_Errno.3
EXTRA_DIST = $(man_MANS)
subdir = doc
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
NROFF = nroff
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
man3dir = $(mandir)/man3
install-man3: $(man3_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man3dir)
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.3*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
3*) ;; \
*) ext='3' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst; \
done
uninstall-man3:
@$(NORMAL_UNINSTALL)
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.3*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
3*) ;; \
*) ext='3' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man3dir)/$$inst"; \
rm -f $(DESTDIR)$(man3dir)/$$inst; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(man3dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am:
install-info: install-info-am
install-man: install-man3
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man
uninstall-man: uninstall-man3
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-man3 install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am uninstall-man uninstall-man3
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,306 +0,0 @@
.\" $Id: jamlib.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
.\"
.\" JAM(mbp) - Copyright 1993 Joaquim Homrighausen, Andrew Milner,
.\" Mats Birch, Mats Wallin.
.\" ALL RIGHTS RESERVED
.TH JAMLIB 3 2002-11-07 "" "JAM subroutine library"
.SH NAME
jamlib \- a JAM subroutine library
.SH DESCRIPTION
These are a collection of subroutines that encapsulate much of the
format\-specific and tedious details of the JAM message base format. The
idea is that application programmers by using these routines can
concentrate on the more high\-level issues of their programs instead of
worrying about their JAM routines.
.PP
I [Bjorn Stenberg] wrote these routines primarily because I needed
them myself. I was trying to implement JAM support in my FrexxLink BBS
system and was frustrated by the poor level of documentation supplied in
the JAMAPI archive distributed by the JAM authors. Finally, I dove into
the JAMAPI source code in a desperate attempt at finding out how to use it.
To my despair, I discovered that the JAMAPI is targeted at a very low level.
I would need to implement a lot of JAM\-handling code into my own program.
.PP
This library is an attempt to do two things:
.PP
Firstly, provide an, at least sparingly, \fIdocumented\fP API, allowing
application programmers to easily implement JAM into their programs.
.PP
Secondly, raise the level of functionality above that of the original
JAMAPI package, so that the application programmer does not have to learn
and understand all the internals of the JAM message base format to
implement support for it.
.PP
I have not succeded completely on any of the two points, of course.
Documentation can never be too good, and there are still a few things about
JAM you must know in order to use it. But I think I have made it somewhat
easier than perhaps was the case before.
.sp
.SS "The Source Code"
I made a point of making this library as system independant as I could.
Only one function needs to be altered when porting this to another system:
The file locking. ANSI C does not include file locking so there is not much
I can do about it.
.PP
The choice of C over C++ is a part of this philosophy aswell. More
systems have C compilers than C++ compilers, and more people know C than
C++. Also, converting this library to a C++ class should be fairly simple.
If you do, send me a copy.
.PP
I use some naming conventions throughout the code and in the examples.
These are invented by myself as a reaction to the stunningly ugly and
hard\-to\-read Hungarian Notation promoted by some people. The rules of my
notation are simple:
.PP
.TP
\(bu
All library\-global identifiers are prefixed with \'\fBJAM_\fP\'. All
file\-global identifiers are prefixed with \'\fBjam_\fP\'. Local
identifiers do not have prefixes.
.TP
\(bu
All variables have a suffix describing their basic type. Suffixes used
in this library are:
.nf
_I \- integer (int Example_I)
_C \- character (char Example_C)
_S \- struct (struct Example_S)
_P \- pointer (void* Example_P)
_A \- array
.fi
.sp
Suffixes are then combined, to show the correct type:
.nf
_PI \- pointer to integer (int* Example_PI)
_PC \- pointer to char (char* Example_PC)
_AC \- array of char (char Example_AC[x])
_PPS \- pointer to pointer to struct (struct** Example_PPS)
.fi
.TP
\(bu
Functions do not have suffixes
.PP
The whole idea is that it is quicker to read and comprehend a
variable called \'\fIText_PC\fP\' than one called \'\fIpszText\fP\'.
We read from left to right, and thus the most important
information \- the name \- should be the leftmost data in the
word. The variable type is additional information and is
therefore added to the end where it does not disturb the reader.
.sp
.SS "The Functions"
The library is divided into five groups:
.TP
\(bu
Message base functions
.TP
\(bu
Message functions
.TP
\(bu
Subfield functions
.TP
\(bu
LastRead functions
.TP
\(bu
Miscellanous functions
.sp
.SS "Message base functions"
These functions handle JAM message bases, by opening, locking, scanning
etc the contents of a message base. These are fairly straight\-forward and
simple routines that you should have little, if any, trouble with.
.PP
A message base is identified by a message base handle, which is obtained
from either
.BR JAM_OpenMB (3)
or
.BR JAM_CreateMB (3).
All functions that read or
write from the message base take this handle as parameter, to know which
message base to use.
.PP
.TP
.BR JAM_OpenMB (3)
Open a message base
.TP
.BR JAM_CloseMB (3)
Close message base
.TP
.BR JAM_CreateMB (3)
Create a new message base
.TP
.BR JAM_RemoveMB (3)
Remove a message base
.TP
.BR JAM_LockMB (3)
Lock message base for exclusive access
.TP
.BR JAM_UnlockMB (3)
Unlock message base
.TP
.BR JAM_ReadMBHeader (3)
Read message base header
.TP
.BR JAM_WriteMBHeader (3)
Write message base header
.TP
.BR JAM_FindUser (3)
Find message to a user
.TP
.BR JAM_GetMBSize (3)
Get the number of messages in message base
.sp
.SS "Message functions"
These functions handle individual JAM messages. A JAM message contains of
three parts:
.sp
.TP
\(bu
Message Header
.TP
\(bu
Message Header Subfields
.TP
\(bu
Message Text
.PP
The message header is a simple C structure and the message text is a
simple text buffer.
.PP
The subfields, however, are a bit more tricky. These contain
everything that is not covered by the header, including the
\fBTO\fP, \fBFROM\fP, \fBSUBJECT\fP fields, origin and
destination network adresses etc. There can be an unlimited
number of subfields to a message.
.PP
In this routine library the subfields are encapsulated by a
\'\fIsubfield packet\fP\', which is handled by its own set of
routines. See a later section of this document for an
explanation of those.
.PP
.TP
.BR JAM_ReadMsgHeader (3)
Read a message\'s header and its subfields
.TP
.BR JAM_ReadMsgText (3)
Read a message\'s text
.TP
.BR JAM_AddMessage (3)
Add a message to message base
.TP
.BR JAM_AddEmptyMessage (3)
Add a empty message entry to a message base
.TP
.BR JAM_ChangeMsgHeader (3)
Change a message\'s header
.TP
.BR JAM_ClearMsgHeader (3)
Clear a message header structure
.TP
.BR JAM_DeleteMessage (3)
Delete message from messagebase
.sp
.SS "Subfield functions"
As described earlier, a subfield is a part of the message header. Due to
the complexity of the different network types in use, it is not feasible to
try and cram all data into one header struct. Therefore, JAM uses a fairly
small header struct and instead marks all additional data fields as
\'\fIsubfields\fP\'.
.PP
In order to make life a little more easy, I have used the concept of a
container for all subfields. I call it a \'\fISubfield Packet\fP\'. It is
identified by a struct pointer, and should be looked upon as a file or a
list that you manipulate via the following five functions:
.PP
.TP
.BR JAM_NewSubPacket (3)
Create a new subfield packet
.TP
.BR JAM_DelSubPacket (3)
Delete a subfield packet
.TP
.BR JAM_GetSubfield (3)
Get a subfield from a subfield packet (not reentrant)
.TP
.BR JAM_GetSubfield_R (3)
Get a subfield from a subfield packet (reentrant)
.TP
.BR JAM_PutSubfield (3)
Put a subfield into a subfield packet
.sp
.SS "LastRead functions"
JAM implements the often\-used concept of high water marking for
remembering which user read how many messages in each area.
.PP
Personally I think this concept stinks, since it does not store *which*
messages a user has read, only the number of the highest message he has
read. But since it\'s a part of JAM and it\'s fairly straightforward and
easy, I\'ve implemented two support functions for it.
.PP
I would, however, strongly recommend all BBS programmers to use proper
message mapping systems instead, so your users can read their messages in
whatever order they wish.
.PP
.TP
.BR JAM_ReadLastRead (3)
Read a lastread record
.TP
.BR JAM_WriteLastRead (3)
Write a lastread record
.sp
.SS "Miscellanous functions"
.PP
.TP
.BR JAM_Crc32 (3)
Calculate CRC32 on a block of data
.TP
.BR JAM_Errno (3)
Specify I/O error
.sp
.SH HISTORY
JAMLIB 1.0 was originally released by Bjorn Stenberg 1996\-03\-06.
Since the original license did not permit modification of the
library, Johan Billing contacted Bjorn Stenberg and asked him to
change the license. Bjorn Stenberg agreed to change the license
to the GNU Lesser General Public
License 1999\-12\-21.
.PP
After that, some minor additions and bug fixes were made by Johan
Billing and JAMLIB 1.1 was released under the new license.
.PP
Somewhen, after 1.2 release or so, Sir Raorn moved JAMlib to GNU
autotools, again with some minor additions an bugfixes.
.SH AUTHOR
All original code except for the CRC32 routine was written by Bjorn
Stenberg. The CRC32 code was rewritten by Johan Billing for JAMLIB 1.1
to replace the original CRC32 code whose origin and copyright was unclear.
The jam.h header file is a compilation of the best from the various header
files in the JAMAPI package with some of additions by Bjorn Stenberg as well.
Additions and modifications by Johan Billing and Sir Raorn.
.PP
The JAM message base proposal is:
.sp
.nf
JAM(mbp) \- Copyright 1993 Joaquim Homrighausen, Andrew Milner,
Mats Birch, Mats Wallin.
ALL RIGHTS RESERVED
.fi
.PP
For questions about JAMLIB, please contact:
.sp
Sir Raorn <raorn@altliux.ru>
.sp
Johan Billing <billing@df.lth.se>
.sp
If you wish to contact Bjorn Stenberg, his current e\-mail
address (as of 1999\-12\-21) is bjorn@haxx.nu.
.PP
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
based on original JAMlib documentation by Bjorn Stenberg
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
.SH "SEE ALSO"
If you are extra curious about the JAM message format, I suggest
you get a hold of an archive called \fIJAMAPI.ARJ\fP. That archive
contains a file called JAM.DOC which is the file I have used as
reference for the development of these routines.
.\" vim: ft=nroff

View File

@ -1,5 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
SUBDIRS = jamlib

View File

@ -1,419 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = jamlib
subdir = include
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = Makefile.am Makefile.in
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign include/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am \
dvi-recursive info info-am info-recursive install install-am \
install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am \
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,5 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
pkginclude_HEADERS = jam.h

View File

@ -1,348 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
pkginclude_HEADERS = jam.h
subdir = include/jamlib
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
HEADERS = $(pkginclude_HEADERS)
DIST_COMMON = $(pkginclude_HEADERS) Makefile.am Makefile.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign include/jamlib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
@list='$(pkginclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f"; \
$(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; for p in $$list; do \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " rm -f $(DESTDIR)$(pkgincludedir)/$$f"; \
rm -f $(DESTDIR)$(pkgincludedir)/$$f; \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-pkgincludeHEADERS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-pkgincludeHEADERS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am uninstall-pkgincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,388 +0,0 @@
/*
JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16:
- Added #defines for JAM_NO_MESSAGE and JAM_CORRUPT_MSG
- Added #ifndef linux around typedefs for ushort, ulong and uchar
- Added prototype for JAM_AddEmptyMessage()
Changes made by Sir Raorn 2001-12-08:
- Added prototype for JAM_DeleteMessage()
*/
/***********************************************************************
**
** JAM Definitions
**
***********************************************************************/
#ifndef __JAM_H__
#define __JAM_H__
#if (defined(__unix__) || defined(unix) || defined(__MACH__)) && !defined(USG)
#include <sys/param.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#if defined(linux)
#include <stdint.h>
#endif
#if !defined(linux)
#if !(((defined(__FreeBSD__) && __FreeBSD_version >= 440000)) || defined(NeXTBSD))
typedef unsigned short ushort; /* must be 16 bits wide */
#endif
typedef uint32_t ulong; /* must be 32 bits wide */
#endif
typedef unsigned char uchar; /* must be 8 bits wide */
#if defined(linux)
#define ulong uint32_t
#endif
/*
** Error codes {{{
*/
#define JAM_BAD_PARAM 1 /* one or more parameters are wrong */
#define JAM_IO_ERROR 2 /* i/o error. check JAM_Errno() for details */
#define JAM_LOCK_FAILED 3 /* lock could not be set */
#define JAM_NOT_LOCKED 4 /* the message base was not locked before writing */
#define JAM_NO_MEMORY 5 /* out of memory! */
#define JAM_NO_USER 6 /* user not found */
#define JAM_NO_MESSAGE 7 /* message has been deleted */
#define JAM_CORRUPT_MSG 8 /* message header is corrupt */
/*
** }}}
*/
/*
** CRC definitions {{{
*/
#define JAM_NO_CRC 0xffffffff
/*
** }}}
*/
/*
** File extensions {{{
*/
#define EXT_HDRFILE ".jhr"
#define EXT_TXTFILE ".jdt"
#define EXT_IDXFILE ".jdx"
#define EXT_LRDFILE ".jlr"
/*
** }}}
*/
/*
** Revision level and header signature {{{
*/
#define CURRENTREVLEV 1
#define HEADERSIGNATURE "JAM\0"
/*
** }}}
*/
/*
** Header file information block, stored first in all .JHR files {{{
*/
typedef struct {
uchar Signature[4]; /* <J><A><M> followed by <NUL> */
ulong DateCreated; /* Creation date */
ulong ModCounter; /* Last processed counter */
ulong ActiveMsgs; /* Number of active (not deleted) msgs */
ulong PasswordCRC; /* CRC-32 of password to access */
ulong BaseMsgNum; /* Lowest message number in index file */
uchar RSRVD[1000]; /* Reserved space */
} s_JamBaseHeader;
/*
** }}}
*/
/*
** Message status bits {{{
*/
#define MSG_LOCAL 0x00000001L /* Msg created locally */
#define MSG_INTRANSIT 0x00000002L /* Msg is in-transit */
#define MSG_PRIVATE 0x00000004L /* Private */
#define MSG_READ 0x00000008L /* Read by addressee */
#define MSG_SENT 0x00000010L /* Sent to remote */
#define MSG_KILLSENT 0x00000020L /* Kill when sent */
#define MSG_ARCHIVESENT 0x00000040L /* Archive when sent */
#define MSG_HOLD 0x00000080L /* Hold for pick-up */
#define MSG_CRASH 0x00000100L /* Crash */
#define MSG_IMMEDIATE 0x00000200L /* Send Msg now, ignore restrictions */
#define MSG_DIRECT 0x00000400L /* Send directly to destination */
#define MSG_GATE 0x00000800L /* Send via gateway */
#define MSG_FILEREQUEST 0x00001000L /* File request */
#define MSG_FILEATTACH 0x00002000L /* File(s) attached to Msg */
#define MSG_TRUNCFILE 0x00004000L /* Truncate file(s) when sent */
#define MSG_KILLFILE 0x00008000L /* Delete file(s) when sent */
#define MSG_RECEIPTREQ 0x00010000L /* Return receipt requested */
#define MSG_CONFIRMREQ 0x00020000L /* Confirmation receipt requested */
#define MSG_ORPHAN 0x00040000L /* Unknown destination */
#define MSG_ENCRYPT 0x00080000L /* Msg text is encrypted */
#define MSG_COMPRESS 0x00100000L /* Msg text is compressed */
#define MSG_ESCAPED 0x00200000L /* Msg text is seven bit ASCII */
#define MSG_FPU 0x00400000L /* Force pickup */
#define MSG_TYPELOCAL 0x00800000L /* Msg is for local use only (no export) */
#define MSG_TYPEECHO 0x01000000L /* Msg is for conference distribution */
#define MSG_TYPENET 0x02000000L /* Msg is direct network mail */
#define MSG_NODISP 0x20000000L /* Msg may not be displayed to user */
#define MSG_LOCKED 0x40000000L /* Msg is locked, no editing possible */
#define MSG_DELETED 0x80000000L /* Msg is deleted */
/*
** }}}
*/
/*
** Message header {{{
*/
typedef struct {
uchar Signature[4]; /* <J><A><M> followed by <NUL> */
ushort Revision; /* CURRENTREVLEV */
ushort ReservedWord; /* Reserved */
ulong SubfieldLen; /* Length of Subfields */
ulong TimesRead; /* Number of times message read */
ulong MsgIdCRC; /* CRC-32 of MSGID line */
ulong ReplyCRC; /* CRC-32 of REPLY line */
ulong ReplyTo; /* This msg is a reply to.. */
ulong Reply1st; /* First reply to this msg */
ulong ReplyNext; /* Next msg in reply chain */
ulong DateWritten; /* When msg was written */
ulong DateReceived; /* When msg was received/read */
ulong DateProcessed; /* When msg was processed by packer */
ulong MsgNum; /* Message number (1-based) */
ulong Attribute; /* Msg attribute, see "Status bits" */
ulong Attribute2; /* Reserved for future use */
ulong TxtOffset; /* Offset of text in text file */
ulong TxtLen; /* Length of message text */
ulong PasswordCRC; /* CRC-32 of password to access msg */
ulong Cost; /* Cost of message */
} s_JamMsgHeader;
/*
** }}}
*/
/*
** Message header Subfield types {{{
*/
#define JAMSFLD_OADDRESS 0
#define JAMSFLD_DADDRESS 1
#define JAMSFLD_SENDERNAME 2
#define JAMSFLD_RECVRNAME 3
#define JAMSFLD_MSGID 4
#define JAMSFLD_REPLYID 5
#define JAMSFLD_SUBJECT 6
#define JAMSFLD_PID 7
#define JAMSFLD_TRACE 8
#define JAMSFLD_ENCLFILE 9
#define JAMSFLD_ENCLFWALIAS 10
#define JAMSFLD_ENCLFREQ 11
#define JAMSFLD_ENCLFILEWC 12
#define JAMSFLD_ENCLINDFILE 13
#define JAMSFLD_EMBINDAT 1000
#define JAMSFLD_FTSKLUDGE 2000
#define JAMSFLD_SEENBY2D 2001
#define JAMSFLD_PATH2D 2002
#define JAMSFLD_FLAGS 2003
#define JAMSFLD_TZUTCINFO 2004
#define JAMSFLD_UNKNOWN 0xFFFF
/*
** }}}
*/
/*
** Message header Subfield {{{
*/
typedef struct {
ushort LoID; /* Field ID, 0 - 0xffff */
ushort HiID; /* Reserved for future use */
ulong DatLen; /* Length of buffer that follows */
uchar* Buffer; /* DatLen bytes of data */
} s_JamSubfield;
typedef struct {
ushort LoID; /* Field ID, 0 - 0xffff */
ushort HiID; /* Reserved for future use */
ulong DatLen; /* Length of buffer that follows */
} s_JamSaveSubfield;
/*
** }}}
*/
/*
** Message index record {{{
*/
typedef struct {
ulong UserCRC; /* CRC-32 of destination username */
ulong HdrOffset; /* Offset of header in .JHR file */
} s_JamIndex;
/*
** }}}
*/
/*
** Lastread structure, one per user {{{
*/
typedef struct {
ulong UserCRC; /* CRC-32 of user name (lowercase) */
ulong UserID; /* Unique UserID */
ulong LastReadMsg; /* Last read message number */
ulong HighReadMsg; /* Highest read message number */
} s_JamLastRead;
/*
** }}}
*/
/*
** JAMLIB message base handle {{{
*/
typedef struct {
FILE* HdrFile_PS; /* File handle for .JHR file */
FILE* TxtFile_PS; /* File handle for .JDT file */
FILE* IdxFile_PS; /* File handle for .JDX file */
FILE* LrdFile_PS; /* File handle for .JLR file */
int Errno_I; /* last i/o error */
int Locked_I; /* is area locked? */
ulong LastUserPos_I; /* last position of lastread record */
ulong LastUserId_I; /* userid for the last read lastread record */
} s_JamBase;
/*
** }}}
*/
/*
** JAMLIB subfield packet {{{
*/
typedef struct {
s_JamSubfield** Fields;
ulong NumFields;
ulong NumAlloc;
} s_JamSubPacket;
/*
** }}}
*/
/*
** JAMLIB function declarations {{{
*/
/* mbase.c {{{ */
int JAM_OpenMB ( uchar* Basename_PC,
s_JamBase** NewArea_PPS );
int JAM_CloseMB ( s_JamBase* Area_PS );
int JAM_CreateMB ( uchar* Basename_PC,
ulong BaseMsg_I,
s_JamBase** NewArea_PPS );
int JAM_RemoveMB ( s_JamBase* Area_PS,
uchar* Basename_PC );
int JAM_LockMB ( s_JamBase* Area_PS,
int Timeout_I );
int JAM_UnlockMB ( s_JamBase* Area_PS );
int JAM_ReadMBHeader ( s_JamBase* Area_PS,
s_JamBaseHeader* Header_PS );
int JAM_WriteMBHeader ( s_JamBase* Area_PS,
s_JamBaseHeader* Header_PS );
int JAM_FindUser ( s_JamBase* Area_PS,
ulong UserCrc_I,
ulong StartMsg_I,
ulong* MsgNo_PI );
int JAM_GetMBSize ( s_JamBase* Area_PS,
ulong* Messages_PI );
/* }}} */
/* message.c {{{ */
int JAM_ReadMsgHeader ( s_JamBase* Area_PS,
ulong MsgNo_I,
s_JamMsgHeader* Header_PS,
s_JamSubPacket** SubfieldPack_PPS );
int JAM_ReadMsgText ( s_JamBase* Area_PS,
ulong Offset_I,
ulong Length_I,
uchar* Buffer_PC );
int JAM_AddMessage ( s_JamBase* Area_PS,
s_JamMsgHeader* Header_PS,
s_JamSubPacket* SubPack_PS,
uchar* Text_PC,
ulong TextLen_I );
int JAM_AddEmptyMessage ( s_JamBase* Area_PS );
int JAM_DeleteMessage ( s_JamBase* Base_PS,
ulong MsgNo_I );
int JAM_ChangeMsgHeader ( s_JamBase* Area_PS,
ulong MsgNo_I,
s_JamMsgHeader* Header_PS );
int JAM_ClearMsgHeader ( s_JamMsgHeader* Header_PS );
int JAM_Errno ( s_JamBase* Area_PS );
/* }}} */
/* lastread.c {{{ */
int JAM_ReadLastRead ( s_JamBase* Area_PS,
ulong User_I,
s_JamLastRead* Record_PS );
int JAM_WriteLastRead ( s_JamBase* Area_PS,
ulong User_I,
s_JamLastRead* Record_PS );
/* }}} */
/* subpacket.c {{{ */
s_JamSubPacket* JAM_NewSubPacket ( void );
int JAM_DelSubPacket ( s_JamSubPacket* SubPack_PS );
s_JamSubfield* JAM_GetSubfield ( s_JamSubPacket* SubPack_PS );
s_JamSubfield* JAM_GetSubfield_R ( s_JamSubPacket* SubPack_PS ,
ulong* Count_PI);
int JAM_PutSubfield ( s_JamSubPacket* SubPack_PS,
s_JamSubfield* Field_PS );
/* }}} */
/* crc32.c {{{ */
ulong JAM_Crc32 ( uchar* Buffer_PC, ulong Length_I );
/* }}} */
/*
** }}}
*/
#endif
/* Local variables:
* vim:set ts=8 sts=4 sw=4:
* vim600:fdm=marker:
*/

View File

@ -1,276 +0,0 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}

View File

@ -1,119 +0,0 @@
<QPG:Generation>
<QPG:Options>
<QPG:User unattended="yes" verbosity="0" listfiles="yes"/>
<QPG:Defaults type="qnx_package"/>
<QPG:Source></QPG:Source>
<QPG:Release date="today" number="+"/>
<QPG:Build></QPG:Build>
<QPG:FileSorting strip="yes"/>
<QPG:Package targets="standart"/>
<QPG:Repository generate="yes"/>
<QPG:FinalDir></QPG:FinalDir>
<QPG:Cleanup></QPG:Cleanup>
</QPG:Options>
<QPG:Responsible>
<QPG:Company>QNX.ORG.RU Community</QPG:Company>
<QPG:Department></QPG:Department>
<QPG:Group></QPG:Group>
<QPG:Team>QNX.ORG.RU Team</QPG:Team>
<QPG:Employee>Mike Gorchak</QPG:Employee>
<QPG:EmailAddress>mike@malva.ua</QPG:EmailAddress>
</QPG:Responsible>
<QPG:Values>
<QPG:Files>
<QPG:Add file="./COPYING" install="LicenseUrl/" handling="repdata"/>
<QPG:Add permissions="0755" file="./src/.libs/libjam.so.2" install="/opt/lib/"/>
<QPG:Add filetype="symlink" file="libjam.so" install="/opt/lib/" linkto="libjam.so.2"/>
<QPG:Add permissions="0644" file="./src/.libs/libjam.a" install="/opt/lib/"/>
<QPG:Add permissions="0644" file="./AUTHORS" install="/usr/doc/jamlib/"/>
<QPG:Add permissions="0644" file="./COPYING" install="/usr/doc/jamlib/"/>
<QPG:Add permissions="0644" file="./Changes" install="/usr/doc/jamlib/"/>
<QPG:Add permissions="0644" file="./INSTALL" install="/usr/doc/jamlib/"/>
<QPG:Add permissions="0644" file="./README" install="/usr/doc/jamlib/"/>
<QPG:Add permissions="0644" file="./jamlib.doc" install="/usr/doc/jamlib/"/>
<QPG:Add permissions="0644" file="./include/jamlib/jam.h" install="/opt/include/jamlib/"/>
<QPG:Add permissions="0644" file="./doc/JAM_AddEmptyMessage.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_AddMessage.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_ChangeMsgHeader.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_ClearMsgHeader.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_CloseMB.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_Crc32.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_CreateMB.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_DelSubPacket.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_DeleteMessage.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_Errno.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_FindUser.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_GetMBSize.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_GetSubfield.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_GetSubfield_R.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_LockMB.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_NewSubPacket.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_OpenMB.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_PutSubfield.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_ReadLastRead.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_ReadMBHeader.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_ReadMsgHeader.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_ReadMsgText.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_RemoveMB.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_UnlockMB.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_WriteLastRead.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/JAM_WriteMBHeader.3" install="/opt/share/man/man3/"/>
<QPG:Add permissions="0644" file="./doc/jamlib.3" install="/opt/share/man/man3/"/>
</QPG:Files>
<QPG:PackageFilter>
<QPM:PackageManifest>
<QPM:PackageDescription>
<QPM:PackageType>Library</QPM:PackageType>
<QPM:PackageName>@PACKAGE_NAME@</QPM:PackageName>
<QPM:PackageReleaseNumber>1</QPM:PackageReleaseNumber>
<QPM:PackageRepository>http://qnx.org.ru/repository</QPM:PackageRepository>
<QPM:FileVersion>1.01</QPM:FileVersion>
</QPM:PackageDescription>
<QPM:ProductDescription>
<QPM:ProductName>jamlib</QPM:ProductName>
<QPM:ProductIdentifier>jamlib</QPM:ProductIdentifier>
<QPM:ProductEmail>raorn@altlinux.ru</QPM:ProductEmail>
<QPM:VendorName>public</QPM:VendorName>
<QPM:VendorInstallName>public</QPM:VendorInstallName>
<QPM:VendorURL>http://jamlib.sourceforge.net</QPM:VendorURL>
<QPM:VendorEmbedURL/>
<QPM:VendorEmail>raorn@altlinux.ru</QPM:VendorEmail>
<QPM:AuthorName>Alexey I. Froloff</QPM:AuthorName>
<QPM:AuthorURL>http://jamlib.sourceforge.net</QPM:AuthorURL>
<QPM:AuthorEmbedURL/>
<QPM:AuthorEmail>raorn@altlinux.ru</QPM:AuthorEmail>
<QPM:ProductIconSmall/>
<QPM:ProductIconLarge/>
<QPM:ProductDescriptionShort>These are a collection of subroutines that encapsulate much of the format-specific and tedious details of the JAM message base format.</QPM:ProductDescriptionShort>
<QPM:ProductDescriptionLong>These are a collection of subroutines that encapsulate much of the format-specific and tedious details of the JAM message base format. The idea is that application programmers by using these routines can concentrate on the more high-level issues of their programs instead of worrying about their JAM routines.</QPM:ProductDescriptionLong>
<QPM:ProductDescriptionURL>http://jamlib.sourceforge.net</QPM:ProductDescriptionURL>
<QPM:ProductDescriptionEmbedURL/>
</QPM:ProductDescription>
<QPM:ReleaseDescription>
<QPM:ReleaseVersion>@PACKAGE_VERSION@</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor/>
<QPM:ReleaseNoteMajor/>
<QPM:ReleaseBuild>1</QPM:ReleaseBuild>
<QPM:CountryExclude/>
<QPM:ReleaseCopyright>GNU Lesser General Public License</QPM:ReleaseCopyright>
</QPM:ReleaseDescription>
<QPM:ContentDescription>
<QPM:ContentTopic>Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
<QPM:ContentKeyword>FIDO, FTN, Jam</QPM:ContentKeyword>
<QPM:Processor/>
<QPM:TargetProcessor/>
<QPM:DisplayEnvironment>Console</QPM:DisplayEnvironment>
<QPM:TargetAudience>Developer</QPM:TargetAudience>
</QPM:ContentDescription>
<QPM:LicenseUrl>repdata://LicenseUrl/COPYING</QPM:LicenseUrl>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements/>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
</QPG:Values>
</QPG:Generation>

File diff suppressed because it is too large Load Diff

View File

@ -1,336 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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, 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

View File

@ -1,111 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage" 1>&2
exit 0
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi
;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi
;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# End:
# mkinstalldirs ends here

View File

@ -1,17 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
INCLUDES = -I$(top_srcdir)/include
lib_LTLIBRARIES = libjam.la
libjam_CURRENT = 2
libjam_REVISION = 5
libjam_AGE = 1
libjam_la_LDFLAGS = -export-dynamic -version-info $(libjam_CURRENT):$(libjam_REVISION):$(libjam_AGE)
libjam_la_SOURCES = crc32.c lastread.c mbase.c message.c structrw.c subpack.c
noinst_HEADERS = structrw.h

View File

@ -1,448 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
INCLUDES = -I$(top_srcdir)/include
lib_LTLIBRARIES = libjam.la
libjam_CURRENT = 2
libjam_REVISION = 5
libjam_AGE = 1
libjam_la_LDFLAGS = -export-dynamic -version-info $(libjam_CURRENT):$(libjam_REVISION):$(libjam_AGE)
libjam_la_SOURCES = crc32.c lastread.c mbase.c message.c structrw.c subpack.c
noinst_HEADERS = structrw.h
subdir = src
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(lib_LTLIBRARIES)
libjam_la_LIBADD =
am_libjam_la_OBJECTS = crc32.lo lastread.lo mbase.lo message.lo \
structrw.lo subpack.lo
libjam_la_OBJECTS = $(am_libjam_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/crc32.Plo ./$(DEPDIR)/lastread.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/mbase.Plo ./$(DEPDIR)/message.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/structrw.Plo ./$(DEPDIR)/subpack.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libjam_la_SOURCES)
HEADERS = $(noinst_HEADERS)
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
SOURCES = $(libjam_la_SOURCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
libLTLIBRARIES_INSTALL = $(INSTALL)
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjam.la: $(libjam_la_OBJECTS) $(libjam_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libjam_la_LDFLAGS) $(libjam_la_OBJECTS) $(libjam_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lastread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbase.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structrw.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subpack.Plo@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-depend distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,85 +0,0 @@
/*
Crc32 - CRC32-calculation for JAM
Copyright (C) 2000 Johan Billing
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <jamlib/jam.h>
/* CRC polynomial 0xedb88320 {{{ */
static ulong crc32tab[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
/* }}} */
/***********************************************************************
**
** JAM_Crc32 - calcutate CRC32 {{{
**/
ulong JAM_Crc32(uchar *Buffer_PC, ulong Length_I)
{
ulong Crc_I;
int c;
Crc_I=0xffffffff;
for(c=0;c < Length_I; c++)
Crc_I=(Crc_I>>8) ^ crc32tab[(uchar)Crc_I ^ tolower(Buffer_PC[c])];
return(Crc_I);
}
/** }}}
**
***********************************************************************/
/* Local variables:
* vim:set ts=8 sts=4 sw=4:
* vim600:fdm=marker:
*/

View File

@ -1,623 +0,0 @@
/*
JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16:
- Changed source to use feof() instead of errno == EPASTEOF
- Changed source to use structrw to read and write structures
- Added JAM_AddEmptyMessage()
- Added error messages JAM_NO_MESSAGE and JAM_CORRUPT_MSG for
JAM_ReadMsgHeader()
- #includes stdlib.h instead of malloc.h and memory.h
Changes made by Sir Raorn 2001-12-08:
- Added JAM_DeleteMessage()
*/
/***********************************************************************
**
** Message.C -- Message handling
**
** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se)
**
***********************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <jamlib/jam.h>
#include "structrw.h"
/***********************************************************************
**
** JAM_ReadMsgHeader - Read message header {{{
**/
int JAM_ReadMsgHeader( s_JamBase* Base_PS,
ulong MsgNo_I,
s_JamMsgHeader* Header_PS,
s_JamSubPacket** SubfieldPack_PPS )
{
s_JamIndex Index_S;
if ( !Base_PS || !Header_PS )
return JAM_BAD_PARAM;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read index record */
if ( 1 > freadjamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* message is not there */
if(Index_S.HdrOffset == 0xffffffff && Index_S.UserCRC == 0xffffffff)
{
return JAM_NO_MESSAGE;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read header */
if ( 1 > freadjammsgheader(Base_PS->HdrFile_PS,Header_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* are Subfields requested? */
if ( SubfieldPack_PPS && Header_PS->SubfieldLen ) {
s_JamSubPacket* SubPacket_PS;
s_JamSubfield Subfield_S;
char* Buf_PC;
char* Ptr_PC;
char* Roof_PC;
int BufSize_I = Header_PS->SubfieldLen;
Buf_PC = (void*) malloc( BufSize_I );
if ( !Buf_PC ) {
return JAM_NO_MEMORY;
}
/* read all subfields */
if ( 1 > fread( Buf_PC, BufSize_I, 1, Base_PS->HdrFile_PS ) ) {
Base_PS->Errno_I = errno;
free (Buf_PC);
return JAM_IO_ERROR;
}
SubPacket_PS = JAM_NewSubPacket();
if ( !SubPacket_PS ) {
free (Buf_PC);
return JAM_NO_MEMORY;
}
Roof_PC = Buf_PC + BufSize_I;
/* cut out the subfields */
for ( Ptr_PC = Buf_PC; Ptr_PC < Roof_PC; Ptr_PC += Subfield_S.DatLen + SIZE_JAMSAVESUBFIELD ) {
int Status_I;
getjamsubfield(Ptr_PC,&Subfield_S);
if ((char *)Subfield_S.Buffer + Subfield_S.DatLen > Roof_PC) {
JAM_DelSubPacket( SubPacket_PS );
free (Buf_PC);
return JAM_CORRUPT_MSG;
}
Status_I = JAM_PutSubfield( SubPacket_PS, &Subfield_S );
if ( Status_I ) {
JAM_DelSubPacket( SubPacket_PS );
free (Buf_PC);
return Status_I;
}
}
free( Buf_PC );
*SubfieldPack_PPS = SubPacket_PS;
} else {
if ( SubfieldPack_PPS )
/* fields requested but none found */
/* return an empty packet */
*SubfieldPack_PPS = JAM_NewSubPacket();
}
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_ReadMsgText - Read message text {{{
**/
int JAM_ReadMsgText( s_JamBase* Base_PS,
ulong Offset_I,
ulong Length_I,
uchar* Buffer_PC )
{
if ( !Base_PS || !Buffer_PC )
return JAM_BAD_PARAM;
if ( !Length_I )
return 0;
if ( fseek( Base_PS->TxtFile_PS, Offset_I, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
if ( 1 > fread( Buffer_PC, Length_I, 1, Base_PS->TxtFile_PS ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_ChangeMsgHeader - Change a message header {{{
**/
int JAM_ChangeMsgHeader( s_JamBase* Base_PS,
ulong MsgNo_I,
s_JamMsgHeader* Header_PS )
{
s_JamBaseHeader BaseHeader_S;
s_JamIndex Index_S;
int Status_I;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* read message base header */
Status_I = JAM_ReadMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read index record */
if ( 1 > freadjamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
if ( Header_PS->Attribute & MSG_DELETED ) {
Index_S.UserCRC = 0xffffffff;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* update index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
}
/* write header */
if ( 1 > fwritejammsgheader(Base_PS->HdrFile_PS,Header_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Status_I = JAM_WriteMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_AddMessage - Add a message to a message base {{{
**/
int JAM_AddMessage( s_JamBase* Base_PS,
s_JamMsgHeader* Header_PS,
s_JamSubPacket* SubPack_PS,
uchar* Text_PC,
ulong TextLen_I )
{
s_JamBaseHeader BaseHeader_S;
s_JamIndex Index_S;
ulong Offset_I;
int Status_I;
ulong TotLen_I;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* read message base header */
Status_I = JAM_ReadMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
/*
** Add text if any
*/
Header_PS->TxtOffset = 0;
Header_PS->TxtLen = 0;
if(Text_PC && TextLen_I)
{
/* go to end of text file */
if ( fseek( Base_PS->TxtFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* store text offset (for header) */
Offset_I = ftell( Base_PS->TxtFile_PS );
if ( Offset_I == -1 ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Header_PS->TxtOffset = Offset_I;
Header_PS->TxtLen = TextLen_I;
/* write text */
if ( 1 > fwrite( Text_PC, TextLen_I, 1, Base_PS->TxtFile_PS ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
}
/*
** Add header
*/
/* go to end of header file */
if ( fseek( Base_PS->HdrFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* calculate the size of all Subfields */
TotLen_I = 0;
if ( SubPack_PS ) {
s_JamSubfield* Subfield_PS;
for ( Subfield_PS = JAM_GetSubfield( SubPack_PS ); Subfield_PS; Subfield_PS = JAM_GetSubfield( NULL ) )
TotLen_I += sizeof( s_JamSaveSubfield ) + Subfield_PS->DatLen;
}
Header_PS->SubfieldLen = TotLen_I;
/* go to end of index file */
if ( fseek( Base_PS->IdxFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find out new message number (for message header) */
Offset_I = ftell( Base_PS->IdxFile_PS );
if ( Offset_I == -1 ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* update header */
Header_PS->MsgNum = Offset_I / sizeof( s_JamIndex ) + BaseHeader_S.BaseMsgNum;
memcpy( Header_PS->Signature, HEADERSIGNATURE, 4 );
Header_PS->Revision = CURRENTREVLEV;
/* go to end of header file */
if ( fseek( Base_PS->HdrFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find out new header offset (for index record) */
Offset_I = ftell( Base_PS->HdrFile_PS );
if ( Offset_I == -1 ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Index_S.HdrOffset = Offset_I;
/* write new header */
if ( 1 > fwritejammsgheader(Base_PS->HdrFile_PS,Header_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write Subfields */
if ( SubPack_PS ) {
s_JamSubfield* Subfield_PS;
uchar User_AC[101];
/* clear username */
User_AC[0] = 0;
for ( Subfield_PS = JAM_GetSubfield( SubPack_PS ); Subfield_PS; Subfield_PS = JAM_GetSubfield( NULL ) ) {
/* first, save Subfield header */
if ( 1 > fwritejamsavesubfield(Base_PS->HdrFile_PS,(s_JamSaveSubfield *)Subfield_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* then, save Subfield data if any*/
if(Subfield_PS->DatLen) {
if ( 1 > fwrite( Subfield_PS->Buffer, Subfield_PS->DatLen,
1, Base_PS->HdrFile_PS ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
}
/* store username for index file */
if ( Subfield_PS->LoID == JAMSFLD_RECVRNAME ) {
memcpy( User_AC, Subfield_PS->Buffer, Subfield_PS->DatLen );
User_AC[ Subfield_PS->DatLen ] = 0;
}
}
/* update index record */
if ( User_AC[0] )
Index_S.UserCRC = JAM_Crc32( User_AC, strlen( User_AC ) );
else
Index_S.UserCRC = JAM_NO_CRC;
} else
/* update index record */
Index_S.UserCRC = JAM_NO_CRC;
/*
** Add index
*/
/* write index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write message base header */
BaseHeader_S.ActiveMsgs++;
Status_I = JAM_WriteMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_AddEmptyMessage - Add a empty message entry to a message base {{{
**/
int JAM_AddEmptyMessage( s_JamBase* Base_PS)
{
s_JamIndex Index_S;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* go to end of index file */
if ( fseek( Base_PS->IdxFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/*
** Add index
*/
Index_S.HdrOffset = 0xffffffff;
Index_S.UserCRC = 0xffffffff;
/* write index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_DeleteMessage - Delete message from messagebase {{{
**/
int JAM_DeleteMessage( s_JamBase* Base_PS,
ulong MsgNo_I )
{
s_JamBaseHeader BaseHeader_S;
s_JamMsgHeader Header_S;
s_JamIndex Index_S;
int Status_I;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* read message base header */
Status_I = JAM_ReadMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read index record */
if ( 1 > freadjamindex( Base_PS->IdxFile_PS, &Index_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* message is not there */
if(Index_S.HdrOffset == 0xffffffff && Index_S.UserCRC == 0xffffffff)
{
return JAM_NO_MESSAGE;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read header */
if ( 1 > freadjammsgheader( Base_PS->HdrFile_PS, &Header_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Header_S.Attribute |= MSG_DELETED;
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write header */
if ( 1 > fwritejammsgheader( Base_PS->HdrFile_PS, &Header_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Index_S.HdrOffset = 0xffffffff;
Index_S.UserCRC = 0xffffffff;
/* write index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write message base header */
BaseHeader_S.ActiveMsgs--;
Status_I = JAM_WriteMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_Errno - Report the latest C library error code {{{
**/
int JAM_Errno( s_JamBase* Base_PS )
{
return Base_PS->Errno_I;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_ClearMsgHeader - Clear a message header {{{
**/
int JAM_ClearMsgHeader( s_JamMsgHeader* Header_PS )
{
if (!Header_PS)
return JAM_BAD_PARAM;
memset( Header_PS, 0, sizeof( s_JamMsgHeader ) );
memcpy( Header_PS->Signature, HEADERSIGNATURE, 4 );
Header_PS->Revision = CURRENTREVLEV;
Header_PS->MsgIdCRC = JAM_NO_CRC;
Header_PS->ReplyCRC = JAM_NO_CRC;
Header_PS->PasswordCRC = JAM_NO_CRC;
return 0;
}
/** }}}
**
***********************************************************************/
/* Local variables:
* vim:set ts=8 sts=4 sw=4:
* vim600:fdm=marker:
*/

View File

@ -1,237 +0,0 @@
/*
structrw - Platform-independent reading and writing of JAM structs
Copyright (C) 1999 Johan Billing
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <jamlib/jam.h>
#include "structrw.h"
ushort jamgetuword(uchar *buf,ulong offset)
{
return (ushort) buf[offset]+buf[offset+1]*256;
}
void jamputuword(uchar *buf,ulong offset,ushort num)
{
buf[offset]=num%256;
buf[offset+1]=num/256;
}
void jamputulong(uchar *buf,ulong offset,ulong num)
{
buf[offset]=num%256;
buf[offset+1]=(num / 256) % 256;
buf[offset+2]=(num / 256 / 256) % 256;
buf[offset+3]=(num / 256 / 256 / 256) % 256;
}
ulong jamgetulong(uchar *buf,ulong offset)
{
return (ulong) buf[offset]+
buf[offset+1]*256+
buf[offset+2]*256*256+
buf[offset+3]*256*256*256;
}
int freadjambaseheader(FILE *fp,s_JamBaseHeader *s_JamBaseHeader)
{
uchar buf[SIZE_JAMBASEHEADER];
if(fread(buf,SIZE_JAMBASEHEADER,1,fp) != 1)
return 0;
memcpy(s_JamBaseHeader->Signature,&buf[JAMBASEHEADER_SIGNATURE],4);
s_JamBaseHeader->DateCreated = jamgetulong(buf,JAMBASEHEADER_DATECREATED);
s_JamBaseHeader->ModCounter = jamgetulong(buf,JAMBASEHEADER_MODCOUNTER);
s_JamBaseHeader->ActiveMsgs = jamgetulong(buf,JAMBASEHEADER_ACTIVEMSGS);
s_JamBaseHeader->PasswordCRC = jamgetulong(buf,JAMBASEHEADER_PASSWORDCRC);
s_JamBaseHeader->BaseMsgNum = jamgetulong(buf,JAMBASEHEADER_BASEMSGNUM);
memcpy(s_JamBaseHeader->RSRVD,&buf[JAMBASEHEADER_RSRVD],1000);
return 1;
}
int fwritejambaseheader(FILE *fp,s_JamBaseHeader *s_JamBaseHeader)
{
uchar buf[SIZE_JAMBASEHEADER];
memcpy(&buf[JAMBASEHEADER_SIGNATURE],s_JamBaseHeader->Signature,4);
jamputulong(buf,JAMBASEHEADER_DATECREATED, s_JamBaseHeader->DateCreated);
jamputulong(buf,JAMBASEHEADER_MODCOUNTER, s_JamBaseHeader->ModCounter);
jamputulong(buf,JAMBASEHEADER_ACTIVEMSGS, s_JamBaseHeader->ActiveMsgs);
jamputulong(buf,JAMBASEHEADER_PASSWORDCRC, s_JamBaseHeader->PasswordCRC );
jamputulong(buf,JAMBASEHEADER_BASEMSGNUM, s_JamBaseHeader->BaseMsgNum);
memcpy(&buf[JAMBASEHEADER_RSRVD],s_JamBaseHeader->RSRVD,1000);
if(fwrite(buf,SIZE_JAMBASEHEADER,1,fp) != 1)
return 0;
return 1;
}
int freadjammsgheader(FILE *fp,s_JamMsgHeader *s_JamMsgHeader)
{
uchar buf[SIZE_JAMMSGHEADER];
if(fread(buf,SIZE_JAMMSGHEADER,1,fp) != 1)
return 0;
memcpy(s_JamMsgHeader->Signature,&buf[JAMMSGHEADER_SIGNATURE],4);
s_JamMsgHeader->Revision = jamgetuword(buf,JAMMSGHEADER_REVISION);
s_JamMsgHeader->ReservedWord = jamgetuword(buf,JAMMSGHEADER_RESERVEDWORD);
s_JamMsgHeader->SubfieldLen = jamgetulong(buf,JAMMSGHEADER_SUBFIELDLEN);
s_JamMsgHeader->TimesRead = jamgetulong(buf,JAMMSGHEADER_TIMESREAD);
s_JamMsgHeader->MsgIdCRC = jamgetulong(buf,JAMMSGHEADER_MSGIDCRC);
s_JamMsgHeader->ReplyCRC = jamgetulong(buf,JAMMSGHEADER_REPLYCRC);
s_JamMsgHeader->ReplyTo = jamgetulong(buf,JAMMSGHEADER_REPLYTO);
s_JamMsgHeader->Reply1st = jamgetulong(buf,JAMMSGHEADER_REPLY1ST);
s_JamMsgHeader->ReplyNext = jamgetulong(buf,JAMMSGHEADER_REPLYNEXT);
s_JamMsgHeader->DateWritten = jamgetulong(buf,JAMMSGHEADER_DATEWRITTEN);
s_JamMsgHeader->DateReceived = jamgetulong(buf,JAMMSGHEADER_DATERECEIVED);
s_JamMsgHeader->DateProcessed = jamgetulong(buf,JAMMSGHEADER_DATEPROCESSED);
s_JamMsgHeader->MsgNum = jamgetulong(buf,JAMMSGHEADER_MSGNUM);
s_JamMsgHeader->Attribute = jamgetulong(buf,JAMMSGHEADER_ATTRIBUTE);
s_JamMsgHeader->Attribute2 = jamgetulong(buf,JAMMSGHEADER_ATTRIBUTE2);
s_JamMsgHeader->TxtOffset = jamgetulong(buf,JAMMSGHEADER_TXTOFFSET);
s_JamMsgHeader->TxtLen = jamgetulong(buf,JAMMSGHEADER_TXTLEN);
s_JamMsgHeader->PasswordCRC = jamgetulong(buf,JAMMSGHEADER_PASSWORDCRC);
s_JamMsgHeader->Cost = jamgetulong(buf,JAMMSGHEADER_COST);
return 1;
}
int fwritejammsgheader(FILE *fp,s_JamMsgHeader *s_JamMsgHeader)
{
uchar buf[SIZE_JAMMSGHEADER];
memcpy(&buf[JAMMSGHEADER_SIGNATURE],s_JamMsgHeader->Signature,4);
jamputuword(buf,JAMMSGHEADER_REVISION, s_JamMsgHeader->Revision);
jamputuword(buf,JAMMSGHEADER_RESERVEDWORD, s_JamMsgHeader->ReservedWord);
jamputulong(buf,JAMMSGHEADER_SUBFIELDLEN, s_JamMsgHeader->SubfieldLen);
jamputulong(buf,JAMMSGHEADER_TIMESREAD, s_JamMsgHeader->TimesRead);
jamputulong(buf,JAMMSGHEADER_MSGIDCRC, s_JamMsgHeader->MsgIdCRC);
jamputulong(buf,JAMMSGHEADER_REPLYCRC, s_JamMsgHeader->ReplyCRC );
jamputulong(buf,JAMMSGHEADER_REPLYTO, s_JamMsgHeader->ReplyTo);
jamputulong(buf,JAMMSGHEADER_REPLY1ST, s_JamMsgHeader->Reply1st);
jamputulong(buf,JAMMSGHEADER_REPLYNEXT, s_JamMsgHeader->ReplyNext);
jamputulong(buf,JAMMSGHEADER_DATEWRITTEN, s_JamMsgHeader->DateWritten);
jamputulong(buf,JAMMSGHEADER_DATERECEIVED, s_JamMsgHeader->DateReceived );
jamputulong(buf,JAMMSGHEADER_DATEPROCESSED, s_JamMsgHeader->DateProcessed);
jamputulong(buf,JAMMSGHEADER_MSGNUM, s_JamMsgHeader->MsgNum);
jamputulong(buf,JAMMSGHEADER_ATTRIBUTE, s_JamMsgHeader->Attribute);
jamputulong(buf,JAMMSGHEADER_ATTRIBUTE2, s_JamMsgHeader->Attribute2);
jamputulong(buf,JAMMSGHEADER_TXTOFFSET, s_JamMsgHeader->TxtOffset);
jamputulong(buf,JAMMSGHEADER_TXTLEN, s_JamMsgHeader->TxtLen);
jamputulong(buf,JAMMSGHEADER_PASSWORDCRC, s_JamMsgHeader->PasswordCRC);
jamputulong(buf,JAMMSGHEADER_COST, s_JamMsgHeader->Cost);
if(fwrite(buf,SIZE_JAMMSGHEADER,1,fp) != 1)
return 0;
return 1;
}
int freadjamindex(FILE *fp,s_JamIndex *s_JamIndex)
{
uchar buf[SIZE_JAMINDEX];
if(fread(buf,SIZE_JAMINDEX,1,fp) != 1)
return 0;
s_JamIndex->UserCRC = jamgetulong(buf,JAMINDEX_USERCRC);
s_JamIndex->HdrOffset = jamgetulong(buf,JAMINDEX_HDROFFSET);
return 1;
}
int fwritejamindex(FILE *fp,s_JamIndex *s_JamIndex)
{
uchar buf[SIZE_JAMINDEX];
jamputulong(buf,JAMINDEX_USERCRC, s_JamIndex->UserCRC);
jamputulong(buf,JAMINDEX_HDROFFSET, s_JamIndex->HdrOffset);
if(fwrite(buf,SIZE_JAMINDEX,1,fp) != 1)
return 0;
return 1;
}
int freadjamlastread(FILE *fp,s_JamLastRead *s_JamLastRead)
{
uchar buf[SIZE_JAMLASTREAD];
if(fread(buf,SIZE_JAMLASTREAD,1,fp) != 1)
return 0;
s_JamLastRead->UserCRC = jamgetulong(buf,JAMLASTREAD_USERCRC);
s_JamLastRead->UserID = jamgetulong(buf,JAMLASTREAD_USERID);
s_JamLastRead->LastReadMsg = jamgetulong(buf,JAMLASTREAD_LASTREADMSG);
s_JamLastRead->HighReadMsg = jamgetulong(buf,JAMLASTREAD_HIGHREADMSG);
return 1;
}
int fwritejamlastread(FILE *fp,s_JamLastRead *s_JamLastRead)
{
uchar buf[SIZE_JAMLASTREAD];
jamputulong(buf,JAMLASTREAD_USERCRC,s_JamLastRead->UserCRC);
jamputulong(buf,JAMLASTREAD_USERID,s_JamLastRead->UserID);
jamputulong(buf,JAMLASTREAD_LASTREADMSG,s_JamLastRead->LastReadMsg);
jamputulong(buf,JAMLASTREAD_HIGHREADMSG,s_JamLastRead->HighReadMsg);
if(fwrite(buf,SIZE_JAMLASTREAD,1,fp) != 1)
return 0;
return 1;
}
int fwritejamsavesubfield(FILE *fp,s_JamSaveSubfield *s_JamSaveSubfield)
{
uchar buf[SIZE_JAMLASTREAD];
jamputuword(buf,JAMSAVESUBFIELD_LOID, s_JamSaveSubfield->LoID);
jamputuword(buf,JAMSAVESUBFIELD_HIID, s_JamSaveSubfield->HiID);
jamputulong(buf,JAMSAVESUBFIELD_DATLEN, s_JamSaveSubfield->DatLen);
if(fwrite(buf,SIZE_JAMSAVESUBFIELD,1,fp) != 1)
return 0;
return 1;
}
void getjamsubfield(uchar *buf,s_JamSubfield *Subfield_S)
{
Subfield_S->LoID = jamgetuword(buf,JAMSAVESUBFIELD_LOID);
Subfield_S->HiID = jamgetuword(buf,JAMSAVESUBFIELD_HIID);
Subfield_S->DatLen = jamgetulong(buf,JAMSAVESUBFIELD_DATLEN);
Subfield_S->Buffer = (uchar *) buf + SIZE_JAMSAVESUBFIELD;
}

View File

@ -1,209 +0,0 @@
/*
JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16:
- Fixed broken JAM_GetSubfield()
- #includes stdlib.h instead of malloc.h and memory.h
Changes made by Johan Billing 2000-09-17:
- Added JAM_GetSubfield_R()
*/
/***********************************************************************
**
** SUBPACKET.C -- Subfield packet handling
**
** Author: Bjorn Stenberg (bjorn.stenberg@sth.frontec.se)
**
***********************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <jamlib/jam.h>
/***********************************************************************
**
** JAM_NewSubPacket - Create a new subfield packet {{{
**/
s_JamSubPacket* JAM_NewSubPacket( void )
{
s_JamSubPacket* Sub_PS;
/* allocate packet struct */
Sub_PS = (s_JamSubPacket*) malloc( sizeof( s_JamSubPacket ) );
if ( !Sub_PS )
return NULL;
Sub_PS->NumAlloc = 20;
Sub_PS->NumFields = 0;
/* allocate pointer array */
Sub_PS->Fields = (s_JamSubfield**) calloc( Sub_PS->NumAlloc, sizeof( s_JamSubfield* ) );
if ( !Sub_PS->Fields ) {
free (Sub_PS);
return NULL;
}
return Sub_PS;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_DelSubPacket - Free the data associated with a subfield packet {{{
**/
int JAM_DelSubPacket( s_JamSubPacket* SubPack_PS )
{
int i;
if (!SubPack_PS)
return JAM_BAD_PARAM;
for ( i=0; i < SubPack_PS->NumFields; i++ ) {
s_JamSubfield* Field_PS = SubPack_PS->Fields[i];
if ( Field_PS->Buffer )
free( Field_PS->Buffer );
free( Field_PS );
}
free( SubPack_PS->Fields );
free( SubPack_PS );
return 0;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_GetSubfield -- Get first/next subfield from a subfield packet {{{
** (not reentrant)
**/
s_JamSubfield* JAM_GetSubfield( s_JamSubPacket* SubPack_PS )
{
static s_JamSubPacket* LastPack_PS = NULL;
static int NextIndex_I = 0;
if ( SubPack_PS ) {
LastPack_PS = SubPack_PS;
NextIndex_I = 0;
}
if ( NextIndex_I < LastPack_PS->NumFields )
return LastPack_PS->Fields[ NextIndex_I++ ];
return NULL;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_GetSubfield_R -- Get first/next subfield from a subfield packet {{{
** (reentrant)
**/
s_JamSubfield* JAM_GetSubfield_R( s_JamSubPacket* SubPack_PS , ulong* Count_PI)
{
if ( *Count_PI < SubPack_PS->NumFields )
return SubPack_PS->Fields[ (*Count_PI)++ ];
return NULL;
}
/** }}}
**
***********************************************************************/
/***********************************************************************
**
** JAM_PutSubfield -- Add a subfield to a subfield packet {{{
**/
int JAM_PutSubfield( s_JamSubPacket* SubPack_PS, s_JamSubfield* Field_PS )
{
s_JamSubfield* NewField_PS;
uchar* NewBuf_PC;
/* do we have to expand the array? */
if ( SubPack_PS->NumFields == SubPack_PS->NumAlloc ) {
s_JamSubfield** Fields_PPS;
SubPack_PS->NumAlloc *= 2;
Fields_PPS = (s_JamSubfield**) realloc( SubPack_PS->Fields, SubPack_PS->NumAlloc * sizeof( s_JamSubfield* ) );
if ( !Fields_PPS ) {
return JAM_NO_MEMORY;
}
SubPack_PS->Fields=Fields_PPS;
}
/*
** Copy the passed subfield
*/
/* allocate a new subfield */
NewField_PS = (s_JamSubfield*) malloc( sizeof( s_JamSubfield ) );
if ( !NewField_PS ) {
return JAM_NO_MEMORY;
}
/* allocate a new buffer */
if ( Field_PS->DatLen ) {
NewBuf_PC = (uchar*) malloc( Field_PS->DatLen );
if ( !NewBuf_PC ) {
free (NewField_PS);
return JAM_NO_MEMORY;
}
memcpy( NewBuf_PC, Field_PS->Buffer, Field_PS->DatLen );
}
else
NewBuf_PC = NULL;
/* copy field struct */
NewField_PS->LoID = Field_PS->LoID;
NewField_PS->HiID = Field_PS->HiID;
NewField_PS->DatLen = Field_PS->DatLen;
NewField_PS->Buffer = NewBuf_PC;
/*
** Update subfield packet
*/
SubPack_PS->Fields[ SubPack_PS->NumFields ] = NewField_PS;
SubPack_PS->NumFields++;
return 0;
}
/** }}}
**
***********************************************************************/
/* Local variables:
* vim:set ts=8 sts=4 sw=4:
* vim600:fdm=marker:
*/

View File

@ -1,5 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
SUBDIRS = jamlib

View File

@ -1,419 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = jamlib
subdir = win32
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = Makefile.am Makefile.in
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign win32/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am \
dvi-recursive info info-am info-recursive install install-am \
install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am \
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,5 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = jamlib.dsp

View File

@ -1,277 +0,0 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = jamlib.dsp
subdir = win32/jamlib
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign win32/jamlib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,139 +0,0 @@
# Microsoft Developer Studio Project File - Name="jamlib" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=jamlib - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "jamlib.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "jamlib.mak" CFG="jamlib - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "jamlib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "jamlib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "jamlib - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JAMLIB_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "__WIN32__" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/jam.dll"
!ELSEIF "$(CFG)" == "jamlib - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JAMLIB_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "__WIN32__" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/jam.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "jamlib - Win32 Release"
# Name "jamlib - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\src\crc32.c
# End Source File
# Begin Source File
SOURCE=..\..\src\jamlib.def
# End Source File
# Begin Source File
SOURCE=..\..\src\lastread.c
# End Source File
# Begin Source File
SOURCE=..\..\src\mbase.c
# End Source File
# Begin Source File
SOURCE=..\..\src\message.c
# End Source File
# Begin Source File
SOURCE=..\..\src\structrw.c
# End Source File
# Begin Source File
SOURCE=..\..\src\subpack.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\include\jamlib\jam.h
# End Source File
# Begin Source File
SOURCE=..\..\src\structrw.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

29
jamlib/Makefile.linux Normal file
View File

@ -0,0 +1,29 @@
CC = gcc $(CPPFLAGS) $(CFLAGS) -D__LINUX__ $(LDFLAGS) -Wall
AR = ar -ru
RM = rm -f
OBJS = crc32.o mbase.o message.o lastread.o subpack.o structrw.o
jamlib.a : $(OBJS)
$(AR) jamlib.a $(OBJS)
crc32.o: crc32.c jam.h
$(CC) -c crc32.c -o crc32.o
mbase.o: mbase.c jam.h
$(CC) -c mbase.c -o mbase.o
message.o: message.c jam.h
$(CC) -c message.c -o message.o
lastread.o: lastread.c jam.h
$(CC) -c lastread.c -o lastread.o
subpack.o: subpack.c jam.h
$(CC) -c subpack.c -o subpack.o
structrw.o: structrw.c jam.h
$(CC) -c structrw.c -o structrw.o
clean:
$(RM) *.o *.a

30
jamlib/Makefile.os2 Normal file
View File

@ -0,0 +1,30 @@
CC = gcc -Wall -D__OS2__ -DINCL_DOSPROCESS
AR = ar -ru
RM = del
OBJS = crc32.o mbase.o message.o lastread.o subpack.o structrw.o
jamlib.a: $(OBJS)
$(AR) jamlib.a $(OBJS)
crc32.o: crc32.c jam.h
$(CC) -c crc32.c -o crc32.o
mbase.o: mbase.c jam.h
$(CC) -c mbase.c -o mbase.o
message.o: message.c jam.h
$(CC) -c message.c -o message.o
lastread.o: lastread.c jam.h
$(CC) -c lastread.c -o lastread.o
subpack.o: subpack.c jam.h
$(CC) -c subpack.c -o subpack.o
structrw.o: structrw.c jam.h
$(CC) -c structrw.c -o structrw.o
clean:
$(RM) *.o *.a

29
jamlib/Makefile.win32 Normal file
View File

@ -0,0 +1,29 @@
CC = gcc -Wall
AR = ar -ru
RM = del
OBJS = crc32.o mbase.o message.o lastread.o subpack.o structrw.o
jamlib.a : $(OBJS)
$(AR) jamlib.a $(OBJS)
crc32.o: crc32.c jam.h
$(CC) -c crc32.c -o crc32.o
mbase.o: mbase.c jam.h
$(CC) -c mbase.c -o mbase.o
message.o: message.c jam.h
$(CC) -c message.c -o message.o
lastread.o: lastread.c jam.h
$(CC) -c lastread.c -o lastread.o
subpack.o: subpack.c jam.h
$(CC) -c subpack.c -o subpack.o
structrw.o: structrw.c jam.h
$(CC) -c structrw.c -o structrw.o
clean:
$(RM) *.o *.a

78
jamlib/crc32.c Normal file
View File

@ -0,0 +1,78 @@
/*
Crc32 - CRC32-calculation for JAM
Copyright (C) 2000 Johan Billing
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2003-10-22
- Fixed comparison between signed and unsigned variable in JAM_Crc32()
*/
#include "jam.h"
uint32_t crc32tab[] = { /* CRC polynomial 0xedb88320 */
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
/***********************************************************************
**
** JAM_Crc32 - Calculates CRC-32
**
***********************************************************************/
uint32_t JAM_Crc32(char *Buffer_PC, uint32_t Length_I)
{
uint32_t Crc_I;
uint32_t c;
Crc_I=0xffffffff;
for(c=0;c < Length_I; c++)
Crc_I=(Crc_I>>8) ^ crc32tab[(char)Crc_I ^ tolower(Buffer_PC[c])];
return(Crc_I);
}

326
jamlib/jam.h Normal file
View File

@ -0,0 +1,326 @@
/*
JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16:
- Added #defines for JAM_NO_MESSAGE and JAM_CORRUPT_MSG
- Added #ifndef linux around typedefs for uint16_t and uint32_t
- Added prototype for JAM_AddEmptyMessage()
Backported changes from JAMLIB 1.4.7 made by Johan Billing 2003-10-26
- Added prototype for JAM_DeleteMessage()
*/
/***********************************************************************
**
** JAM Definitions
**
***********************************************************************/
#ifndef __JAM_H__
#define __JAM_H__
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <stdint.h>
/*
** Error codes
*/
#define JAM_BAD_PARAM 1 /* one or more parameters are wrong */
#define JAM_IO_ERROR 2 /* i/o error. check JAM_Errno() for details */
#define JAM_LOCK_FAILED 3 /* lock could not be set */
#define JAM_NOT_LOCKED 4 /* the message base was not locked before writing */
#define JAM_NO_MEMORY 5 /* out of memory! */
#define JAM_NO_USER 6 /* user not found */
#define JAM_NO_MESSAGE 7 /* message has been deleted */
#define JAM_CORRUPT_MSG 8 /* message header is corrupt */
/*
** CRC definitions
*/
#define JAM_NO_CRC 0xffffffff
/*
** File extensions
*/
#define EXT_HDRFILE ".jhr"
#define EXT_TXTFILE ".jdt"
#define EXT_IDXFILE ".jdx"
#define EXT_LRDFILE ".jlr"
/*
** Revision level and header signature
*/
#define CURRENTREVLEV 1
#define HEADERSIGNATURE "JAM\0"
/*
** Header file information block, stored first in all .JHR files
*/
typedef struct {
char Signature[4]; /* <J><A><M> followed by <NUL> */
uint32_t DateCreated; /* Creation date */
uint32_t ModCounter; /* Last processed counter */
uint32_t ActiveMsgs; /* Number of active (not deleted) msgs */
uint32_t PasswordCRC; /* CRC-32 of password to access */
uint32_t BaseMsgNum; /* Lowest message number in index file */
char RSRVD[1000]; /* Reserved space */
} s_JamBaseHeader;
/*
** Message status bits
*/
#define MSG_LOCAL 0x00000001L /* Msg created locally */
#define MSG_INTRANSIT 0x00000002L /* Msg is in-transit */
#define MSG_PRIVATE 0x00000004L /* Private */
#define MSG_READ 0x00000008L /* Read by addressee */
#define MSG_SENT 0x00000010L /* Sent to remote */
#define MSG_KILLSENT 0x00000020L /* Kill when sent */
#define MSG_ARCHIVESENT 0x00000040L /* Archive when sent */
#define MSG_HOLD 0x00000080L /* Hold for pick-up */
#define MSG_CRASH 0x00000100L /* Crash */
#define MSG_IMMEDIATE 0x00000200L /* Send Msg now, ignore restrictions */
#define MSG_DIRECT 0x00000400L /* Send directly to destination */
#define MSG_GATE 0x00000800L /* Send via gateway */
#define MSG_FILEREQUEST 0x00001000L /* File request */
#define MSG_FILEATTACH 0x00002000L /* File(s) attached to Msg */
#define MSG_TRUNCFILE 0x00004000L /* Truncate file(s) when sent */
#define MSG_KILLFILE 0x00008000L /* Delete file(s) when sent */
#define MSG_RECEIPTREQ 0x00010000L /* Return receipt requested */
#define MSG_CONFIRMREQ 0x00020000L /* Confirmation receipt requested */
#define MSG_ORPHAN 0x00040000L /* Unknown destination */
#define MSG_ENCRYPT 0x00080000L /* Msg text is encrypted */
#define MSG_COMPRESS 0x00100000L /* Msg text is compressed */
#define MSG_ESCAPED 0x00200000L /* Msg text is seven bit ASCII */
#define MSG_FPU 0x00400000L /* Force pickup */
#define MSG_TYPELOCAL 0x00800000L /* Msg is for local use only (no export) */
#define MSG_TYPEECHO 0x01000000L /* Msg is for conference distribution */
#define MSG_TYPENET 0x02000000L /* Msg is direct network mail */
#define MSG_NODISP 0x20000000L /* Msg may not be displayed to user */
#define MSG_LOCKED 0x40000000L /* Msg is locked, no editing possible */
#define MSG_DELETED 0x80000000L /* Msg is deleted */
/*
** Message header
*/
typedef struct {
char Signature[4]; /* <J><A><M> followed by <NUL> */
uint16_t Revision; /* CURRENTREVLEV */
uint16_t ReservedWord; /* Reserved */
uint32_t SubfieldLen; /* Length of Subfields */
uint32_t TimesRead; /* Number of times message read */
uint32_t MsgIdCRC; /* CRC-32 of MSGID line */
uint32_t ReplyCRC; /* CRC-32 of REPLY line */
uint32_t ReplyTo; /* This msg is a reply to.. */
uint32_t Reply1st; /* First reply to this msg */
uint32_t ReplyNext; /* Next msg in reply chain */
uint32_t DateWritten; /* When msg was written */
uint32_t DateReceived; /* When msg was received/read */
uint32_t DateProcessed; /* When msg was processed by packer */
uint32_t MsgNum; /* Message number (1-based) */
uint32_t Attribute; /* Msg attribute, see "Status bits" */
uint32_t Attribute2; /* Reserved for future use */
uint32_t TxtOffset; /* Offset of text in text file */
uint32_t TxtLen; /* Length of message text */
uint32_t PasswordCRC; /* CRC-32 of password to access msg */
uint32_t Cost; /* Cost of message */
} s_JamMsgHeader;
/*
** Message header Subfield types
*/
#define JAMSFLD_OADDRESS 0
#define JAMSFLD_DADDRESS 1
#define JAMSFLD_SENDERNAME 2
#define JAMSFLD_RECVRNAME 3
#define JAMSFLD_MSGID 4
#define JAMSFLD_REPLYID 5
#define JAMSFLD_SUBJECT 6
#define JAMSFLD_PID 7
#define JAMSFLD_TRACE 8
#define JAMSFLD_ENCLFILE 9
#define JAMSFLD_ENCLFWALIAS 10
#define JAMSFLD_ENCLFREQ 11
#define JAMSFLD_ENCLFILEWC 12
#define JAMSFLD_ENCLINDFILE 13
#define JAMSFLD_EMBINDAT 1000
#define JAMSFLD_FTSKLUDGE 2000
#define JAMSFLD_SEENBY2D 2001
#define JAMSFLD_PATH2D 2002
#define JAMSFLD_FLAGS 2003
#define JAMSFLD_TZUTCINFO 2004
#define JAMSFLD_UNKNOWN 0xffff
/*
** Message header Subfield
*/
typedef struct {
uint16_t LoID; /* Field ID, 0 - 0xffff */
uint16_t HiID; /* Reserved for future use */
uint32_t DatLen; /* Length of buffer that follows */
char* Buffer; /* DatLen bytes of data */
} s_JamSubfield;
typedef struct {
uint16_t LoID; /* Field ID, 0 - 0xffff */
uint16_t HiID; /* Reserved for future use */
uint32_t DatLen; /* Length of buffer that follows */
} s_JamSaveSubfield;
/*
** Message index record
*/
typedef struct {
uint32_t UserCRC; /* CRC-32 of destination username */
uint32_t HdrOffset; /* Offset of header in .JHR file */
} s_JamIndex;
/*
** Lastread structure, one per user
*/
typedef struct {
uint32_t UserCRC; /* CRC-32 of user name (lowercase) */
uint32_t UserID; /* Unique UserID */
uint32_t LastReadMsg; /* Last read message number */
uint32_t HighReadMsg; /* Highest read message number */
} s_JamLastRead;
/*
** JAMLIB message base handle
*/
typedef struct {
FILE* HdrFile_PS; /* File handle for .JHR file */
FILE* TxtFile_PS; /* File handle for .JDT file */
FILE* IdxFile_PS; /* File handle for .JDX file */
FILE* LrdFile_PS; /* File handle for .JLR file */
int Errno_I; /* last i/o error */
int Locked_I; /* is area locked? */
uint32_t LastUserPos_I; /* last position of lastread record */
uint32_t LastUserId_I; /* userid for the last read lastread record */
} s_JamBase;
/*
** JAMLIB subfield packet
*/
typedef struct {
s_JamSubfield** Fields;
uint32_t NumFields;
uint32_t NumAlloc;
} s_JamSubPacket;
/*
** JAMLIB function declarations
*/
/* mbase.c */
int JAM_OpenMB ( char* Basename_PC,
s_JamBase** NewArea_PPS );
int JAM_CloseMB ( s_JamBase* Area_PS );
int JAM_CreateMB ( char* Basename_PC,
uint32_t BaseMsg_I,
s_JamBase** NewArea_PPS );
int JAM_RemoveMB ( s_JamBase* Area_PS,
char* Basename_PC );
int JAM_LockMB ( s_JamBase* Area_PS,
int Timeout_I );
int JAM_UnlockMB ( s_JamBase* Area_PS );
int JAM_ReadMBHeader ( s_JamBase* Area_PS,
s_JamBaseHeader* Header_PS );
int JAM_WriteMBHeader ( s_JamBase* Area_PS,
s_JamBaseHeader* Header_PS );
int JAM_FindUser ( s_JamBase* Area_PS,
uint32_t UserCrc_I,
uint32_t StartMsg_I,
uint32_t* MsgNo_PI );
int JAM_GetMBSize ( s_JamBase* Area_PS,
uint32_t* Messages_PI );
/* message.c */
int JAM_ReadMsgHeader ( s_JamBase* Area_PS,
uint32_t MsgNo_I,
s_JamMsgHeader* Header_PS,
s_JamSubPacket** SubfieldPack_PPS );
int JAM_ReadMsgText ( s_JamBase* Area_PS,
uint32_t Offset_I,
uint32_t Length_I,
char* Buffer_PC );
int JAM_AddMessage ( s_JamBase* Area_PS,
s_JamMsgHeader* Header_PS,
s_JamSubPacket* SubPack_PS,
char* Text_PC,
uint32_t TextLen_I );
int JAM_AddEmptyMessage ( s_JamBase* Area_PS );
int JAM_DeleteMessage ( s_JamBase* Base_PS,
uint32_t MsgNo_I );
int JAM_ChangeMsgHeader ( s_JamBase* Area_PS,
uint32_t MsgNo_I,
s_JamMsgHeader* Header_PS );
int JAM_ClearMsgHeader ( s_JamMsgHeader* Header_PS );
int JAM_Errno ( s_JamBase* Area_PS );
/* lastread.c */
int JAM_ReadLastRead ( s_JamBase* Area_PS,
uint32_t User_I,
s_JamLastRead* Record_PS );
int JAM_WriteLastRead ( s_JamBase* Area_PS,
uint32_t User_I,
s_JamLastRead* Record_PS );
/* subpacket.c */
s_JamSubPacket* JAM_NewSubPacket ( void );
int JAM_DelSubPacket ( s_JamSubPacket* SubPack_PS );
s_JamSubfield* JAM_GetSubfield ( s_JamSubPacket* SubPack_PS );
s_JamSubfield* JAM_GetSubfield_R ( s_JamSubPacket* SubPack_PS ,
uint32_t* Count_PI);
int JAM_PutSubfield ( s_JamSubPacket* SubPack_PS,
s_JamSubfield* Field_PS );
/* crc32.c */
uint32_t JAM_Crc32 ( char* Buffer_PC, uint32_t Length_I );
#endif

View File

@ -6,9 +6,9 @@
modifications by Johan Billing modifications by Johan Billing
Version 1.2 version 1.3.2
2000-09-17 2004-07-10
GENERAL GENERAL
@ -25,6 +25,55 @@ General Public License 1999-12-21 (see the accompanying file LICENSE).
After that, some minor additions and bug fixes were made by Johan After that, some minor additions and bug fixes were made by Johan
Billing and JAMLIB 1.1 was released under the new license. Billing and JAMLIB 1.1 was released under the new license.
Changes in 1.3.2:
* Updated the Win32-specific parts of the code to make it compatible with
newer versions of MinGW (tested with 3.1.0-1).
Changes in 1.3.1:
* Backported the following bugfixes and improvements from JAMLIB 1.4.7 while
retaining the platform-independence and high portability of the early
versions of JAMLIB.
- JAMLIB now uses calloc() instead of malloc() followed by memset()
- JAM_OpenMB() and JAM_CreateMB() will set (*NewArea_PPS) to NULL if
calloc() failed
- JAM_CreateMB() no longer attempts indefinitely to lock the newly created
messagebase. If the first attempt fails, it will return an error.
- jam_Lock() now sets Base_PS->Errno under Linux
- JAM_NewSubPacket() and JAM_PutSubField() would give memory leaks under
conditions of low memory conditions. Fixed.
- JAM_ReadMsgHeader() would give memory leaks on failure. Fixed.
- Added JAM_DeleteMessage()
Big thanks to Sir Raorn (and others?) for finding and fixing these bugs!
* JAM_CreateMB() would never unlock or close the newly created messagebase
upon failure. Fixed.
* Improved handling of ActiveMsgs counter. JAM_AddMessage() now only
increases ActiveMsgs if the added message does not have MSG_DELETED set.
JAM_ChangeMsgHeader() decreases ActiveMsgs if MSG_DELETED is set and the
message wasn't already deleted. JAM_DeleteMessage() now only decreases
ActiveMsgs if the message wasn't already deleted.
* Updated the documentation to reflect the need to free() memory after
JAM_CloseMB() and failed calls to JAM_OpenMB() and JAM_CreateMB().
* Eliminated compiler warnings
Changes in 1.3:
* JAM_AddMessage() would fail when trying to add an empty message
to the messagebase under Linux. Fixed.
Changes in 1.2: Changes in 1.2:
* Since JAM_GetSubField() is not reentrant and cannot be used in * Since JAM_GetSubField() is not reentrant and cannot be used in
@ -146,7 +195,6 @@ For questions about JAMLIB, please contact:
Johan Billing Johan Billing
Fidonet: 2:205/454.77
E-mail: billing@df.lth.se E-mail: billing@df.lth.se
If you wish to contact Björn Stenberg, his current e-mail address (as of If you wish to contact Björn Stenberg, his current e-mail address (as of
@ -270,7 +318,7 @@ Description
Unlocks (if locked) and closes the currently open message base. Unlocks (if locked) and closes the currently open message base.
Parameters Parameters
Base_PS The message base to close. Note, that uou must Base_PS The message base to close. Note, that you must
free() this memory by yourself. free() this memory by yourself.
Returns Returns
@ -318,8 +366,6 @@ Parameters
Returns Returns
0 if successful 0 if successful
JAM_IO_ERROR if an I/O error occured. see JAM_Errno() JAM_IO_ERROR if an I/O error occured. see JAM_Errno()
JAM_LOCK_FAILED if the newly created message base can not be locked
see JAM_Errno()
JAM_BAD_PARAM if BaseMsg_I is 0 or NewBase_PPS is NULL JAM_BAD_PARAM if BaseMsg_I is 0 or NewBase_PPS is NULL
Example Example
@ -672,7 +718,7 @@ Returns
0 if successful 0 if successful
JAM_IO_ERROR if an I/O error occured. see JAM_Errno() JAM_IO_ERROR if an I/O error occured. see JAM_Errno()
JAM_NO_MEMORY if a memory allocation failed JAM_NO_MEMORY if a memory allocation failed
JAM_NO_MESSAGE if message has been removed JAM_NO_MESSAGE if message has been removed
JAM_CORRUPT_MSG if message subfields are corrupted JAM_CORRUPT_MSG if message subfields are corrupted
Example Example
@ -870,6 +916,8 @@ Returns
Example Example
none none
=============================================== ===============================================
JAM_ChangeMsgHeader - Change a message's header JAM_ChangeMsgHeader - Change a message's header
=============================================== ===============================================
@ -883,8 +931,6 @@ Description
Writes over an old message header with a new one. Only the header - Writes over an old message header with a new one. Only the header -
not the subfields - can be changed due to the subfields' dynamic not the subfields - can be changed due to the subfields' dynamic
size. size.
If message have MSG_DELETED attribute set, UserCRC field in index
and ActiveMsgs base header also updated.
NOTE! Use this function with caution. It is easy to corrupt a NOTE! Use this function with caution. It is easy to corrupt a
message by giving it an incorrect header. message by giving it an incorrect header.
@ -943,6 +989,7 @@ Returns
JAM_BAD_PARAM if Header_PS is NULL JAM_BAD_PARAM if Header_PS is NULL
=================================================== ===================================================
JAM_DeleteMessage - Delete message from messagebase JAM_DeleteMessage - Delete message from messagebase
=================================================== ===================================================
@ -956,7 +1003,6 @@ Description
Deletes message from messagebase by setting HdrOffset and UserCRC Deletes message from messagebase by setting HdrOffset and UserCRC
in index to 0xFFFFFFFF. ActiveMsgs in base header also updated. in index to 0xFFFFFFFF. ActiveMsgs in base header also updated.
Parameters Parameters
Base_PS The message base to use Base_PS The message base to use
@ -973,7 +1019,6 @@ Example
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Subfield packet functions Subfield packet functions
@ -1315,8 +1360,8 @@ Syntax
Description Description
Calculates the Crc32 value for a block of data. All ASCII Calculates the Crc32 value for a block of data. All ASCII
characters are converted to lowercase before calculating characters are converted to lowercase before calculating
the CRC (the input data is unchanged). the CRC (the input data is unchanged).
Parameters Parameters
Buffer_PC A pointer to the first byte of the data block Buffer_PC A pointer to the first byte of the data block
@ -1371,3 +1416,5 @@ Examples
} }

View File

@ -1,51 +1,54 @@
/* /*
JAMLIB - A JAM subroutine library JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg Copyright (C) 1999 Björn Stenberg
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 Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 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
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16: Changes made by Johan Billing 2000-04-16:
- Changed source to use feof() instead of errno == EPASTEOF - Changed source to use feof() instead of errno == EPASTEOF
- Changed source to use structrw to read and write structures - Changed source to use structrw to read and write structures
*/ */
/*********************************************************************** /***********************************************************************
** **
** LASTREAD.C -- Lastread pointer handling ** LASTREAD.C -- Lastread pointer handling
** **
** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se) ** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se)
** **
***********************************************************************/ ***********************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <jamlib/jam.h> #include "jam.h"
#include "structrw.h" #include "structrw.h"
/*********************************************************************** /***********************************************************************
** **
** JAM_ReadLastRead - Read LastRead record {{{ ** File global variables
**/ **
***********************************************************************/
/***********************************************************************
**
** JAM_ReadLastRead - Read LastRead record
**
***********************************************************************/
int JAM_ReadLastRead( s_JamBase* Base_PS, int JAM_ReadLastRead( s_JamBase* Base_PS,
ulong User_I, uint32_t User_I,
s_JamLastRead* Record_PS ) s_JamLastRead* Record_PS )
{ {
s_JamLastRead Record_S; s_JamLastRead Record_S;
int Pos_I; int Pos_I;
@ -60,8 +63,8 @@ int JAM_ReadLastRead( s_JamBase* Base_PS,
for ( Pos_I = 0; ; Pos_I++ ) { for ( Pos_I = 0; ; Pos_I++ ) {
if ( 1 > freadjamlastread(Base_PS->LrdFile_PS,&Record_S) ) { if ( 1 > freadjamlastread(Base_PS->LrdFile_PS,&Record_S) ) {
if ( feof(Base_PS->LrdFile_PS) ) if ( feof(Base_PS->LrdFile_PS) )
return JAM_NO_USER; return JAM_NO_USER;
Base_PS->Errno_I = errno; Base_PS->Errno_I = errno;
return JAM_IO_ERROR; return JAM_IO_ERROR;
@ -77,17 +80,15 @@ int JAM_ReadLastRead( s_JamBase* Base_PS,
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_WriteLastRead - Write LastRead record {{{ ** JAM_WriteLastRead - Write LastRead record
**/ **
int JAM_WriteLastRead( s_JamBase* Base_PS, ***********************************************************************/
ulong User_I, int JAM_WriteLastRead( s_JamBase* Base_PS,
s_JamLastRead* Record_PS ) uint32_t User_I,
s_JamLastRead* Record_PS )
{ {
s_JamLastRead Record_S; s_JamLastRead Record_S;
int Pos_I; int Pos_I;
@ -95,7 +96,7 @@ int JAM_WriteLastRead( s_JamBase* Base_PS,
if (!Record_PS) if (!Record_PS)
return JAM_BAD_PARAM; return JAM_BAD_PARAM;
/* if the last read is stored {{{ */ /* if the last read is stored */
if ( User_I == Base_PS->LastUserId_I ) { if ( User_I == Base_PS->LastUserId_I ) {
Pos_I = Base_PS->LastUserPos_I * sizeof( s_JamLastRead ); Pos_I = Base_PS->LastUserPos_I * sizeof( s_JamLastRead );
@ -110,7 +111,7 @@ int JAM_WriteLastRead( s_JamBase* Base_PS,
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
/* is it where we expected it to be? {{{ */ /* is it where we expected it to be? */
if ( User_I == Record_S.UserID ) { if ( User_I == Record_S.UserID ) {
if ( fseek( Base_PS->LrdFile_PS, Pos_I, SEEK_SET ) ) { if ( fseek( Base_PS->LrdFile_PS, Pos_I, SEEK_SET ) ) {
@ -118,16 +119,16 @@ int JAM_WriteLastRead( s_JamBase* Base_PS,
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
if ( 1 > fwritejamlastread(Base_PS->LrdFile_PS,Record_PS) ) { if ( 1 > fwritejamlastread(Base_PS->LrdFile_PS,Record_PS) ) {
Base_PS->Errno_I = errno; Base_PS->Errno_I = errno;
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
fflush(Base_PS -> LrdFile_PS); fflush(Base_PS -> LrdFile_PS);
return 0; return 0;
} /* }}} */ }
} /* }}} */ }
/* no last position, or position incorrect */ /* no last position, or position incorrect */
if ( fseek( Base_PS->LrdFile_PS, 0, SEEK_SET ) ) { if ( fseek( Base_PS->LrdFile_PS, 0, SEEK_SET ) ) {
@ -137,8 +138,8 @@ int JAM_WriteLastRead( s_JamBase* Base_PS,
for ( Pos_I = 0; ; Pos_I++ ) { for ( Pos_I = 0; ; Pos_I++ ) {
if ( 1 > freadjamlastread(Base_PS->LrdFile_PS,&Record_S) ) { if ( 1 > freadjamlastread(Base_PS->LrdFile_PS,&Record_S) ) {
if ( feof(Base_PS->LrdFile_PS) ) { if ( feof(Base_PS->LrdFile_PS) ) {
/* user not in file, append a new record */ /* user not in file, append a new record */
if ( fseek( Base_PS->LrdFile_PS, 0, SEEK_END ) ) { if ( fseek( Base_PS->LrdFile_PS, 0, SEEK_END ) ) {
@ -153,7 +154,8 @@ int JAM_WriteLastRead( s_JamBase* Base_PS,
/* found the user? */ /* found the user? */
if ( Record_S.UserID == User_I ) { if ( Record_S.UserID == User_I ) {
if ( fseek( Base_PS->LrdFile_PS, Pos_I * sizeof(s_JamLastRead), SEEK_SET ) ) { if ( fseek( Base_PS->LrdFile_PS, Pos_I * sizeof(s_JamLastRead),
SEEK_SET ) ) {
Base_PS->Errno_I = errno; Base_PS->Errno_I = errno;
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
@ -170,10 +172,3 @@ int JAM_WriteLastRead( s_JamBase* Base_PS,
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/* Local variables:
* vim:set ts=8 sts=4 sw=4:
* vim600:fdm=marker:
*/

View File

@ -1,108 +1,124 @@
/* /*
JAMLIB - A JAM subroutine library JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg Copyright (C) 1999 Björn Stenberg
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 Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 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
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16: Changes made by Johan Billing 2000-04-16:
- Added support for Win32 and Linux - Added support for Win32 and Linux
- Changed JAM_OpenMB to open files in binary mode - Changed JAM_OpenMB to open files in binary mode
- Changed source to use feof() instead of errno == EPASTEOF - Changed source to use feof() instead of errno == EPASTEOF
- Changed source to use structrw to read and write structures - Changed source to use structrw to read and write structures
- Fixed broken JAM_FindUser() - Fixed broken JAM_FindUser()
- #includes string.h and stdlib.h instead of memory.h - #includes string.h and stdlib.h instead of memory.h
Backported changes from JAMLIB 1.4.7 made by Johan Billing 2003-10-26
- Now uses calloc instead of malloc/memset
- (*NewArea_PPS) will be set to zero even if calloc() failed in
JAM_OpenMB() and JAM_CreateMB()
- JAM_CreateMB() no longer attempts to forever to lock the newly created
messagebase. If the first attempt fails, it will return an error.
- jam_Lock() now sets Base_PS->Errno under Linux
Other changes made by Johan Billing 2003-10-26
- Fixed comparison between signed and unsigned variable in JAM_GetMBSize()
- JAM_CreateMB() would not unlock and close the newly created messagebase
upon failure.
Changes made by Johan Billing 2004-07-10
- Updated the Win32-specific parts of the code to make it compatible with
newer versions of MinGW (tested with 3.1.0-1):
* Now uses Sleep() instead of sleep()
* Changed _LK_UNLOCK to _LK_UNLCK in jam_Lock()
*/ */
/*********************************************************************** /***********************************************************************
** **
** MBASE.C -- Message base handling ** MBASE.C -- Message base handling
** **
** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se) ** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se)
** **
***********************************************************************/ ***********************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <jamlib/jam.h> #include "jam.h"
#include "structrw.h" #include "structrw.h"
#if defined( __OS2__ ) #if defined( __OS2__ )
# include <os2.h> /* ANSI C does not include file locking :-( */ #include <os2.h> /* ANSI C does not include file locking :-( */
#endif #endif
#if defined( __WIN32__ ) #if defined( __WIN32__ )
# include <sys/locking.h> #include <sys/locking.h>
# include <io.h> #include <io.h>
#include <windows.h>
#if !defined( _LK_UNLCK ) && defined ( _LK_UNLOCK )
#define _LK_UNLCK _LK_UNLOCK /* For backwards compatibility */
#endif #endif
#if defined( __UNIX__ ) #endif
# if HAVE_SYS_FILE_H
# include <sys/file.h> #if defined( __LINUX__ )
# endif #include <sys/file.h>
# if HAVE_UNISTD_H #include <unistd.h>
# include <unistd.h>
# endif
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
# ifdef USE_LOCKF
# include <sys/file.h>
# endif
#endif #endif
#define OS_ERROR_OFFSET 10000 #define OS_ERROR_OFFSET 10000
#if defined( __OS2__ ) #if defined( __OS2__ )
# define JAM_Sleep( _x_ ) DosSleep( (_x_)*1000 ) #define JAM_Sleep( _x_ ) DosSleep( _x_*1000 )
#endif #endif
#if defined( __WIN32__ ) #if defined( __WIN32__ )
# define JAM_Sleep(x) _sleep((x)*1000) #define JAM_Sleep(x) Sleep(x*1000)
#endif #endif
#if defined( __UNIX__ ) #if defined( __LINUX__ )
# define JAM_Sleep(x) sleep(x) #define JAM_Sleep(x) sleep(x)
#endif #endif
/*********************************************************************** /*************************************<**********************************
** **
** File-global functions {{{ ** File-global functions
**/ **
int jam_Open( s_JamBase* Base_PS, uchar* Filename_PC, char* Mode_PC ); ***********************************************************************/
int jam_Open( s_JamBase* Base_PS, char* Filename_PC, char* Mode_PC );
int jam_Lock( s_JamBase* Base_PS, int DoLock_I ); int jam_Lock( s_JamBase* Base_PS, int DoLock_I );
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_OpenMB - Open message base {{{ ** JAM_OpenMB - Open message base
**/ **
int JAM_OpenMB( uchar* Basename_PC, s_JamBase** NewArea_PPS ) ***********************************************************************/
int JAM_OpenMB( char* Basename_PC, s_JamBase** NewArea_PPS )
{ {
s_JamBase* Base_PS; s_JamBase* Base_PS;
int Status_I; int Status_I;
if ( !NewArea_PPS ) if ( !NewArea_PPS )
return JAM_BAD_PARAM; return JAM_BAD_PARAM;
@ -116,26 +132,25 @@ int JAM_OpenMB( uchar* Basename_PC, s_JamBase** NewArea_PPS )
*NewArea_PPS = Base_PS; *NewArea_PPS = Base_PS;
Status_I = jam_Open( Base_PS, Basename_PC, "r+b" ); Status_I = jam_Open( Base_PS, Basename_PC, "r+b" );
if ( Status_I ) if ( Status_I ) {
return Status_I; return Status_I;
}
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_CreateMB - Create a new message base {{{ ** JAM_CreateMB - Create a new message base
**/ **
int JAM_CreateMB( uchar* Basename_PC, ***********************************************************************/
ulong BaseMsg_I, int JAM_CreateMB( char* Basename_PC,
s_JamBase** NewArea_PPS ) uint32_t BaseMsg_I,
s_JamBase** NewArea_PPS )
{ {
s_JamBaseHeader Base_S; s_JamBaseHeader Base_S;
int Status_I; int Status_I;
s_JamBase* Base_PS; s_JamBase* Base_PS;
if ( !NewArea_PPS || !BaseMsg_I ) if ( !NewArea_PPS || !BaseMsg_I )
return JAM_BAD_PARAM; return JAM_BAD_PARAM;
@ -159,16 +174,16 @@ int JAM_CreateMB( uchar* Basename_PC,
Base_S.BaseMsgNum = BaseMsg_I; Base_S.BaseMsgNum = BaseMsg_I;
memset( &Base_S.RSRVD, 0, sizeof( Base_S.RSRVD ) ); memset( &Base_S.RSRVD, 0, sizeof( Base_S.RSRVD ) );
Status_I = JAM_LockMB( Base_PS, 0 ); Status_I = JAM_LockMB( Base_PS, 0 ); /* If the new base cannot be locked directly, something is seriously wrong */
if ( Status_I ) if ( Status_I ) {
/* FIXME: Base was created, but we can not lock it JAM_CloseMB(Base_PS);
* (normaly this should not happen)
* Shouldn't we remove recently created files? */
return Status_I; return Status_I;
}
Status_I = JAM_WriteMBHeader( Base_PS, &Base_S ); Status_I = JAM_WriteMBHeader( Base_PS, &Base_S );
if ( Status_I ) { if ( Status_I ) {
JAM_UnlockMB( Base_PS ); JAM_UnlockMB( Base_PS );
JAM_CloseMB(Base_PS);
return Status_I; return Status_I;
} }
@ -176,14 +191,12 @@ int JAM_CreateMB( uchar* Basename_PC,
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_CloseMB - Close message base {{{ ** JAM_CloseMB - Close message base
**/ **
***********************************************************************/
int JAM_CloseMB( s_JamBase* Base_PS ) int JAM_CloseMB( s_JamBase* Base_PS )
{ {
if ( Base_PS->Locked_I ) { if ( Base_PS->Locked_I ) {
@ -191,34 +204,24 @@ int JAM_CloseMB( s_JamBase* Base_PS )
if ( Status_I ) if ( Status_I )
return Status_I; return Status_I;
} }
if ( Base_PS->HdrFile_PS ) { if ( Base_PS->HdrFile_PS ) {
fclose( Base_PS->HdrFile_PS ); Base_PS->HdrFile_PS = NULL; fclose( Base_PS->HdrFile_PS ); Base_PS->HdrFile_PS = NULL;
}
if ( Base_PS->TxtFile_PS ) {
fclose( Base_PS->TxtFile_PS ); Base_PS->TxtFile_PS = NULL; fclose( Base_PS->TxtFile_PS ); Base_PS->TxtFile_PS = NULL;
}
if ( Base_PS->IdxFile_PS ) {
fclose( Base_PS->IdxFile_PS ); Base_PS->IdxFile_PS = NULL; fclose( Base_PS->IdxFile_PS ); Base_PS->IdxFile_PS = NULL;
}
if ( Base_PS->LrdFile_PS ) {
fclose( Base_PS->LrdFile_PS ); Base_PS->LrdFile_PS = NULL; fclose( Base_PS->LrdFile_PS ); Base_PS->LrdFile_PS = NULL;
} }
Base_PS->Locked_I = 0; Base_PS->Locked_I = 0;
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_RemoveMB - Remove a message base {{{ ** JAM_RemoveMB - Remove a message base
**/ **
int JAM_RemoveMB( s_JamBase* Base_PS, uchar* Basename_PC ) ***********************************************************************/
int JAM_RemoveMB( s_JamBase* Base_PS, char* Basename_PC )
{ {
uchar Filename_AC[250]; char Filename_AC[250];
int Status_AI[4]; int Status_AI[4];
/* .JHR file */ /* .JHR file */
@ -250,17 +253,16 @@ int JAM_RemoveMB( s_JamBase* Base_PS, uchar* Basename_PC )
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_GetMBSize - Get the number of messages in message base {{{ ** JAM_GetMBSize - Get the number of messages in message base
**/ **
int JAM_GetMBSize( s_JamBase* Base_PS, ulong* Messages_PI ) ***********************************************************************/
int JAM_GetMBSize( s_JamBase* Base_PS, uint32_t* Messages_PI )
{ {
ulong Offset_I; long Offset_I;
/* go to end of index file */ /* go to end of index file */
if ( fseek( Base_PS->IdxFile_PS, 0, SEEK_END ) ) { if ( fseek( Base_PS->IdxFile_PS, 0, SEEK_END ) ) {
@ -278,58 +280,56 @@ int JAM_GetMBSize( s_JamBase* Base_PS, ulong* Messages_PI )
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_LockMB - Lock message base {{{ ** JAM_LockMB - Lock message base
**/ **
***********************************************************************/
int JAM_LockMB( s_JamBase* Base_PS, int Timeout_I ) int JAM_LockMB( s_JamBase* Base_PS, int Timeout_I )
{ {
if ( Base_PS->Locked_I ) if ( Base_PS->Locked_I )
return 0; return 0;
switch ( Timeout_I ) { switch ( Timeout_I )
case -1:
/* unlimited timeout */
while ( jam_Lock( Base_PS, 1 ) == JAM_LOCK_FAILED )
JAM_Sleep( 1 );
return 0;
case 0:
/* no timeout */
return jam_Lock( Base_PS, 1 );
default:
/* X seconds timeout */
{ {
time_t Time_I = time(NULL) + Timeout_I; /* unlimited timeout */
case -1:
while ( jam_Lock( Base_PS, 1 ) == JAM_LOCK_FAILED )
JAM_Sleep( 1 );
return 0;
while ( time(NULL) < Time_I ) /* no timeout */
{ case 0:
int Result_I; return jam_Lock( Base_PS, 1 );
Result_I = jam_Lock( Base_PS, 1 ); /* X seconds timeout */
default:
{
time_t Time_I = time(NULL) + Timeout_I;
if ( Result_I == JAM_LOCK_FAILED ) while ( time(NULL) < Time_I )
JAM_Sleep( 1 ); {
else int Result_I;
return Result_I;
} Result_I = jam_Lock( Base_PS, 1 );
return JAM_LOCK_FAILED;
} if ( Result_I == JAM_LOCK_FAILED )
JAM_Sleep( 1 );
else
return Result_I;
}
return JAM_LOCK_FAILED;
}
} }
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_UnlockMB - Flush all writes and unlock message base {{{ ** JAM_UnlockMB - Flush all writes and unlock message base
**/ **
***********************************************************************/
int JAM_UnlockMB( s_JamBase* Base_PS ) int JAM_UnlockMB( s_JamBase* Base_PS )
{ {
fflush( Base_PS->HdrFile_PS ); fflush( Base_PS->HdrFile_PS );
@ -339,14 +339,12 @@ int JAM_UnlockMB( s_JamBase* Base_PS )
return jam_Lock( Base_PS, 0 ); return jam_Lock( Base_PS, 0 );
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_ReadMBHeader - Read message base header {{{ ** JAM_ReadMBHeader - Read message base header
**/ **
***********************************************************************/
int JAM_ReadMBHeader( s_JamBase* Base_PS, s_JamBaseHeader* Header_PS ) int JAM_ReadMBHeader( s_JamBase* Base_PS, s_JamBaseHeader* Header_PS )
{ {
if ( !Header_PS || !Base_PS ) if ( !Header_PS || !Base_PS )
@ -364,14 +362,13 @@ int JAM_ReadMBHeader( s_JamBase* Base_PS, s_JamBaseHeader* Header_PS )
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_WriteMBHeader - Write message base header {{{ ** JAM_WriteMBHeader - Write message base header
**/ **
***********************************************************************/
int JAM_WriteMBHeader( s_JamBase* Base_PS, s_JamBaseHeader* Header_PS ) int JAM_WriteMBHeader( s_JamBase* Base_PS, s_JamBaseHeader* Header_PS )
{ {
if ( !Header_PS || !Base_PS ) if ( !Header_PS || !Base_PS )
@ -398,23 +395,22 @@ int JAM_WriteMBHeader( s_JamBase* Base_PS, s_JamBaseHeader* Header_PS )
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** JAM_FindUser - Scan scan file for messages to a user {{{ ** JAM_FindUser - Scan scan file for messages to a user
**/ **
***********************************************************************/
int JAM_FindUser( s_JamBase* Base_PS, int JAM_FindUser( s_JamBase* Base_PS,
ulong UserCrc_I, uint32_t UserCrc_I,
ulong StartMsg_I, uint32_t StartMsg_I,
ulong* MsgNo_PI ) uint32_t* MsgNo_PI )
{ {
ulong MsgNo_I; uint32_t MsgNo_I;
/* go to start message */ /* go to start message */
if ( fseek( Base_PS->IdxFile_PS, StartMsg_I * sizeof( s_JamIndex ), SEEK_SET ) ) { if ( fseek( Base_PS->IdxFile_PS, StartMsg_I * sizeof( s_JamIndex ),
SEEK_SET ) ) {
Base_PS->Errno_I = errno; Base_PS->Errno_I = errno;
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
@ -424,9 +420,9 @@ int JAM_FindUser( s_JamBase* Base_PS,
s_JamIndex Index_S; s_JamIndex Index_S;
if ( 1 > freadjamindex(Base_PS->IdxFile_PS,&Index_S) ) { if ( 1 > freadjamindex(Base_PS->IdxFile_PS,&Index_S) ) {
if ( feof(Base_PS->IdxFile_PS) ) if ( feof(Base_PS->IdxFile_PS) )
return JAM_NO_USER; return JAM_NO_USER;
Base_PS->Errno_I = errno; Base_PS->Errno_I = errno;
@ -434,20 +430,18 @@ int JAM_FindUser( s_JamBase* Base_PS,
} }
if ( Index_S.UserCRC == UserCrc_I ) if ( Index_S.UserCRC == UserCrc_I )
break; break;
} }
*MsgNo_PI = MsgNo_I; *MsgNo_PI = MsgNo_I;
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** jam_Lock - Lock/unlock a message base {{{ ** jam_Lock - Lock/unlock a message base
**/ **
***********************************************************************/
int jam_Lock( s_JamBase* Base_PS, int DoLock_I ) int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
{ {
#if defined(__OS2__) #if defined(__OS2__)
@ -469,7 +463,6 @@ int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
Status_I = DosSetFileLocks( Handle_I, NULL, &Area_S, Timeout_I, 0 ); Status_I = DosSetFileLocks( Handle_I, NULL, &Area_S, Timeout_I, 0 );
else else
Status_I = DosSetFileLocks( Handle_I, &Area_S, NULL, Timeout_I, 0 ); Status_I = DosSetFileLocks( Handle_I, &Area_S, NULL, Timeout_I, 0 );
if ( Status_I ) { if ( Status_I ) {
if ( 232 == Status_I ) if ( 232 == Status_I )
return JAM_LOCK_FAILED; return JAM_LOCK_FAILED;
@ -477,7 +470,6 @@ int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
Base_PS->Errno_I = Status_I + OS_ERROR_OFFSET; Base_PS->Errno_I = Status_I + OS_ERROR_OFFSET;
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
if ( DoLock_I ) if ( DoLock_I )
Base_PS->Locked_I = 1; Base_PS->Locked_I = 1;
else else
@ -496,12 +488,12 @@ int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
} }
if ( DoLock_I ) if ( DoLock_I )
Status_I = _locking(Handle_I,_LK_NBLCK,1); Status_I = _locking(Handle_I,_LK_NBLCK,1);
else else
Status_I = _locking(Handle_I,_LK_UNLCK,1); Status_I = _locking(Handle_I,_LK_UNLCK,1);
if ( Status_I ) if ( Status_I )
return JAM_LOCK_FAILED; return JAM_LOCK_FAILED;
if ( DoLock_I ) if ( DoLock_I )
Base_PS->Locked_I = 1; Base_PS->Locked_I = 1;
@ -509,8 +501,9 @@ int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
Base_PS->Locked_I = 0; Base_PS->Locked_I = 0;
return 0; return 0;
#elif defined(__UNIX__) #elif defined(__LINUX__)
int Handle_I,Status_I; int Handle_I,Status_I;
struct flock fl;
fseek(Base_PS->HdrFile_PS,0,SEEK_SET); /* Lock from start of file */ fseek(Base_PS->HdrFile_PS,0,SEEK_SET); /* Lock from start of file */
@ -520,27 +513,19 @@ int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
return JAM_IO_ERROR; return JAM_IO_ERROR;
} }
#ifdef USE_LOCKF if(DoLock_I) fl.l_type=F_WRLCK;
if(DoLock_I) Status_I = lockf(Handle_I, F_TLOCK, 1); else fl.l_type=F_UNLCK;
else Status_I = lockf(Handle_I, F_ULOCK, 1);
#else
{
struct flock fl;
if(DoLock_I) fl.l_type=F_WRLCK; fl.l_whence=SEEK_SET;
else fl.l_type=F_UNLCK; fl.l_start=0;
fl.l_len=1;
fl.l_pid=getpid();
fl.l_whence=SEEK_SET; Status_I=fcntl(Handle_I,F_SETLK,&fl);
fl.l_start=0;
fl.l_len=1;
fl.l_pid=getpid();
Status_I=fcntl(Handle_I,F_SETLK,&fl);
}
#endif
if ( Status_I ) { if ( Status_I ) {
Base_PS->Errno_I = errno; Base_PS->Errno_I = errno;
return JAM_LOCK_FAILED; return JAM_LOCK_FAILED;
} }
if ( DoLock_I ) if ( DoLock_I )
@ -553,17 +538,15 @@ int jam_Lock( s_JamBase* Base_PS, int DoLock_I )
#error Unsupported platform #error Unsupported platform
#endif #endif
} }
/** }}}
**
***********************************************************************/
/*********************************************************************** /***********************************************************************
** **
** jam_Open - Open/create message base files {{{ ** jam_Open - Open/create message base files
**/ **
int jam_Open( s_JamBase* Base_PS, uchar* Basename_PC, char* Mode_PC ) ***********************************************************************/
int jam_Open( s_JamBase* Base_PS, char* Basename_PC, char* Mode_PC )
{ {
uchar Filename_AC[250]; char Filename_AC[250];
/* .JHR file */ /* .JHR file */
sprintf( Filename_AC, "%s%s", Basename_PC, EXT_HDRFILE ); sprintf( Filename_AC, "%s%s", Basename_PC, EXT_HDRFILE );
@ -605,10 +588,4 @@ int jam_Open( s_JamBase* Base_PS, uchar* Basename_PC, char* Mode_PC )
return 0; return 0;
} }
/** }}}
**
***********************************************************************/
/* Local variables:
* vim:set ts=8 sts=4 sw=4:
* vim600:fdm=marker:
*/

625
jamlib/message.c Normal file
View File

@ -0,0 +1,625 @@
/*
JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16:
- Changed source to use feof() instead of errno == EPASTEOF
- Changed source to use structrw to read and write structures
- Added JAM_AddEmptyMessage()
- Added error messages JAM_NO_MESSAGE and JAM_CORRUPT_MSG for
JAM_ReadMsgHeader()
- #includes stdlib.h instead of malloc.h and memory.h
- Fixed a bug that caused JAM_AddMessage() to fail when trying to
add an empty message to the messagebase under Linux.
Backported changes from JAMLIB 1.4.7 made by Johan Billing 2003-10-26
- Fixed memory leaks that would occur if JAM_ReadMsgHeader() failed
- Added JAM_DeleteMessage()
Other changes made by Johan Billing 2003-10-26
- Fixed comparison between signed and unsigned variable in JAM_AddMessage()
- Improved handling of ActiveMsgs counter. JAM_AddMessage() now only
increases ActiveMsgs if the added message does not have MSG_DELETED set.
JAM_ChangeMsgHeader() decreases ActiveMsgs if MSG_DELETED is set and the
message wasn't already deleted. JAM_DeleteMessage() now only decreases
ActiveMsgs if the message wasn't already deleted.
*/
/***********************************************************************
**
** Message.C -- Message handling
**
** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se)
**
***********************************************************************/
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "jam.h"
#include "structrw.h"
/***********************************************************************
**
** JAM_ReadMsgHeader - Read message header
**
***********************************************************************/
int JAM_ReadMsgHeader( s_JamBase* Base_PS,
uint32_t MsgNo_I,
s_JamMsgHeader* Header_PS,
s_JamSubPacket** SubfieldPack_PPS )
{
s_JamIndex Index_S;
if ( !Base_PS || !Header_PS )
return JAM_BAD_PARAM;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read index record */
if ( 1 > freadjamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* message is not there */
if(Index_S.HdrOffset == 0xffffffff && Index_S.UserCRC == 0xffffffff)
{
return JAM_NO_MESSAGE;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read header */
if ( 1 > freadjammsgheader(Base_PS->HdrFile_PS,Header_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* are Subfields requested? */
if ( SubfieldPack_PPS && Header_PS->SubfieldLen ) {
s_JamSubPacket* SubPacket_PS;
s_JamSubfield Subfield_S;
char* Buf_PC;
char* Ptr_PC;
char* Roof_PC;
int BufSize_I = Header_PS->SubfieldLen;
Buf_PC = (void*) malloc( BufSize_I );
if ( !Buf_PC )
return JAM_NO_MEMORY;
/* read all subfields */
if ( 1 > fread( Buf_PC, BufSize_I, 1, Base_PS->HdrFile_PS ) ) {
Base_PS->Errno_I = errno;
free (Buf_PC);
return JAM_IO_ERROR;
}
SubPacket_PS = JAM_NewSubPacket();
if ( !SubPacket_PS ) {
free (Buf_PC);
return JAM_NO_MEMORY;
}
Roof_PC = Buf_PC + BufSize_I;
/* cut out the subfields */
for ( Ptr_PC = Buf_PC;
Ptr_PC < Roof_PC;
Ptr_PC += Subfield_S.DatLen + SIZE_JAMSAVESUBFIELD ) {
int Status_I;
getjamsubfield(Ptr_PC,&Subfield_S);
if((char *)Subfield_S.Buffer + Subfield_S.DatLen > Roof_PC) {
JAM_DelSubPacket( SubPacket_PS );
free (Buf_PC);
return JAM_CORRUPT_MSG;
}
Status_I = JAM_PutSubfield( SubPacket_PS, &Subfield_S );
if ( Status_I ) {
JAM_DelSubPacket( SubPacket_PS );
free (Buf_PC);
return Status_I;
}
}
free( Buf_PC );
*SubfieldPack_PPS = SubPacket_PS;
}
else
if ( SubfieldPack_PPS )
/* fields requested but none found */
/* return an empty packet */
*SubfieldPack_PPS = JAM_NewSubPacket();
return 0;
}
/***********************************************************************
**
** JAM_ReadMsgText - Read message text
**
***********************************************************************/
int JAM_ReadMsgText( s_JamBase* Base_PS,
uint32_t Offset_I,
uint32_t Length_I,
char* Buffer_PC )
{
if ( !Base_PS || !Buffer_PC )
return JAM_BAD_PARAM;
if ( !Length_I )
return 0;
if ( fseek( Base_PS->TxtFile_PS, Offset_I, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
if ( 1 > fread( Buffer_PC, Length_I, 1, Base_PS->TxtFile_PS ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
return 0;
}
/***********************************************************************
**
** JAM_ChangeMsgHeader - Change a message header
**
***********************************************************************/
int JAM_ChangeMsgHeader( s_JamBase* Base_PS,
uint32_t MsgNo_I,
s_JamMsgHeader* Header_PS )
{
s_JamBaseHeader BaseHeader_S;
s_JamMsgHeader OldHeader_S;
s_JamIndex Index_S;
int Status_I;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* read message base header */
Status_I = JAM_ReadMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ),
SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read index record */
if ( 1 > freadjamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read old message header */
if ( 1 > freadjammsgheader( Base_PS->HdrFile_PS, &OldHeader_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write header */
if ( 1 > fwritejammsgheader(Base_PS->HdrFile_PS,Header_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
if( ( Header_PS->Attribute & MSG_DELETED ) && !(OldHeader_S.Attribute & MSG_DELETED) ) {
/* message is deleted now but wasn't before */
BaseHeader_S.ActiveMsgs--;
}
Status_I = JAM_WriteMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
return 0;
}
/***********************************************************************
**
** JAM_AddMessage - Add a message to a message base
**
***********************************************************************/
int JAM_AddMessage( s_JamBase* Base_PS,
s_JamMsgHeader* Header_PS,
s_JamSubPacket* SubPack_PS,
char* Text_PC,
uint32_t TextLen_I )
{
s_JamBaseHeader BaseHeader_S;
s_JamIndex Index_S;
long Offset_I;
int Status_I;
uint32_t TotLen_I;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* read message base header */
Status_I = JAM_ReadMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
/*
** Add text if any
*/
Header_PS->TxtOffset = 0;
Header_PS->TxtLen = 0;
if(Text_PC && TextLen_I!=0)
{
/* go to end of text file */
if ( fseek( Base_PS->TxtFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* store text offset (for header) */
Offset_I = ftell( Base_PS->TxtFile_PS );
if ( Offset_I == -1 ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Header_PS->TxtOffset = Offset_I;
Header_PS->TxtLen = TextLen_I;
/* write text */
if ( 1 > fwrite( Text_PC, TextLen_I, 1, Base_PS->TxtFile_PS ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
}
/*
** Add header
*/
/* go to end of header file */
if ( fseek( Base_PS->HdrFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* calculate the size of all Subfields */
TotLen_I = 0;
if ( SubPack_PS ) {
s_JamSubfield* Subfield_PS;
for ( Subfield_PS = JAM_GetSubfield( SubPack_PS ); Subfield_PS;
Subfield_PS = JAM_GetSubfield( NULL ) )
TotLen_I += sizeof( s_JamSaveSubfield ) + Subfield_PS->DatLen;
}
Header_PS->SubfieldLen = TotLen_I;
/* go to end of index file */
if ( fseek( Base_PS->IdxFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find out new message number (for message header) */
Offset_I = ftell( Base_PS->IdxFile_PS );
if ( Offset_I == -1 ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* update header */
Header_PS->MsgNum = Offset_I / sizeof( s_JamIndex ) +
BaseHeader_S.BaseMsgNum;
memcpy( Header_PS->Signature, HEADERSIGNATURE, 4 );
Header_PS->Revision = CURRENTREVLEV;
/* go to end of header file */
if ( fseek( Base_PS->HdrFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find out new header offset (for index record) */
Offset_I = ftell( Base_PS->HdrFile_PS );
if ( Offset_I == -1 ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Index_S.HdrOffset = Offset_I;
/* write new header */
if ( 1 > fwritejammsgheader(Base_PS->HdrFile_PS,Header_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write Subfields */
if ( SubPack_PS ) {
s_JamSubfield* Subfield_PS;
char User_AC[101];
/* clear username */
User_AC[0] = 0;
for ( Subfield_PS = JAM_GetSubfield( SubPack_PS ); Subfield_PS;
Subfield_PS = JAM_GetSubfield( NULL ) ) {
/* first, save Subfield header */
if ( 1 > fwritejamsavesubfield(Base_PS->HdrFile_PS,(s_JamSaveSubfield *)Subfield_PS) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* then, save Subfield data if any*/
if(Subfield_PS->DatLen) {
if ( 1 > fwrite( Subfield_PS->Buffer, Subfield_PS->DatLen,
1, Base_PS->HdrFile_PS ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
}
/* store username for index file */
if ( Subfield_PS->LoID == JAMSFLD_RECVRNAME ) {
memcpy( User_AC, Subfield_PS->Buffer, Subfield_PS->DatLen );
User_AC[ Subfield_PS->DatLen ] = 0;
}
}
/* update index record */
if ( User_AC[0] )
Index_S.UserCRC = JAM_Crc32( User_AC, strlen( User_AC ) );
else
Index_S.UserCRC = JAM_NO_CRC;
}
else
/* update index record */
Index_S.UserCRC = JAM_NO_CRC;
/*
** Add index
*/
/* write index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
if(!(Header_PS->Attribute & MSG_DELETED))
BaseHeader_S.ActiveMsgs++; /* Only increase ActiveMsgs if MSG_DELETED not set */
/* write message base header */
Status_I = JAM_WriteMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
return 0;
}
/***********************************************************************
**
** JAM_AddEmptyMessage - Add a empty message entry to a message base
**
***********************************************************************/
int JAM_AddEmptyMessage( s_JamBase* Base_PS)
{
s_JamIndex Index_S;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* go to end of index file */
if ( fseek( Base_PS->IdxFile_PS, 0, SEEK_END ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/*
** Add index
*/
Index_S.HdrOffset = 0xffffffff;
Index_S.UserCRC = 0xffffffff;
/* write index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
return 0;
}
/***********************************************************************
**
** JAM_DeleteMessage - Delete message from messagebase
**
***********************************************************************/
int JAM_DeleteMessage( s_JamBase* Base_PS,
uint32_t MsgNo_I )
{
s_JamBaseHeader BaseHeader_S;
s_JamMsgHeader Header_S;
s_JamIndex Index_S;
int Status_I;
uint32_t OldAttribute_I;
if ( !Base_PS )
return JAM_BAD_PARAM;
if ( !Base_PS->Locked_I )
return JAM_NOT_LOCKED;
/* read message base header */
Status_I = JAM_ReadMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read index record */
if ( 1 > freadjamindex( Base_PS->IdxFile_PS, &Index_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* message is not there */
if(Index_S.HdrOffset == 0xffffffff && Index_S.UserCRC == 0xffffffff)
{
return JAM_NO_MESSAGE;
}
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* read header */
if ( 1 > freadjammsgheader( Base_PS->HdrFile_PS, &Header_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
OldAttribute_I = Header_S.Attribute;
Header_S.Attribute |= MSG_DELETED;
/* find header */
if ( fseek( Base_PS->HdrFile_PS, Index_S.HdrOffset, SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* write header */
if ( 1 > fwritejammsgheader( Base_PS->HdrFile_PS, &Header_S ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
/* find index record */
if ( fseek( Base_PS->IdxFile_PS, MsgNo_I * sizeof( s_JamIndex ), SEEK_SET ) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
Index_S.HdrOffset = 0xffffffff;
Index_S.UserCRC = 0xffffffff;
/* write index record */
if ( 1 > fwritejamindex(Base_PS->IdxFile_PS,&Index_S) ) {
Base_PS->Errno_I = errno;
return JAM_IO_ERROR;
}
if(!(OldAttribute_I & MSG_DELETED))
BaseHeader_S.ActiveMsgs--; /* decrease ActiveMsgs if the message wasn't already deleted */
/* write message base header */
Status_I = JAM_WriteMBHeader( Base_PS, &BaseHeader_S );
if ( Status_I )
return Status_I;
return 0;
}
/***********************************************************************
**
** JAM_Errno - Report the latest C library error code
**
***********************************************************************/
int JAM_Errno( s_JamBase* Base_PS )
{
return Base_PS->Errno_I;
}
/***********************************************************************
**
** JAM_ClearMsgHeader - Clear a message header
**
***********************************************************************/
int JAM_ClearMsgHeader( s_JamMsgHeader* Header_PS )
{
if (!Header_PS)
return JAM_BAD_PARAM;
memset( Header_PS, 0, sizeof( s_JamMsgHeader ) );
memcpy( Header_PS->Signature, HEADERSIGNATURE, 4 );
Header_PS->Revision = CURRENTREVLEV;
Header_PS->MsgIdCRC = JAM_NO_CRC;
Header_PS->ReplyCRC = JAM_NO_CRC;
Header_PS->PasswordCRC = JAM_NO_CRC;
return 0;
}

239
jamlib/structrw.c Normal file
View File

@ -0,0 +1,239 @@
/*
structrw - Platform-independent reading and writing of JAM structs
Copyright (C) 1999 Johan Billing
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2003-10-22
- Added #include <string.h>
*/
#include <stdio.h>
#include <string.h>
#include "jam.h"
#include "structrw.h"
uint16_t jamgetuword(char *buf,uint32_t offset)
{
return (uint16_t) buf[offset]+
buf[offset+1]*256;
}
void jamputuword(char *buf,uint32_t offset,uint16_t num)
{
buf[offset]=num%256;
buf[offset+1]=num/256;
}
void jamputuint32_t(char *buf,uint32_t offset,uint32_t num)
{
buf[offset]=num%256;
buf[offset+1]=(num / 256) % 256;
buf[offset+2]=(num / 256 / 256) % 256;
buf[offset+3]=(num / 256 / 256 / 256) % 256;
}
uint32_t jamgetuint32_t(char *buf,uint32_t offset)
{
return (uint32_t) buf[offset]+
buf[offset+1]*256+
buf[offset+2]*256*256+
buf[offset+3]*256*256*256;
}
int freadjambaseheader(FILE *fp,s_JamBaseHeader *s_JamBaseHeader)
{
char buf[SIZE_JAMBASEHEADER];
if(fread(buf,SIZE_JAMBASEHEADER,1,fp) != 1)
return 0;
memcpy(s_JamBaseHeader->Signature,&buf[JAMBASEHEADER_SIGNATURE],4);
s_JamBaseHeader->DateCreated = jamgetuint32_t(buf,JAMBASEHEADER_DATECREATED);
s_JamBaseHeader->ModCounter = jamgetuint32_t(buf,JAMBASEHEADER_MODCOUNTER);
s_JamBaseHeader->ActiveMsgs = jamgetuint32_t(buf,JAMBASEHEADER_ACTIVEMSGS);
s_JamBaseHeader->PasswordCRC = jamgetuint32_t(buf,JAMBASEHEADER_PASSWORDCRC);
s_JamBaseHeader->BaseMsgNum = jamgetuint32_t(buf,JAMBASEHEADER_BASEMSGNUM);
memcpy(s_JamBaseHeader->RSRVD,&buf[JAMBASEHEADER_RSRVD],1000);
return 1;
}
int fwritejambaseheader(FILE *fp,s_JamBaseHeader *s_JamBaseHeader)
{
char buf[SIZE_JAMBASEHEADER];
memcpy(&buf[JAMBASEHEADER_SIGNATURE],s_JamBaseHeader->Signature,4);
jamputuint32_t(buf,JAMBASEHEADER_DATECREATED, s_JamBaseHeader->DateCreated);
jamputuint32_t(buf,JAMBASEHEADER_MODCOUNTER, s_JamBaseHeader->ModCounter);
jamputuint32_t(buf,JAMBASEHEADER_ACTIVEMSGS, s_JamBaseHeader->ActiveMsgs);
jamputuint32_t(buf,JAMBASEHEADER_PASSWORDCRC, s_JamBaseHeader->PasswordCRC );
jamputuint32_t(buf,JAMBASEHEADER_BASEMSGNUM, s_JamBaseHeader->BaseMsgNum);
memcpy(&buf[JAMBASEHEADER_RSRVD],s_JamBaseHeader->RSRVD,1000);
if(fwrite(buf,SIZE_JAMBASEHEADER,1,fp) != 1)
return 0;
return 1;
}
int freadjammsgheader(FILE *fp,s_JamMsgHeader *s_JamMsgHeader)
{
char buf[SIZE_JAMMSGHEADER];
if(fread(buf,SIZE_JAMMSGHEADER,1,fp) != 1)
return 0;
memcpy(s_JamMsgHeader->Signature,&buf[JAMMSGHEADER_SIGNATURE],4);
s_JamMsgHeader->Revision = jamgetuword(buf,JAMMSGHEADER_REVISION);
s_JamMsgHeader->ReservedWord = jamgetuword(buf,JAMMSGHEADER_RESERVEDWORD);
s_JamMsgHeader->SubfieldLen = jamgetuint32_t(buf,JAMMSGHEADER_SUBFIELDLEN);
s_JamMsgHeader->TimesRead = jamgetuint32_t(buf,JAMMSGHEADER_TIMESREAD);
s_JamMsgHeader->MsgIdCRC = jamgetuint32_t(buf,JAMMSGHEADER_MSGIDCRC);
s_JamMsgHeader->ReplyCRC = jamgetuint32_t(buf,JAMMSGHEADER_REPLYCRC);
s_JamMsgHeader->ReplyTo = jamgetuint32_t(buf,JAMMSGHEADER_REPLYTO);
s_JamMsgHeader->Reply1st = jamgetuint32_t(buf,JAMMSGHEADER_REPLY1ST);
s_JamMsgHeader->ReplyNext = jamgetuint32_t(buf,JAMMSGHEADER_REPLYNEXT);
s_JamMsgHeader->DateWritten = jamgetuint32_t(buf,JAMMSGHEADER_DATEWRITTEN);
s_JamMsgHeader->DateReceived = jamgetuint32_t(buf,JAMMSGHEADER_DATERECEIVED);
s_JamMsgHeader->DateProcessed = jamgetuint32_t(buf,JAMMSGHEADER_DATEPROCESSED);
s_JamMsgHeader->MsgNum = jamgetuint32_t(buf,JAMMSGHEADER_MSGNUM);
s_JamMsgHeader->Attribute = jamgetuint32_t(buf,JAMMSGHEADER_ATTRIBUTE);
s_JamMsgHeader->Attribute2 = jamgetuint32_t(buf,JAMMSGHEADER_ATTRIBUTE2);
s_JamMsgHeader->TxtOffset = jamgetuint32_t(buf,JAMMSGHEADER_TXTOFFSET);
s_JamMsgHeader->TxtLen = jamgetuint32_t(buf,JAMMSGHEADER_TXTLEN);
s_JamMsgHeader->PasswordCRC = jamgetuint32_t(buf,JAMMSGHEADER_PASSWORDCRC);
s_JamMsgHeader->Cost = jamgetuint32_t(buf,JAMMSGHEADER_COST);
return 1;
}
int fwritejammsgheader(FILE *fp,s_JamMsgHeader *s_JamMsgHeader)
{
char buf[SIZE_JAMMSGHEADER];
memcpy(&buf[JAMMSGHEADER_SIGNATURE],s_JamMsgHeader->Signature,4);
jamputuword(buf,JAMMSGHEADER_REVISION, s_JamMsgHeader->Revision);
jamputuword(buf,JAMMSGHEADER_RESERVEDWORD, s_JamMsgHeader->ReservedWord);
jamputuint32_t(buf,JAMMSGHEADER_SUBFIELDLEN, s_JamMsgHeader->SubfieldLen);
jamputuint32_t(buf,JAMMSGHEADER_TIMESREAD, s_JamMsgHeader->TimesRead);
jamputuint32_t(buf,JAMMSGHEADER_MSGIDCRC, s_JamMsgHeader->MsgIdCRC);
jamputuint32_t(buf,JAMMSGHEADER_REPLYCRC, s_JamMsgHeader->ReplyCRC );
jamputuint32_t(buf,JAMMSGHEADER_REPLYTO, s_JamMsgHeader->ReplyTo);
jamputuint32_t(buf,JAMMSGHEADER_REPLY1ST, s_JamMsgHeader->Reply1st);
jamputuint32_t(buf,JAMMSGHEADER_REPLYNEXT, s_JamMsgHeader->ReplyNext);
jamputuint32_t(buf,JAMMSGHEADER_DATEWRITTEN, s_JamMsgHeader->DateWritten);
jamputuint32_t(buf,JAMMSGHEADER_DATERECEIVED, s_JamMsgHeader->DateReceived );
jamputuint32_t(buf,JAMMSGHEADER_DATEPROCESSED, s_JamMsgHeader->DateProcessed);
jamputuint32_t(buf,JAMMSGHEADER_MSGNUM, s_JamMsgHeader->MsgNum);
jamputuint32_t(buf,JAMMSGHEADER_ATTRIBUTE, s_JamMsgHeader->Attribute);
jamputuint32_t(buf,JAMMSGHEADER_ATTRIBUTE2, s_JamMsgHeader->Attribute2);
jamputuint32_t(buf,JAMMSGHEADER_TXTOFFSET, s_JamMsgHeader->TxtOffset);
jamputuint32_t(buf,JAMMSGHEADER_TXTLEN, s_JamMsgHeader->TxtLen);
jamputuint32_t(buf,JAMMSGHEADER_PASSWORDCRC, s_JamMsgHeader->PasswordCRC);
jamputuint32_t(buf,JAMMSGHEADER_COST, s_JamMsgHeader->Cost);
if(fwrite(buf,SIZE_JAMMSGHEADER,1,fp) != 1)
return 0;
return 1;
}
int freadjamindex(FILE *fp,s_JamIndex *s_JamIndex)
{
char buf[SIZE_JAMINDEX];
if(fread(buf,SIZE_JAMINDEX,1,fp) != 1)
return 0;
s_JamIndex->UserCRC = jamgetuint32_t(buf,JAMINDEX_USERCRC);
s_JamIndex->HdrOffset = jamgetuint32_t(buf,JAMINDEX_HDROFFSET);
return 1;
}
int fwritejamindex(FILE *fp,s_JamIndex *s_JamIndex)
{
char buf[SIZE_JAMINDEX];
jamputuint32_t(buf,JAMINDEX_USERCRC, s_JamIndex->UserCRC);
jamputuint32_t(buf,JAMINDEX_HDROFFSET, s_JamIndex->HdrOffset);
if(fwrite(buf,SIZE_JAMINDEX,1,fp) != 1)
return 0;
return 1;
}
int freadjamlastread(FILE *fp,s_JamLastRead *s_JamLastRead)
{
char buf[SIZE_JAMLASTREAD];
if(fread(buf,SIZE_JAMLASTREAD,1,fp) != 1)
return 0;
s_JamLastRead->UserCRC = jamgetuint32_t(buf,JAMLASTREAD_USERCRC);
s_JamLastRead->UserID = jamgetuint32_t(buf,JAMLASTREAD_USERID);
s_JamLastRead->LastReadMsg = jamgetuint32_t(buf,JAMLASTREAD_LASTREADMSG);
s_JamLastRead->HighReadMsg = jamgetuint32_t(buf,JAMLASTREAD_HIGHREADMSG);
return 1;
}
int fwritejamlastread(FILE *fp,s_JamLastRead *s_JamLastRead)
{
char buf[SIZE_JAMLASTREAD];
jamputuint32_t(buf,JAMLASTREAD_USERCRC,s_JamLastRead->UserCRC);
jamputuint32_t(buf,JAMLASTREAD_USERID,s_JamLastRead->UserID);
jamputuint32_t(buf,JAMLASTREAD_LASTREADMSG,s_JamLastRead->LastReadMsg);
jamputuint32_t(buf,JAMLASTREAD_HIGHREADMSG,s_JamLastRead->HighReadMsg);
if(fwrite(buf,SIZE_JAMLASTREAD,1,fp) != 1)
return 0;
return 1;
}
int fwritejamsavesubfield(FILE *fp,s_JamSaveSubfield *s_JamSaveSubfield)
{
char buf[SIZE_JAMLASTREAD];
jamputuword(buf,JAMSAVESUBFIELD_LOID, s_JamSaveSubfield->LoID);
jamputuword(buf,JAMSAVESUBFIELD_HIID, s_JamSaveSubfield->HiID);
jamputuint32_t(buf,JAMSAVESUBFIELD_DATLEN, s_JamSaveSubfield->DatLen);
if(fwrite(buf,SIZE_JAMSAVESUBFIELD,1,fp) != 1)
return 0;
return 1;
}
void getjamsubfield(char *buf,s_JamSubfield *Subfield_S)
{
Subfield_S->LoID = jamgetuword(buf,JAMSAVESUBFIELD_LOID);
Subfield_S->HiID = jamgetuword(buf,JAMSAVESUBFIELD_HIID);
Subfield_S->DatLen = jamgetuint32_t(buf,JAMSAVESUBFIELD_DATLEN);
Subfield_S->Buffer = (char *) buf + SIZE_JAMSAVESUBFIELD;
}

View File

@ -1,21 +1,21 @@
/* /*
structrw - Platform-independent reading and writing of JAM structs structrw - Platform-independent reading and writing of JAM structs
Copyright (C) 1999 Johan Billing Copyright (C) 1999 Johan Billing
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 Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 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
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define JAMBASEHEADER_SIGNATURE 0 #define JAMBASEHEADER_SIGNATURE 0
#define JAMBASEHEADER_DATECREATED 4 #define JAMBASEHEADER_DATECREATED 4
@ -81,4 +81,6 @@ int freadjamlastread(FILE *fp,s_JamLastRead *s_JamLastRead);
int fwritejamlastread(FILE *fp,s_JamLastRead *s_JamLastRead); int fwritejamlastread(FILE *fp,s_JamLastRead *s_JamLastRead);
int fwritejamsavesubfield(FILE *fp,s_JamSaveSubfield *s_JamSaveSubfield); int fwritejamsavesubfield(FILE *fp,s_JamSaveSubfield *s_JamSaveSubfield);
void getjamsubfield(uchar *buf,s_JamSubfield *Subfield_S); void getjamsubfield(char *buf,s_JamSubfield *Subfield_S);

201
jamlib/subpack.c Normal file
View File

@ -0,0 +1,201 @@
/*
JAMLIB - A JAM subroutine library
Copyright (C) 1999 Björn Stenberg
This library 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.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Changes made by Johan Billing 2000-04-16:
- Fixed broken JAM_GetSubfield()
- #includes stdlib.h instead of malloc.h and memory.h
Changes made by Johan Billing 2000-09-17:
- Added JAM_GetSubfield_R()
Backported changes from JAMLIB 1.4.7 made by Johan Billing 2003-10-22
- JAM_NewSubPacket() and JAM_PutSubField() would give memory leaks under
low memory conditions. Fixed.
Other changes made by Johan Billing 2003-10-22
- Fixed comparison between signed and unsigned variable in
JAM_DelSubPacket() and JAM_GetSubField()
*/
/***********************************************************************
**
** SUBPACKET.C -- Subfield packet handling
**
** Author: Bjrn Stenberg (bjorn.stenberg@sth.frontec.se)
**
***********************************************************************/
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "jam.h"
/***********************************************************************
**
** JAM_NewSubPacket - Create a new subfield packet
**
***********************************************************************/
s_JamSubPacket* JAM_NewSubPacket( void )
{
s_JamSubPacket* Sub_PS;
/* allocate packet struct */
Sub_PS = (s_JamSubPacket*) malloc( sizeof( s_JamSubPacket ) );
if ( !Sub_PS )
return NULL;
Sub_PS->NumAlloc = 20;
Sub_PS->NumFields = 0;
/* allocate pointer array */
Sub_PS->Fields = (s_JamSubfield**) calloc( Sub_PS->NumAlloc,
sizeof( s_JamSubfield* ) );
if ( !Sub_PS->Fields ) {
free (Sub_PS);
return NULL;
}
return Sub_PS;
}
/***********************************************************************
**
** JAM_DelSubPacket - Free the data associated with a subfield packet
**
***********************************************************************/
int JAM_DelSubPacket( s_JamSubPacket* SubPack_PS )
{
uint32_t i;
if (!SubPack_PS)
return JAM_BAD_PARAM;
for ( i=0; i < SubPack_PS->NumFields; i++ ) {
s_JamSubfield* Field_PS = SubPack_PS->Fields[i];
if ( Field_PS->Buffer )
free( Field_PS->Buffer );
free( Field_PS );
}
free( SubPack_PS->Fields );
free( SubPack_PS );
return 0;
}
/***********************************************************************
**
** JAM_GetSubfield -- Get first/next subfield from a subfield packet
** (not reentrant)
**
***********************************************************************/
s_JamSubfield* JAM_GetSubfield( s_JamSubPacket* SubPack_PS )
{
static s_JamSubPacket* LastPack_PS = NULL;
static uint32_t NextIndex_I = 0;
if ( SubPack_PS ) {
LastPack_PS = SubPack_PS;
NextIndex_I = 0;
}
if ( NextIndex_I < LastPack_PS->NumFields )
return LastPack_PS->Fields[ NextIndex_I++ ];
return NULL;
}
/***********************************************************************
**
** JAM_GetSubfield_R -- Get first/next subfield from a subfield packet
** (reentrant)
**
***********************************************************************/
s_JamSubfield* JAM_GetSubfield_R( s_JamSubPacket* SubPack_PS , uint32_t* Count_PI)
{
if ( *Count_PI < SubPack_PS->NumFields )
return SubPack_PS->Fields[ (*Count_PI)++ ];
return NULL;
}
/***********************************************************************
**
** JAM_PutSubfield -- Add a subfield to a subfield packet
**
***********************************************************************/
int JAM_PutSubfield( s_JamSubPacket* SubPack_PS, s_JamSubfield* Field_PS )
{
s_JamSubfield* NewField_PS;
char* NewBuf_PC;
/* do we have to expand the array? */
if ( SubPack_PS->NumFields == SubPack_PS->NumAlloc ) {
s_JamSubfield** Fields_PPS;
SubPack_PS->NumAlloc *= 2;
Fields_PPS = (s_JamSubfield**) realloc( SubPack_PS->Fields,
SubPack_PS->NumAlloc *
sizeof( s_JamSubfield* ) );
if ( !Fields_PPS )
return JAM_NO_MEMORY;
SubPack_PS->Fields=Fields_PPS;
}
/*
** Copy the passed subfield
*/
/* allocate a new subfield */
NewField_PS = (s_JamSubfield*) malloc( sizeof( s_JamSubfield ) );
if ( !NewField_PS )
return JAM_NO_MEMORY;
/* allocate a new buffer */
if ( Field_PS->DatLen ) {
NewBuf_PC = (char*) malloc( Field_PS->DatLen );
if ( !NewBuf_PC ) {
free (NewField_PS);
return JAM_NO_MEMORY;
}
memcpy( NewBuf_PC, Field_PS->Buffer, Field_PS->DatLen );
}
else
NewBuf_PC = NULL;
/* copy field struct */
NewField_PS->LoID = Field_PS->LoID;
NewField_PS->HiID = Field_PS->HiID;
NewField_PS->DatLen = Field_PS->DatLen;
NewField_PS->Buffer = NewBuf_PC;
/*
** Update subfield packet
*/
SubPack_PS->Fields[ SubPack_PS->NumFields ] = NewField_PS;
SubPack_PS->NumFields++;
return 0;
}