Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Arnaud Cornet | 237f729221 | |
Arnaud Cornet | e1b7de1735 | |
nohar | 99ba56376a | |
nohar | 3a309b0a06 |
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
BasedOnStyle: LLVM
|
||||
Language: Cpp
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Linux
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AlignAfterOpenBracket: true
|
||||
SpaceAfterCStyleCast: false
|
||||
MaxEmptyLinesToKeep: 2
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakStringLiterals: false
|
||||
SortIncludes: false
|
||||
ContinuationIndentWidth: 8
|
||||
ColumnLimit: 80
|
|
@ -1,63 +0,0 @@
|
|||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
/ar-lib
|
||||
/mdate-sh
|
||||
/py-compile
|
||||
/test-driver
|
||||
/ylwrap
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/config.guess
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.scan
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
|
||||
# https://www.gnu.org/software/libtool/
|
||||
|
||||
/ltmain.sh
|
||||
|
||||
# http://www.gnu.org/software/texinfo
|
||||
|
||||
/texinfo.tex
|
||||
|
||||
# http://www.gnu.org/software/m4/
|
||||
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
|
||||
# Makefiles
|
||||
Makefile
|
||||
src/.deps/
|
||||
src/Makefile
|
||||
tests/.deps/
|
||||
tests/Makefile
|
||||
|
||||
# Generated code
|
||||
src/conf.c
|
||||
src/conf.h
|
||||
src/config.h
|
||||
src/config.h.in
|
||||
src/lex.c
|
||||
|
||||
# Binaries
|
||||
src/*.o
|
||||
src/*.a
|
||||
src/bip
|
||||
src/bipmkpw
|
5
AUTHORS
5
AUTHORS
|
@ -1,13 +1,12 @@
|
|||
Arnaud 'nohar' Cornet
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
|
||||
Sexy contributors:
|
||||
Yoan 'jj' Guillot: fixes
|
||||
Yannick 'YS' Schaus: SSL cert stuff
|
||||
Raphaël 'Trou' Rigo: fixes
|
||||
Raphaël 'Trou' Rigo: fixes
|
||||
|
||||
Thanks to our marketting and management team:
|
||||
ack|, ato, blackmore, lafouine, Gaston & gromit
|
||||
|
||||
Crypto shamelessly stolen from Christophe 'sexy' Devine.
|
||||
Credits to Jouni Malinen for base64 library (http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/)
|
||||
|
|
2
COPYING
2
COPYING
|
@ -1,4 +1,4 @@
|
|||
bip copyright 2004 2005 Arnaud Cornet and Loïc Gomez, is released under the
|
||||
bip copyright 2004 2005 Arnaud Cornet and Loic Gomez, is released under the
|
||||
terms of the GNU GPL, License that you can find below.
|
||||
|
||||
Specific permission is granted for the GPLed code in this distribution to
|
||||
|
|
406
INSTALL
406
INSTALL
|
@ -1,370 +1,182 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands './configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
These are generic installation instructions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
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, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache'
|
||||
and enabled with '--cache-file=config.cache' or simply '-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
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 you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
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.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version
|
||||
of 'autoconf'.
|
||||
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:
|
||||
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.
|
||||
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' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
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. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. 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
|
||||
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.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
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
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
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 can use GNU 'make'. 'cd' to the
|
||||
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 '..'. This
|
||||
is known as a "VPATH" build.
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
With a non-GNU 'make', it is safer 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.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
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' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
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
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
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=DIR' 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. In general, the
|
||||
default for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
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.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
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
|
||||
=================
|
||||
|
||||
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'.
|
||||
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as
|
||||
their prerequisites, which makes it generally unusable when shipped
|
||||
generated files such as 'configure' are involved. Use GNU 'make'
|
||||
instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
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' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
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
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
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.
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
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 machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--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.
|
||||
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.
|
||||
|
||||
Defining Variables
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to
|
||||
an Autoconf limitation. Until the limitation is lifted, you can use
|
||||
this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
`--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=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used
|
||||
only in the top level, while the 'recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
`--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
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
|
19
Makefile.am
19
Makefile.am
|
@ -1,18 +1 @@
|
|||
if COND_WANT_TESTS
|
||||
MAYBE_TESTS = tests
|
||||
endif
|
||||
SUBDIRS = src . $(MAYBE_TESTS)
|
||||
|
||||
dist_man_MANS = bip.1 bip.conf.5 bipmkpw.1 bipgenconfig.1
|
||||
|
||||
examplesdir = $(prefix)/share/doc/bip/examples/
|
||||
dist_examples_DATA = samples/bip.conf samples/bip.vim
|
||||
|
||||
EXTRA_DIST = \
|
||||
BUGS \
|
||||
scripts/bip-release \
|
||||
scripts/bipgenconfig \
|
||||
systemd
|
||||
|
||||
lint:
|
||||
find src/ tests/ \( -name *.c -o -name *.h \) -type f -print0 | xargs -0 clang-format -i
|
||||
SUBDIRS = src samples
|
||||
|
|
|
@ -0,0 +1,574 @@
|
|||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006 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@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
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 = :
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \
|
||||
install-sh missing mkinstalldirs ylwrap
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d $(distdir) \
|
||||
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr $(distdir); }; }
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LEX = @LEX@
|
||||
LEXLIB = @LEXLIB@
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
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@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
YFLAGS = @YFLAGS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src samples
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
|
||||
cd $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
# 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):
|
||||
@failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
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) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
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) \
|
||||
|| eval $$failcom; \
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
tags="$$tags $$include_option=$$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; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
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
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d $(distdir) || mkdir $(distdir)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
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='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
distdir=`$(am__cd) $(distdir) && pwd`; \
|
||||
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$top_distdir" \
|
||||
distdir="$$distdir/$$subdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
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 $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | 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
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
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 | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& 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 ../.. && umask 077 && mkdir "$$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 \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$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
|
||||
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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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 mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
|
||||
install-strip
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-shar dist-tarZ dist-zip distcheck distclean \
|
||||
distclean-generic distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
tags-recursive uninstall uninstall-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:
|
160
NEWS
160
NEWS
|
@ -1,160 +0,0 @@
|
|||
2022-03-10 (0.9.3) "sanitize our bip and add some layers"
|
||||
- Add SASL authentication support (EXTERNAL, PLAIN)
|
||||
- Handle some recommended GCC flags
|
||||
- fix /bip user info command
|
||||
|
||||
2021-10-12 (0.9.2) "for the love of unsubsquirrel"
|
||||
- Update and fix minor issues in sample bip and vim configuration files
|
||||
|
||||
2021-10-12 (0.9.1) "one more"
|
||||
- ENABLED might not be defined: use a default value.
|
||||
|
||||
2021-10-08 (0.9.0) "it's never too late"
|
||||
Visible changes:
|
||||
- "backlog_no_timestamp" is deprecated, "backlog_timestamp" should be used
|
||||
instead. The allowed values for this new parameter are: "none", "time",
|
||||
"datetime". "time" is the default value and allow to keep the default
|
||||
behavior.
|
||||
- allow to set TLS ciphers: for bip client side (client_side_ciphers),
|
||||
globally for all connections (ssl_default_ciphers) and foreach connection
|
||||
(ssl_ciphers).
|
||||
- allow to set DH parameter used for clients SSL connections with the new
|
||||
client_side_dh_param parameter.
|
||||
- Add write_oidentd_file parameter. Existing oidentd users must use
|
||||
'write_oidentd = true' in their config to keep existing behavior.
|
||||
|
||||
2013-10-19 (0.8.9) "If it's really that urgent, why don't you do it yourself?"
|
||||
- code fixes
|
||||
- buildsys fixes (bison 2.6 compatibility and others)
|
||||
- improved TRUST OK command replies when there's no untrusted certificate
|
||||
- fixed GCC warnings
|
||||
|
||||
2011-04-14 (0.8.8) "spring release"
|
||||
- Allow to disable logs by connection.
|
||||
- When global option log is disabled, query are not backlogged.
|
||||
- Avoid segfault when global option log is false.
|
||||
|
||||
2011-01-18 (0.8.7) "bazooka"
|
||||
- Fix "FATAL: list_remove: item not found"
|
||||
- Fix build errors on armel
|
||||
- minor fixes
|
||||
|
||||
2010-09-12 (0.8.6) "CVE-2010-3071"
|
||||
- Fix for CVE-2010-3071.
|
||||
|
||||
2010-08-07 (0.8.5) "Unpacking"
|
||||
- Now builds position independant executables
|
||||
|
||||
2009-11-15 (0.8.4) "I’ll have the same thing please"
|
||||
- Fix build OpenSSL detection issue.
|
||||
|
||||
2009-11-15 (0.8.3) "Hey Dublin! What’s the craic?"
|
||||
- Fixes a fatal() on gamesurge networks.
|
||||
|
||||
2009-08-24 (0.8.2) "Farewell Paris"
|
||||
- Fix hanging bip on hanging client connexions.
|
||||
|
||||
2009-07-17 (0.8.1) "Ran ran ru in Praha"
|
||||
- Fixed an annoying bug that resulted in too much backlog.
|
||||
- Fix TRUST command.
|
||||
- Close some unused log files.
|
||||
|
||||
2009-03-02 (0.8.0) "swelling millionnaire"
|
||||
- Cosmetic bug fixes since last rc.
|
||||
|
||||
2009-02-02 (0.8.0-rc1) "got booze?"
|
||||
- One bug fixed and a client hack added to avoid the "+" or "-" prefix in
|
||||
irssi when connecting irssi and xchat to the same bip connection.
|
||||
|
||||
2009-01-24 (0.8.x)
|
||||
Visible changes:
|
||||
- One logfile per nick for queries, instead of the messy privates.x.log
|
||||
Slight log format change (now the format of the log of queries is very
|
||||
similar to the on used for channels)
|
||||
- "Window"-local blreset and blreset on talk. By default the blreset_on_talk
|
||||
now only clears the backlog of the query you talked to or the channel you
|
||||
talked to. The /quote bip blreset command now can take a query name or a
|
||||
channel name as an argument. "/quote bip blreset" still resets the backlog of
|
||||
the whole network.
|
||||
- /quote bip backlog x command where x is the number of hours will backlog x
|
||||
hours.
|
||||
- autorejoin on kick by default. Can be disabled with the option
|
||||
autojoin_on_kick = false in a connection block.
|
||||
- bip SSL on the client<->bip part now support Ephemeral Diffie Hellman key
|
||||
exchange.
|
||||
|
||||
2008-10-24 (0.7.5) "But I have promises to keep, And miles to go before I
|
||||
sleep, And miles to go before I sleep."
|
||||
- Halfop handling fixed, and a shameful segfault. The segfault may be
|
||||
exploitable by clients, but only after successful login. Please upgrade.
|
||||
|
||||
2008-06-28 (0.7.4) "But where is 0.7.3 ?!"
|
||||
- Some usefull bugfixes, especially for unreal irc network users.
|
||||
|
||||
2008-04-05 (0.7.2) "Enjoy the fish"
|
||||
- Contains a compilation fix for OpenBSD.
|
||||
|
||||
2008-04-02: bip 0.7.1 "hot mama"
|
||||
- Contains a configuration validation fix, and a memory leak fix.
|
||||
|
||||
2008-02-16 (0.7.0) "birthday party"
|
||||
- The good stuff: sighup support, /bip reload should also work now
|
||||
- New commands (allow a user to add a new network without restarting bip for
|
||||
instance)
|
||||
- Better user feedback when issuing /bip commands.
|
||||
- Lots of new backlog options, some of which can now be set per user instead of
|
||||
globally.
|
||||
- And a few fixes on top of that.
|
||||
|
||||
2008-02-07 Arnaud Cornet <nohar@t1r.net>
|
||||
What's to expect in bip now:
|
||||
- Support kill -HUP and /bip reload cleanly.
|
||||
- Close/reopen files on sighup.
|
||||
- Have some reply when running BIP commands. ssl_check_mode, always_backlog,
|
||||
backlog, bl_msg_only, backlog_lines, backlog_no_timestamp, blreset_on_talk be
|
||||
settable at the connection block rather than the user block.
|
||||
- Add backlog option to channels. Useful if you don't care about one particular
|
||||
channel.
|
||||
- bip_use_notice: Add this option to receive bip message through notices.
|
||||
- Make SSL "basic" certificate check more loose (more SSH-like). In "basic"
|
||||
mode, normally un trusted certificates get to be trusted if they manually
|
||||
trusted by user. This provides an SSH like private key auth mechani Expired
|
||||
certificates were considered invalid in this mode which does not make much
|
||||
sense.
|
||||
- blreset: add -q option to /bip blreset command if you don't want it to reply
|
||||
anything (for scripts).
|
||||
- Support add_conn and del_conn bip commands for live connection addition and
|
||||
removal.
|
||||
- Have a bold arrow to highligh your own word on private messages and multiple
|
||||
connected clients.
|
||||
|
||||
2007-12-09
|
||||
- Bip has now two types of users "admins" and normal user. Some commands are
|
||||
reserved to admin. Add a admin = true; statement in your config (in user
|
||||
block) accordingly.
|
||||
|
||||
2007-10-29
|
||||
- Certificate validation change. In "basic" mode, expired certificates are now
|
||||
accepted as long as they are in store (therefore trusted). This makes the
|
||||
basic mode be more SSH like. Some extreme security zealots might want to be
|
||||
warned.
|
||||
|
||||
2007-09-02
|
||||
- as of now log parameters go in the user {} statment. This breaks
|
||||
every config and there is no backwrads compatibility as of now.
|
||||
- Lots of internal changes, expect crashes.
|
||||
|
||||
2007-08-19 (0.6.1)
|
||||
- Fixes half closed socket descriptor leak, as well as a potential crash on
|
||||
startup.
|
||||
- Bip switches to git. You can clone the public repository with:
|
||||
- git clone http://bip.t1r.net/bip.git
|
||||
|
||||
2007-02-27 (0.6.0)
|
||||
- Includes more commands, more options, more fixes.
|
||||
- UPDATE: Thanks to YS for the sexy logo! How rude of me to forget to give
|
||||
proper credits!
|
||||
- Bip is developed by Arnaud Cornet and Loïc Gomez and is distributed under
|
||||
the GNU Public License Version 2 (see the AUTHORS file for a list of
|
||||
contributors).
|
||||
- BIP IRC channel is on OFTC : irc://irc.oftc.net/bip
|
243
README
243
README
|
@ -1,224 +1,53 @@
|
|||
This is the BIP IRC Proxy README.
|
||||
|
||||
Bip can be used in two different ways:
|
||||
Bip can be used in two different way:
|
||||
- Old school bnc user style: easy and straightforward.
|
||||
- Unix service style with and init.d scripts and the logs in /var/log
|
||||
|
||||
This small README file explains the usage "Old school" with which :
|
||||
This small README file explains the usage "Old school" with which :
|
||||
- you do not need the root privileges.
|
||||
- gives easy access to the logs to the owner of the shell.
|
||||
- gives easy access to the logs of the users of this bip to the one owning the
|
||||
shell.
|
||||
|
||||
Table of contents :
|
||||
Install bip on the machine that will be running bip (which is likely to be your
|
||||
personnal or shared server) either compiling the package or using your distro's
|
||||
package. Then create a configuration file:
|
||||
|
||||
I. Installation
|
||||
II. Configuration
|
||||
A. Manual configuration
|
||||
B. Automated configuration
|
||||
III. Running bip
|
||||
IV. Using bip
|
||||
A. Connecting your client(s)
|
||||
B. Backlog and flood control
|
||||
C. Multiple users and ident issues
|
||||
If you are using a distribution package, the bip.conf sample configuration file
|
||||
is likely to be shipped in /usr/share/doc/bip/examples/bip.conf.gz or something
|
||||
similar.
|
||||
|
||||
Create your bip configuration an log directory:
|
||||
|
||||
# mkdir -p ~/.bip/logs
|
||||
|
||||
I. INSTALLATION
|
||||
Put the uncompressed configuration file in your ~/.bip directory (it's path
|
||||
should be ~/.bip/bip.conf), and edit it, most importantly the "user" section
|
||||
that contains information about you and the servers you will want to connect
|
||||
to. The "name" field in the "user" section is your login to connect to bip.
|
||||
The "password" field is a hash of the password you will use to connect to bip.
|
||||
To generate a hash value from a password, use bipmkpw, program which comes in
|
||||
the bip package and source.
|
||||
The "name" field of the "connection" subsections are the server identifier for
|
||||
when you connect to bip.
|
||||
|
||||
Install bip on the machine that will be running bip (which is likely to be
|
||||
your personnal or shared server) either compiling the package or using your
|
||||
distro's package. Then create a configuration file.
|
||||
Once all this is configured, start bip as you regular user:
|
||||
|
||||
Choose your distribution package if available. If not, build bip the
|
||||
old-fashioned way. You will need make, gcc, lex, yacc, automake,
|
||||
autoconf-archive and optionally libssl-dev to build bip.
|
||||
# bip
|
||||
|
||||
Just issue:
|
||||
Once bip starts, it connects to the different servers your defined in
|
||||
"connection". Then you want to use your regular irc client and connect to bip.
|
||||
Point your client to the machine bip is running and set the proper port number
|
||||
(defined in your bip.conf). You should then configure the client to use a
|
||||
specific irc server password constructed this way:
|
||||
|
||||
From bip-X.Y.Z.tar.gz package:
|
||||
# ./configure && make
|
||||
user:password:network
|
||||
|
||||
From repository:
|
||||
# autoreconf -i
|
||||
# ./configure --enable-maintainer-mode && make
|
||||
The user is the name field of the "user" section, the password is the *hash* of
|
||||
the password you entered in the "password" field of the same user section (the
|
||||
hash is generated with bipmkpw) and the network is the "name" field of the
|
||||
"connection" subsection. This is how bip authenticates you and puts your client
|
||||
to the correct network.
|
||||
|
||||
If openssl and its developement files are installed, bip should build with
|
||||
SSL support. After a successful build the bip binary can be found in
|
||||
./src/bip.
|
||||
Using the default (or sample file) configuration, logs are in ~/.bip/logs/
|
||||
|
||||
By default, "-Werror" is used. If you encounter warnings, you could try:
|
||||
# CFLAGS="-Wno-error" ./configure && make
|
||||
|
||||
|
||||
II. CONFIGURATION
|
||||
|
||||
First of all, create your bip configuration an log directory:
|
||||
|
||||
# mkdir -p ~/.bip/logs
|
||||
|
||||
There are two ways to create your bip configuration :
|
||||
- edit the sample bip.conf file to match your needs
|
||||
- use the bipgenconfig script to easily generate a configuration
|
||||
|
||||
If you want to connect to bip using an SSL client, you'll need to create
|
||||
a certificate / key pair (in a bip.pem file) to allow bip to serve SSL
|
||||
sockets.
|
||||
|
||||
A. MANUAL CONFIGURATION
|
||||
|
||||
If you are using a distribution package, the bip.conf sample configuration
|
||||
file is likely to be shipped in /usr/share/doc/bip/examples/bip.conf.gz or
|
||||
something similar.
|
||||
|
||||
If not, you'll find sample configuration file in the source package's
|
||||
`samples' subdirectory.
|
||||
|
||||
Put the uncompressed configuration file in your ~/.bip directory (its
|
||||
path should be ~/.bip/bip.conf), and edit it, most importantly the "user"
|
||||
section that contains information about you and the servers you will want
|
||||
to connect to. The "name" field in the "user" section is your login to
|
||||
connect to bip.
|
||||
The "name" field of the "connection" subsections are the server identifier
|
||||
for when you connect to bip.
|
||||
|
||||
The "password" field is a hash of the password you will use to connect to
|
||||
bip. To generate a hash value from a password, use bipmkpw, program which
|
||||
comes in the bip package and source.
|
||||
|
||||
If you've set client_side_ssl to true, you'll need to generate a bip.pem
|
||||
file containing a certificate / key pair. In order to do so, you can use
|
||||
the third party `openssl' binary :
|
||||
|
||||
# openssl req -new -x509 -days 365 -nodes -out bip.pem -keyout bip.pem
|
||||
|
||||
You can then remove the passphrase with :
|
||||
|
||||
# openssl x509 -subject -dates -fingerprint -noout -in bip.pem
|
||||
|
||||
B. AUTOMATED CONFIGURATION
|
||||
|
||||
You can also use the bipgenconfig script to generate a new configuration.
|
||||
This script will also help you generate the SSL certificate / key pair
|
||||
needed for clients to connect to BIP through SSL.
|
||||
|
||||
This script can be found either in the source package's `scripts'
|
||||
directory or shipped with your distribution's package.
|
||||
|
||||
Using the script is very simple, and it will generate a configuration
|
||||
file but won't overwrite any existing configuration.
|
||||
|
||||
It will ask you the path to the bipmkpw binary, to automatically hash the
|
||||
passwords you'll provide. Please make sure to enter the correct path to
|
||||
the binary or you might observe unexpected behaviour.
|
||||
|
||||
You'll need to move the generated configuration from bip.conf.autogen to
|
||||
bip.conf and the generated PEM file from bip.pem.autogen to bip.pem (or
|
||||
whatever path you've configured in bip.conf).
|
||||
|
||||
|
||||
III. RUNNING BIP
|
||||
|
||||
Once all this is configured, start bip as your regular user:
|
||||
|
||||
# ./src/bip
|
||||
|
||||
If you have installed bip in your path (or if you are using you
|
||||
distribution's package), simply use:
|
||||
|
||||
# bip
|
||||
|
||||
Once bip starts, it connects to the different servers your defined in
|
||||
all "user"'s "connection" blocks.
|
||||
|
||||
|
||||
IV. USING BIP
|
||||
|
||||
A. CONNECTING YOUR CLIENT(S)
|
||||
|
||||
Then you want to use your regular irc client and connect to bip. Point
|
||||
your client to the machine bip is running and set the proper port number
|
||||
(defined in your bip.conf). You should then configure the client to use a
|
||||
specific irc server password constructed this way:
|
||||
|
||||
user:password:connection
|
||||
|
||||
The user is the name field of the "user" section, the password is the
|
||||
password (*not* the hash) corresponding to the "password" field of the
|
||||
same user section (which is the hash generated with bipmkpw) and the
|
||||
connection is the "name" field of the "connection" subsection. This is
|
||||
how bip authenticates you and puts your client to the correct network.
|
||||
|
||||
Using the default (or sample file) configuration, logs are in ~/.bip/logs/
|
||||
|
||||
B. BACKLOG AND FLOOD CONTROL
|
||||
|
||||
Bip has a backlogging system which will send back parts of the last logs
|
||||
upon client connection. Depending on your configuration, that may mean a
|
||||
*lot* of data sent back to your client.
|
||||
|
||||
Users' messages will be replayed as if they were being sent at the moment
|
||||
your client connects to bip, and if not disabled, system messages will
|
||||
appear as coming from the "-bip" user.
|
||||
|
||||
Considering that, you may want to disable your client's anti-flood system,
|
||||
totally or not, depending on it's flexibility.
|
||||
Since bip doesn't replay CTCP messages, you can safely let your client's
|
||||
anti-flood system manage them.
|
||||
|
||||
[Xchat]
|
||||
If you're using Xchat, you can "disable" it by issuing these commands :
|
||||
/set flood_msg_num = 1000
|
||||
/set flood_msg_time = 10
|
||||
In fact you'll tell xchat to activate its anti-flood system when you're
|
||||
receiving more than 1000 messages in less than 10 seconds.
|
||||
|
||||
If you forgot to set these, private messages may not appear in separate
|
||||
tabs as usual. If so, simply issue a :
|
||||
/set gui_auto_open_dialog on
|
||||
|
||||
C. MULTIPLE USERS AND IDENT ISSUES
|
||||
|
||||
When you host many connections to the same IRC network, you might have
|
||||
more connections than allowed by the network from one host.
|
||||
|
||||
Depending on the network and the services it runs, session limits may be
|
||||
enforced either matching only your ip address/hostname, or matching the
|
||||
username/ident part too.
|
||||
|
||||
To avoid being killed for session limit exceeded, you should define a
|
||||
default_username in each user {}; block. A user without default_username
|
||||
would appear as ~bip@yourhost if bip is the system user running bip. With
|
||||
a default_username set to "myuser", he would appear as ~myuser@yourhost,
|
||||
which may be sufficient for most networks.
|
||||
|
||||
If the network you're on is a bit more demanding, you can set up an
|
||||
oidentd server on your host, and enable oidentd spoofing support
|
||||
('write_oidentd = true;' option in bip configuration file). Let's
|
||||
say bip is the system user running bip, you should add to
|
||||
your /etc/oidentd.conf :
|
||||
|
||||
user "bip" {
|
||||
default {
|
||||
allow spoof_all
|
||||
allow spoof_privport
|
||||
allow spoof
|
||||
}
|
||||
}
|
||||
|
||||
Then reload oidentd and make sure that ~bip is accessible (+rx) by the
|
||||
user running oidentd (which means most of the time ~bip should be world
|
||||
readable and browsable +rx).
|
||||
|
||||
If you already have a ~bip/.oidentd.conf file, don't worry, bip'll only
|
||||
add its entries without deleting any of the contents of the file.
|
||||
This step should remove the "~" character from the username/ident part of
|
||||
your ircmask, and thus satisfy some networks.
|
||||
|
||||
If the network is still killing you for session limit exceeded, you'll
|
||||
have to contact it's admins and ask them for an exception on your host or
|
||||
ip address.
|
||||
|
||||
|
||||
Happy ircing!
|
||||
|
||||
-- Arnaud Cornet <nohar@t1r.net> and Loïc Gomez <opensource@kyoshiro.org>
|
||||
Happy ircing!
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
*** This is a warning about bip's replay/backlog system ***
|
||||
|
||||
Bip has a backlogging system which will send back parts of the last logs upon
|
||||
client connection. Depending on your configuration, that may mean a *lot* of
|
||||
data sent back to your client.
|
||||
|
||||
Users' messages will be replayed as if they were being sent at the moment your
|
||||
client connects to bip, and if not disabled, system messages will appear as
|
||||
coming from the "-bip" user.
|
||||
|
||||
Considering that, you may want to disable your client's anti-flood system,
|
||||
totally or not, depending on it's flexibility.
|
||||
Since bip doesn't relay CTCP messages, you can safely let your client's
|
||||
anti-flood system manage them.
|
||||
|
||||
[Xchat]
|
||||
If you're using Xchat, you can "disable" it by issuing these commands :
|
||||
/set flood_msg_num = 1000
|
||||
/set flood_msg_time = 10
|
||||
In fact you'll tell xchat to activate its anti-flood system when you're
|
||||
receiving more than 1000 messages in less than 10 seconds.
|
||||
|
||||
If you forgot to set these, private messages may not appear in separate tabs
|
||||
as usual. If so, simply issue a :
|
||||
/set gui_auto_open_dialog on
|
15
TODO
15
TODO
|
@ -1,10 +1,9 @@
|
|||
- Allow to dump a config file, so that when the config is dynamically
|
||||
changed, we can find it back after bip restart.
|
||||
|
||||
- uid, gid
|
||||
- keep invites when detached ?
|
||||
- allow global (or per net ?) IP filtering
|
||||
- more /bip commands
|
||||
- DCC proxying...
|
||||
- encrypt logs
|
||||
- pre_on_connect_send => before join
|
||||
|
||||
- use gnutls
|
||||
- MODE #channel and WHO #channel on join
|
||||
|
@ -24,6 +23,7 @@ Best regards,
|
|||
Whoopie
|
||||
--
|
||||
|
||||
|
||||
23:46 < nixternal> i have a question...when i log into my bip server with more
|
||||
than 1 client at a time...i get a mass "ban message" from
|
||||
the server..notice of all channel bans that i am in
|
||||
|
@ -38,10 +38,3 @@ Whoopie
|
|||
that asked for it
|
||||
23:54 < nohar> there is such thing for /who already
|
||||
|
||||
_____________
|
||||
FAQ:
|
||||
- why I cannot add non-ssl servers with ssl-servers
|
||||
- why is my vhost not used when I connect (one IP)
|
||||
|
||||
|
||||
- backlog_no_private
|
||||
|
|
|
@ -0,0 +1,895 @@
|
|||
# generated automatically by aclocal 1.10 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006 Free Software Foundation, Inc.
|
||||
# This file 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.
|
||||
|
||||
m4_if(m4_PACKAGE_VERSION, [2.61],,
|
||||
[m4_fatal([this file was generated for autoconf 2.61.
|
||||
You have another version of autoconf. If you want to use that,
|
||||
you should regenerate the build system entirely.], [63])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.10'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.10], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
# _AM_AUTOCONF_VERSION(VERSION)
|
||||
# -----------------------------
|
||||
# aclocal traces this macro to find the Autoconf version.
|
||||
# This is a private macro too. Using m4_define simplifies
|
||||
# the logic in aclocal, which can simply ignore this definition.
|
||||
m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.10])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])dnl
|
||||
AC_SUBST([$1_FALSE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 9
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], UPC, [depcc="$UPC" am_compiler_list=],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
#serial 3
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
|
||||
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 12
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`"; then
|
||||
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
|
||||
# is not polluted with repeated "-I."
|
||||
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
||||
[_AM_DEPENDENCIES(OBJC)],
|
||||
[define([AC_PROG_OBJC],
|
||||
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_PROG_LEX
|
||||
# -----------
|
||||
# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a
|
||||
# "missing" invocation, for better error output.
|
||||
AC_DEFUN([AM_PROG_LEX],
|
||||
[AC_PREREQ(2.50)dnl
|
||||
AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
|
||||
AC_REQUIRE([AC_PROG_LEX])dnl
|
||||
if test "$LEX" = :; then
|
||||
LEX=${am_missing_run}flex
|
||||
fi])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check for `mkdir -p'.
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
|
||||
dnl while keeping a definition of mkdir_p for backward compatibility.
|
||||
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
|
||||
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
|
||||
dnl Makefile.ins that do not define MKDIR_P, so we do our own
|
||||
dnl adjustment using top_builddir (which is defined more often than
|
||||
dnl MKDIR_P).
|
||||
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
|
||||
case $mkdir_p in
|
||||
[[\\/$]]* | ?:[[\\/]]*) ;;
|
||||
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
# This macro is traced by Automake.
|
||||
AC_DEFUN([_AM_SUBST_NOTMAKE])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
10
bip.1
10
bip.1
|
@ -6,7 +6,7 @@ bip \- BIP IRC Proxy
|
|||
|
||||
.SH SYNOPSIS
|
||||
|
||||
\fBbip\fP [ \fB-n\fP ] [ \fB-f\fP \fIconfig_file\fP ] [ \fB-s\fP \fIbipdir\fP ] [ \fB-h\fP ]
|
||||
\fBbip\fP [ \fB-f\fP \fIconfig_file\fP ] [ \fB-n\fP ] [ \fB-h\fP ]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
|
@ -24,10 +24,8 @@ Use config_file as the configuration file.
|
|||
If no config file is given, bip will try to open ~/.bip/bip.conf.
|
||||
|
||||
.TP
|
||||
\fB-s\fP bipdir
|
||||
Set bip home directory to bipdir instead of $HOME/.bip. \fBbipdir\fP is
|
||||
the default parent directory for client certificate, configuration, logs, pid,
|
||||
oidentd.
|
||||
\fB-s\fP homedir
|
||||
Set bip home directory to homedir instead of $HOME/.bip.
|
||||
|
||||
.TP
|
||||
\fB-h\fP
|
||||
|
@ -40,7 +38,7 @@ bip.conf
|
|||
.SH AUTHOR
|
||||
|
||||
Arnaud 'nohar' Cornet
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
Loic 'Kyoshiro' Gomez
|
||||
|
||||
Thanks to jj, YS and lafouine, for hanging around while we were coding.
|
||||
|
||||
|
|
|
@ -0,0 +1,322 @@
|
|||
.TH BIP 1 "10 October 2005"
|
||||
|
||||
.SH NAME
|
||||
|
||||
bip.conf \- Configuration file for BIP IRC Proxy
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
A BIP configuration file consists of a list of variable affectations or
|
||||
sections. It contains the global options, networks definitions, users
|
||||
configuration, users connections declarations. Each section is described in
|
||||
this manpage.
|
||||
|
||||
The bip.conf skeleton should be something like this :
|
||||
|
||||
.nf
|
||||
option1 = value;
|
||||
option2 = value;
|
||||
...
|
||||
|
||||
network {
|
||||
net_opt = value;
|
||||
...
|
||||
server { ... };
|
||||
server { ... };
|
||||
};
|
||||
...
|
||||
|
||||
user {
|
||||
user_opt = value;
|
||||
...
|
||||
connection {
|
||||
conn_opt = value;
|
||||
...
|
||||
channel { ... };
|
||||
};
|
||||
connection {
|
||||
conn_opt = value;
|
||||
...
|
||||
channel { ... };
|
||||
channel { ... };
|
||||
...
|
||||
};
|
||||
};
|
||||
.fi
|
||||
|
||||
.SH SYNTAX RULES
|
||||
|
||||
The syntax is quite simple :
|
||||
.br
|
||||
\- everything after the \fB#\fP character is ignored (comments)
|
||||
.br
|
||||
\- each variable affectation must be finished with a \fB;\fP
|
||||
.br
|
||||
\- each section { } must be finished with a \fB;\fP
|
||||
.br
|
||||
|
||||
If you use vim you will probably want to use vim with the provided
|
||||
\fBbip.vim\fP syntax file to avoid common syntax and lexical mistakes. You can
|
||||
also find an example configuration file along with BIP.
|
||||
|
||||
.SH GLOBAL OPTIONS
|
||||
|
||||
.TP
|
||||
\fBbacklog_always\fP (default: \fBfalse\fP)
|
||||
If true, clients will always receive \fBbacklog_lines\fP log lines, even if
|
||||
they were already sent before. This option should of course not be enabled if
|
||||
\fBbacklog_lines\fP is 0 !
|
||||
|
||||
.TP
|
||||
\fBbacklog\fP (default: \fBtrue\fP)
|
||||
Enable or disable the whole backlog system, which allows clients to see a
|
||||
log replay upon connection.
|
||||
|
||||
.TP
|
||||
\fBbacklog_lines\fP (default: \fB10\fP)
|
||||
If set to 0, BIP will replay all the logs since last client disconnect. Else,
|
||||
it'll replay exactly \fBbacklog_lines\fP lines on each channel and privates.
|
||||
Be aware that BIP will replay \fBbacklog_lines\fP lines of all privates, even
|
||||
if there are more. For example if Coyote told you 12 lines and then RoadRunner
|
||||
6, you'll only have a replay of the 6 RoadRunner's lines and the last 4 of
|
||||
Coyote's.
|
||||
|
||||
\fBbacklog_no_timestamp\fP (default: \fBfalse\fP)
|
||||
If true, backlogged line won't include the timestamp.
|
||||
|
||||
.TP
|
||||
\fBbacklog_reset_on_talk\fP (default: \fBfalse\fP)
|
||||
When true, backlog will not be reset upon client disconnection but upon client
|
||||
talk (channel/private message or action). It means that next time you log to
|
||||
your bip session the backlogging will start at the time right after your last
|
||||
words on irc.
|
||||
|
||||
.TP
|
||||
\fBbacklog_msg_only\fP (default: \fBfalse\fP)
|
||||
When true, bip will backlog only channel/private messages/notices. No topic
|
||||
change, nick change, user quit/part/join will be backlogged upon connection.
|
||||
|
||||
.TP
|
||||
\fBclient_side_ssl\fP (default: \fBfalse\fP)
|
||||
When true, clients will need to connect to BIP using SSL.
|
||||
|
||||
.TP
|
||||
\fBip\fP
|
||||
Ignored for the time beeing.
|
||||
|
||||
.TP
|
||||
\fBlog\fP (default: \fBtrue\fP)
|
||||
When true, the log system is enabled. Else, BIP will not write a single log
|
||||
file. Backlog is then stored into memory.
|
||||
|
||||
.TP
|
||||
\fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP)
|
||||
Determines the log file name depending on :
|
||||
.br
|
||||
\- %u username (name in user { }; section)
|
||||
.br
|
||||
\- %n network name (name in connection { }; section)
|
||||
.br
|
||||
\- %c channel name
|
||||
.br
|
||||
\- %Y 4 digits year
|
||||
.br
|
||||
\- %m 2 digits month
|
||||
.br
|
||||
\- %d 2 digits day
|
||||
|
||||
.TP
|
||||
\fBlog_level\fP (default: \fB1\fP)
|
||||
Specify the verbosity of BIP from 0 (fatal errors) to 6 (huge debug output)
|
||||
|
||||
.TP
|
||||
\fBlog_root\fP (default: \fBHOME/.bip/logs\fP)
|
||||
Main log directory. Sub-directories and files will be created from there
|
||||
depending on \fBlog_format\fP.
|
||||
|
||||
.TP
|
||||
\fBlog_sync_interval\fP (default: \fB5\fP)
|
||||
Defines the delay between each logfiles sync to the disk. Must be a non null
|
||||
positive integer.
|
||||
|
||||
.TP
|
||||
\fBpid_file\fP (default: \fBHOME/.bip/bip.pid\fP)
|
||||
Defines the file where BIP's pid will be stored. BIP checks if this file exists
|
||||
and if the pid is still alive upon startup. If true, BIP refuses to start.
|
||||
|
||||
.TP
|
||||
\fBport\fP (default: \fB7778\fP)
|
||||
The port on which BIP should listen for clients.
|
||||
|
||||
.SH NETWORK SECTION
|
||||
|
||||
This section allows you to declare a network for use in the connection
|
||||
sections. It may appear more than once in the configuration file.
|
||||
|
||||
.TP
|
||||
\fBssl\fP (default: \fBfalse\fP)
|
||||
If true, BIP will connect to this network using SSL only. You cannot mix
|
||||
SSL servers and non-SSL servers in the same network section. This is by choice,
|
||||
we believe it's a bad idea.
|
||||
|
||||
.TP
|
||||
\fBname\fP
|
||||
It's the network name used in the \fBconnection section\fP. Please note that
|
||||
this value is not used in \fBlog_format\fP, since it uses the variable
|
||||
\fBname\fP from the \fBconnection section\fP.
|
||||
|
||||
.SH SERVER SUB-SECTION
|
||||
|
||||
BIP will cycle through the server sections list when reconnecting to a network.
|
||||
It may appear more than once in a network section.
|
||||
|
||||
.TP
|
||||
\fBhost\fP
|
||||
The server's hostname or IP address.
|
||||
|
||||
.TP
|
||||
\fBport\fP (default: \fB6667\fP)
|
||||
The server port to connect to.
|
||||
|
||||
.SH USER SECTION
|
||||
|
||||
This section allows you to define the users allowed to connect to BIP and their
|
||||
options. It may appear more than once in the configuration file.
|
||||
|
||||
.TP
|
||||
\fBdefault_nick\fP
|
||||
The default nick option for each \fBconnection section\fP where no \fBnick\fP
|
||||
is defined. See \fBCONNECTION SECTION\fP for more details.
|
||||
|
||||
.TP
|
||||
\fBdefault_realname\fP
|
||||
The default realname option for each \fBconnection section\fP where no
|
||||
\fBrealname\fP is defined. See \fBCONNECTION SECTION\fP for more details.
|
||||
|
||||
.TP
|
||||
\fBdefault_user\fP
|
||||
The default user option for each \fBconnection section\fP where no \fBuser\fP
|
||||
is defined. See \fBCONNECTION SECTION\fP for more details.
|
||||
|
||||
.TP
|
||||
\fBname\fP
|
||||
The user name. It'll be used to authenticate to bip and in \fBlog_format\fP.
|
||||
|
||||
.TP
|
||||
\fBpassword\fP
|
||||
The password. It \fBMUST\fP be generated with \fBbimkpw\fP or it'll not work.
|
||||
|
||||
.TP
|
||||
\fBssl_check_mode\fP (default: \fBnone\fP)
|
||||
Tells whether BIP should check the server SSL certificate and against what.
|
||||
Can be \fBnone\fP for no check at all, \fBca\fP to check if the cert is signed
|
||||
by a Certificate Authority in repository, or \fBbasic\fP to check if cert
|
||||
exists in repository. The repository is defined by \fBssl_check_store\fP.
|
||||
|
||||
.TP
|
||||
\fBssl_check_store\fP (default: \fBnot set\fP)
|
||||
This repository is browsed by BIP when a SSL certificate or CA check is needed.
|
||||
|
||||
.SH CONNECTION SUB-SECTION
|
||||
|
||||
Each connection section associates a user to the networks he wants to connect
|
||||
to. Thus, it must be declared in the user sections, and can be used more than
|
||||
once.
|
||||
|
||||
.TP
|
||||
\fBaway_nick\fP (default: \fBnot set\fP)
|
||||
If true, and if there are no more client attached, BIP will change nickname to
|
||||
this \fBaway_nick\fP. Your nickname will be restored upon client connect.
|
||||
|
||||
.TP
|
||||
\fBno_client_away_msg\fP (default: \fBnot set\fP)
|
||||
This options allows you to set an away message. This away message will be set
|
||||
when the last client disconnects, and removed when a client connects.
|
||||
|
||||
.TP
|
||||
\fBfollow_nick\fP (default: \fBfalse\fP)
|
||||
If set to true, when you change nick, BIP stores the new nickname as the new
|
||||
default nickname value. Thus, if you are disconnected from the server, BIP will
|
||||
restore the correct nickname.
|
||||
|
||||
.TP
|
||||
\fBignore_first_nick\fP (default: \fBfalse\fP)
|
||||
If set to true, BIP will ignore the nickname sent by the client upon connect.
|
||||
Further nickname changes will be processed as usual.
|
||||
|
||||
.TP
|
||||
\fBnetwork\fP
|
||||
The network name. See the \fBNETWORK SECTION\fP.
|
||||
|
||||
.TP
|
||||
\fBnick\fP
|
||||
BIP will send that string as your nickname upon connect. If not specified
|
||||
and if \fBdefault_nickname\fP is specified in the \fBuser section\fP, BIP will
|
||||
use that default nickname string.
|
||||
|
||||
.TP
|
||||
\fBon_connect_send\fP
|
||||
You can specify this field more than once. BIP will send the text as is to the
|
||||
server. It'd be useful for a greet on connect or to send you NickServ password.
|
||||
|
||||
.TP
|
||||
\fBpassword\fP
|
||||
This is the irc server password, which is sent upon connection to the irc server
|
||||
only.
|
||||
|
||||
.TP
|
||||
\fBrealname\fP
|
||||
BIP will send that string as the realname part (description in whois result)
|
||||
upon connect. If not specified and if \fBdefault_realname\fP is specified in
|
||||
the \fBuser section\fP, BIP will use that default realname string.
|
||||
|
||||
.TP
|
||||
\fBsource_port\fP
|
||||
If specified, tells BIP to connect from this port to the IRC server.
|
||||
|
||||
.TP
|
||||
\fBuser\fP
|
||||
BIP will send that string as the user part (usually between ! and @ in a whois
|
||||
result) upon connect. It's also used by the oidentd support (if enabled). If
|
||||
not specified and if \fBdefault_user\fP is specified in the \fBuser section\fP,
|
||||
BIP will use that default user string.
|
||||
|
||||
.TP
|
||||
\fBvhost\fP
|
||||
If specified, BIP will use \fBvhost\fP as the IP address to bind to when
|
||||
connecting to the IRC server. It'll allow you to use a specific IP address
|
||||
for this network when you have more than one. This options is totally useless
|
||||
to people who only have one IP address.
|
||||
|
||||
.SH CHANNEL SUB-SUB-SECTION
|
||||
|
||||
This section defines the list of channels to join for a user on a particular
|
||||
network. It is to be found in the connection sections and appear more than once
|
||||
in a connection section.
|
||||
|
||||
.TP
|
||||
\fBname\fP
|
||||
The channel name (#bip, &bip, ...).
|
||||
|
||||
.TP
|
||||
\fBkey\fP
|
||||
The channel key if needed.
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
bip, bipmkpw
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
bip authors:
|
||||
.br
|
||||
Arnaud 'nohar' Cornet
|
||||
.br
|
||||
Loic 'Kyoshiro' Gomez
|
||||
|
||||
Thanks to jj, YS and lafouine, for hanging around while we were coding.
|
||||
.br
|
||||
Crypto shamelessly taken from Christophe 'sexy' Devine.
|
||||
.br
|
||||
This man page is written by Loic 'Kyoshiro' Gomez.
|
||||
|
497
bip.conf.5
497
bip.conf.5
|
@ -1,497 +0,0 @@
|
|||
.TH BIP.CONF 5 "2 January 2022"
|
||||
|
||||
.SH NAME
|
||||
|
||||
bip.conf \- Configuration file for BIP IRC Proxy
|
||||
|
||||
.SH SYNOPSIS
|
||||
|
||||
.PP
|
||||
~/.bip/bip.conf
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
A BIP configuration file consists of a list of variable affectations or
|
||||
sections. It contains the global options, networks definitions, users
|
||||
configuration, users connections declarations. Each section is described in
|
||||
this manpage.
|
||||
|
||||
The
|
||||
.BR bip.conf
|
||||
skeleton should be something like this :
|
||||
|
||||
.EX
|
||||
option1 = value;
|
||||
option2 = value;
|
||||
...
|
||||
|
||||
network {
|
||||
net_opt = value;
|
||||
...
|
||||
server { ... };
|
||||
server { ... };
|
||||
};
|
||||
...
|
||||
|
||||
user {
|
||||
user_opt = value;
|
||||
...
|
||||
connection {
|
||||
conn_opt = value;
|
||||
...
|
||||
channel { ... };
|
||||
};
|
||||
connection {
|
||||
conn_opt = value;
|
||||
...
|
||||
channel { ... };
|
||||
channel { ... };
|
||||
...
|
||||
};
|
||||
};
|
||||
.EE
|
||||
|
||||
.SH SYNTAX RULES
|
||||
|
||||
The syntax is quite simple :
|
||||
.RS
|
||||
.IP \(bu 4
|
||||
everything after the \fB#\fP character is ignored (comments)
|
||||
.IP \(bu 4
|
||||
each variable affectation must be finished with a \fB;\fP
|
||||
.IP \(bu 4
|
||||
each section { } must be finished with a \fB;\fP
|
||||
.RE
|
||||
|
||||
If you use vim you will probably want to use vim with the provided
|
||||
\fBbip.vim\fP syntax file to avoid common syntax and lexical mistakes. You can
|
||||
also find an example configuration file along with BIP.
|
||||
|
||||
By default, \fBbipdir\fR is the \fI$HOME/.bip\fR directory and the parent
|
||||
directory for client certificate, configuration, logs, pid, oidentd. If
|
||||
environment variable \fB$HOME\fP doesn't exist, \fB-s\fP parameter must be
|
||||
used.
|
||||
|
||||
.SH GLOBAL OPTIONS
|
||||
|
||||
.TP
|
||||
\fBclient_side_ssl\fP (default: \fBfalse\fP)
|
||||
When true, clients will need to connect to BIP using SSL.
|
||||
You'll also need to generate a SSL cert/key pair in \fIbipdir/bip.pem\fR
|
||||
(usually \fI~/.bip/bip.pem\fR or \fI/var/lib/bip/bip.pem\fR) or \fBclient_side_ssl_pem\fP if
|
||||
defined.
|
||||
|
||||
.TP
|
||||
\fBclient_side_ssl_pem\fP (default: \fI<bipdir>/bip.pem\fR)
|
||||
Set this to the full path of the cert/key pair bip should use to accept clients
|
||||
SSL connections.
|
||||
|
||||
.TP
|
||||
\fBclient_side_ciphers\fP
|
||||
OpenSSL cipher lists used for clients SSL connections. If not set, OpenSSL
|
||||
default ciphers will be used.
|
||||
|
||||
.TP
|
||||
\fBclient_side_dh_param\fP DH parameters filename\fP (default: \fI<bipdir>/dh.pem\fR)
|
||||
Used for clients SSL connections, Supply at least 2048-bit parameters.
|
||||
|
||||
.TP
|
||||
\fBssl_default_ciphers\fP
|
||||
OpenSSL cipher lists used for server connections. If not set, OpenSSL default
|
||||
ciphers will be used.
|
||||
|
||||
.TP
|
||||
\fBip\fP (default: \fB0.0.0.0\fP)
|
||||
Listening IP address. This is the IP address bip will listen for incoming
|
||||
client connections.
|
||||
|
||||
.TP
|
||||
\fBlog\fP (default: \fBtrue\fP)
|
||||
When true, the log system is enabled. Else, BIP will not write a single log
|
||||
file. Backlog is then stored into memory.
|
||||
|
||||
.TP
|
||||
\fBlog_system\fP (default: \fBtrue\fP)
|
||||
When true, system messages such as connection errors are logged. Else, BIP will
|
||||
not write system logs.
|
||||
|
||||
.TP
|
||||
\fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP)
|
||||
Determines the log filename depending on :
|
||||
.br
|
||||
\- %u username (name in \fBuser\fP { }; section)
|
||||
.br
|
||||
\- %n network name (name in \fBconnection\fP { }; section)
|
||||
.br
|
||||
\- %c channel name
|
||||
.br
|
||||
\- %Y 4 digits year
|
||||
.br
|
||||
\- %m 2 digits month
|
||||
.br
|
||||
\- %d 2 digits day
|
||||
|
||||
.TP
|
||||
\fBlog_level\fP (default: \fB1\fP)
|
||||
Specify the verbosity of BIP from 0 (fatal errors) to 6 (huge debug output)
|
||||
|
||||
.TP
|
||||
\fBlog_root\fP (default: \fI<bipdir>/logs\fR
|
||||
Main log directory. Sub-directories and files will be created from there
|
||||
depending on \fBlog_format\fP.
|
||||
|
||||
.TP
|
||||
\fBlog_sync_interval\fP (default: \fB5\fP)
|
||||
Defines the delay between each logfiles sync to the disk. Must be a non null
|
||||
positive integer.
|
||||
|
||||
.TP
|
||||
\fBreconn_timer\fP (default: \fB30\fP)
|
||||
Defines the initial delay (in seconds) before a reconnection attempt.
|
||||
The delay increases with the number of attempts:
|
||||
delay = reconn_timer * number of attempts
|
||||
|
||||
.TP
|
||||
\fBpid_file\fP (default: \fI<bipdir>/bip.pid\fR)
|
||||
Defines the file where BIP's pid will be stored. BIP checks if this file exists
|
||||
and if the pid is still alive upon startup. If true, BIP refuses to start.
|
||||
|
||||
.TP
|
||||
\fBwrite_oidentd\fP (default: \fIfalse\fR)
|
||||
Must be set to true to overwrite oidentd configs.
|
||||
|
||||
.TP
|
||||
\fBoidentd_file\fP (default: \fI<bipdir>/.oidentd.conf\fR)
|
||||
oidentd configuration file (if oidentd enabled).
|
||||
|
||||
.TP
|
||||
\fBport\fP (default: \fB7778\fP)
|
||||
The port on which BIP should listen for clients.
|
||||
|
||||
.SH NETWORK SECTION
|
||||
|
||||
This section allows you to declare a network for use in the connection
|
||||
sections. It may appear more than once in the configuration file.
|
||||
|
||||
.TP
|
||||
\fBssl\fP (default: \fBfalse\fP)
|
||||
If true, BIP will connect to this network using SSL only. You cannot mix
|
||||
SSL servers and non-SSL servers in the same \fBnetwork\fP section. This is by choice,
|
||||
we believe it's a bad idea.
|
||||
|
||||
.TP
|
||||
\fBssl_ciphers\fP (override global \fBssl_default_ciphers\fP)
|
||||
OpenSSL cipher lists used for this network.
|
||||
|
||||
.TP
|
||||
\fBname\fP
|
||||
It's the network name used in the \fBconnection\fP section. Please note that
|
||||
this value is not used in \fBlog_format\fP, since it uses the variable
|
||||
\fBname\fP from the \fBconnection\fP section.
|
||||
|
||||
.SH SERVER SUB-SECTION
|
||||
|
||||
BIP will cycle through the server sections list when reconnecting to a network.
|
||||
It may appear more than once in a network section.
|
||||
|
||||
.TP
|
||||
\fBhost\fP
|
||||
The server's hostname or IP address.
|
||||
|
||||
.TP
|
||||
\fBport\fP (default: \fB6667\fP)
|
||||
The server port to connect to.
|
||||
|
||||
.SH USER SECTION
|
||||
|
||||
This section allows you to define the users allowed to connect to BIP and their
|
||||
options. It may appear more than once in the configuration file.
|
||||
|
||||
.TP
|
||||
\fBadmin\fP (default: \fBfalse\fP)
|
||||
If a user has admin set to true, he'll become a bip administrator, which allows
|
||||
him for example to reload bip from IRC or to see the user configuration.
|
||||
|
||||
.TP
|
||||
\fBbacklog\fP (default: \fBtrue\fP)
|
||||
Enable or disable the whole backlog system, which allows clients to see a
|
||||
log replay upon connection.
|
||||
|
||||
.TP
|
||||
\fBbacklog_always\fP (default: \fBfalse\fP)
|
||||
If true, clients will always receive \fBbacklog_lines\fP log lines, even if
|
||||
they were already sent before. That means :
|
||||
If \fBbacklog_always\fP is false, backlog will be reset whenever there
|
||||
is no more client connected to a network. Else backlog will not be reset.
|
||||
This option should of course not be enabled if \fBbacklog_lines\fP is 0 !
|
||||
If you still want to do so, don't forget to \fB/BIP BLRESET\fP sometimes.
|
||||
|
||||
.TP
|
||||
\fBbacklog_lines\fP (default: \fB0\fP)
|
||||
If set to 0, BIP will replay all the logs since last client disconnect. Else,
|
||||
it'll replay exactly \fBbacklog_lines\fP lines on each channel and privates.
|
||||
Be aware that BIP will replay \fBbacklog_lines\fP lines of all privates, even
|
||||
if there are more. For example if Coyote told you 12 lines and then RoadRunner
|
||||
6, you'll only have a replay of the 6 RoadRunner's lines and the last 4 of
|
||||
Coyote's.
|
||||
|
||||
.TP
|
||||
\fBbacklog_timestamp\fP (default: \fBtime\fP)
|
||||
\fBnone\fP disables timestamps in backlogged lines, \fBtime\fP or
|
||||
\fBdatetime\fP allow one to select the timestamp format in backlogged lines.
|
||||
|
||||
.TP
|
||||
\fBbacklog_no_timestamp\fP (default: \fBfalse\fP)
|
||||
This parameter is deprecated, use \fBbacklog_timestamp\fP instead.
|
||||
.I false
|
||||
implies
|
||||
.I backlog_timestamp = "none"
|
||||
and
|
||||
.I true
|
||||
implies
|
||||
.I backlog_timestamp = "time"
|
||||
\&.
|
||||
|
||||
.TP
|
||||
\fBbacklog_reset_on_talk\fP (default: \fBfalse\fP)
|
||||
When true, backlog will be reset upon client talk (channel/private message or
|
||||
action). It means that next time you log to your bip session, the backlogging
|
||||
will start at the time right after your last words on that specific channel or
|
||||
query.
|
||||
|
||||
.TP
|
||||
\fBbacklog_reset_connection\fP (default: \fBfalse\fP)
|
||||
When true, backlog_reset_on_talk option above is changed in that the whole
|
||||
network backlog is reset when you talk in the network.
|
||||
|
||||
.TP
|
||||
\fBbacklog_msg_only\fP (default: \fBfalse\fP)
|
||||
When true, bip will backlog only channel/private messages/notices. No topic
|
||||
change, nick change, user quit/part/join will be backlogged upon connection.
|
||||
|
||||
.TP
|
||||
\fBbip_use_notice\fP (default: \fBfalse\fP)
|
||||
If \fBbip_use_notice\fP is true, bip's notifications to the clients will be
|
||||
send as notices instead of private messages. For example, this setting applies
|
||||
to disconnection notifications or \fB/BIP\fP command replies.
|
||||
|
||||
.TP
|
||||
\fBdefault_nick\fP
|
||||
The default nick option for each \fBconnection\fP section where no \fBnick\fP
|
||||
is defined. See \fBCONNECTION SECTION\fP for more details.
|
||||
|
||||
.TP
|
||||
\fBdefault_realname\fP
|
||||
The default realname option for each \fBconnection\fP section where no
|
||||
\fBrealname\fP is defined. See \fBCONNECTION SECTION\fP for more details.
|
||||
|
||||
.TP
|
||||
\fBdefault_user\fP
|
||||
The default user option for each \fBconnection\fP section where no \fBuser\fP
|
||||
is defined. See \fBCONNECTION SECTION\fP for more details.
|
||||
|
||||
.TP
|
||||
\fBname\fP
|
||||
The username. It'll be used to authenticate to bip and in \fBlog_format\fP.
|
||||
|
||||
.TP
|
||||
\fBpassword\fP
|
||||
The password. It \fBMUST\fP be generated with \fBbipmkpw\fP or it'll not work.
|
||||
|
||||
.TP
|
||||
\fBssl_check_mode\fP (default: \fBnone\fP)
|
||||
Tells whether BIP should check the server SSL certificate and against what.
|
||||
Can be \fBnone\fP for no check at all, \fBca\fP to check if the cert is signed
|
||||
by a Certificate Authority in repository, or \fBbasic\fP to check if cert
|
||||
exists in repository. The repository is defined by \fBssl_check_store\fP. This
|
||||
allows a "ssh-like" private key generation scheme. Note that in basic mode:
|
||||
.br
|
||||
- expired certificates that are in the store are considered valid.
|
||||
.br
|
||||
- CA-signed certificates are considered valid even if not in store.
|
||||
|
||||
.TP
|
||||
\fBssl_check_store\fP (default: \fBnot set\fP)
|
||||
This repository is browsed by BIP when a SSL certificate or CA check is needed.
|
||||
In ssl_check_mode \fBbasic\fP it must be a file, to which certificates you
|
||||
choose to trust will be appended. In ssl_check_mode \fBca\fP it may be a
|
||||
single file containing one or more trusted certificates concatenated together
|
||||
between BEGIN CERTIFICATE and END CERTIFICATE lines, a directory containing
|
||||
individual certificates in PEM format which has been processed by \fBc_rehash\fP,
|
||||
or unset, in which case bip will attempt to use the default certificate store of
|
||||
the OpenSSL it is built against.
|
||||
|
||||
.TP
|
||||
\fBssl_client_certfile\fP (default: \fBnot set\fP)
|
||||
Some networks (OFTC at least) allow you to authenticate to nickserv services
|
||||
using a client side certificate. Make this variable point to the .pem file to
|
||||
use this feature.
|
||||
|
||||
.SH CONNECTION SUB-SECTION
|
||||
|
||||
Each \fBconnection\fP section associates a user to the networks he wants to connect
|
||||
to. Thus, it must be declared in the \fBUser\fP sections, and can be used more than
|
||||
once.
|
||||
|
||||
.TP
|
||||
\fBaway_nick\fP (default: \fBnot set\fP)
|
||||
If set, and if there are no more client attached, BIP will change nickname to
|
||||
this \fBaway_nick\fP. Your nickname will be restored upon client connect.
|
||||
|
||||
.TP
|
||||
\fBno_client_away_msg\fP (default: \fBnot set\fP)
|
||||
This options allows you to set an away message. This away message will be set
|
||||
when the last client disconnects, and removed when a client connects.
|
||||
|
||||
.TP
|
||||
\fBfollow_nick\fP (default: \fBfalse\fP)
|
||||
If set to true, when you change nick, BIP stores the new nickname as the new
|
||||
default nickname value. Thus, if you are disconnected from the server, BIP will
|
||||
restore the correct nickname.
|
||||
|
||||
.TP
|
||||
\fBautojoin_on_kick\fP (default: \fBtrue\fP)
|
||||
If set to false bip will not attempt to re-join a channel from which you were
|
||||
kicked.
|
||||
|
||||
.TP
|
||||
\fBignore_first_nick\fP (default: \fBfalse\fP)
|
||||
If set to true, BIP will ignore the nickname sent by the client upon connect.
|
||||
Further nickname changes will be processed as usual.
|
||||
|
||||
.TP
|
||||
\fBignore_server_capab\fP (default: \fBtrue\fP)
|
||||
By default bip ignores when a server advertises the CAPAB feature. Servers that
|
||||
support this can prefix each line with a "+" or a "-" depending if a user is
|
||||
registered or not. xchat checks if a server has the CAPAB feature and enables
|
||||
it.
|
||||
If you have two clients connected to a bip connection, one that supports this
|
||||
mode and one that does not, you see the plus and the minuses on each line in
|
||||
the client that does not support CAPAB. To avoid that, when a server advertises
|
||||
CAPAB bip simply removes it. You can set this option to false to keep using
|
||||
CAPAB (if you only use clients that support it for instance).
|
||||
|
||||
.TP
|
||||
\fBnetwork\fP
|
||||
The network name. See the \fBNETWORK SECTION\fP.
|
||||
|
||||
.TP
|
||||
\fBlog\fP (override global log)
|
||||
When \fBtrue\fP, the file logs are enabled for this connection.
|
||||
When \fBfalse\fP, no log file is written, logs are kept in memory.
|
||||
|
||||
.TP
|
||||
\fBnick\fP
|
||||
BIP will send that string as your nickname upon connect. If not specified
|
||||
and if \fBdefault_nickname\fP is specified in the \fBuser\fP section, BIP will
|
||||
use that default nickname string.
|
||||
|
||||
.TP
|
||||
\fBon_connect_send\fP
|
||||
You can specify this field more than once. BIP will send the text as is to the
|
||||
server. It'd be useful for a greet on connect or to send your NickServ password.
|
||||
|
||||
.TP
|
||||
\fBpassword\fP
|
||||
This is the IRC server password, which is sent upon connection to the IRC server
|
||||
only.
|
||||
|
||||
.TP
|
||||
\fBrealname\fP
|
||||
BIP will send that string as the realname part (description in whois result)
|
||||
upon connect. If not specified and if \fBdefault_realname\fP is specified in
|
||||
the \fBuser\fP section, BIP will use that default realname string.
|
||||
|
||||
.TP
|
||||
\fBsasl_mechanism\fP
|
||||
Tells BIP to use specified SASL mechanism. Currently supported: PLAIN, EXTERNAL.
|
||||
PLAIN mechanism requires \fBsasl_username\fP and \fBsasl_password\fP and is the
|
||||
default if these are set.
|
||||
|
||||
.TP
|
||||
\fBsasl_username\fP
|
||||
This connection's username to pass on using SASL authentication.
|
||||
|
||||
.TP
|
||||
\fBsasl_password\fP
|
||||
This connection's password to pass on using SASL authentication.
|
||||
|
||||
.TP
|
||||
\fBsource_port\fP
|
||||
If specified, tells BIP to connect from this port to the IRC server.
|
||||
|
||||
.TP
|
||||
\fBssl_check_mode\fP (default: \fBthe user's option\fP)
|
||||
See \fBssl_check_mode\fP option in \fBUser\fP section.
|
||||
|
||||
.TP
|
||||
\fBuser\fP
|
||||
BIP will send that string as the user part (usually between ! and @ in a whois
|
||||
result) upon connect. It's also used by the oidentd support (if enabled). If
|
||||
not specified and if \fBdefault_user\fP is specified in the \fBuser\fP section,
|
||||
BIP will use that default user string.
|
||||
|
||||
.TP
|
||||
\fBvhost\fP
|
||||
If specified, BIP will use \fBvhost\fP as the IP address to bind to when
|
||||
connecting to the IRC server. It'll allow you to use a specific IP address
|
||||
for this network when you have more than one. This options is totally useless
|
||||
to people who only have one IP address.
|
||||
|
||||
.SH CHANNEL SUB-SUB-SECTION
|
||||
|
||||
This section defines the list of channels to join for a user on a particular
|
||||
network. It is to be found in the \fBconnection\fP sections and appear more than once
|
||||
in a \fBconnection\fP section.
|
||||
|
||||
.TP
|
||||
\fBname\fP
|
||||
The channel name (#bip, &bip, ...).
|
||||
|
||||
.TP
|
||||
\fBkey\fP
|
||||
The channel key if needed.
|
||||
|
||||
.TP
|
||||
\fBbacklog\fP (default: \fBtrue\fP)
|
||||
Enable or disable backlogging of this particular channel.
|
||||
Setting this to true will NOT enable the backlog system, see the \fBuser\fP
|
||||
section.
|
||||
|
||||
.SH IRC CLIENT CONFIGURATION
|
||||
.P
|
||||
On your IRC client, setup as many IRC servers as connections defined in your
|
||||
\fBconnection\fP section.
|
||||
.P
|
||||
Host and port must match values defined in \fBip\fP and \fBport\fP global
|
||||
option. The password must be \fIusername:password:connectionname\fR where:
|
||||
|
||||
.RS
|
||||
.IP \(bu 4
|
||||
username is the \fIname\fR defined in the \fIuser\fR section;
|
||||
.IP \(bu 4
|
||||
password is the clear text value of the \fIpassword\fR corresponding to the
|
||||
hashed password defined in the \fIuser\fR section;
|
||||
.IP \(bu 4
|
||||
connectionname is the \fIname\fR defined in \fIconnection\fR sub-section.
|
||||
.RE
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
.BR bip (1),
|
||||
.BR bipmkpw (1)
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
bip authors:
|
||||
.br
|
||||
Arnaud 'nohar' Cornet
|
||||
.br
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
|
||||
Thanks to jj, YS and lafouine, for hanging around while we were coding.
|
||||
.br
|
||||
Crypto shamelessly taken from Christophe 'sexy' Devine.
|
||||
.br
|
||||
This man page is written by Loïc 'Kyoshiro' Gomez.
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
.TH BIP 1 "10 October 2005"
|
||||
|
||||
.SH NAME
|
||||
|
||||
bipgenconfig \- BIP IRC Proxy configuration program
|
||||
|
||||
.SH SYNOPSIS
|
||||
|
||||
\fBbipgenconfig\fP
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
bipgenconfig will help you build a configuration file for BIP IRC Proxy
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
bip, bip.conf, bipmkpw
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
Arnaud 'nohar' Cornet
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
|
||||
Thanks to jj, YS and lafouine, for hanging around while we were coding.
|
||||
|
||||
Crypto shamelessly taken from Christophe 'sexy' Devine.
|
||||
|
|
@ -13,17 +13,14 @@ bipmkpw \- Password hasher for BIP
|
|||
bipmkpw converts a password into the double-hash used by bip. Copy the
|
||||
generated output from bipmkpw into bip config file.
|
||||
|
||||
Password cannot contain spaces.
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
.BR bip.conf (5)
|
||||
.BR bip (1)
|
||||
bip.conf
|
||||
|
||||
.SH COPYRIGHT
|
||||
|
||||
Arnaud 'nohar' Cornet
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
Loic 'Kyoshiro' Gomez
|
||||
|
||||
Thanks to jj, YS and lafouine, for hanging around while we were coding.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
180
configure.ac
180
configure.ac
|
@ -1,180 +0,0 @@
|
|||
m4_pattern_allow([^AM_])
|
||||
m4_pattern_allow([^AC_])
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([Bip IRC Proxy],[0.9.3-git],[http://bip.milkypond.org/projects/bip/activity],[bip],[http://bip.milkypond.org/])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AM_PROG_AR
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
AM_PROG_LEX
|
||||
AC_PROG_YACC
|
||||
|
||||
dnl PKG_PREREQ(MIN-VERSION)
|
||||
dnl -----------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Verify that the version of the pkg-config macros are at least
|
||||
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
||||
dnl installed version of pkg-config, this checks the developer's version
|
||||
dnl of pkg.m4 when generating configure.
|
||||
dnl
|
||||
dnl To ensure that this macro is defined, also add:
|
||||
dnl m4_ifndef([PKG_PREREQ],
|
||||
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
||||
dnl
|
||||
dnl See the "Since" comment for each macro you use to see what version
|
||||
dnl of the macros you require.
|
||||
m4_defun([PKG_PREREQ],
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||
])dnl PKG_PREREQ
|
||||
|
||||
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
dnl ----------------------------------
|
||||
dnl Since: 0.16
|
||||
dnl
|
||||
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
||||
dnl first found in the path. Checks that the version of pkg-config found
|
||||
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
||||
dnl used since that's the first version where most current features of
|
||||
dnl pkg-config existed.
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])dnl PKG_PROG_PKG_CONFIG
|
||||
|
||||
PKG_CHECK_MODULES(OPENSSL, [libssl >= 0.9.8 libcrypto >= 0.9.8], [
|
||||
with_openssl=yes
|
||||
AC_DEFINE([HAVE_LIBSSL], [1],
|
||||
[Build SSL support])
|
||||
], [ with_openssl=no ])
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_pie=yes],
|
||||
[ap_cv_cc_pie=no],
|
||||
[ap_cv_cc_pie=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_pie" = "yes"; then
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
enable_pie=yes
|
||||
fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts hardening flags], [ap_cv_cc_hardening], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_hardening=yes],
|
||||
[ap_cv_cc_hardening=no],
|
||||
[ap_cv_cc_hardening=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_hardening" = "yes"; then
|
||||
CFLAGS="$CFLAGS -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code"
|
||||
enable_cc_hardening=yes
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts some warning flags], [ap_cv_cc_warnings], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -Wformat-overflow=2 -Wformat-truncation=2 -Wtrampolines -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wstringop-overflow=4 -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wstack-usage=1000000 -Wcast-align=strict"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_warnings=yes],
|
||||
[ap_cv_cc_warnings=no],
|
||||
[ap_cv_cc_warnings=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_warnings" = "yes"; then
|
||||
CFLAGS="$CFLAGS -Wformat-overflow=2 -Wformat-truncation=2 -Wtrampolines -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wstringop-overflow=4 -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wstack-usage=1000000 -Wcast-align=strict"
|
||||
enable_cc_warnings=yes
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts some supplementary warning flags], [ap_cv_cc_warnings2], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -Wformat=2 -Wformat-security -Wnull-dereference -Wstack-protector -Walloca -Wvla -Wcast-qual -Wconversion -Wshadow -Wstrict-overflow=4 -Wstrict-prototypes -Wswitch-default -Wswitch-enum"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_warnings2=yes],
|
||||
[ap_cv_cc_warnings2=no],
|
||||
[ap_cv_cc_warnings2=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_warnings2" = "yes"; then
|
||||
CFLAGS="$CFLAGS -Wformat=2 -Wformat-security -Wnull-dereference -Wstack-protector -Walloca -Wvla -Wcast-qual -Wconversion -Wshadow -Wstrict-overflow=4 -Wstrict-prototypes -Wswitch-default -Wswitch-enum"
|
||||
enable_cc_warnings2=yes
|
||||
fi
|
||||
|
||||
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts -Warith-conversion flag], [ap_cv_cc_warith], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -Warith-conversion"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_warith=yes],
|
||||
[ap_cv_cc_warith=no],
|
||||
[ap_cv_cc_warith=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_warith" = "yes"; then
|
||||
CFLAGS="$CFLAGS -Warith-conversion"
|
||||
enable_warith_conversion=yes
|
||||
fi
|
||||
|
||||
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.6], [enable_tests=yes], [enable_tests=no])
|
||||
AM_CONDITIONAL([COND_WANT_TESTS], [test "$enable_tests" = yes])
|
||||
|
||||
AC_CHECK_FUNC(backtrace_symbols_fd, [
|
||||
AC_DEFINE(HAVE_BACKTRACE, [], [Use glibc backtrace on fatal()])
|
||||
LDFLAGS="-rdynamic $LDFLAGS"
|
||||
backtrace="(with backtrace)"
|
||||
])
|
||||
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
echo OPENSSL: $with_openssl
|
||||
echo PIE: $enable_pie
|
||||
echo TESTS: $enable_tests
|
|
@ -0,0 +1,39 @@
|
|||
AC_INIT(src/bip.c)
|
||||
AM_CONFIG_HEADER(src/config.h)
|
||||
AM_INIT_AUTOMAKE(bip,0.6.0)
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
|
||||
CFLAGS="-O2 -W -Wall"
|
||||
|
||||
debug=false
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Turn on debugging],
|
||||
[debug=true && CFLAGS="-O0 -g -W -Wall"])
|
||||
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
|
||||
|
||||
oidentd=false
|
||||
AC_ARG_ENABLE(oidentd,
|
||||
[ --enable-oidentd Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)],
|
||||
AC_DEFINE([HAVE_OIDENTD], [], [Enable oidentd.conf management support])
|
||||
|
||||
)
|
||||
#[oidentd=true]
|
||||
AM_CONDITIONAL(OIDENTD, test x$debug = xtrue)
|
||||
|
||||
requires_libssl="yes"
|
||||
AC_ARG_ENABLE(ssl,
|
||||
[ --disable-ssl Drop OpenSSL support],
|
||||
[requires_libssl=no])
|
||||
if test "x$requires_libssl" = "xyes" ; then
|
||||
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [],
|
||||
[AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])])
|
||||
|
||||
AC_CHECK_LIB(ssl, SSL_read, [],
|
||||
[AC_MSG_ERROR(
|
||||
[library 'ssl' is required for OpenSSL support])],
|
||||
-lcrypto)
|
||||
fi
|
||||
AC_OUTPUT(Makefile src/Makefile samples/Makefile)
|
|
@ -0,0 +1,530 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2005-07-09.11
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, 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>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
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. In older versions, 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.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# 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"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
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
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mecanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space 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 preprocessed 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'.
|
||||
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
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $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 $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# 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 ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
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 preprocessed 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 -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [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 preprocessed 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
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
|
@ -0,0 +1,269 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
#
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# 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 "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
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 -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
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
|
||||
true
|
||||
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
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; 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
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# 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 true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,360 @@
|
|||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2005-06-08.21
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, 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
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-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]
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program).
|
||||
case "$1" in
|
||||
lex|yacc)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. 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)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. 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)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. 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*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. 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)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' 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' $msg. 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 $msg. 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)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. 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)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. 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."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
|
||||
# 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 is $msg.
|
||||
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 prerequisites 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
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
|
@ -0,0 +1,40 @@
|
|||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
|
@ -0,0 +1,2 @@
|
|||
examplesdir = $(prefix)/share/doc/bip/examples/
|
||||
examples_DATA = bip.conf bip.vim
|
|
@ -0,0 +1,324 @@
|
|||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006 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@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
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 = :
|
||||
subdir = samples
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||
am__installdirs = "$(DESTDIR)$(examplesdir)"
|
||||
examplesDATA_INSTALL = $(INSTALL_DATA)
|
||||
DATA = $(examples_DATA)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LEX = @LEX@
|
||||
LEXLIB = @LEXLIB@
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
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@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
YFLAGS = @YFLAGS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
examplesdir = $(prefix)/share/doc/bip/examples/
|
||||
examples_DATA = bip.conf bip.vim
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu samples/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu samples/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
install-examplesDATA: $(examples_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)"
|
||||
@list='$(examples_DATA)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(examplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(examplesdir)/$$f'"; \
|
||||
$(examplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(examplesdir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-examplesDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(examples_DATA)'; for p in $$list; do \
|
||||
f=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(examplesdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(examplesdir)/$$f"; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
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 $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(examplesdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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 mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-examplesDATA
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-examplesDATA
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-examplesDATA install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-examplesDATA
|
||||
|
||||
# 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:
|
286
samples/bip.conf
286
samples/bip.conf
|
@ -1,140 +1,87 @@
|
|||
# bip default config file.
|
||||
# Thou shoult change thy password
|
||||
|
||||
# Default values are commented out.
|
||||
|
||||
# Listening IP address. This is the IP address bip will listen for incoming
|
||||
# client connections.
|
||||
#ip = "0.0.0.0";
|
||||
ip = "0.0.0.0";
|
||||
|
||||
# To connect a client to bip, try the port below, and
|
||||
# be sure to set the password to the value
|
||||
# specified in the network you want to connect to.
|
||||
# Port is 7778 by default.
|
||||
#port = 7778;
|
||||
# specified in the network you want to connect to.
|
||||
port = 7778;
|
||||
|
||||
# If you set this to true, you'll only be able to connect to bip
|
||||
# with a SSL capable IRC client. Be sure to generate a certificate
|
||||
# for bip using scripts/bipgenconfig.
|
||||
#client_side_ssl = false;
|
||||
# for bip with 'make cert'
|
||||
client_side_ssl = false;
|
||||
|
||||
# This is the file containing the SSL cert/key pair bip'll use to
|
||||
# serve SSL clients. If unset, it defaults to <bipdir>/bip.pem
|
||||
# Supply at least 2048-bit parameters, for example using openssl:
|
||||
# openssl dhparam -out dh.pem 2048;
|
||||
#client_side_ssl_pem = "<bipdir>/bip.pem";
|
||||
log_level = 3;
|
||||
|
||||
# OpenSSL cipher lists used with SSL client connections.
|
||||
# If not set, OpenSSL default ciphers will be used. See OpenSSL ciphers
|
||||
# command. An example value: "ECDHE-RSA-AES128-GCM-SHA256".
|
||||
#client_side_ciphers = ;
|
||||
|
||||
# DH parameters bip'll use when serving SSL clients.
|
||||
# Supply at least 2048-bit parameters, for example using openssl:
|
||||
# openssl dhparam -out dh.pem 2048;
|
||||
#client_side_dh_param = "<bipdir>/dh.pem";
|
||||
|
||||
# Default OpenSSL cipher lists used with outgoing connections to IRC servers.
|
||||
# If not set, OpenSSL default ciphers will be used. See OpenSSL ciphers
|
||||
# command. An example value: "ECDHE-RSA-AES128-GCM-SHA256".
|
||||
# If not set, OpenSSL default ciphers will be used.
|
||||
#ssl_default_ciphers = ;
|
||||
|
||||
# Define where the pidfile should be stored. Defaults to <bipdir>/bip.pid.
|
||||
#pid_file="";
|
||||
|
||||
# Defaults to false, whether to write oidentd.conf files (see below).
|
||||
#write_oidentd = true;
|
||||
|
||||
# Defaults to <bipdir>/.oidentd.conf
|
||||
#oidentd_file="";
|
||||
|
||||
# Set to false and uncomment this line to disable logging and backlogging.
|
||||
#log = true;
|
||||
|
||||
# Define bip's log level :
|
||||
# 0 : only fatal errors
|
||||
# 1 : add others errors
|
||||
# 2 : add warnings
|
||||
# 3 : add info messages
|
||||
# 4 : add debug messages
|
||||
#log_level = 3;
|
||||
#pid_file="/var/run/bip/bip.pid";
|
||||
|
||||
# This is where logs go. Channel and private messages will use that
|
||||
# configuration value as a prefix, and then log_format to determine
|
||||
# full log filename. Defaults to <bipdir>/logs.
|
||||
#log_root = "";
|
||||
|
||||
# Set to false and uncomment this line to disable bip's internal messages
|
||||
# logging. This is not recommended, a better option is to reduce log_level.
|
||||
#log_system = true;
|
||||
# full log filename.
|
||||
#log_root = "/var/proxy/logs";
|
||||
|
||||
# Log format allows you to make log filenames depend on the log line's
|
||||
# attributes. Here's a list :
|
||||
# %u -> username
|
||||
# %u -> user name
|
||||
# %n -> network name
|
||||
# %Y -> 4 digit year
|
||||
# %m -> 2 digit month
|
||||
# %d -> 2 digit day
|
||||
# %h -> 2 digit hour of the day
|
||||
# %c -> destination (#chan, nick, ...)
|
||||
#log_format = "%u/%n/%Y-%m/%c.%d.log";
|
||||
# %c -> destination (#chan, privates, ...)
|
||||
#log_format = "%n/%Y-%m/%c.%d.log";
|
||||
|
||||
# Sets the frequency (in seconds) of log syncing (real write to kernel)
|
||||
#log_sync_interval = 5;
|
||||
|
||||
# Sets the initial delay (in seconds) before a reconnection attempt.
|
||||
# The delay increases with the number of attempts:
|
||||
# delay = reconn_timer * number of attempts
|
||||
#reconn_timer = 30;
|
||||
# Makes bip send the log of each channel and privates while
|
||||
# you were not connected to the proxy upon connection.
|
||||
#backlog = true; # enable backlog
|
||||
backlog_lines = 10; # number of lines in backlog, 0 means no limit
|
||||
backlog_always = true; # backlog even lines already backlogged
|
||||
#backlog_no_timestamp = false; # Disables time stamps if you find them ugly.
|
||||
|
||||
# If blreset_on_talk talking on an irc network has the same effect of issuing
|
||||
# /bip blreset, meaning that stuffed logged before the command won't be read
|
||||
# back on backlog
|
||||
#blreset_on_talk = false;
|
||||
|
||||
# If bl_msg_only is true, only channel and private messages will be backlogged
|
||||
# upon the reconnection of a client. Default is false, thus joins, parts, quits,
|
||||
# nick changes, topic changes, ... are backlogged
|
||||
#backlog_msg_only = false;
|
||||
|
||||
# Network definition, a name and server info
|
||||
#network {
|
||||
# name = "iiens";
|
||||
# server { host = "irc.iiens.net"; port = 6667; };
|
||||
#};
|
||||
network {
|
||||
name = "iiens";
|
||||
server { host = "irc.iiens.net"; port = 6667; };
|
||||
};
|
||||
|
||||
#network {
|
||||
# name = "oftc";
|
||||
# server { host = "irc.oftc.net"; port = 6667; };
|
||||
# server { host = "other.oftc.server"; port = 6667; };
|
||||
#};
|
||||
|
||||
# SSL network sample. SSL is per-network option, not per-server !
|
||||
#network {
|
||||
# name = "oftcs";
|
||||
# ssl = true;
|
||||
# server { host = "ircs.oftc.net"; port = 9999; };
|
||||
#};
|
||||
network {
|
||||
name = "oftc";
|
||||
server { host = "irc.oftc.net"; port = 6667; };
|
||||
#server { host = "other.oftc.server"; port = 6667; };
|
||||
};
|
||||
|
||||
# Configuration example with one user who connects to two irc networks
|
||||
# To use the multi-server feature:
|
||||
# - define the connections
|
||||
# - chose and setup a different login for each connection
|
||||
# on your irc client:
|
||||
# - Use the multi server feature of your client, the server being each time
|
||||
# - Use the multi server feature of your client, the server beeing each time
|
||||
# the server where bip is running. In your client setup server password to:
|
||||
# username:password:connectionname
|
||||
# - do not store the password in clear here, use the bipmkpw util to generate
|
||||
# a hash
|
||||
# a hash
|
||||
|
||||
# User structure is grouping information for a given user
|
||||
#user {
|
||||
# The name in bip of the user, required. This is used by bip only.
|
||||
#name = ;
|
||||
# This user's password (md5(md5("tata"))) with seed - generated by
|
||||
# bipmkpw, for example: "3880f2b39b3b9cb507b052b695d2680859bfc327".
|
||||
#password = ;
|
||||
|
||||
# Set this to true if you want this user to have admin privileges on
|
||||
# bip. User will be able to RELOAD bip and see all users' configuration
|
||||
# (except pass).
|
||||
#admin = false;
|
||||
|
||||
# When bip_use_notice is true, bip will send internal messages like
|
||||
# disconnection notifications or /BIP commands replies as notices
|
||||
# instead of private messages. The default is false.
|
||||
#bip_use_notice = false;
|
||||
user {
|
||||
# The name in bip of the user
|
||||
# This is used by bip only
|
||||
name = "bip4ever";
|
||||
# this user's password (md5(md5("tata"))) with seed - generated by bipmkpw
|
||||
password = "3880f2b39b3b9cb507b052b695d2680859bfc327";
|
||||
|
||||
# SSL certificates checking mode for user:
|
||||
# - "none" to accept anything;
|
||||
|
@ -145,144 +92,71 @@
|
|||
# in the store below (you have to put in it every cert, CRL, up to the
|
||||
# root CA). You have to build your store manually, so you may prefer
|
||||
# using "basic" unless you're a crypto zealot...
|
||||
#ssl_check_mode = "none";
|
||||
ssl_check_mode = "none";
|
||||
|
||||
# Location of the user's store for server SSL certificate check
|
||||
# Location of the user's store for SSL certificate check
|
||||
# In "basic" mode, that must point to a single file with all trusted
|
||||
# certs concatenated together (the interactive "trust" appends to this
|
||||
# file).
|
||||
# In "ca" mode, it can be either:
|
||||
# - a directory of a standard openssl store; you must put PEM objects
|
||||
# (certificates, CRLs...) with .pem extension and run `c_rehash .' in it
|
||||
# - a certificate bundle file containing one or more certificates in PEM
|
||||
# format, enclosed in BEGIN CERTIFICATE / END CERTIFICATE lines
|
||||
# - unspecified: in this case, bip will attempt to use the default
|
||||
# certificate store of the OpenSSL it is built against. This is the default.
|
||||
#ssl_check_store = "";
|
||||
|
||||
# Some networks (OFTC at least) allow you to authenticate to nickserv
|
||||
# using client side certificates, see
|
||||
# http://www.oftc.net/oftc/NickServ/CertFP
|
||||
# This is where you put your user's certificate.
|
||||
# The default is not to use a certificate.
|
||||
#ssl_client_certfile = "";
|
||||
|
||||
# These will be the default for each connections.
|
||||
#default_nick = ;
|
||||
#default_user = ;
|
||||
#default_realname = ;
|
||||
|
||||
# Makes bip send the log of each channel and privates while
|
||||
# you were not connected to the proxy upon connection.
|
||||
#backlog = true; # enable backlog
|
||||
#backlog_lines = 10; # number of lines in backlog, 0 means no limit
|
||||
|
||||
# When true, backlog even lines already backlogged, do not reset backlog
|
||||
# when no client attached anymore.
|
||||
#backlog_always = false;
|
||||
|
||||
# "none", "time" or "datetime": disables time stamps, use time or datetime.
|
||||
#backlog_timestamp = "time";
|
||||
|
||||
# This parameter is deprecated, use backlog_timestamp instead.
|
||||
#backlog_no_timestamp = false; # implies backlog_timestamp = "none";
|
||||
|
||||
# If blreset_on_talk talking on an irc network has the same effect of
|
||||
# issuing /bip blreset <current window>, meaning that stuffed logged
|
||||
# before the command won't be read back on backlog.
|
||||
#backlog_reset_on_talk = false;
|
||||
|
||||
# If you have backlog_reset_on_talk set to true, talking in a query
|
||||
# will reset the backlog for the query. Same goes for channel. With the
|
||||
# following option set to true, talking in a connection will reset the
|
||||
# whole connection. The backlog for the current network is reset.
|
||||
#backlog_reset_connection = false;
|
||||
|
||||
# If bl_msg_only is true, only channel and private messages will be
|
||||
# backlogged upon the reconnection of a client. Default is false, thus
|
||||
# joins, parts, quits, nick changes, topic changes, ... are backlogged.
|
||||
#backlog_msg_only = false;
|
||||
# In "ca" mode, it's a directory of a standard openssl store; you must
|
||||
# put PEM objects (certificates, CRLs...) with .pem extension and run
|
||||
# `c_rehash .' in it
|
||||
ssl_check_store = "/home/bip4ever/.bip/trustedcerts.txt";
|
||||
|
||||
# These will be the default for each connections
|
||||
default_nick = "bip4ever";
|
||||
default_user = "bip4ever";
|
||||
default_realname = "bip4ever";
|
||||
|
||||
# A user can have mutiple connections to irc networks.
|
||||
# define a connection:
|
||||
#connection {
|
||||
# used by bip only, required (for example: "oftc").
|
||||
#name = ;
|
||||
# which ircnet to connect to, required (for example: "oftc").
|
||||
#network = ;
|
||||
#log = false; # disable or enable logging and backlogging for
|
||||
# the current connection. Overrides global
|
||||
# (top-level) log parameter.
|
||||
|
||||
# You can define ssl_check_mode here, if you want a different
|
||||
# behavior than the one defined in the parent level ('user' section).
|
||||
#ssl_check_mode = "none";
|
||||
connection {
|
||||
name = "iiens"; # used by bip only
|
||||
network = "iiens"; # which ircnet to connect to
|
||||
|
||||
# If you have multiple IP addresses, you can set the one you
|
||||
# want bip to use here. This options is totally useless to people who
|
||||
# only have one IP address.
|
||||
#vhost = "";
|
||||
# want bip to use here. See manpage for more information
|
||||
#vhost = "192.168.10.6";
|
||||
|
||||
# When source_port is defined, bip will connect to the IRC
|
||||
# server from this port number. That means the IRC server will
|
||||
# see the socket coming from <your_ip>:source_port.
|
||||
#source_port = 10000;
|
||||
#source_port = "4567";
|
||||
|
||||
# These will be sent to the real server. Nick, user and realname are
|
||||
# required. Default values are defined at the parent level
|
||||
# (default_nick, default_user, default_realname).
|
||||
#nick = "othernick";
|
||||
# these will be sent to the real server
|
||||
#user = "otheruser";
|
||||
#realname = "otheruser";
|
||||
#password = "server password";
|
||||
|
||||
#You can specify this field more than once. BIP will send the text as is to the server.
|
||||
#on_connect_send = "PRIVMSG NickServ :IDENTIFY nspassword";
|
||||
|
||||
# You can connect with SASL on networks supporting it
|
||||
#sasl_username = "username";
|
||||
#sasl_password = "sikioure password";
|
||||
#sasl_mechanism = "PLAIN";
|
||||
#password = "serverpassword";
|
||||
|
||||
# Some options:
|
||||
#away_nick = "bip`away";
|
||||
# Away message to be set when no client is connected
|
||||
#no_client_away_msg = "Having life, knock again later";
|
||||
#follow_nick = false;
|
||||
#ignore_first_nick = false;
|
||||
|
||||
#autojoin_on_kick = true;
|
||||
#ignore_server_capab = true;
|
||||
#follow_nick = true;
|
||||
#ignore_first_nick = true;
|
||||
#on_connect_send = "PRIVMSG NickServ :IDENTIFY nspassword";
|
||||
|
||||
# Autojoined channels:
|
||||
#channel { name = "#bip"; }; # name is required.
|
||||
|
||||
channel { name = "#bip"; };
|
||||
# Password protected channel
|
||||
#channel {
|
||||
# name = "#elite_UnDeRgR0uNd";
|
||||
# key = "sikiour";
|
||||
#};
|
||||
channel {
|
||||
name = "#elite_UnDeRgR0uNd";
|
||||
key = "sikour";
|
||||
};
|
||||
};
|
||||
|
||||
#another channel
|
||||
#channel {
|
||||
# name = "#huge(28)_activity";
|
||||
# disable backlogging of this channel.
|
||||
# backlog = false;
|
||||
#};
|
||||
#};
|
||||
|
||||
# another connection (optional)
|
||||
#connection {
|
||||
#name = "iiens"; # used by bip only
|
||||
#network = "iiens"; # which ircnet to connect to
|
||||
# another connection (optionnal)
|
||||
connection {
|
||||
name = "oftc"; # used by bip only
|
||||
network = "oftc"; # which ircnet to connect to
|
||||
|
||||
# Some options:
|
||||
#away_nick = "bip`away";
|
||||
#follow_nick = true;
|
||||
#ignore_first_nick = true;
|
||||
#on_connect_send = "PRIVMSG NickServ :IDENTIFY nspassword";
|
||||
|
||||
# Autojoined channels:
|
||||
#channel { name = "#bip"; };
|
||||
#};
|
||||
#};
|
||||
channel { name = "#bip"; };
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
" Vim syntax file
|
||||
" Language: Bip configuration file
|
||||
" Copyright: Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
|
||||
" Copyright: Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
|
||||
" License: This file is part of the bip project. See the file 'COPYING' for
|
||||
" the exact licensing terms.
|
||||
"
|
||||
|
@ -52,20 +52,20 @@ syn region bipMain start=/\%^/ end=/\%$/
|
|||
\ contains=bipKeyword,bipNetwork,bipUser,bipComment,bipEndError
|
||||
|
||||
" Top level elements
|
||||
syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl
|
||||
\ log log_system write_oidentd
|
||||
syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl
|
||||
\ no_backlog always_backlog bl_msg_only blreset_on_talk
|
||||
\ backlog_no_timestamp backlog
|
||||
syn keyword bipKeyword contained nextgroup=bipStringV log_root
|
||||
\ log_format oidentd_file pid_file client_side_ssl_pem client_side_ciphers
|
||||
\ client_side_dh_param ssl_default_ciphers
|
||||
\ log_format pid_file
|
||||
syn keyword bipKeyword contained nextgroup=bipNumericV port log_level
|
||||
\ log_sync_interval reconn_timer
|
||||
\ backlog_lines log_sync_interval
|
||||
syn keyword bipKeyword contained nextgroup=bipIPV ip
|
||||
|
||||
" Network block (level 1)
|
||||
syn region bipNetwork contained matchgroup=Macro
|
||||
\ start=/network\s*{\s*/ end=/};/
|
||||
\ contains=bipNKeyword,bipServer,bipComment,bipEndError,bipWhite
|
||||
syn keyword bipNKeyword contained nextgroup=bipStringV name ciphers
|
||||
syn keyword bipNKeyword contained nextgroup=bipStringV name
|
||||
syn keyword bipNKeyword contained nextgroup=bipBoolV ssl
|
||||
|
||||
" User block (level 1)
|
||||
|
@ -74,33 +74,25 @@ syn region bipUser contained matchgroup=Macro start=/user\s*{\s*/
|
|||
\ contains=bipUKeyword,bipConnection,bipComment,bipEndError,bipWhite
|
||||
syn keyword bipUKeyword contained nextgroup=bipStringV password name
|
||||
\ default_nick default_user default_realname ssl_check_store
|
||||
\ ssl_check_mode ssl_client_certfile backlog_timestamp
|
||||
syn keyword bipUKeyword contained nextgroup=bipNumericV backlog_lines
|
||||
syn keyword bipUKeyword contained nextgroup=bipBoolV admin
|
||||
\ backlog backlog_reset_on_talk
|
||||
\ backlog_msg_only backlog_always bip_use_notice
|
||||
\ backlog_reset_connection
|
||||
" DEPRECATED \ always_backlog bl_msg_only blreset_on_talk
|
||||
" DEPRECATED \ backlog_no_timestamp
|
||||
\ ssl_check_mode
|
||||
|
||||
" Connection block (level 2)
|
||||
syn region bipConnection contained matchgroup=Macro
|
||||
\ start=/connection\s*{\s*/ end=/};/
|
||||
\ contains=bipCoKeyword,bipChannel,bipComment,bipEndError,bipWhite
|
||||
syn keyword bipCoKeyword contained nextgroup=bipBoolV autojoin_on_kick
|
||||
\ follow_nick ignore_first_nick log ignore_server_capab
|
||||
syn keyword bipCoKeyword contained nextgroup=bipBoolV ssl follow_nick
|
||||
\ ignore_first_nick
|
||||
syn keyword bipCoKeyword contained nextgroup=bipStringV name user nick
|
||||
\ network password vhost away_nick on_connect_send realname
|
||||
\ no_client_away_msg ssl_check_mode sasl_username sasl_password
|
||||
\ sasl_mechanism
|
||||
\ no_client_away_msg
|
||||
syn keyword bipCoKeyword contained nextgroup=bipNumericV source_port
|
||||
no_client_away_msg
|
||||
|
||||
" Channel elements (lvl 2)
|
||||
syn region bipChannel contained matchgroup=Macro
|
||||
\ start=/channel\s*{\s*/ end=/};/
|
||||
\ contains=bipCKeyword,bipComment,bipEndError,bipWhite
|
||||
syn keyword bipCKeyword contained nextgroup=bipStringV name key
|
||||
syn keyword bipCKeyword contained nextgroup=bipBoolV backlog
|
||||
|
||||
" Server elements (lvl 2)
|
||||
syn region bipServer contained matchgroup=Macro
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -d src ] || [ ! -f NEWS ] ; then
|
||||
echo "Please run me in bip sources root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release_version="$1"
|
||||
release_name="$2"
|
||||
: ${MAKEOPTS:=-j -l4}
|
||||
|
||||
set_version() {
|
||||
local release_version
|
||||
release_version="${1}"
|
||||
sed -i -e '/^AC_INIT/s/\(,\[\)[^]]*/\1'${release_version}'/' configure.ac
|
||||
}
|
||||
|
||||
get_version() {
|
||||
grep -e '^AC_INIT' configure.ac | cut -d [ -f 3 | cut -d ] -f 1
|
||||
}
|
||||
|
||||
make_distcheck() {
|
||||
# prepare sources
|
||||
autoreconf -i -Wall
|
||||
# Create makefile, use all possible options
|
||||
./configure
|
||||
# run distcheck
|
||||
if ! make ${MAKEOPTS} distcheck; then
|
||||
echo "'make distcheck' fails, please try again." >&2
|
||||
return 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
}
|
||||
|
||||
git log > ChangeLog
|
||||
if [ -n "$release_version" ]; then
|
||||
# Don't forget to update NEWS file before a release
|
||||
expected="$(date --rfc-3339=date) (${release_version})"
|
||||
if [ -n "${release_name}" ]; then
|
||||
expected="${expected} \"${release_name}\""
|
||||
fi
|
||||
head -n 1 NEWS | grep -q "^${expected}$" || (echo "NEWS file doesn't match the expected format (${expected})" && exit 1)
|
||||
|
||||
set_version "${release_version}"
|
||||
make_distcheck || exit 1
|
||||
|
||||
git commit -a --gpg-sign -m "Update version and ChangeLog for bip-${release_version} release."
|
||||
TAG_COMMENT="Release ${release_version}"
|
||||
if [ -n "${release_name}" ]; then
|
||||
TAG_COMMENT="${TAG_COMMENT} '${release_name}'"
|
||||
fi
|
||||
git tag --sign -m "${TAG_COMMENT}" release-${release_version}
|
||||
|
||||
set_version "${release_version}-git"
|
||||
git commit -a --gpg-sign -m "Add -git to version string."
|
||||
|
||||
echo "See bip-${release_version}.tar.gz"
|
||||
else
|
||||
make_distcheck || exit 1
|
||||
|
||||
tarname=bip-$(get_version)
|
||||
prefix=bip-$(date +%Y%m%d)
|
||||
|
||||
rm -rf "${tarname}" "${prefix}"
|
||||
tar -xzf "${tarname}".tar.gz
|
||||
rm -rf "${tarname}".tar.gz
|
||||
|
||||
mv "${tarname}" "${prefix}"
|
||||
tar -czf "${prefix}".tar.gz "${prefix}"
|
||||
rm -rf "${prefix}"
|
||||
|
||||
# Revert the ChangeLog.
|
||||
git checkout HEAD -- ChangeLog
|
||||
|
||||
echo "See ${prefix}.tar.gz"
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
git clean -d -i -e "bip-*.tar.gz"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env perl
|
||||
#
|
||||
# This file is part of the bip project
|
||||
# Copyright (C) 2004 2007 Arnaud Cornet and Loïc Gomez
|
||||
# Copyright (C) 2004 2007 Arnaud Cornet and Loïc Gomez
|
||||
#
|
||||
# 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
|
||||
|
@ -14,27 +14,19 @@ use strict;
|
|||
use IO::File;
|
||||
use Data::Dumper;
|
||||
|
||||
my $bipdir = $ENV{'HOME'} . '/.bip';
|
||||
my $CFILE = $bipdir . '/bip.conf.autogen';
|
||||
my $sfile = $bipdir . '/bipgenconfig.store';
|
||||
my $certout = $bipdir . '/bip.pem.autogen';
|
||||
my $CFILE = $ENV{'HOME'} . '/.bip/bip.conf.autogen';
|
||||
my $sfile = $ENV{'HOME'} . '/.bip/bipgenconfig.store';
|
||||
my $SERIALIZE_DBG = 1;
|
||||
my %cf;
|
||||
my $DEBUG = 0;
|
||||
my $global_done = 0;
|
||||
my $cert_done = 0;
|
||||
my $mode = 'normal';
|
||||
# maximum level of nested blocks { { { } } }
|
||||
# maximum level of blocks { { { } } }
|
||||
my $maxlevel = 5;
|
||||
my $bipmkpw;
|
||||
my $tmpcrt = "/tmp/bip-cert.cnf";
|
||||
|
||||
my %optcompat = (
|
||||
"bl_msg_only" => "backlog_msg_only",
|
||||
"blreset_on_talk" => "backlog_reset_on_talk",
|
||||
"always_backlog" => "backlog_always",
|
||||
);
|
||||
|
||||
my $certout = $ENV{'HOME'} . '/.bip/bip.pem.autogen';
|
||||
my %optdesc = (
|
||||
'global' => {
|
||||
'ip' => { 'type' => 's', 'adv' => 1, 'default' => '0.0.0.0',
|
||||
|
@ -46,18 +38,12 @@ my %optdesc = (
|
|||
'client_side_ssl' => { 'type' => 'b', 'adv' => 1, 'default' => 'true',
|
||||
'optional' => 1,
|
||||
'desc' => 'Do you want to enable client side SSL ?' },
|
||||
'client_side_ssl_pem' => { 'type' => 's', 'adv' => 1, 'optional' => 1,
|
||||
'default' => '',
|
||||
'desc' => 'Where is the bip.pem file (cert/key pair) ?' },
|
||||
'pid_file' => { 'type' => 's', 'adv' => 1, 'optional' => 1,
|
||||
'default' => $bipdir . '/bip.pid',
|
||||
'default' => $ENV{'HOME'} . '/.bip/bip.pid',
|
||||
'desc' => 'Where do you want the pidfile to be stored ?' },
|
||||
'log' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
||||
'optional' => 1,
|
||||
'desc' => 'Do you want to enable channel logging ?' },
|
||||
'log_system' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
||||
'optional' => 1,
|
||||
'desc' => 'Do you want to enable system logging ?' },
|
||||
'desc' => 'Do you want to enable the logging system ?' },
|
||||
'log_sync_interval' => { 'type' => 'i', 'adv' => 1,
|
||||
'optional' => 1,
|
||||
'default' => '5', 'depends' => 'log', 'depval' => 'true',
|
||||
|
@ -68,13 +54,38 @@ my %optdesc = (
|
|||
'desc' => 'Define bip\'s system logs verbosity level {less 0 - 7 tremendous}:' },
|
||||
'log_root' => { 'type' => 's', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => $bipdir . '/logs',
|
||||
'default' => $ENV{'HOME'} . '/.bip/logs',
|
||||
'depends' => 'log', 'depval' => 'true',
|
||||
'desc' => 'In which directory do you want logs to be stored ?' },
|
||||
'log_format' => { 'type' => 's', 'adv' => 1, 'default' => '%n/%Y-%m/%c.%d.log',
|
||||
'optional' => 1,
|
||||
'depends' => 'log', 'depval' => 'true',
|
||||
'desc' => 'Define the channel/private log format {see strftime, limited}:' },
|
||||
'backlog' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
||||
'optional' => 1,
|
||||
'depends' => 'log', 'depval' => 'true',
|
||||
'desc' => 'Do you want to activate backlog {play back logs} system ?' },
|
||||
'backlog_lines' => { 'type' => 'i', 'adv' => 0, 'default' => '10',
|
||||
'optional' => 1,
|
||||
'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'How much line do you want bip to play back upon client connect' .
|
||||
" {0 => replay everything since backlog's last reset} ?" },
|
||||
'backlog_no_timestamp' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Disable timestamp in backlog ?' },
|
||||
'bl_msg_only' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Only playback users messages {chan/priv}, no nick/join/... ?' },
|
||||
'always_backlog' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Always backlog {false means backlog pointers are reset after each backlog} ?' },
|
||||
'blreset_on_talk' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Reset backlog each time an attached client "talks" ?' },
|
||||
},
|
||||
|
||||
'network' => {
|
||||
|
@ -91,15 +102,9 @@ my %optdesc = (
|
|||
'name' => { 'type' => 's', 'adv' => 0, 'default' => '',
|
||||
'optional' => 0,
|
||||
'desc' => 'User\'s internal name ?' },
|
||||
'admin' => { 'type' => 'b', 'adv' => 0, 'default' => 'false',
|
||||
'optional' => 1,
|
||||
'desc' => 'Is user an admin ?' },
|
||||
'password' => { 'type' => 'p', 'adv' => 0, 'default' => '',
|
||||
'optional' => 0,
|
||||
'desc' => 'Set a password for his bip account:' },
|
||||
'bip_use_notice' => { 'type' => 'b', 'adv' => 0, 'default' => 'false',
|
||||
'optional' => 1,
|
||||
'desc' => 'Do you prefer bip to use notices instead of privmsgs ?' },
|
||||
'ssl_check_mode' => { 'type' => 's', 'adv' => 1,
|
||||
'optional' => 1, 'default' => 'none',
|
||||
'desc' => 'Type of SSL servers certificate\'s checks' },
|
||||
|
@ -115,34 +120,7 @@ my %optdesc = (
|
|||
'default_realname' => { 'type' => 's', 'adv' => 0, 'default' => '',
|
||||
'optional' => 0,
|
||||
'desc' => 'User\'s default IRC realname' },
|
||||
'backlog' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
||||
'optional' => 1,
|
||||
'depends' => 'log', 'depval' => 'true',
|
||||
'desc' => 'Do you want to activate backlog {play back logs} system ?' },
|
||||
'backlog_lines' => { 'type' => 'i', 'adv' => 0, 'default' => '0',
|
||||
'optional' => 1,
|
||||
'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'How much line do you want bip to play back upon client connect' .
|
||||
" {0 => replay everything since backlog's last reset} ?" },
|
||||
'backlog_timestamp' => { 'type' => 's', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'time', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Use time, datetime or disable prefix in backlog',
|
||||
'values' => ['none', 'time', 'datetime'] },
|
||||
'backlog_msg_only' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Only playback users messages {chan/priv}, no nick/join/... ?' },
|
||||
'backlog_always' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Always backlog {false means backlog pointers are reset after each backlog} ?' },
|
||||
'backlog_reset_on_talk' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Reset backlog each time an attached client "talks" ?' },
|
||||
'connection' => { 'type' => 'e' },
|
||||
|
||||
},
|
||||
|
||||
'connection' => {
|
||||
|
@ -191,9 +169,6 @@ my %optdesc = (
|
|||
'on_connect_send' => { 'type' => 's', 'adv' => 0, 'default' => '',
|
||||
'optional' => 1,
|
||||
'desc' => 'Send this raw message upon connection to IRC server' },
|
||||
'ssl_check_mode' => { 'type' => 's', 'adv' => 1,
|
||||
'optional' => 1, 'default' => '',
|
||||
'desc' => 'Type of SSL servers certificate\'s checks' },
|
||||
'channel' => { 'type' => 'e' },
|
||||
},
|
||||
|
||||
|
@ -220,15 +195,20 @@ my %optorder = (
|
|||
'ip' ,
|
||||
'port' ,
|
||||
'client_side_ssl' ,
|
||||
'client_side_ssl_pem' ,
|
||||
'pid_file' ,
|
||||
undef,
|
||||
'log' ,
|
||||
'log_system' ,
|
||||
'log_sync_interval' ,
|
||||
'log_level' ,
|
||||
'log_root' ,
|
||||
'log_format' ,
|
||||
undef,
|
||||
'backlog' ,
|
||||
'backlog_lines' ,
|
||||
'backlog_no_timestamp' ,
|
||||
'bl_msg_only' ,
|
||||
'always_backlog' ,
|
||||
'blreset_on_talk' ,
|
||||
],
|
||||
|
||||
'network' => [
|
||||
|
@ -246,13 +226,6 @@ my %optorder = (
|
|||
'default_nick' ,
|
||||
'default_user' ,
|
||||
'default_realname' ,
|
||||
undef,
|
||||
'backlog' ,
|
||||
'backlog_lines' ,
|
||||
'backlog_timestamp' ,
|
||||
'backlog_msg_only' ,
|
||||
'backlog_always' ,
|
||||
'backlog_reset_on_talk' ,
|
||||
'connection' ,
|
||||
],
|
||||
|
||||
|
@ -272,7 +245,6 @@ my %optorder = (
|
|||
'away_nick' ,
|
||||
'no_client_away_msg' ,
|
||||
'on_connect_send' ,
|
||||
'ssl_check_mode' ,
|
||||
'channel' ,
|
||||
],
|
||||
|
||||
|
@ -314,10 +286,6 @@ sub askOpt {
|
|||
} else {
|
||||
$o = askval($e->{'desc'}, $sel, ($mayempty && ($opt ne 1 ||
|
||||
$e->{'type'} eq 'i' ? 1 : undef)), 1);
|
||||
if (defined $e->{'values'} && !grep(/^$o$/, @{$e->{'values'}})) {
|
||||
print("The allowed values are '@{[ join '\', \'', @{$e->{'values'}} ]}'\n");
|
||||
next;
|
||||
}
|
||||
}
|
||||
if ($o eq undef && $opt eq 0) {
|
||||
print("This value is mandatory, please enter a value\n");
|
||||
|
@ -378,31 +346,6 @@ sub askbool {
|
|||
sub askPass {
|
||||
my ($text) = @_;
|
||||
|
||||
which_bipmkpw();
|
||||
print("$text ? ");
|
||||
my $pass = `$bipmkpw`;
|
||||
chomp($pass);
|
||||
$pass =~ s/^Password:\s*\n?//si;
|
||||
chomp($pass);
|
||||
return $pass;
|
||||
}
|
||||
|
||||
sub which_bipmkpw {
|
||||
my ($which);
|
||||
|
||||
return if ($bipmkpw ne '' && -x "$bipmkpw");
|
||||
|
||||
if (-x "/usr/bin/bipmkpw") {
|
||||
$bipmkpw = '/usr/bin/bipmkpw';
|
||||
return;
|
||||
}
|
||||
|
||||
$which = `which bipmkpw`;
|
||||
if ($which ne '' && -x "$which") {
|
||||
$bipmkpw = $which;
|
||||
return;
|
||||
}
|
||||
|
||||
while (!$bipmkpw || ! -x "$bipmkpw") {
|
||||
if ($bipmkpw ne '' && (! -f $bipmkpw || ! -x $bipmkpw)) {
|
||||
print("No exec permission: $bipmkpw\n");
|
||||
|
@ -410,7 +353,12 @@ sub which_bipmkpw {
|
|||
$bipmkpw = askval("Please enter the path to bipmkpw:",
|
||||
undef, 1);
|
||||
}
|
||||
return;
|
||||
print("$text ? ");
|
||||
my $pass = `$bipmkpw`;
|
||||
chomp($pass);
|
||||
$pass =~ s/^Password:\s*\n?//si;
|
||||
chomp($pass);
|
||||
return $pass;
|
||||
}
|
||||
|
||||
sub askval {
|
||||
|
@ -459,40 +407,9 @@ sub loadConfig {
|
|||
$fh->close;
|
||||
$hr = unserialize($data) || return "Invalid format in $f";
|
||||
%cf = %{$hr};
|
||||
$cf{'networks'} = [ values %{$cf{'networks'}} ];
|
||||
$cf{'users'} = [ values %{$cf{'users'}} ];
|
||||
|
||||
sanitizeCompat(\%cf);
|
||||
foreach (@{$cf{'networks'}}) {
|
||||
$_->{'server'} = [ values %{$_->{'server'}} ];
|
||||
}
|
||||
foreach my $tcu (@{$cf{'users'}}) {
|
||||
my $backlog_no_timestamp = delete($tcu->{'backlog_no_timestamp'});
|
||||
if (defined $backlog_no_timestamp) {
|
||||
grep(/^$backlog_no_timestamp$/, ('false', 'true')) || return "Invalid value for backlog_no_timestamp: '$backlog_no_timestamp'";
|
||||
$tcu->{'backlog_timestamp'} = $backlog_no_timestamp == 'false' ? 'time' : 'none';
|
||||
}
|
||||
$tcu->{'connection'} = [ values %{$tcu->{'connection'}} ];
|
||||
foreach my $tcc (@{$tcu->{'connection'}}) {
|
||||
$tcc->{'channel'} = [ values %{$tcc->{'channel'}} ];
|
||||
}
|
||||
}
|
||||
return "Config loaded from $f";
|
||||
}
|
||||
|
||||
sub sanitizeCompat {
|
||||
my ($d) = @_;
|
||||
|
||||
foreach (keys %$d) {
|
||||
if (ref($d->{$_}) eq 'ARRAY') {
|
||||
foreach my $d2 (@{$d->{$_}}) {
|
||||
sanitizeCompat($d2);
|
||||
}
|
||||
}
|
||||
$d->{$optcompat{$_}} = $d->{$_} if (defined $optcompat{$_});
|
||||
}
|
||||
}
|
||||
|
||||
sub resetConfig {
|
||||
my $r = askbool("Do you want to reset current loaded configuration options, networks, users... ?", 'false');
|
||||
$r eq 'false' && return "Reset config aborted";
|
||||
|
@ -584,7 +501,7 @@ authorityKeyIdentifier=keyid:always";
|
|||
# print "Existing $certout found, renamed to $certout.$ts\n";
|
||||
# }
|
||||
|
||||
`openssl req -new -newkey rsa:4096 -x509 -days 365 -nodes -config "$tmpcrt" -out "$certout" -keyout "$certout"`;
|
||||
`openssl req -new -x509 -days 365 -nodes -config "$tmpcrt" -out "$certout" -keyout "$certout"`;
|
||||
# TODO check command status
|
||||
`openssl x509 -subject -dates -fingerprint -noout -in "$certout"`;
|
||||
# TODO check command status
|
||||
|
@ -613,7 +530,7 @@ sub writeConfig {
|
|||
next if ($cf{'global'}->{$k} eq undef);
|
||||
next if ($optdesc{'global'}->{$k}->{'nosave'} eq 1);
|
||||
my $t = $optdesc{'global'}->{$k}->{'type'};
|
||||
if ($t eq 's') {
|
||||
if ($t eq 's' || $t eq 'b') {
|
||||
print $fh "$k = \"" . $cf{'global'}->{$k} . "\";\n";
|
||||
} else {
|
||||
print $fh "$k = " . $cf{'global'}->{$k} . ";\n";
|
||||
|
@ -665,12 +582,11 @@ sub printBlock {
|
|||
fatal("Too much recursion levels ($level)") if ($level ge $maxlevel);
|
||||
|
||||
$out .= $prefix . $name . " {\n";
|
||||
foreach my $k (@{$optorder{$name}}) {
|
||||
next if ($k eq undef);
|
||||
foreach my $k (keys(%{$e})) {
|
||||
next if ($e->{$k} eq undef);
|
||||
next if ($optdesc{$name}->{$k}->{'nosave'} eq 1);
|
||||
my $t = $optdesc{$name}->{$k}->{'type'};
|
||||
if ($t eq 's' || $t eq 'p') {
|
||||
if ($t eq 's' || $t eq 'b') {
|
||||
$out .= $prefix . "\t$k = \"" . $e->{$k} . "\";\n";
|
||||
} elsif (ref($e->{$k}) eq 'ARRAY') {
|
||||
foreach my $e2 (@{$e->{$k}}) {
|
||||
|
@ -680,7 +596,7 @@ sub printBlock {
|
|||
$out .= $prefix . "\t$k = " . $e->{$k} . ";\n";
|
||||
}
|
||||
}
|
||||
$out .= $prefix . "};\n\n";
|
||||
$out .= $prefix . "}\n\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
@ -1355,14 +1271,6 @@ sub invMode {
|
|||
return ($mode eq 'advanced' ? 'normal' : 'advanced');
|
||||
}
|
||||
|
||||
if (! -e $bipdir) {
|
||||
mkdir($bipdir) || fatal("Unable to create bip's dir `$bipdir'");
|
||||
} elsif (! -d $bipdir) {
|
||||
fatal("Bip's dir `$bipdir' already exists and is not a directory");
|
||||
} elsif (! -w $bipdir) {
|
||||
fatal("Bip's dir `$bipdir' already exists and is not writable");
|
||||
}
|
||||
|
||||
main_menu();
|
||||
#sets config backlog
|
||||
#different user/nick/real ?
|
||||
|
|
|
@ -1,39 +1,10 @@
|
|||
noinst_LIBRARIES = libbip.a libbiplex.a
|
||||
|
||||
libbiplex_a_SOURCES = \
|
||||
conf.y lex.l
|
||||
|
||||
# Not adding AM_CFLAGS here, because many debian flex releases generate code
|
||||
# that compares signed and unsigned integers. It looks like this issue is
|
||||
# fixed by flex 2.6.5 which is unreleased.
|
||||
libbiplex_a_CFLAGS = $(OPENSSL_CFLAGS)
|
||||
|
||||
libbip_a_SOURCES = \
|
||||
bip.c bip.h \
|
||||
connection.c connection.h \
|
||||
defaults.h \
|
||||
irc.c irc.h \
|
||||
line.c line.h \
|
||||
log.c log.h \
|
||||
md5.c md5.h \
|
||||
path_util.c path_util.h \
|
||||
tuple.h \
|
||||
util.c util.h \
|
||||
utils/base64.c utils/base64.h
|
||||
|
||||
libbip_a_CFLAGS = ${OPENSSL_CFLAGS} $(AM_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = bip bipmkpw
|
||||
|
||||
bip_SOURCES = bip_main.c
|
||||
bip_CFLAGS = ${OPENSSL_CFLAGS} $(AM_CFLAGS)
|
||||
bip_LDADD = libbip.a libbiplex.a ${OPENSSL_LIBS}
|
||||
|
||||
bip_SOURCES = conf.y lex.l bip.c connection.c irc.c line.c log.c md5.c util.c
|
||||
bipmkpw_SOURCES = bipmkpw.c md5.c util.c
|
||||
bipmkpw_CFLAGS = ${OPENSSL_CFLAGS} $(AM_CFLAGS)
|
||||
bipmkpw_LDADD = libbip.a libbiplex.a $(OPENSSL_LIBS)
|
||||
|
||||
AM_YFLAGS= -d
|
||||
BUILT_SOURCES = conf.c conf.h lex.c
|
||||
|
||||
AM_CFLAGS=-Wall -Wextra -Werror -Wundef -Wpedantic
|
||||
if DEBUG
|
||||
AM_CFLAGS+=-Wall -g
|
||||
AM_LDFLAGS+=-g
|
||||
else
|
||||
AM_CFLAGS+=-Wall
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,467 @@
|
|||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006 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@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
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 = :
|
||||
bin_PROGRAMS = bip$(EXEEXT) bipmkpw$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in conf.c conf.h lex.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_bip_OBJECTS = conf.$(OBJEXT) lex.$(OBJEXT) bip.$(OBJEXT) \
|
||||
connection.$(OBJEXT) irc.$(OBJEXT) line.$(OBJEXT) \
|
||||
log.$(OBJEXT) md5.$(OBJEXT) util.$(OBJEXT)
|
||||
bip_OBJECTS = $(am_bip_OBJECTS)
|
||||
bip_LDADD = $(LDADD)
|
||||
am_bipmkpw_OBJECTS = bipmkpw.$(OBJEXT) md5.$(OBJEXT) util.$(OBJEXT)
|
||||
bipmkpw_OBJECTS = $(am_bipmkpw_OBJECTS)
|
||||
bipmkpw_LDADD = $(LDADD)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
|
||||
YLWRAP = $(top_srcdir)/ylwrap
|
||||
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
|
||||
SOURCES = $(bip_SOURCES) $(bipmkpw_SOURCES)
|
||||
DIST_SOURCES = $(bip_SOURCES) $(bipmkpw_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LEX = @LEX@
|
||||
LEXLIB = @LEXLIB@
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
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@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
YFLAGS = @YFLAGS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
bip_SOURCES = conf.y lex.l bip.c connection.c irc.c line.c log.c md5.c util.c
|
||||
bipmkpw_SOURCES = bipmkpw.c md5.c util.c
|
||||
AM_YFLAGS = -d
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .l .o .obj .y
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
; then \
|
||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(bindir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
conf.h: conf.c
|
||||
@if test ! -f $@; then \
|
||||
rm -f conf.c; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) conf.c; \
|
||||
else :; fi
|
||||
bip$(EXEEXT): $(bip_OBJECTS) $(bip_DEPENDENCIES)
|
||||
@rm -f bip$(EXEEXT)
|
||||
$(LINK) $(bip_OBJECTS) $(bip_LDADD) $(LIBS)
|
||||
bipmkpw$(EXEEXT): $(bipmkpw_OBJECTS) $(bipmkpw_DEPENDENCIES)
|
||||
@rm -f bipmkpw$(EXEEXT)
|
||||
$(LINK) $(bipmkpw_OBJECTS) $(bipmkpw_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bip.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bipmkpw.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connection.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lex.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.l.c:
|
||||
$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
|
||||
|
||||
.y.c:
|
||||
$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
|
||||
|
||||
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
|
||||
|
||||
TAGS: $(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; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(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
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
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 $(PROGRAMS) config.h
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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."
|
||||
-rm -f conf.c
|
||||
-rm -f conf.h
|
||||
-rm -f lex.c
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic ctags distclean distclean-compile \
|
||||
distclean-generic distclean-hdr distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-binPROGRAMS install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-binPROGRAMS
|
||||
|
||||
@DEBUG_TRUE@ AM_CFLAGS+=-Wall -g
|
||||
@DEBUG_TRUE@ AM_LDFLAGS+=-g
|
||||
@DEBUG_FALSE@ AM_CFLAGS+=-Wall
|
||||
# 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:
|
54
src/bip.h
54
src/bip.h
|
@ -2,7 +2,7 @@
|
|||
* $Id: bip.h,v 1.6 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -14,12 +14,60 @@
|
|||
#ifndef BIP_H
|
||||
#define BIP_H
|
||||
|
||||
struct c_network
|
||||
{
|
||||
char *name;
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl;
|
||||
#endif
|
||||
list_t serverl;
|
||||
};
|
||||
|
||||
struct c_user
|
||||
{
|
||||
char *name;
|
||||
unsigned char *password;
|
||||
unsigned int seed;
|
||||
char *default_user;
|
||||
char *default_nick;
|
||||
char *default_realname;
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl_check_mode;
|
||||
char *ssl_check_store;
|
||||
#endif
|
||||
list_t connectionl;
|
||||
};
|
||||
|
||||
struct c_connection
|
||||
{
|
||||
char *name;
|
||||
struct c_network *network;
|
||||
char *realname, *user, *nick;
|
||||
char *password; /* server pass */
|
||||
char *vhost;
|
||||
unsigned short source_port;
|
||||
list_t channell;
|
||||
|
||||
int follow_nick;
|
||||
int ignore_first_nick;
|
||||
char *away_nick;
|
||||
list_t on_connect_send;
|
||||
char *no_client_away_msg;
|
||||
|
||||
struct client *client;
|
||||
};
|
||||
|
||||
struct c_channel
|
||||
{
|
||||
char *name;
|
||||
char *key;
|
||||
};
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
int adm_trust(struct link_client *ic, struct line *line);
|
||||
#endif
|
||||
int adm_bip(bip_t *bip, struct link_client *ic, struct line *line, int privmsg);
|
||||
int adm_bip(struct link_client *ic, struct line *line, unsigned int privmsg);
|
||||
int ssl_check_trust(struct link_client *ic);
|
||||
void adm_blreset(struct link_client *ic);
|
||||
void bip_notify(struct link_client *ic, char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
|
363
src/bip_main.c
363
src/bip_main.c
|
@ -1,363 +0,0 @@
|
|||
/*
|
||||
* $Id: bip.c,v 1.39 2005/04/21 06:58:50 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See the file "COPYING" for the exact licensing terms.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "irc.h"
|
||||
#include "conf.h"
|
||||
#include "path_util.h"
|
||||
#include "tuple.h"
|
||||
#include "log.h"
|
||||
#include "bip.h"
|
||||
#include "line.h"
|
||||
#include "defaults.h"
|
||||
|
||||
#define S_CONF "bip.conf"
|
||||
#define OIDENTD_FILENAME ".oidentd.conf"
|
||||
|
||||
extern int sighup;
|
||||
extern char *conf_log_root;
|
||||
extern char *conf_log_format;
|
||||
extern int conf_log_level;
|
||||
extern char *conf_ip;
|
||||
extern unsigned short conf_port;
|
||||
extern int conf_css;
|
||||
#ifdef HAVE_LIBSSL
|
||||
extern char *conf_ssl_certfile;
|
||||
extern char *conf_client_ciphers;
|
||||
extern char *conf_client_dh_file;
|
||||
extern char *conf_server_default_ciphers;
|
||||
#endif
|
||||
extern int conf_daemonize;
|
||||
extern char *conf_pid_file;
|
||||
extern char *conf_biphome;
|
||||
extern int conf_reconn_timer;
|
||||
|
||||
/* log options, for sure the trickiest :) */
|
||||
extern int conf_log;
|
||||
extern int conf_log_system;
|
||||
extern int conf_log_sync_interval;
|
||||
extern bip_t *_bip;
|
||||
extern FILE *conf_global_log_file;
|
||||
|
||||
void reload_config(int i);
|
||||
void bad_quit(int i);
|
||||
void check_rlimits(void);
|
||||
void rlimit_cpu_reached(int i);
|
||||
void rlimit_bigfile_reached(int i);
|
||||
void conf_die(bip_t *bip, char *fmt, ...);
|
||||
int fireup(bip_t *bip, FILE *conf);
|
||||
int check_ssl_files(int failmode);
|
||||
int do_pid_stuff(void);
|
||||
|
||||
static void usage(char *name)
|
||||
{
|
||||
printf("Usage: %s [-f config_file] [-h] [-n]\n"
|
||||
" -f config_file: Use config_file as the configuration file\n"
|
||||
" If no config file is given %s will try to open ~/.bip/" S_CONF
|
||||
"\n"
|
||||
" -n: Don't daemonize, log in stderr\n"
|
||||
" -s: Bip HOME, default parent directory for client certificate,\n"
|
||||
" configuration, logs, pid, oidentd\n"
|
||||
" -v: Print version and exit\n"
|
||||
" -h: This help\n",
|
||||
name, name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void version(void)
|
||||
{
|
||||
printf("Bip IRC Proxy - " PACKAGE_VERSION
|
||||
"\n"
|
||||
"Copyright © Arnaud Cornet and Loïc Gomez (2004 - 2008)\n"
|
||||
"Distributed under the GNU General Public License Version 2\n");
|
||||
}
|
||||
|
||||
static void log_file_setup(void)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
if (conf_log_system && conf_daemonize) {
|
||||
if (conf_global_log_file && conf_global_log_file != stderr)
|
||||
fclose(conf_global_log_file);
|
||||
snprintf(buf, (size_t)4095, "%s/bip.log", conf_log_root);
|
||||
FILE *f = fopen(buf, "a");
|
||||
if (!f)
|
||||
fatal("Can't open %s: %s", buf, strerror(errno));
|
||||
conf_global_log_file = f;
|
||||
} else {
|
||||
conf_global_log_file = stderr;
|
||||
}
|
||||
}
|
||||
|
||||
static pid_t daemonize(void)
|
||||
{
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
fatal("Fork failed");
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
if (setsid() < 0)
|
||||
fatal("setsid() failed");
|
||||
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
fatal("Fork failed");
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
/* This better be the very last action since fatal makes use of
|
||||
* conf_global_log_file */
|
||||
return getpid();
|
||||
}
|
||||
|
||||
int check_ssl_files(int failmode)
|
||||
{
|
||||
int e;
|
||||
struct stat fs;
|
||||
|
||||
if (!conf_ssl_certfile) {
|
||||
conf_ssl_certfile = default_path(
|
||||
conf_biphome, "bip.pem", "SSL certificate");
|
||||
}
|
||||
|
||||
if (failmode == HARD_FAIL)
|
||||
assert_path_exists(conf_ssl_certfile);
|
||||
else if (!check_path_exists(conf_ssl_certfile))
|
||||
return 0;
|
||||
|
||||
e = stat(conf_ssl_certfile, &fs);
|
||||
if (e)
|
||||
mylog(LOG_WARN,
|
||||
"Unable to check PEM file, stat(%s): %s",
|
||||
conf_ssl_certfile, strerror(errno));
|
||||
else if ((fs.st_mode & S_IROTH) | (fs.st_mode & S_IWOTH))
|
||||
mylog(LOG_ERROR,
|
||||
"PEM file %s should not be world "
|
||||
"readable / writable. Please fix the modes.",
|
||||
conf_ssl_certfile);
|
||||
|
||||
if (conf_client_dh_file) {
|
||||
if (failmode == HARD_FAIL) {
|
||||
assert_path_exists(conf_client_dh_file);
|
||||
} else if (!check_path_exists(conf_client_dh_file)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* all is well */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *conf = NULL;
|
||||
char *confpath = NULL;
|
||||
int ch;
|
||||
int r, fd;
|
||||
char buf[30];
|
||||
bip_t bip;
|
||||
|
||||
bip_init(&bip);
|
||||
_bip = &bip;
|
||||
|
||||
conf_ip = bip_strdup("0.0.0.0");
|
||||
conf_port = 7778;
|
||||
conf_css = 0;
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGHUP, reload_config);
|
||||
signal(SIGINT, bad_quit);
|
||||
signal(SIGQUIT, bad_quit);
|
||||
signal(SIGTERM, bad_quit);
|
||||
signal(SIGXFSZ, rlimit_bigfile_reached);
|
||||
signal(SIGXCPU, rlimit_cpu_reached);
|
||||
|
||||
conf_log_root = NULL;
|
||||
conf_log_format = bip_strdup(DEFAULT_LOG_FORMAT);
|
||||
conf_log_level = DEFAULT_LOG_LEVEL;
|
||||
conf_reconn_timer = DEFAULT_RECONN_TIMER;
|
||||
conf_daemonize = 1;
|
||||
conf_global_log_file = stderr;
|
||||
conf_pid_file = NULL;
|
||||
#ifdef HAVE_LIBSSL
|
||||
conf_ssl_certfile = NULL;
|
||||
conf_client_ciphers = NULL;
|
||||
conf_server_default_ciphers = NULL;
|
||||
conf_client_dh_file = NULL;
|
||||
#endif
|
||||
|
||||
while ((ch = getopt(argc, argv, "hvnf:s:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
confpath = bip_strdup(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
conf_daemonize = 0;
|
||||
break;
|
||||
case 's':
|
||||
conf_biphome = bip_strdup(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
version();
|
||||
usage(argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
umask(0027);
|
||||
|
||||
check_rlimits();
|
||||
|
||||
char *home = NULL; /* oidentd path searching ignores conf_biphome */
|
||||
home = getenv("HOME");
|
||||
if (!home && !conf_biphome) {
|
||||
conf_die(&bip,
|
||||
"no value for environment variable $HOME,"
|
||||
"use '-s' parameter");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!conf_biphome) {
|
||||
conf_biphome = bip_malloc(strlen(home) + strlen("/.bip") + 1);
|
||||
strcpy(conf_biphome, home);
|
||||
strcat(conf_biphome, "/.bip");
|
||||
}
|
||||
|
||||
if (!bip.oidentdpath) {
|
||||
bip.oidentdpath = bip_malloc(strlen(conf_biphome) + 1
|
||||
+ strlen(OIDENTD_FILENAME) + 1);
|
||||
strcpy(bip.oidentdpath, conf_biphome);
|
||||
strcat(bip.oidentdpath, "/");
|
||||
strcat(bip.oidentdpath, OIDENTD_FILENAME);
|
||||
}
|
||||
|
||||
if (!confpath) {
|
||||
confpath = bip_malloc(strlen(conf_biphome) + 1 + strlen(S_CONF)
|
||||
+ 1);
|
||||
strcpy(confpath, conf_biphome);
|
||||
strcat(confpath, "/");
|
||||
strcat(confpath, S_CONF);
|
||||
}
|
||||
conf = fopen(confpath, "r");
|
||||
if (!conf)
|
||||
fatal("config file not found (%s)", confpath);
|
||||
|
||||
r = fireup(&bip, conf);
|
||||
fclose(conf);
|
||||
if (!r)
|
||||
fatal("Not starting: error in config file.");
|
||||
|
||||
if (!conf_log_root) {
|
||||
char *ap = "/logs";
|
||||
conf_log_root =
|
||||
bip_malloc(strlen(conf_biphome) + strlen(ap) + 1);
|
||||
strcpy(conf_log_root, conf_biphome);
|
||||
strcat(conf_log_root, ap);
|
||||
mylog(LOG_INFO, "Default log root: %s", conf_log_root);
|
||||
}
|
||||
if (!conf_pid_file) {
|
||||
char *pid = "/bip.pid";
|
||||
conf_pid_file =
|
||||
bip_malloc(strlen(conf_biphome) + strlen(pid) + 1);
|
||||
strcpy(conf_pid_file, conf_biphome);
|
||||
strcat(conf_pid_file, pid);
|
||||
mylog(LOG_INFO, "Default pid file: %s", conf_pid_file);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
if (conf_css) {
|
||||
check_ssl_files(HARD_FAIL);
|
||||
}
|
||||
#endif
|
||||
|
||||
check_dir(conf_log_root, 1);
|
||||
fd = do_pid_stuff();
|
||||
pid_t pid = 0;
|
||||
|
||||
log_file_setup();
|
||||
if (conf_daemonize)
|
||||
pid = daemonize();
|
||||
else
|
||||
pid = getpid();
|
||||
snprintf(buf, (size_t)29, "%lu\n", (unsigned long int)pid);
|
||||
ssize_t written;
|
||||
written = write(fd, buf, strlen(buf));
|
||||
if (written <= 0)
|
||||
mylog(LOG_ERROR, "Could not write to PID file");
|
||||
close(fd);
|
||||
|
||||
bip.listener = listen_new(conf_ip, conf_port, conf_css);
|
||||
if (!bip.listener || bip.listener->connected == CONN_ERROR)
|
||||
fatal("Could not create listening socket");
|
||||
|
||||
for (;;) {
|
||||
irc_main(&bip);
|
||||
|
||||
sighup = 0;
|
||||
|
||||
conf = fopen(confpath, "r");
|
||||
if (!conf)
|
||||
fatal("%s config file not found", confpath);
|
||||
fireup(&bip, conf);
|
||||
fclose(conf);
|
||||
|
||||
/* re-open to allow logfile rotate */
|
||||
log_file_setup();
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
/*
|
||||
* reload SSL context if server-side SSL is enabled and SSL files
|
||||
* seem accessible.
|
||||
*/
|
||||
if (conf_css) {
|
||||
if (check_ssl_files(SOFT_FAIL)) {
|
||||
if (set_ssl_context(SSLCTX_FORCE_UPDATE) == 1)
|
||||
mylog(LOG_DEBUG, "SSL context has been updated");
|
||||
else
|
||||
mylog(LOG_DEBUG, "SSL context has not been updated");
|
||||
} else {
|
||||
mylog(LOG_ERROR, "Unable to update SSL context, "
|
||||
"file checks failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -2,8 +2,7 @@
|
|||
* $Id$
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -23,66 +22,48 @@
|
|||
#include "util.h"
|
||||
#include "md5.h"
|
||||
|
||||
extern int conf_log_level;
|
||||
extern FILE *conf_global_log_file;
|
||||
extern int conf_log_system;
|
||||
|
||||
void bipmkpw_fatal(char *msg, char *err)
|
||||
{
|
||||
fprintf(stderr, "%s: %s\n", msg, err);
|
||||
exit(1);
|
||||
}
|
||||
int conf_log_level;
|
||||
FILE *conf_global_log_file;
|
||||
int conf_log;
|
||||
|
||||
void readpass(char *buffer, int buflen)
|
||||
{
|
||||
int ttyfd = open("/dev/tty", O_RDWR);
|
||||
if (ttyfd == -1)
|
||||
bipmkpw_fatal("Unable to open tty", strerror(errno));
|
||||
|
||||
if (ttyfd == -1) {
|
||||
fprintf(stderr, "Unable to open tty: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct termios tt, ttback;
|
||||
memset(&ttback, 0, sizeof(ttback));
|
||||
if (tcgetattr(ttyfd, &ttback) < 0)
|
||||
bipmkpw_fatal("tcgetattr failed", strerror(errno));
|
||||
|
||||
if (tcgetattr(ttyfd, &ttback) < 0) {
|
||||
printf("tcgetattr failed: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memcpy(&tt, &ttback, sizeof(ttback));
|
||||
// unsigned conversion from ‘int’ to ‘tcflag_t’ {aka ‘unsigned int’} changes
|
||||
// value from ‘-11’ to ‘4294967285’
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
tt.c_lflag &= ~(ICANON | ECHO);
|
||||
#pragma GCC diagnostic pop
|
||||
if (tcsetattr(ttyfd, TCSANOW, &tt) < 0)
|
||||
bipmkpw_fatal("tcsetattr failed", strerror(errno));
|
||||
|
||||
if (!write(ttyfd, "Password: ", (size_t)10))
|
||||
bipmkpw_fatal("tty write failed", strerror(errno));
|
||||
|
||||
tt.c_lflag &= ~(ICANON|ECHO);
|
||||
if (tcsetattr(ttyfd, TCSANOW, &tt) < 0) {
|
||||
printf("tcsetattr failed: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
write(ttyfd, "Password: ", 10);
|
||||
|
||||
int idx = 0;
|
||||
int valid = 1;
|
||||
while (idx < buflen) {
|
||||
ssize_t rbytes = read(ttyfd, buffer + idx, (size_t)1);
|
||||
if (rbytes <= 0) {
|
||||
break;
|
||||
}
|
||||
read(ttyfd, buffer+idx, 1);
|
||||
if (buffer[idx] == '\n') {
|
||||
buffer[idx] = 0;
|
||||
break;
|
||||
} else if (buffer[idx] == ' ') {
|
||||
valid = 0;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (!write(ttyfd, "\n", (size_t)1))
|
||||
bipmkpw_fatal("tty write failed", strerror(errno));
|
||||
|
||||
|
||||
write(ttyfd, "\n", 1);
|
||||
|
||||
tcsetattr(ttyfd, TCSANOW, &ttback);
|
||||
close(ttyfd);
|
||||
|
||||
if (!valid) {
|
||||
fprintf(stderr, "Password cannot contain spaces.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
@ -93,21 +74,13 @@ int main(void)
|
|||
unsigned int seed;
|
||||
|
||||
readpass(str, 256);
|
||||
str[255] = 0;
|
||||
|
||||
// passing argument 1 of ‘srand’ with different width due to prototype
|
||||
// [-Werror=traditional-conversion] conversion from ‘time_t’ {aka ‘long int’} to
|
||||
// ‘unsigned int’ may change value [-Werror=conversion] We don't care.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtraditional-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
// the time used to type the pass is entropy
|
||||
srand(time(NULL));
|
||||
#pragma GCC diagnostic pop
|
||||
seed = (unsigned)rand(); // rand should be > 0
|
||||
|
||||
seed = rand();
|
||||
|
||||
md5 = chash_double(str, seed);
|
||||
for (i = 0; i < 20; i++)
|
||||
for (i = 0; i < 20; i++)
|
||||
printf("%02x", md5[i]);
|
||||
printf("\n");
|
||||
free(md5);
|
||||
|
|
141
src/conf.y
141
src/conf.y
|
@ -4,7 +4,6 @@
|
|||
*
|
||||
* This file is part of the bip proproject
|
||||
* Copyright (C) 2004 Arnaud Cornet
|
||||
* Copyright (C) 2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -20,24 +19,34 @@
|
|||
extern int yylex (void);
|
||||
extern char *yytext;
|
||||
extern int linec;
|
||||
extern int conf_error;
|
||||
#define ERRBUFSZ 80
|
||||
extern char conf_errstr[ERRBUFSZ];
|
||||
|
||||
#define YYMALLOC bip_malloc
|
||||
|
||||
extern int yyerror(char *);
|
||||
|
||||
int yywrap(void)
|
||||
int yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//int yydebug = 1;
|
||||
int yyerror()
|
||||
{
|
||||
snprintf(conf_errstr, ERRBUFSZ, "Parse error near %s, line %d\n",
|
||||
yytext, linec + 1);
|
||||
conf_errstr[ERRBUFSZ - 1] = 0;
|
||||
conf_error = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int yydebug = 1;
|
||||
|
||||
list_t *root_list;
|
||||
|
||||
struct tuple *tuple_i_new(int type, int i)
|
||||
{
|
||||
struct tuple *t;
|
||||
t = bip_malloc(sizeof(struct tuple));
|
||||
t = malloc(sizeof(struct tuple));
|
||||
if (!t)
|
||||
fatal("malloc");
|
||||
t->type = type;
|
||||
t->ndata = i;
|
||||
t->tuple_type = TUPLE_INT;
|
||||
|
@ -47,7 +56,9 @@ struct tuple *tuple_i_new(int type, int i)
|
|||
struct tuple *tuple_p_new(int type, void *p)
|
||||
{
|
||||
struct tuple *t;
|
||||
t = bip_malloc(sizeof(struct tuple));
|
||||
t = malloc(sizeof(struct tuple));
|
||||
if (!t)
|
||||
fatal("malloc");
|
||||
t->type = type;
|
||||
t->pdata = p;
|
||||
return t;
|
||||
|
@ -69,7 +80,7 @@ struct tuple *tuple_l_new(int type, void *p)
|
|||
|
||||
%}
|
||||
|
||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CIPHERS LEX_CSS_CIPHERS LEX_DEFAULT_CIPHERS LEX_DH_PARAM LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_TIMESTAMP LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_WRITE_OIDENTD LEX_OIDENTD_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER LEX_SASL_USERNAME LEX_SASL_PASSWORD LEX_SASL_MECHANISM
|
||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY
|
||||
|
||||
%union {
|
||||
int number;
|
||||
|
@ -95,43 +106,30 @@ command:
|
|||
| LEX_LOG_FORMAT LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_LOG_FORMAT,
|
||||
$3); }
|
||||
| LEX_LOG_LEVEL LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_LOG_LEVEL, $3); }
|
||||
| LEX_RECONN_TIMER LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_RECONN_TIMER, $3); }
|
||||
| LEX_IP LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_IP, $3); }
|
||||
| LEX_PORT LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_PORT, $3); }
|
||||
| LEX_CSS LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_CSS, $3); }
|
||||
| LEX_CSS_PEM LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CSS_PEM, $3); }
|
||||
| LEX_CSS_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CSS_CIPHERS, $3); }
|
||||
| LEX_DEFAULT_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_DEFAULT_CIPHERS, $3); }
|
||||
| LEX_DH_PARAM LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_DH_PARAM, $3); }
|
||||
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
||||
| LEX_LOG_SYSTEM LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG_SYSTEM, $3); }
|
||||
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
||||
LEX_LOG_SYNC_INTERVAL, $3); }
|
||||
| LEX_PID_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PID_FILE, $3); }
|
||||
| LEX_WRITE_OIDENTD LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_WRITE_OIDENTD, $3); }
|
||||
| LEX_OIDENTD_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_OIDENTD_FILE, $3); }
|
||||
/* deprecated */
|
||||
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_LINES, $3);
|
||||
}
|
||||
| LEX_BACKLOG_TIMESTAMP LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_BACKLOG_TIMESTAMP, $3);
|
||||
}
|
||||
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
||||
| LEX_BACKLOG_LINES LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_BACKLOG_LINES,
|
||||
$3); }
|
||||
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3);
|
||||
}
|
||||
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
|
||||
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
|
||||
}
|
||||
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
|
||||
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG,
|
||||
$3); }
|
||||
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
|
||||
}
|
||||
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
||||
LEX_ALWAYS_BACKLOG, $3); }
|
||||
/* /deprecated */
|
||||
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
||||
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
||||
LEX_ALWAYS_BACKLOG, $3); }
|
||||
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
||||
LEX_LOG_SYNC_INTERVAL, $3); }
|
||||
| LEX_PID_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PID_FILE, $3); }
|
||||
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
|
||||
}
|
||||
| LEX_NETWORK LEX_LBRA network LEX_RBRA { $$ = tuple_l_new(LEX_NETWORK,
|
||||
$3); }
|
||||
$3); }
|
||||
| LEX_USER LEX_LBRA user LEX_RBRA { $$ = tuple_l_new(LEX_USER, $3); }
|
||||
|
||||
network:
|
||||
|
@ -141,9 +139,8 @@ network:
|
|||
net_command:
|
||||
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
|
||||
| LEX_SSL LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_SSL, $3); }
|
||||
| LEX_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CIPHERS, $3); }
|
||||
| LEX_SERVER LEX_LBRA server LEX_RBRA {
|
||||
$$ = tuple_l_new(LEX_SERVER, $3); }
|
||||
$$ = tuple_l_new(LEX_SERVER, $3); }
|
||||
|
||||
user:
|
||||
{ $$ = list_new(NULL); }
|
||||
|
@ -153,45 +150,19 @@ usr_command:
|
|||
LEX_NAME LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_NAME, $3); }
|
||||
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
|
||||
$3); }
|
||||
| LEX_ADMIN LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_ADMIN, $3); }
|
||||
| LEX_BIP_USE_NOTICE LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BIP_USE_NOTICE, $3); }
|
||||
$3); }
|
||||
| LEX_SSL_CHECK_MODE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SSL_CHECK_MODE, $3); }
|
||||
LEX_SSL_CHECK_MODE, $3); }
|
||||
| LEX_SSL_CHECK_STORE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SSL_CHECK_STORE, $3); }
|
||||
| LEX_SSL_CLIENT_CERTFILE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SSL_CLIENT_CERTFILE, $3); }
|
||||
LEX_SSL_CHECK_STORE, $3); }
|
||||
| LEX_DEFAULT_USER LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_DEFAULT_USER, $3); }
|
||||
| LEX_DEFAULT_NICK LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_DEFAULT_NICK, $3); }
|
||||
| LEX_DEFAULT_REALNAME LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_DEFAULT_REALNAME, $3); }
|
||||
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_LINES, $3);
|
||||
}
|
||||
| LEX_BACKLOG_TIMESTAMP LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_BACKLOG_TIMESTAMP, $3);
|
||||
}
|
||||
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3);
|
||||
}
|
||||
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
|
||||
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
|
||||
}
|
||||
| LEX_BLRESET_CONNECTION LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BLRESET_CONNECTION, $3);
|
||||
}
|
||||
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
|
||||
}
|
||||
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
||||
LEX_ALWAYS_BACKLOG, $3); }
|
||||
| LEX_CONNECTION LEX_LBRA connection LEX_RBRA {
|
||||
$$ = tuple_l_new(LEX_CONNECTION, $3); }
|
||||
$$ = tuple_l_new(LEX_CONNECTION, $3); }
|
||||
|
||||
connection:
|
||||
{ $$ = list_new(NULL); }
|
||||
|
@ -201,41 +172,28 @@ connection:
|
|||
con_command:
|
||||
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
|
||||
| LEX_NETWORK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NETWORK,
|
||||
$3); }
|
||||
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
||||
$3); }
|
||||
| LEX_NICK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NICK, $3); }
|
||||
| LEX_USER LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_USER, $3); }
|
||||
| LEX_REALNAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_REALNAME,
|
||||
$3); }
|
||||
$3); }
|
||||
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
|
||||
$3); }
|
||||
| LEX_SASL_USERNAME LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SASL_USERNAME, $3); }
|
||||
| LEX_SASL_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SASL_PASSWORD, $3); }
|
||||
| LEX_SASL_MECHANISM LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SASL_MECHANISM, $3); }
|
||||
$3); }
|
||||
| LEX_VHOST LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_VHOST, $3); }
|
||||
| LEX_SOURCE_PORT LEX_EQ LEX_INT {
|
||||
$$ = tuple_i_new(LEX_SOURCE_PORT, $3); }
|
||||
| LEX_AWAY_NICK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_AWAY_NICK,
|
||||
$3); }
|
||||
$3); }
|
||||
| LEX_FOLLOW_NICK LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_FOLLOW_NICK, $3); }
|
||||
| LEX_IGN_FIRST_NICK LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
||||
LEX_IGN_FIRST_NICK, $3); }
|
||||
| LEX_AUTOJOIN_ON_KICK LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_AUTOJOIN_ON_KICK, $3); }
|
||||
| LEX_IGNORE_CAPAB LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_IGNORE_CAPAB, $3); }
|
||||
| LEX_CHANNEL LEX_LBRA channel LEX_RBRA { $$ = tuple_l_new(
|
||||
LEX_CHANNEL, $3); }
|
||||
LEX_CHANNEL, $3); }
|
||||
| LEX_ON_CONNECT_SEND LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_ON_CONNECT_SEND, $3); }
|
||||
LEX_ON_CONNECT_SEND, $3); }
|
||||
| LEX_NO_CLIENT_AWAY_MSG LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_NO_CLIENT_AWAY_MSG, $3); }
|
||||
| LEX_SSL_CHECK_MODE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SSL_CHECK_MODE, $3); }
|
||||
LEX_NO_CLIENT_AWAY_MSG, $3); }
|
||||
channel:
|
||||
{ $$ = list_new(NULL); }
|
||||
| channel cha_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
|
||||
|
@ -243,7 +201,6 @@ channel:
|
|||
cha_command:
|
||||
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
|
||||
| LEX_KEY LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_KEY, $3); }
|
||||
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
|
||||
|
||||
server:
|
||||
{ $$ = list_new(NULL); }
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/* src/config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define to 1 if you have the `ssl' library (-lssl). */
|
||||
#undef HAVE_LIBSSL
|
||||
|
||||
/* Enable oidentd.conf management support */
|
||||
#undef HAVE_OIDENTD
|
||||
|
||||
/* 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
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
|
||||
`char[]'. */
|
||||
#undef YYTEXT_POINTER
|
1164
src/connection.c
1164
src/connection.c
File diff suppressed because it is too large
Load Diff
|
@ -2,8 +2,7 @@
|
|||
* $Id: connection.h,v 1.40 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -30,6 +29,7 @@
|
|||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509.h>
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include <openssl/bio.h>
|
||||
#endif
|
||||
|
||||
#define CONN_BUFFER_SIZE 8192
|
||||
#define CONN_BUFFER_SIZE 2048
|
||||
|
||||
#define CONN_OK 1
|
||||
#define CONN_TIMEOUT 2
|
||||
|
@ -60,9 +60,6 @@
|
|||
#define SSL_CHECK_NONE (0)
|
||||
#define SSL_CHECK_BASIC (1)
|
||||
#define SSL_CHECK_CA (2)
|
||||
|
||||
#define SSLCTX_NO_REPLACE 0
|
||||
#define SSLCTX_FORCE_UPDATE 1
|
||||
#endif
|
||||
|
||||
struct connecting_data;
|
||||
|
@ -78,47 +75,39 @@ typedef struct connection {
|
|||
time_t connect_time;
|
||||
time_t timeout;
|
||||
char *incoming;
|
||||
size_t incoming_end;
|
||||
unsigned incoming_end;
|
||||
list_t *outgoing;
|
||||
char *partial;
|
||||
list_t *incoming_lines;
|
||||
void *user_data;
|
||||
list_t *ip_list;
|
||||
struct connecting_data *connecting_data;
|
||||
#ifdef HAVE_LIBSSL
|
||||
SSL_CTX *ssl_ctx_h;
|
||||
SSL *ssl_h;
|
||||
int ssl_check_mode;
|
||||
char *ssl_check_store;
|
||||
X509 *cert;
|
||||
#endif
|
||||
char *localip, *remoteip;
|
||||
uint16_t localport, remoteport;
|
||||
} connection_t;
|
||||
|
||||
connection_t *connection_new(char *dsthostname, int dstport, char *srchostname,
|
||||
int srcport, int ssl, char *ssl_ciphers,
|
||||
int ssl_check_mode, char *ssl_check_store,
|
||||
char *ssl_client_certfile, time_t timeout);
|
||||
int srcport, int ssl, int ssl_check_mode,
|
||||
char *ssl_check_store,int timeout);
|
||||
connection_t *listen_new(char *hostname, int port, int ssl);
|
||||
connection_t *accept_new(connection_t *cn);
|
||||
void connection_free(connection_t *cn);
|
||||
void connection_close(connection_t *cn);
|
||||
|
||||
void write_line(connection_t *cn, char *line);
|
||||
void write_lines(connection_t *cn, list_t *lines);
|
||||
void write_line_fast(connection_t *cn, char *line);
|
||||
list_t *read_lines(connection_t *cn, int *error);
|
||||
list_t *wait_event(list_t *cn_list, time_t *msec, int *nc);
|
||||
list_t *wait_event(list_t *cn_list, int *msec, int *nc);
|
||||
|
||||
int cn_is_connected(connection_t *cn);
|
||||
int cn_is_listening(connection_t *cn);
|
||||
|
||||
uint16_t connection_localport(connection_t *cn);
|
||||
uint16_t connection_remoteport(connection_t *cn);
|
||||
int connection_localport(connection_t *cn);
|
||||
int connection_remoteport(connection_t *cn);
|
||||
char *connection_localip(connection_t *cn);
|
||||
char *connection_remoteip(connection_t *cn);
|
||||
#ifdef HAVE_LIBSSL
|
||||
/* Set SSL context, force update if already set and force is 1
|
||||
* Return 1 if SSL context has been set */
|
||||
int set_ssl_context(int force);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* $Id: irc.h,v 1.43 2005/04/21 06:58:50 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See the file "COPYING" for the exact licensing terms.
|
||||
*/
|
||||
|
||||
#ifndef DEFAULTS_H
|
||||
#define DEFAULTS_H
|
||||
|
||||
#include "irc.h"
|
||||
|
||||
#define DEFAULT_BACKLOG 1
|
||||
#define DEFAULT_ALWAYS_BACKLOG 0
|
||||
#define DEFAULT_BL_MSG_ONLY 0
|
||||
#define DEFAULT_BACKLOG_LINES 0
|
||||
#define DEFAULT_BACKLOG_TIMESTAMP BLTSTime
|
||||
#define DEFAULT_BLRESET_ON_TALK 0
|
||||
#define DEFAULT_BLRESET_CONNECTION 0
|
||||
#define DEFAULT_LOG 1
|
||||
#define DEFAULT_LOG_SYSTEM 1
|
||||
#define DEFAULT_LOG_SYNC_INTERVAL 5
|
||||
#define DEFAULT_LOG_LEVEL LOG_INFO
|
||||
#define DEFAULT_LOG_FORMAT "%u/%n/%Y-%m/%c.%d.log"
|
||||
#define DEFAULT_BIP_USE_NOTICE 0
|
||||
#define DEFAULT_RECONN_TIMER 30
|
||||
|
||||
#endif /* DEFAULTS_H */
|
173
src/irc.h
173
src/irc.h
|
@ -2,8 +2,7 @@
|
|||
* $Id: irc.h,v 1.43 2005/04/21 06:58:50 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -16,7 +15,7 @@
|
|||
#define IRC_H
|
||||
#include "connection.h"
|
||||
#include "line.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
#define ERR_PROTOCOL (-1)
|
||||
#define ERR_AUTH (-2)
|
||||
|
@ -26,16 +25,24 @@
|
|||
#define OK_COPY_CLI (4)
|
||||
#define OK_COPY_WHO (5)
|
||||
|
||||
#define P_SERV "b.i.p"
|
||||
#define P_SERV "bip.bip.bip"
|
||||
#define S_PING "BIPPING"
|
||||
#define P_IRCMASK "-bip!bip@" P_SERV
|
||||
#define P_IRCMASK "-bip!bip@bip.bip.bip"
|
||||
|
||||
struct server {
|
||||
char *host;
|
||||
unsigned short port;
|
||||
};
|
||||
|
||||
#define server_new() bip_calloc(sizeof(struct server), 1)
|
||||
#define server_new() calloc(sizeof(struct server), 1)
|
||||
|
||||
#define NICKOP 1
|
||||
#define NICKVOICED 2
|
||||
|
||||
struct nick {
|
||||
char *name;
|
||||
int ovmask;
|
||||
};
|
||||
|
||||
struct channel {
|
||||
char *name;
|
||||
|
@ -46,83 +53,29 @@ struct channel {
|
|||
char type;
|
||||
char *creator;
|
||||
char *create_ts;
|
||||
hash_t ovmasks;
|
||||
hash_t nicks;
|
||||
int running_names;
|
||||
};
|
||||
|
||||
#define IRC_TYPE_CLIENT (0)
|
||||
#define IRC_TYPE_SERVER (1)
|
||||
#define IRC_TYPE_LOGGING_CLIENT (2)
|
||||
#define IRC_TYPE_LOGING_CLIENT (2)
|
||||
#define IRC_TYPE_TRUST_CLIENT (3)
|
||||
|
||||
enum BLTimestamp {
|
||||
BLTSNone = 0,
|
||||
BLTSTime,
|
||||
BLTSDateTime,
|
||||
};
|
||||
|
||||
struct bipuser {
|
||||
/** client connection static data **/
|
||||
|
||||
char *name;
|
||||
unsigned char *password;
|
||||
unsigned int seed;
|
||||
int admin;
|
||||
int bip_use_notice;
|
||||
|
||||
/* common link options */
|
||||
|
||||
char *default_nick;
|
||||
char *default_username;
|
||||
char *default_realname;
|
||||
|
||||
/* backlog options */
|
||||
char backlog;
|
||||
int backlog_lines;
|
||||
char always_backlog;
|
||||
char bl_msg_only;
|
||||
char blreset_on_talk;
|
||||
char blreset_connection;
|
||||
|
||||
enum BLTimestamp backlog_timestamp;
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl_check_mode;
|
||||
char *ssl_check_store;
|
||||
char *ssl_client_certfile;
|
||||
#endif
|
||||
|
||||
hash_t connections;
|
||||
char in_use; /* for mark and sweep on reload */
|
||||
};
|
||||
|
||||
struct network {
|
||||
char *name;
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl;
|
||||
char *ciphers;
|
||||
#endif
|
||||
int serverc;
|
||||
struct server *serverv;
|
||||
};
|
||||
|
||||
#define SASL_AUTH_EXTERNAL 1
|
||||
#define SASL_AUTH_PLAIN 2
|
||||
|
||||
struct link {
|
||||
char *name; /* id */
|
||||
char *name; /* id */
|
||||
|
||||
/** link live data **/
|
||||
struct link_server *l_server;
|
||||
unsigned int l_clientc;
|
||||
int l_clientc;
|
||||
struct link_client **l_clientv;
|
||||
|
||||
struct log *log;
|
||||
|
||||
/* we honnor the /who from clients one client at a time, this is the
|
||||
/* we honnor the /who from clients one client at a time, this is the
|
||||
* client that is /who-ing. Now for bans too */
|
||||
struct link_client *who_client;
|
||||
|
||||
struct log *log;
|
||||
|
||||
/* server related live stuff */
|
||||
int s_state;
|
||||
int s_conn_attempt;
|
||||
|
@ -132,44 +85,45 @@ struct link {
|
|||
|
||||
/* connection state (reconnecting, was_connected ...) */
|
||||
int recon_timer;
|
||||
time_t last_connection_attempt;
|
||||
time_t last_connection;
|
||||
|
||||
/** link options */
|
||||
|
||||
char follow_nick;
|
||||
char ignore_first_nick;
|
||||
char autojoin_on_kick;
|
||||
char ignore_server_capab;
|
||||
int follow_nick;
|
||||
int ignore_first_nick;
|
||||
list_t on_connect_send;
|
||||
char *no_client_away_msg;
|
||||
char *away_nick;
|
||||
hash_t chan_infos; /* channels we want */
|
||||
list_t chan_infos_order; /* for order only */
|
||||
hash_t chan_infos; /* channels we want */
|
||||
list_t chan_infos_order; /* for order only */
|
||||
|
||||
struct bipuser *user;
|
||||
/** client connection static data **/
|
||||
|
||||
char *username;
|
||||
unsigned char *password;
|
||||
unsigned int seed;
|
||||
|
||||
/** server connection static data **/
|
||||
/* server list */
|
||||
struct network *network;
|
||||
int serverc;
|
||||
struct server **serverv;
|
||||
int cur_server;
|
||||
|
||||
char *username;
|
||||
char *realname;
|
||||
char *user;
|
||||
char *real_name;
|
||||
char *s_password;
|
||||
char *sasl_username;
|
||||
char *sasl_password;
|
||||
int sasl_mechanism;
|
||||
char *connect_nick;
|
||||
|
||||
/* socket creation info */
|
||||
char *vhost;
|
||||
int bind_port;
|
||||
int s_ssl;
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl_check_mode;
|
||||
STACK_OF(X509) * untrusted_certs;
|
||||
char *ssl_check_store;
|
||||
STACK_OF(X509) *untrusted_certs;
|
||||
#endif
|
||||
int in_use; /* for mark and sweep on reload */
|
||||
};
|
||||
|
||||
struct link_connection {
|
||||
|
@ -188,9 +142,9 @@ struct link_any {
|
|||
|
||||
#define IRCC_NONE (0)
|
||||
#define IRCC_NICK (1)
|
||||
#define IRCC_USER (1 << 1)
|
||||
#define IRCC_PASS (1 << 2)
|
||||
#define IRCC_READY (IRCC_NICK | IRCC_PASS | IRCC_USER)
|
||||
#define IRCC_USER (1<<1)
|
||||
#define IRCC_PASS (1<<2)
|
||||
#define IRCC_READY (IRCC_NICK|IRCC_PASS|IRCC_USER)
|
||||
|
||||
struct link_client {
|
||||
struct link_connection _link_c;
|
||||
|
@ -214,17 +168,15 @@ struct link_client {
|
|||
#define IRCS_CONNECTED (2)
|
||||
#define IRCS_WAS_CONNECTED (3)
|
||||
#define IRCS_RECONNECTING (4)
|
||||
#define IRCS_TIMER_WAIT (5)
|
||||
|
||||
struct log;
|
||||
|
||||
struct chan_info {
|
||||
char *name;
|
||||
char *key;
|
||||
int backlog;
|
||||
};
|
||||
|
||||
#define chan_info_new() bip_calloc(sizeof(struct chan_info), (size_t)1)
|
||||
#define chan_info_new() calloc(sizeof(struct chan_info), 1)
|
||||
|
||||
struct link_server {
|
||||
struct link_connection _link_c;
|
||||
|
@ -235,51 +187,22 @@ struct link_server {
|
|||
hash_t channels;
|
||||
|
||||
char *user_mode;
|
||||
size_t user_mode_len;
|
||||
int user_mode_len;
|
||||
|
||||
/* init stuff */
|
||||
unsigned lag;
|
||||
time_t laginit_ts;
|
||||
int lag;
|
||||
int laginit_ts;
|
||||
int lagtest_timeout;
|
||||
|
||||
/* chanmodes */
|
||||
array_t chanmodes;
|
||||
|
||||
/* user modes */
|
||||
char *prefixes;
|
||||
char *usermodes;
|
||||
};
|
||||
|
||||
typedef struct bip {
|
||||
connection_t *listener;
|
||||
/* all connected tcp connections */
|
||||
list_t conn_list;
|
||||
/* all links */
|
||||
list_t link_list;
|
||||
/* connecting clients */
|
||||
list_t connecting_client_list;
|
||||
|
||||
hash_t networks;
|
||||
hash_t users;
|
||||
list_t errors;
|
||||
struct link_client *reloading_client;
|
||||
char *oidentdpath;
|
||||
int write_oidentd;
|
||||
} bip_t;
|
||||
|
||||
void bip_init(bip_t *bip);
|
||||
struct link_client *irc_client_new(void);
|
||||
struct link_server *irc_server_new(struct link *link, connection_t *conn);
|
||||
void irc_server_free(struct link_server *is);
|
||||
struct client *client_new(void);
|
||||
void irc_main(bip_t *);
|
||||
struct client *client_new();
|
||||
void irc_main(connection_t *inc, list_t *clientl);
|
||||
int ischannel(char p);
|
||||
void irc_client_close(struct link_client *);
|
||||
void irc_client_free(struct link_client *);
|
||||
struct link *irc_link_new(void);
|
||||
void link_kill(bip_t *bip, struct link *);
|
||||
struct link *irc_link_new();
|
||||
void unbind_from_link(struct link_client *ic);
|
||||
char *nick_from_ircmask(const char *mask);
|
||||
void irc_cli_backlog(struct link_client *ic, int hours);
|
||||
#define BIP_FAKEMASK "!bip@bip.bip.bip"
|
||||
|
||||
#endif
|
||||
|
|
62
src/lex.l
62
src/lex.l
|
@ -1,11 +1,9 @@
|
|||
%option nounput noinput
|
||||
%{
|
||||
/*
|
||||
* $Id: lex.l,v 1.23 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip proproject
|
||||
* Copyright (C) 2004 Arnaud Cornet
|
||||
* Copyright (C) 2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -15,35 +13,32 @@
|
|||
*/
|
||||
|
||||
#include "conf.h"
|
||||
int linec;
|
||||
int linec = 0;
|
||||
#define YY_NO_UNPUT
|
||||
#include "util.h"
|
||||
extern int conf_error;
|
||||
extern list_t *root_list;
|
||||
extern int yyparse(void);
|
||||
void yyparse(void);
|
||||
void free_conf(list_t*);
|
||||
int conf_error;
|
||||
typedef struct bip bip_t;
|
||||
extern bip_t *_bip;
|
||||
|
||||
void conf_die(bip_t *, char *, ...);
|
||||
|
||||
int yyerror(char *err)
|
||||
#if 0
|
||||
/* SPANK ME WITH A SHOVEL */
|
||||
static void yyunput(int c, char *buf);
|
||||
void dummy_lex_FFS(void)
|
||||
{
|
||||
conf_die(_bip, "Parse error '%s' near '%s', line %d", err, yytext,
|
||||
linec + 1);
|
||||
conf_error = 1;
|
||||
return 1;
|
||||
yyunput(0, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
list_t *parse_conf(FILE *file, int *err)
|
||||
list_t *parse_conf(FILE *file)
|
||||
{
|
||||
conf_error = 0;
|
||||
linec = 0;
|
||||
|
||||
YY_BUFFER_STATE in = yy_create_buffer(file, YY_BUF_SIZE);
|
||||
yy_switch_to_buffer(in);
|
||||
yyparse();
|
||||
yy_delete_buffer(in);
|
||||
*err = conf_error;
|
||||
if (conf_error) {
|
||||
free_conf(root_list);
|
||||
return NULL;
|
||||
}
|
||||
return root_list;
|
||||
}
|
||||
%}
|
||||
|
@ -68,7 +63,6 @@ list_t *parse_conf(FILE *file, int *err)
|
|||
"host" { return LEX_HOST; }
|
||||
"name" { return LEX_NAME; }
|
||||
"user" { return LEX_USER; }
|
||||
"admin" { return LEX_ADMIN; }
|
||||
"connection" { return LEX_CONNECTION; }
|
||||
"nick" { return LEX_NICK; }
|
||||
"realname" { return LEX_REALNAME; }
|
||||
|
@ -81,28 +75,21 @@ list_t *parse_conf(FILE *file, int *err)
|
|||
"ssl" { return LEX_SSL; }
|
||||
"ssl_check_mode" { return LEX_SSL_CHECK_MODE; }
|
||||
"ssl_check_store" { return LEX_SSL_CHECK_STORE; }
|
||||
"ssl_client_certfile" { return LEX_SSL_CLIENT_CERTFILE; }
|
||||
"ssl_default_ciphers" { return LEX_DEFAULT_CIPHERS; }
|
||||
"ciphers" { return LEX_CIPHERS; }
|
||||
"key" { return LEX_KEY; }
|
||||
"autojoin_on_kick" { return LEX_AUTOJOIN_ON_KICK; }
|
||||
"channel" { return LEX_CHANNEL; }
|
||||
"log_level" { return LEX_LOG_LEVEL; }
|
||||
"log_root" { return LEX_LOG_ROOT; }
|
||||
"log_format" { return LEX_LOG_FORMAT; }
|
||||
"backlog_lines" { return LEX_BACKLOG_LINES; }
|
||||
"backlog_timestamp" { return LEX_BACKLOG_TIMESTAMP; }
|
||||
"backlog_no_timestamp" { return LEX_BACKLOG_NO_TIMESTAMP; }
|
||||
"backlog_no_timestamp" { return LEX_BACKLOG_NO_TIMESTAMP; }
|
||||
"backlog" { return LEX_BACKLOG; }
|
||||
"backlog_always" { return LEX_ALWAYS_BACKLOG; }
|
||||
"backlog_msg_only" { return LEX_BL_MSG_ONLY; }
|
||||
"backlog_reset_on_talk" { return LEX_BLRESET_ON_TALK; }
|
||||
"backlog_reset_connection" { return LEX_BLRESET_CONNECTION; }
|
||||
"blreset_on_talk" { return LEX_BLRESET_ON_TALK; }
|
||||
"bl_msg_only" { return LEX_BL_MSG_ONLY; }
|
||||
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
|
||||
"log" { return LEX_LOG; }
|
||||
"log_system" { return LEX_LOG_SYSTEM; }
|
||||
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }
|
||||
"follow_nick" { return LEX_FOLLOW_NICK; }
|
||||
"ignore_first_nick" { return LEX_IGN_FIRST_NICK; }
|
||||
|
@ -110,20 +97,11 @@ list_t *parse_conf(FILE *file, int *err)
|
|||
"on_connect_send" { return LEX_ON_CONNECT_SEND; }
|
||||
"no_client_away_msg" { return LEX_NO_CLIENT_AWAY_MSG; }
|
||||
"pid_file" { return LEX_PID_FILE; }
|
||||
"write_oidentd" { return LEX_WRITE_OIDENTD; }
|
||||
"oidentd_file" { return LEX_OIDENTD_FILE; }
|
||||
"bip_use_notice" { return LEX_BIP_USE_NOTICE; }
|
||||
"client_side_ssl_pem" { return LEX_CSS_PEM; }
|
||||
"client_side_ciphers" { return LEX_CSS_CIPHERS; }
|
||||
"client_side_dh_param" { return LEX_DH_PARAM; }
|
||||
"sasl_username" { return LEX_SASL_USERNAME; }
|
||||
"sasl_password" { return LEX_SASL_PASSWORD; }
|
||||
"sasl_mechanism" { return LEX_SASL_MECHANISM; }
|
||||
"ignore_server_capab" { return LEX_IGNORE_CAPAB; }
|
||||
"reconn_timer" { return LEX_RECONN_TIMER; }
|
||||
\"[^"]*\" {
|
||||
size_t len = strlen(yytext) - 2;
|
||||
yylval.string = bip_malloc(len + 1);
|
||||
yylval.string = malloc(len + 1);
|
||||
if (!yylval.string)
|
||||
fatal("malloc");
|
||||
memcpy(yylval.string, yytext + 1, len);
|
||||
yylval.string[len] = 0;
|
||||
return LEX_STRING;
|
||||
|
@ -132,6 +110,6 @@ list_t *parse_conf(FILE *file, int *err)
|
|||
"{" { return LEX_LBRA; }
|
||||
"}" { return LEX_RBRA; }
|
||||
";" { return LEX_SEMICOLON; }
|
||||
. { conf_die(_bip, "Parse error in config file line %d, unknown character '%s'", linec + 1, yytext); conf_error = 1;
|
||||
. { printf("Parse error line %d, unknown character '%s'\n", linec + 1, yytext);
|
||||
return LEX_BUNCH; }
|
||||
%%
|
||||
|
|
192
src/line.c
192
src/line.c
|
@ -2,8 +2,7 @@
|
|||
* $Id$
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -14,34 +13,33 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "line.h"
|
||||
#include "util.h"
|
||||
|
||||
char *_irc_line_to_string(struct line *l, int skip_first);
|
||||
|
||||
// TODO resolve assuming signed overflow does not occur when changing X +- C1
|
||||
// cmp C2 to X cmp C2 -+ C1
|
||||
#pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
|
||||
void irc_line_init(struct line *l)
|
||||
{
|
||||
memset(l, 0, sizeof(struct line));
|
||||
array_init(&l->words);
|
||||
}
|
||||
|
||||
void _irc_line_deinit(struct line *l)
|
||||
{
|
||||
array_deinit(&l->words);
|
||||
}
|
||||
|
||||
struct line *irc_line_new()
|
||||
{
|
||||
struct line *l;
|
||||
|
||||
l = bip_malloc(sizeof(struct line));
|
||||
l = malloc(sizeof(struct line));
|
||||
if (!l)
|
||||
fatal("malloc");
|
||||
irc_line_init(l);
|
||||
return l;
|
||||
}
|
||||
|
||||
void irc_line_clear(struct line *l)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < l->elemc; i++)
|
||||
free(l->elemv[i]);
|
||||
free(l->elemv);
|
||||
if (l->origin)
|
||||
free(l->origin);
|
||||
memset(l, 0, sizeof(struct line));
|
||||
}
|
||||
|
||||
void irc_line_write(struct line *l, connection_t *c)
|
||||
{
|
||||
char *bytes = irc_line_to_string(l);
|
||||
|
@ -51,58 +49,44 @@ void irc_line_write(struct line *l, connection_t *c)
|
|||
|
||||
struct line *irc_line_dup(struct line *line)
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
struct line *nl = irc_line_new();
|
||||
char *ptr;
|
||||
|
||||
nl->origin = line->origin ? bip_strdup(line->origin) : NULL;
|
||||
array_each(&line->words, i, ptr)
|
||||
array_set(&nl->words, i, bip_strdup(ptr));
|
||||
nl->origin = line->origin ? strdup(line->origin) : NULL;
|
||||
nl->elemc = line->elemc;
|
||||
nl->elemv = malloc(sizeof(char *) * line->elemc);
|
||||
for (i = 0; i < line->elemc; i++)
|
||||
nl->elemv[i] = strdup(line->elemv[i]);
|
||||
nl->colon = line->colon;
|
||||
return nl;
|
||||
}
|
||||
|
||||
char *irc_line_pop(struct line *l)
|
||||
void _irc_line_append(struct line *l, char *s)
|
||||
{
|
||||
return (char *)array_pop(&l->words);
|
||||
l->elemc++;
|
||||
l->elemv = realloc(l->elemv, l->elemc * sizeof(char *));
|
||||
if (!l)
|
||||
fatal("realloc");
|
||||
l->elemv[l->elemc - 1] = s;
|
||||
}
|
||||
|
||||
void _irc_line_append(struct line *l, const char *s)
|
||||
void irc_line_append(struct line *l, char *s)
|
||||
{
|
||||
array_push(&l->words, bip_strdup(s));
|
||||
}
|
||||
|
||||
void irc_line_append(struct line *l, const char *s)
|
||||
{
|
||||
_irc_line_append(l, bip_strdup(s));
|
||||
_irc_line_append(l, strdup(s));
|
||||
}
|
||||
|
||||
char *irc_line_to_string(struct line *l)
|
||||
{
|
||||
return _irc_line_to_string(l, 0);
|
||||
}
|
||||
|
||||
char *irc_line_to_string_skip(struct line *l, int skip_first)
|
||||
{
|
||||
if (skip_first >= irc_line_count(l)) {
|
||||
return NULL;
|
||||
}
|
||||
return _irc_line_to_string(l, skip_first);
|
||||
}
|
||||
|
||||
char *_irc_line_to_string(struct line *l, int skip_first)
|
||||
{
|
||||
size_t len = 0;
|
||||
int i;
|
||||
unsigned i;
|
||||
char *ret;
|
||||
|
||||
if (l->origin)
|
||||
len = strlen(l->origin) + 2;
|
||||
for (i = skip_first; i < array_count(&l->words); i++)
|
||||
len += strlen(array_get(&l->words, i)) + 1;
|
||||
for (i = 0; i < l->elemc; i++)
|
||||
len += strlen(l->elemv[i]) + 1;
|
||||
len += 1; /* remove one trailing space and add \r\n */
|
||||
len++; /* last args ":" */
|
||||
ret = bip_malloc(len + 1);
|
||||
len++; /* last args ":" */
|
||||
ret = malloc(len + 1);
|
||||
ret[0] = 0;
|
||||
|
||||
if (l->origin) {
|
||||
|
@ -110,92 +94,42 @@ char *_irc_line_to_string(struct line *l, int skip_first)
|
|||
strcat(ret, l->origin);
|
||||
strcat(ret, " ");
|
||||
}
|
||||
for (i = skip_first; i < array_count(&l->words) - 1; i++) {
|
||||
strcat(ret, array_get(&l->words, i));
|
||||
for (i = 0; i < l->elemc - 1; i++) {
|
||||
strcat(ret, l->elemv[i]);
|
||||
strcat(ret, " ");
|
||||
}
|
||||
if (strchr(array_get(&l->words, i), ' ') || l->colon)
|
||||
if (strchr(l->elemv[i], ' ') || l->colon)
|
||||
strcat(ret, ":");
|
||||
|
||||
strcat(ret, array_get(&l->words, i));
|
||||
strcat(ret, l->elemv[i]);
|
||||
strcat(ret, "\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *irc_line_to_string_to(struct line *line, char *nick)
|
||||
{
|
||||
char *tmp;
|
||||
char *l;
|
||||
const char *prev;
|
||||
|
||||
prev = irc_line_elem(line, 1);
|
||||
tmp = bip_strdup(prev);
|
||||
array_set(&line->words, 1, nick);
|
||||
l = irc_line_to_string(line);
|
||||
array_set(&line->words, 1, tmp);
|
||||
bip_cfree(prev);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
int irc_line_count(struct line *line)
|
||||
{
|
||||
return array_count(&line->words);
|
||||
}
|
||||
|
||||
int irc_line_includes(struct line *line, int elem)
|
||||
{
|
||||
return array_includes(&line->words, elem);
|
||||
}
|
||||
|
||||
const char *irc_line_elem(struct line *line, int elem)
|
||||
{
|
||||
return array_get(&line->words, elem);
|
||||
}
|
||||
|
||||
void irc_line_drop(struct line *line, int elem)
|
||||
{
|
||||
bip_cfree(array_drop(&line->words, elem));
|
||||
}
|
||||
|
||||
int irc_line_is_error(struct line *line)
|
||||
{
|
||||
const char *irc_code = irc_line_elem(line, 0);
|
||||
return (irc_code[0] == '4');
|
||||
}
|
||||
|
||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp)
|
||||
{
|
||||
return !strcmp(irc_line_elem(line, elem), cmp);
|
||||
}
|
||||
|
||||
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp)
|
||||
{
|
||||
return !strcasecmp(irc_line_elem(line, elem), cmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* takes a null terminated string as input w/o \r\n
|
||||
*/
|
||||
struct line *irc_line_new_from_string(char *str)
|
||||
struct line *irc_line(char *str)
|
||||
{
|
||||
struct line *line;
|
||||
char *space;
|
||||
size_t len;
|
||||
int curelem = 0;
|
||||
|
||||
line = irc_line_new();
|
||||
line = calloc(sizeof(struct line), 1);
|
||||
if (!line)
|
||||
fatal("calloc");
|
||||
if (str[0] == ':') {
|
||||
space = str + 1;
|
||||
|
||||
while (*space && *space != ' ')
|
||||
space++;
|
||||
if (!*space) {
|
||||
irc_line_free(line);
|
||||
if (!*space)
|
||||
return NULL;
|
||||
}
|
||||
// space is at least str + 1, len >= 0
|
||||
len = (size_t)(space - str - 1); /* leading ':' */
|
||||
line->origin = bip_malloc(len + 1);
|
||||
len = space - str - 1; /* leading ':' */
|
||||
line->origin = malloc(len + 1);
|
||||
if (!line->origin)
|
||||
fatal("malloc");
|
||||
memcpy(line->origin, str + 1, len);
|
||||
line->origin[len] = 0;
|
||||
str = space;
|
||||
|
@ -207,6 +141,12 @@ struct line *irc_line_new_from_string(char *str)
|
|||
while (*str) {
|
||||
char *tmp;
|
||||
|
||||
line->elemc++;
|
||||
line->elemv = realloc(line->elemv,
|
||||
line->elemc * sizeof(char *));
|
||||
if (!line->elemv)
|
||||
fatal("realloc");
|
||||
|
||||
space = str;
|
||||
if (*space == ':') {
|
||||
line->colon = 1;
|
||||
|
@ -217,15 +157,16 @@ struct line *irc_line_new_from_string(char *str)
|
|||
while (*space && *space != ' ')
|
||||
space++;
|
||||
}
|
||||
// str is the start of string
|
||||
// space is the end of string or end of word
|
||||
len = (size_t)(space - str);
|
||||
tmp = bip_malloc(len + 1);
|
||||
len = space - str;
|
||||
tmp = line->elemv[curelem] = malloc(len + 1);
|
||||
if (!tmp)
|
||||
fatal("malloc");
|
||||
memcpy(tmp, str, len);
|
||||
tmp[len] = 0;
|
||||
if (array_count(&line->words) == 0)
|
||||
strucase(tmp);
|
||||
array_push(&line->words, tmp);
|
||||
if (curelem == 0)
|
||||
strucase(line->elemv[curelem]);
|
||||
|
||||
curelem++;
|
||||
|
||||
str = space;
|
||||
while (*str == ' ')
|
||||
|
@ -236,11 +177,10 @@ struct line *irc_line_new_from_string(char *str)
|
|||
|
||||
void irc_line_free(struct line *l)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < array_count(&l->words); i++)
|
||||
bip_cfree(array_get(&l->words, i));
|
||||
array_deinit(&l->words);
|
||||
unsigned i;
|
||||
for (i = 0; i < l->elemc; i++)
|
||||
free(l->elemv[i]);
|
||||
free(l->elemv);
|
||||
if (l->origin)
|
||||
free(l->origin);
|
||||
free(l);
|
||||
|
|
136
src/line.h
136
src/line.h
|
@ -2,8 +2,7 @@
|
|||
* $Id$
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -17,91 +16,82 @@
|
|||
|
||||
#include "connection.h"
|
||||
|
||||
#define WRITE_LINE0(con, org, com) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
#define WRITE_LINE0(con, org, com) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
irc_line_write(&l, con); \
|
||||
free(l.elemv); \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_LINE1(con, org, com, a) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
#define WRITE_LINE1(con, org, com, a) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a); \
|
||||
irc_line_write(&l, con); \
|
||||
free(l.elemv); \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_LINE2(con, org, com, a1, a2) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
#define WRITE_LINE2(con, org, com, a1, a2) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
irc_line_write(&l, con); \
|
||||
free(l.elemv); \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_LINE3(con, org, com, a1, a2, a3) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
#define WRITE_LINE3(con, org, com, a1, a2, a3) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
irc_line_write(&l, con); \
|
||||
free(l.elemv); \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_LINE4(con, org, com, a1, a2, a3, a4) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
_irc_line_append(&l, a4); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
#define WRITE_LINE4(con, org, com, a1, a2, a3, a4) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
_irc_line_append(&l, a4); \
|
||||
irc_line_write(&l, con); \
|
||||
free(l.elemv); \
|
||||
} while(0)
|
||||
|
||||
struct line {
|
||||
char *origin;
|
||||
array_t words;
|
||||
unsigned int elemc;
|
||||
char **elemv;
|
||||
int colon;
|
||||
};
|
||||
|
||||
void irc_line_init(struct line *l);
|
||||
void _irc_line_deinit(struct line *l);
|
||||
struct line *irc_line_new(void);
|
||||
struct line *irc_line_new();
|
||||
void irc_line_clear(struct line *l);
|
||||
void irc_line_write(struct line *l, connection_t *c);
|
||||
void irc_line_append(struct line *l, const char *s);
|
||||
struct line *irc_line_new_from_string(char *str);
|
||||
void irc_line_append(struct line *l, char *s);
|
||||
struct line *irc_line(char *str);
|
||||
char *irc_line_to_string(struct line *l);
|
||||
char *irc_line_to_string_skip(struct line *l, int skip_first);
|
||||
char *irc_line_to_string_to(struct line *line, char *nick);
|
||||
void irc_line_free(struct line *l);
|
||||
struct line *irc_line_dup(struct line *line);
|
||||
void _irc_line_append(struct line *l, const char *s);
|
||||
int irc_line_includes(struct line *line, int elem);
|
||||
const char *irc_line_elem(struct line *line, int elem);
|
||||
int irc_line_count(struct line *line);
|
||||
char *irc_line_pop(struct line *l);
|
||||
int irc_line_is_error(struct line *line);
|
||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp);
|
||||
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp);
|
||||
void irc_line_drop(struct line *line, int elem);
|
||||
void _irc_line_append(struct line *l, char *s);
|
||||
|
||||
#endif
|
||||
|
|
85
src/log.h
85
src/log.h
|
@ -2,8 +2,7 @@
|
|||
* $Id: log.h,v 1.26 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 Arnaud Cornet
|
||||
* Copyright (C) 2004,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -14,7 +13,6 @@
|
|||
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -25,85 +23,74 @@
|
|||
#include "util.h"
|
||||
|
||||
#define MAX_PATH_LEN 1024
|
||||
#define LOGLINE_MAXLEN 2048
|
||||
#define LOGLINE_MAXLEN 512
|
||||
|
||||
#define S_PRIVATES "privates"
|
||||
|
||||
struct list;
|
||||
|
||||
typedef struct logfile {
|
||||
FILE *file;
|
||||
char *filename;
|
||||
char *canonical_filename;
|
||||
struct tm last_log;
|
||||
size_t backlog_offset;
|
||||
size_t len;
|
||||
} logfile_t;
|
||||
|
||||
typedef struct logstore {
|
||||
typedef struct logfilegroup
|
||||
{
|
||||
char *name;
|
||||
list_t file_group;
|
||||
int skip_advance;
|
||||
|
||||
list_t *memlog;
|
||||
int memc;
|
||||
int track_backlog;
|
||||
list_iterator_t file_it;
|
||||
long file_offset;
|
||||
} logstore_t;
|
||||
list_iterator_t backlog_it;
|
||||
} logfilegroup_t;
|
||||
|
||||
typedef struct log {
|
||||
hash_t logfgs;
|
||||
char *network;
|
||||
char *user;
|
||||
char *buffer;
|
||||
int connected;
|
||||
int backlogging;
|
||||
list_iterator_t file_it;
|
||||
int lastfile_seeked;
|
||||
int log_to_file;
|
||||
|
||||
struct bipuser *user;
|
||||
} log_t;
|
||||
|
||||
log_t *log_new(struct bipuser *user, const char *network);
|
||||
void log_close_all(log_t *logdata);
|
||||
log_t *log_new(char *user, char *network);
|
||||
void logdata_free(log_t *logdata);
|
||||
int log_compare_files(logfile_t *f1, char *f2);
|
||||
|
||||
void log_join(log_t *logdata, const char *ircmask, const char *channel);
|
||||
void log_part(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
void log_kick(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *who, const char *message);
|
||||
void log_quit(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
void log_nick(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *newnick);
|
||||
void log_privmsg(log_t *logdata, const char *ircmask, const char *destination,
|
||||
const char *message);
|
||||
void log_notice(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
void log_cli_privmsg(log_t *logdata, const char *ircmask,
|
||||
const char *destination, const char *message);
|
||||
void log_cli_notice(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
void log_write(log_t *logdata, const char *str, const char *destination);
|
||||
void log_mode(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *modes, array_t *mode_args);
|
||||
void log_topic(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
void log_init_topic(log_t *logdata, const char *channel, const char *message);
|
||||
void log_init_topic_time(log_t *logdata, const char *channel, const char *who,
|
||||
const char *when);
|
||||
void log_join(log_t *logdata, char *ircmask, char *channel);
|
||||
void log_part(log_t *logdata, char *ircmask, char *channel, char *message);
|
||||
void log_kick(log_t *logdata, char *ircmask, char *channel, char *who,
|
||||
char *message);
|
||||
void log_quit(log_t *logdata, char *ircmask, char *channel, char *message);
|
||||
void log_nick(log_t *logdata, char *ircmask, char *channel, char *newnick);
|
||||
void log_privmsg(log_t *logdata, char *ircmask, char *destination,
|
||||
char *message);
|
||||
void log_notice(log_t *logdata, char *ircmask, char *channel, char *message);
|
||||
void log_cli_privmsg(log_t *logdata, char *ircmask, char *destination,
|
||||
char *message);
|
||||
void log_cli_notice(log_t *logdata, char *ircmask, char *channel,
|
||||
char *message);
|
||||
void log_write(log_t *logdata, char *str, char *destination);
|
||||
void log_mode(log_t *logdata, char *ircmask, char *channel,
|
||||
char *modes, char **modargv, unsigned modargc);
|
||||
void log_topic(log_t *logdata, char *ircmask, char *channel, char *message);
|
||||
void log_init_topic(log_t *logdata, char *channel, char *message);
|
||||
void log_init_topic_time(log_t *logdata, char *channel, char *who, char *when);
|
||||
void log_connected(log_t *logdata);
|
||||
void log_disconnected(log_t *logdata);
|
||||
void log_ping_timeout(log_t *logdata);
|
||||
void log_client_disconnected(log_t *logdata);
|
||||
void log_client_connected(log_t *logdata);
|
||||
int log_has_backlog(log_t *logdata, const char *destination);
|
||||
char *log_backread(log_t *logdata, char *destination, int *skip);
|
||||
int log_has_backlog(log_t *logdata, char *destination);
|
||||
void log_flush_all(void);
|
||||
void log_client_none_connected(log_t *logdata);
|
||||
void log_reset_all(log_t *logdata);
|
||||
void log_free(log_t *log);
|
||||
int check_dir(char *filename, int is_fatal);
|
||||
void log_reset_store(log_t *log, const char *storename);
|
||||
void log_drop(log_t *log, const char *storename);
|
||||
|
||||
list_t *log_backlogs(log_t *log);
|
||||
list_t *backlog_lines(log_t *log, const char *bl, const char *cli_nick,
|
||||
int hours);
|
||||
void log_reset(logfilegroup_t *);
|
||||
#endif
|
||||
|
|
573
src/md5.c
573
src/md5.c
|
@ -1,8 +1,7 @@
|
|||
/*
|
||||
* RFC 1321 compliant MD5 implementation
|
||||
*
|
||||
* Copyright (C) 2001-2003 Christophe Devine
|
||||
* Copyright (C) 2022 Loïc Gomez
|
||||
* Copyright (C) 2001-2003 Christophe Devine
|
||||
*
|
||||
* 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
|
||||
|
@ -23,220 +22,227 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "md5.h"
|
||||
#include "util.h"
|
||||
|
||||
#define GET_UINT32(n, b, i) \
|
||||
{ \
|
||||
(n) = ((uint32)(b)[(i)]) | ((uint32)(b)[(i) + 1] << 8) \
|
||||
| ((uint32)(b)[(i) + 2] << 16) \
|
||||
| ((uint32)(b)[(i) + 3] << 24); \
|
||||
}
|
||||
|
||||
#define PUT_UINT32(n, b, i) \
|
||||
{ \
|
||||
(b)[(i)] = (uint8)((n)); \
|
||||
(b)[(i) + 1] = (uint8)((n) >> 8); \
|
||||
(b)[(i) + 2] = (uint8)((n) >> 16); \
|
||||
(b)[(i) + 3] = (uint8)((n) >> 24); \
|
||||
}
|
||||
|
||||
void md5_starts(md5_context *ctx)
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
#define GET_UINT32(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32) (b)[(i) ] ) \
|
||||
| ( (uint32) (b)[(i) + 1] << 8 ) \
|
||||
| ( (uint32) (b)[(i) + 2] << 16 ) \
|
||||
| ( (uint32) (b)[(i) + 3] << 24 ); \
|
||||
}
|
||||
|
||||
void md5_process(md5_context *ctx, uint8 data[64])
|
||||
{
|
||||
uint32 X[16], A, B, C, D;
|
||||
|
||||
GET_UINT32(X[0], data, 0);
|
||||
GET_UINT32(X[1], data, 4);
|
||||
GET_UINT32(X[2], data, 8);
|
||||
GET_UINT32(X[3], data, 12);
|
||||
GET_UINT32(X[4], data, 16);
|
||||
GET_UINT32(X[5], data, 20);
|
||||
GET_UINT32(X[6], data, 24);
|
||||
GET_UINT32(X[7], data, 28);
|
||||
GET_UINT32(X[8], data, 32);
|
||||
GET_UINT32(X[9], data, 36);
|
||||
GET_UINT32(X[10], data, 40);
|
||||
GET_UINT32(X[11], data, 44);
|
||||
GET_UINT32(X[12], data, 48);
|
||||
GET_UINT32(X[13], data, 52);
|
||||
GET_UINT32(X[14], data, 56);
|
||||
GET_UINT32(X[15], data, 60);
|
||||
|
||||
#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
#define P(a, b, c, d, k, s, t) \
|
||||
{ \
|
||||
a += F(b, c, d) + X[k] + t; \
|
||||
a = S(a, s) + b; \
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
|
||||
#define F(x, y, z) (z ^ (x & (y ^ z)))
|
||||
|
||||
P(A, B, C, D, 0, 7, 0xD76AA478);
|
||||
P(D, A, B, C, 1, 12, 0xE8C7B756);
|
||||
P(C, D, A, B, 2, 17, 0x242070DB);
|
||||
P(B, C, D, A, 3, 22, 0xC1BDCEEE);
|
||||
P(A, B, C, D, 4, 7, 0xF57C0FAF);
|
||||
P(D, A, B, C, 5, 12, 0x4787C62A);
|
||||
P(C, D, A, B, 6, 17, 0xA8304613);
|
||||
P(B, C, D, A, 7, 22, 0xFD469501);
|
||||
P(A, B, C, D, 8, 7, 0x698098D8);
|
||||
P(D, A, B, C, 9, 12, 0x8B44F7AF);
|
||||
P(C, D, A, B, 10, 17, 0xFFFF5BB1);
|
||||
P(B, C, D, A, 11, 22, 0x895CD7BE);
|
||||
P(A, B, C, D, 12, 7, 0x6B901122);
|
||||
P(D, A, B, C, 13, 12, 0xFD987193);
|
||||
P(C, D, A, B, 14, 17, 0xA679438E);
|
||||
P(B, C, D, A, 15, 22, 0x49B40821);
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x, y, z) (y ^ (z & (x ^ y)))
|
||||
|
||||
P(A, B, C, D, 1, 5, 0xF61E2562);
|
||||
P(D, A, B, C, 6, 9, 0xC040B340);
|
||||
P(C, D, A, B, 11, 14, 0x265E5A51);
|
||||
P(B, C, D, A, 0, 20, 0xE9B6C7AA);
|
||||
P(A, B, C, D, 5, 5, 0xD62F105D);
|
||||
P(D, A, B, C, 10, 9, 0x02441453);
|
||||
P(C, D, A, B, 15, 14, 0xD8A1E681);
|
||||
P(B, C, D, A, 4, 20, 0xE7D3FBC8);
|
||||
P(A, B, C, D, 9, 5, 0x21E1CDE6);
|
||||
P(D, A, B, C, 14, 9, 0xC33707D6);
|
||||
P(C, D, A, B, 3, 14, 0xF4D50D87);
|
||||
P(B, C, D, A, 8, 20, 0x455A14ED);
|
||||
P(A, B, C, D, 13, 5, 0xA9E3E905);
|
||||
P(D, A, B, C, 2, 9, 0xFCEFA3F8);
|
||||
P(C, D, A, B, 7, 14, 0x676F02D9);
|
||||
P(B, C, D, A, 12, 20, 0x8D2A4C8A);
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x, y, z) (x ^ y ^ z)
|
||||
|
||||
P(A, B, C, D, 5, 4, 0xFFFA3942);
|
||||
P(D, A, B, C, 8, 11, 0x8771F681);
|
||||
P(C, D, A, B, 11, 16, 0x6D9D6122);
|
||||
P(B, C, D, A, 14, 23, 0xFDE5380C);
|
||||
P(A, B, C, D, 1, 4, 0xA4BEEA44);
|
||||
P(D, A, B, C, 4, 11, 0x4BDECFA9);
|
||||
P(C, D, A, B, 7, 16, 0xF6BB4B60);
|
||||
P(B, C, D, A, 10, 23, 0xBEBFBC70);
|
||||
P(A, B, C, D, 13, 4, 0x289B7EC6);
|
||||
P(D, A, B, C, 0, 11, 0xEAA127FA);
|
||||
P(C, D, A, B, 3, 16, 0xD4EF3085);
|
||||
P(B, C, D, A, 6, 23, 0x04881D05);
|
||||
P(A, B, C, D, 9, 4, 0xD9D4D039);
|
||||
P(D, A, B, C, 12, 11, 0xE6DB99E5);
|
||||
P(C, D, A, B, 15, 16, 0x1FA27CF8);
|
||||
P(B, C, D, A, 2, 23, 0xC4AC5665);
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
P(A, B, C, D, 0, 6, 0xF4292244);
|
||||
P(D, A, B, C, 7, 10, 0x432AFF97);
|
||||
P(C, D, A, B, 14, 15, 0xAB9423A7);
|
||||
P(B, C, D, A, 5, 21, 0xFC93A039);
|
||||
P(A, B, C, D, 12, 6, 0x655B59C3);
|
||||
P(D, A, B, C, 3, 10, 0x8F0CCC92);
|
||||
P(C, D, A, B, 10, 15, 0xFFEFF47D);
|
||||
P(B, C, D, A, 1, 21, 0x85845DD1);
|
||||
P(A, B, C, D, 8, 6, 0x6FA87E4F);
|
||||
P(D, A, B, C, 15, 10, 0xFE2CE6E0);
|
||||
P(C, D, A, B, 6, 15, 0xA3014314);
|
||||
P(B, C, D, A, 13, 21, 0x4E0811A1);
|
||||
P(A, B, C, D, 4, 6, 0xF7537E82);
|
||||
P(D, A, B, C, 11, 10, 0xBD3AF235);
|
||||
P(C, D, A, B, 2, 15, 0x2AD7D2BB);
|
||||
P(B, C, D, A, 9, 21, 0xEB86D391);
|
||||
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
#define PUT_UINT32(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (uint8) ( (n) ); \
|
||||
(b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
|
||||
(b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
|
||||
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
|
||||
}
|
||||
|
||||
void md5_update(md5_context *ctx, uint8 *input, uint32 length)
|
||||
void md5_starts( md5_context *ctx )
|
||||
{
|
||||
uint32 left, fill;
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += length;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if (ctx->total[0] < length)
|
||||
ctx->total[1]++;
|
||||
|
||||
if (left && length >= fill) {
|
||||
memcpy((void *)(ctx->buffer + left), (void *)input, fill);
|
||||
md5_process(ctx, ctx->buffer);
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while (length >= 64) {
|
||||
md5_process(ctx, input);
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
|
||||
if (length) {
|
||||
memcpy((void *)(ctx->buffer + left), (void *)input, length);
|
||||
}
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
static uint8 md5_padding[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
void md5_finish(md5_context *ctx, uint8 digest[16])
|
||||
void md5_process( md5_context *ctx, uint8 data[64] )
|
||||
{
|
||||
uint32 last, padn;
|
||||
uint32 high, low;
|
||||
uint8 msglen[8];
|
||||
uint32 X[16], A, B, C, D;
|
||||
|
||||
high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
|
||||
low = (ctx->total[0] << 3);
|
||||
GET_UINT32( X[0], data, 0 );
|
||||
GET_UINT32( X[1], data, 4 );
|
||||
GET_UINT32( X[2], data, 8 );
|
||||
GET_UINT32( X[3], data, 12 );
|
||||
GET_UINT32( X[4], data, 16 );
|
||||
GET_UINT32( X[5], data, 20 );
|
||||
GET_UINT32( X[6], data, 24 );
|
||||
GET_UINT32( X[7], data, 28 );
|
||||
GET_UINT32( X[8], data, 32 );
|
||||
GET_UINT32( X[9], data, 36 );
|
||||
GET_UINT32( X[10], data, 40 );
|
||||
GET_UINT32( X[11], data, 44 );
|
||||
GET_UINT32( X[12], data, 48 );
|
||||
GET_UINT32( X[13], data, 52 );
|
||||
GET_UINT32( X[14], data, 56 );
|
||||
GET_UINT32( X[15], data, 60 );
|
||||
|
||||
PUT_UINT32(low, msglen, 0);
|
||||
PUT_UINT32(high, msglen, 4);
|
||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = (last < 56) ? (56 - last) : (120 - last);
|
||||
#define P(a,b,c,d,k,s,t) \
|
||||
{ \
|
||||
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
|
||||
}
|
||||
|
||||
md5_update(ctx, md5_padding, padn);
|
||||
md5_update(ctx, msglen, (unsigned long)8);
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
|
||||
PUT_UINT32(ctx->state[0], digest, 0);
|
||||
PUT_UINT32(ctx->state[1], digest, 4);
|
||||
PUT_UINT32(ctx->state[2], digest, 8);
|
||||
PUT_UINT32(ctx->state[3], digest, 12);
|
||||
#define F(x,y,z) (z ^ (x & (y ^ z)))
|
||||
|
||||
P( A, B, C, D, 0, 7, 0xD76AA478 );
|
||||
P( D, A, B, C, 1, 12, 0xE8C7B756 );
|
||||
P( C, D, A, B, 2, 17, 0x242070DB );
|
||||
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
|
||||
P( A, B, C, D, 4, 7, 0xF57C0FAF );
|
||||
P( D, A, B, C, 5, 12, 0x4787C62A );
|
||||
P( C, D, A, B, 6, 17, 0xA8304613 );
|
||||
P( B, C, D, A, 7, 22, 0xFD469501 );
|
||||
P( A, B, C, D, 8, 7, 0x698098D8 );
|
||||
P( D, A, B, C, 9, 12, 0x8B44F7AF );
|
||||
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
|
||||
P( B, C, D, A, 11, 22, 0x895CD7BE );
|
||||
P( A, B, C, D, 12, 7, 0x6B901122 );
|
||||
P( D, A, B, C, 13, 12, 0xFD987193 );
|
||||
P( C, D, A, B, 14, 17, 0xA679438E );
|
||||
P( B, C, D, A, 15, 22, 0x49B40821 );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (z & (x ^ y)))
|
||||
|
||||
P( A, B, C, D, 1, 5, 0xF61E2562 );
|
||||
P( D, A, B, C, 6, 9, 0xC040B340 );
|
||||
P( C, D, A, B, 11, 14, 0x265E5A51 );
|
||||
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
|
||||
P( A, B, C, D, 5, 5, 0xD62F105D );
|
||||
P( D, A, B, C, 10, 9, 0x02441453 );
|
||||
P( C, D, A, B, 15, 14, 0xD8A1E681 );
|
||||
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
|
||||
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
|
||||
P( D, A, B, C, 14, 9, 0xC33707D6 );
|
||||
P( C, D, A, B, 3, 14, 0xF4D50D87 );
|
||||
P( B, C, D, A, 8, 20, 0x455A14ED );
|
||||
P( A, B, C, D, 13, 5, 0xA9E3E905 );
|
||||
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
|
||||
P( C, D, A, B, 7, 14, 0x676F02D9 );
|
||||
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
|
||||
P( A, B, C, D, 5, 4, 0xFFFA3942 );
|
||||
P( D, A, B, C, 8, 11, 0x8771F681 );
|
||||
P( C, D, A, B, 11, 16, 0x6D9D6122 );
|
||||
P( B, C, D, A, 14, 23, 0xFDE5380C );
|
||||
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
|
||||
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
|
||||
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
|
||||
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
|
||||
P( A, B, C, D, 13, 4, 0x289B7EC6 );
|
||||
P( D, A, B, C, 0, 11, 0xEAA127FA );
|
||||
P( C, D, A, B, 3, 16, 0xD4EF3085 );
|
||||
P( B, C, D, A, 6, 23, 0x04881D05 );
|
||||
P( A, B, C, D, 9, 4, 0xD9D4D039 );
|
||||
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
|
||||
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
|
||||
P( B, C, D, A, 2, 23, 0xC4AC5665 );
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (x | ~z))
|
||||
|
||||
P( A, B, C, D, 0, 6, 0xF4292244 );
|
||||
P( D, A, B, C, 7, 10, 0x432AFF97 );
|
||||
P( C, D, A, B, 14, 15, 0xAB9423A7 );
|
||||
P( B, C, D, A, 5, 21, 0xFC93A039 );
|
||||
P( A, B, C, D, 12, 6, 0x655B59C3 );
|
||||
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
|
||||
P( C, D, A, B, 10, 15, 0xFFEFF47D );
|
||||
P( B, C, D, A, 1, 21, 0x85845DD1 );
|
||||
P( A, B, C, D, 8, 6, 0x6FA87E4F );
|
||||
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
|
||||
P( C, D, A, B, 6, 15, 0xA3014314 );
|
||||
P( B, C, D, A, 13, 21, 0x4E0811A1 );
|
||||
P( A, B, C, D, 4, 6, 0xF7537E82 );
|
||||
P( D, A, B, C, 11, 10, 0xBD3AF235 );
|
||||
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
|
||||
P( B, C, D, A, 9, 21, 0xEB86D391 );
|
||||
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
}
|
||||
|
||||
void md5_update( md5_context *ctx, uint8 *input, uint32 length )
|
||||
{
|
||||
uint32 left, fill;
|
||||
|
||||
if( ! length ) return;
|
||||
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += length;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < length )
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && length >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, fill );
|
||||
md5_process( ctx, ctx->buffer );
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( length >= 64 )
|
||||
{
|
||||
md5_process( ctx, input );
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
|
||||
if( length )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, length );
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 md5_padding[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
void md5_finish( md5_context *ctx, uint8 digest[16] )
|
||||
{
|
||||
uint32 last, padn;
|
||||
uint32 high, low;
|
||||
uint8 msglen[8];
|
||||
|
||||
high = ( ctx->total[0] >> 29 )
|
||||
| ( ctx->total[1] << 3 );
|
||||
low = ( ctx->total[0] << 3 );
|
||||
|
||||
PUT_UINT32( low, msglen, 0 );
|
||||
PUT_UINT32( high, msglen, 4 );
|
||||
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
|
||||
md5_update( ctx, md5_padding, padn );
|
||||
md5_update( ctx, msglen, 8 );
|
||||
|
||||
PUT_UINT32( ctx->state[0], digest, 0 );
|
||||
PUT_UINT32( ctx->state[1], digest, 4 );
|
||||
PUT_UINT32( ctx->state[2], digest, 8 );
|
||||
PUT_UINT32( ctx->state[3], digest, 12 );
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
@ -248,76 +254,92 @@ void md5_finish(md5_context *ctx, uint8 digest[16])
|
|||
* those are the standard RFC 1321 test vectors
|
||||
*/
|
||||
|
||||
static char *msg[] = {
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"message digest",
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"12345678901234567890123456789012345678901234567890123456789012"
|
||||
"345678901234567890"};
|
||||
|
||||
static char *val[] = {
|
||||
"d41d8cd98f00b204e9800998ecf8427e", "0cc175b9c0f1b6a831c399e269772661",
|
||||
"900150983cd24fb0d6963f7d28e17f72", "f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"c3fcd3d76192e4007dfb496cca67e13b", "d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"57edf4a22be3c955ac49da2e2107b67a"};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
static char *msg[] =
|
||||
{
|
||||
FILE *f;
|
||||
int i, j;
|
||||
char output[33];
|
||||
md5_context ctx;
|
||||
unsigned char buf[1000];
|
||||
unsigned char md5sum[16];
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"message digest",
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"12345678901234567890123456789012345678901234567890123456789012" \
|
||||
"345678901234567890"
|
||||
};
|
||||
|
||||
if (argc < 2) {
|
||||
printf("\n MD5 Validation Tests:\n\n");
|
||||
static char *val[] =
|
||||
{
|
||||
"d41d8cd98f00b204e9800998ecf8427e",
|
||||
"0cc175b9c0f1b6a831c399e269772661",
|
||||
"900150983cd24fb0d6963f7d28e17f72",
|
||||
"f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"c3fcd3d76192e4007dfb496cca67e13b",
|
||||
"d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"57edf4a22be3c955ac49da2e2107b67a"
|
||||
};
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
printf(" Test %d ", i + 1);
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
int i, j;
|
||||
char output[33];
|
||||
md5_context ctx;
|
||||
unsigned char buf[1000];
|
||||
unsigned char md5sum[16];
|
||||
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, (uint8 *)msg[i], strlen(msg[i]));
|
||||
md5_finish(&ctx, md5sum);
|
||||
if( argc < 2 )
|
||||
{
|
||||
printf( "\n MD5 Validation Tests:\n\n" );
|
||||
|
||||
for (j = 0; j < 16; j++) {
|
||||
sprintf(output + j * 2, "%02x", md5sum[j]);
|
||||
}
|
||||
for( i = 0; i < 7; i++ )
|
||||
{
|
||||
printf( " Test %d ", i + 1 );
|
||||
|
||||
if (memcmp(output, val[i], 32)) {
|
||||
printf("failed!\n");
|
||||
return (1);
|
||||
}
|
||||
md5_starts( &ctx );
|
||||
md5_update( &ctx, (uint8 *) msg[i], strlen( msg[i] ) );
|
||||
md5_finish( &ctx, md5sum );
|
||||
|
||||
printf("passed.\n");
|
||||
}
|
||||
for( j = 0; j < 16; j++ )
|
||||
{
|
||||
sprintf( output + j * 2, "%02x", md5sum[j] );
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
} else {
|
||||
if (!(f = fopen(argv[1], "rb"))) {
|
||||
perror("fopen");
|
||||
return (1);
|
||||
}
|
||||
if( memcmp( output, val[i], 32 ) )
|
||||
{
|
||||
printf( "failed!\n" );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
md5_starts(&ctx);
|
||||
printf( "passed.\n" );
|
||||
}
|
||||
|
||||
while ((i = fread(buf, 1, sizeof(buf), f)) > 0) {
|
||||
md5_update(&ctx, buf, i);
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ! ( f = fopen( argv[1], "rb" ) ) )
|
||||
{
|
||||
perror( "fopen" );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
md5_finish(&ctx, md5sum);
|
||||
md5_starts( &ctx );
|
||||
|
||||
for (j = 0; j < 16; j++) {
|
||||
printf("%02x", md5sum[j]);
|
||||
}
|
||||
while( ( i = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
||||
{
|
||||
md5_update( &ctx, buf, i );
|
||||
}
|
||||
|
||||
printf(" %s\n", argv[1]);
|
||||
}
|
||||
md5_finish( &ctx, md5sum );
|
||||
|
||||
return (0);
|
||||
for( j = 0; j < 16; j++ )
|
||||
{
|
||||
printf( "%02x", md5sum[j] );
|
||||
}
|
||||
|
||||
printf( " %s\n", argv[1] );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -326,6 +348,29 @@ int main(int argc, char *argv[])
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
unsigned char *md5dup(unsigned char *data, size_t len)
|
||||
{
|
||||
md5_context ctx;
|
||||
unsigned char *md5 = malloc(16);
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, data, len);
|
||||
md5_finish(&ctx, md5);
|
||||
return md5;
|
||||
}
|
||||
|
||||
unsigned char *strmd5(char *str)
|
||||
{
|
||||
size_t length;
|
||||
if (!str)
|
||||
return NULL;
|
||||
length = strlen(str);
|
||||
if (length == 0)
|
||||
return NULL;
|
||||
return md5dup((unsigned char*)str, length);
|
||||
}
|
||||
*/
|
||||
|
||||
unsigned char *chash_double(char *str, unsigned int seed)
|
||||
{
|
||||
size_t length;
|
||||
|
@ -335,27 +380,22 @@ unsigned char *chash_double(char *str, unsigned int seed)
|
|||
|
||||
length = strlen(str);
|
||||
length += 4;
|
||||
ptr = bip_malloc(length);
|
||||
// conversion from ‘unsigned int’ to ‘unsigned char’ may change value
|
||||
// [-Werror=conversion]
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
ptr = malloc(length);
|
||||
ptr[0] = seed >> 24 & 0xff;
|
||||
#pragma GCC diagnostic pop
|
||||
ptr[1] = seed >> 16 & 0xff;
|
||||
ptr[2] = seed >> 8 & 0xff;
|
||||
ptr[3] = seed & 0xff;
|
||||
memcpy(ptr + 4, str, length - 4);
|
||||
|
||||
md5 = bip_malloc((size_t)16 + 4);
|
||||
memcpy(md5, ptr, (size_t)4);
|
||||
md5 = malloc(16 + 4);
|
||||
memcpy(md5, ptr, 4);
|
||||
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, ptr, length);
|
||||
md5_finish(&ctx, md5 + 4);
|
||||
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, md5, (unsigned long)20);
|
||||
md5_update(&ctx, md5, 20);
|
||||
md5_finish(&ctx, md5 + 4);
|
||||
free(ptr);
|
||||
return md5;
|
||||
|
@ -376,3 +416,4 @@ int chash_cmp(char *try, unsigned char *pass, unsigned int seed)
|
|||
free(try_hash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
17
src/md5.h
17
src/md5.h
|
@ -2,19 +2,22 @@
|
|||
#define _MD5_H
|
||||
|
||||
#ifndef uint8
|
||||
#define uint8 unsigned char
|
||||
#define uint8 unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef uint32
|
||||
#define uint32 unsigned long int
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint32 total[2];
|
||||
uint32 state[4];
|
||||
uint8 buffer[64];
|
||||
} md5_context;
|
||||
typedef struct
|
||||
{
|
||||
uint32 total[2];
|
||||
uint32 state[4];
|
||||
uint8 buffer[64];
|
||||
}
|
||||
md5_context;
|
||||
|
||||
int chash_cmp(char *try, unsigned char *pass, unsigned int seed);
|
||||
int chash_cmp(char *try, unsigned char *pass,
|
||||
unsigned int seed);
|
||||
unsigned char *chash_double(char *str, unsigned int seed);
|
||||
#endif /* md5.h */
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2016 Pierre-Louis Bonicoli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See the file "COPYING" for the exact licensing terms.
|
||||
*/
|
||||
|
||||
#include "path_util.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *default_path(const char *biphome, const char *filename, const char *desc)
|
||||
{
|
||||
char *conf_file;
|
||||
// '/' and \0
|
||||
conf_file = bip_malloc(strlen(biphome) + strlen(filename) + 2);
|
||||
strcpy(conf_file, biphome);
|
||||
conf_file[strlen(biphome)] = '/';
|
||||
conf_file[strlen(biphome) + 1] = '\0';
|
||||
strcat(conf_file, filename);
|
||||
mylog(LOG_INFO, "Default %s: %s", desc, conf_file);
|
||||
return conf_file;
|
||||
}
|
||||
|
||||
void assert_path_exists(char *path)
|
||||
{
|
||||
struct stat st_buf;
|
||||
|
||||
if (stat(path, &st_buf) != 0)
|
||||
fatal("Path %s doesn't exist (%s)", path, strerror(errno));
|
||||
}
|
||||
|
||||
int check_path_exists(char *path)
|
||||
{
|
||||
struct stat st_buf;
|
||||
|
||||
if (stat(path, &st_buf) != 0) {
|
||||
mylog(LOG_WARN, "Path %s doesn't exist (%s)", path, strerror(errno));
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2016 Pierre-Louis Bonicoli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See the file "COPYING" for the exact licensing terms.
|
||||
*/
|
||||
#ifndef PATH_UTIL_H
|
||||
#define PATH_UTIL_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* return path of filename located in bip home directory */
|
||||
char *default_path(const char *biphome, const char *filename, const char *desc);
|
||||
/* exit program if path doesn't exist */
|
||||
void assert_path_exists(char *path);
|
||||
/* return 1 if path exists, 0 otherwise */
|
||||
int check_path_exists(char *path);
|
||||
|
||||
#endif
|
|
@ -2,7 +2,7 @@
|
|||
* $Id: conf.h,v 1.5 2005/04/17 15:20:32 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
|
637
src/util.c
637
src/util.c
|
@ -2,8 +2,7 @@
|
|||
* $Id: util.c,v 1.60 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -13,14 +12,11 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "connection.h"
|
||||
#include "util.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -28,165 +24,8 @@
|
|||
#include <errno.h>
|
||||
|
||||
extern int conf_log_level;
|
||||
extern int conf_log_system;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
extern int conf_log;
|
||||
extern int errno;
|
||||
#pragma GCC diagnostic pop
|
||||
extern FILE *conf_global_log_file;
|
||||
|
||||
void memory_fatal(void)
|
||||
{
|
||||
fflush(conf_global_log_file);
|
||||
#define OOMMSG "Out of memory.\n"
|
||||
fwrite(OOMMSG, (size_t)1, strlen(OOMMSG), conf_global_log_file);
|
||||
#undef OOMMSG
|
||||
fflush(conf_global_log_file);
|
||||
exit(28);
|
||||
}
|
||||
|
||||
void *bip_malloc(size_t size)
|
||||
{
|
||||
void *r;
|
||||
|
||||
assert(size < INT_MAX / 4);
|
||||
|
||||
r = malloc(size);
|
||||
if (!r)
|
||||
memory_fatal();
|
||||
return r;
|
||||
}
|
||||
|
||||
void *bip_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *r = calloc(nmemb, size);
|
||||
if (!r)
|
||||
memory_fatal();
|
||||
return r;
|
||||
}
|
||||
|
||||
void *bip_realloc(void *ptr, size_t size)
|
||||
{
|
||||
void *r;
|
||||
|
||||
assert(size < INT_MAX / 4);
|
||||
|
||||
r = realloc(ptr, size);
|
||||
if (size > 0 && r == NULL)
|
||||
memory_fatal();
|
||||
return r;
|
||||
}
|
||||
|
||||
void bip_cfree(const void *ptr)
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
// there's no other way to free a const pointer
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
free((void *)ptr);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
char *bip_strdup(const char *str)
|
||||
{
|
||||
char *r = strdup(str);
|
||||
if (!r)
|
||||
memory_fatal();
|
||||
return r;
|
||||
}
|
||||
|
||||
char *bip_strcat_fit(size_t *remaining, char *str, const char *str2)
|
||||
{
|
||||
char *res;
|
||||
|
||||
if (!remaining || !str || !str2) {
|
||||
mylog(LOG_DEBUGVERB, "bip_strcat_fit: got NULL pointer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = memccpy(str, str2, '\0', *remaining);
|
||||
if (!res) {
|
||||
mylog(LOG_DEBUGTOOMUCH,
|
||||
"bip_strcat_fit: memccpy() failed, remaining %lu",
|
||||
*remaining);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res--;
|
||||
if (res < str) {
|
||||
mylog(LOG_DEBUG, "bip_strcat_fit: memccpy res < str");
|
||||
return NULL;
|
||||
}
|
||||
(*remaining) -= (size_t)(res - str);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define STRCATF_BUF_MAXLEN 1024
|
||||
char *bip_strcatf_fit(size_t *remaining, char *str, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char str2[STRCATF_BUF_MAXLEN + 1];
|
||||
int written;
|
||||
char *res = NULL;
|
||||
|
||||
if (!remaining || !str || !fmt) {
|
||||
mylog(LOG_DEBUGVERB, "bip_strcatf_fit: NULL pointer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (*remaining > STRCATF_BUF_MAXLEN) {
|
||||
mylog(LOG_ERROR,
|
||||
"bip_strcatf_fit: remaining "
|
||||
"is over STRCATF_BUF_MAXLEN");
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
str2[*remaining] = '\0';
|
||||
written = vsnprintf(str2, *remaining, fmt, ap);
|
||||
if (written < 0) {
|
||||
mylog(LOG_ERROR, "bip_strcatf_fit: vsnprintf failed with: %s",
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((unsigned)written >= *remaining) {
|
||||
mylog(LOG_DEBUGVERB,
|
||||
"bip_strcatf_fit,vsnprintf: no space left");
|
||||
goto end;
|
||||
}
|
||||
|
||||
res = memccpy(str, str2, '\0', *remaining);
|
||||
if (!res) {
|
||||
mylog(LOG_DEBUGTOOMUCH,
|
||||
"bip_strcatf_fit: memccpy() failed, "
|
||||
"remaining %lu",
|
||||
*remaining);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (res < str) {
|
||||
mylog(LOG_DEBUG, "bip_strcatf_fit: memccpy res < str");
|
||||
goto end;
|
||||
}
|
||||
res--;
|
||||
(*remaining) -= (size_t)(res - str);
|
||||
|
||||
end:
|
||||
va_end(ap);
|
||||
return res;
|
||||
}
|
||||
|
||||
void bip_clock_gettime(clockid_t clockid, struct timespec *tp)
|
||||
{
|
||||
int err = clock_gettime(clockid, tp);
|
||||
|
||||
if (err != 0)
|
||||
fatal("clock_gettime: %s", strerror(errno));
|
||||
|
||||
if (tp->tv_sec < 0 || tp->tv_nsec < 0)
|
||||
fatal("clock_gettime returned negative time");
|
||||
}
|
||||
|
||||
/*
|
||||
* <nick> ::= <letter> { <letter> | <number> | <special> }
|
||||
|
@ -199,10 +38,10 @@ int is_valid_nick(char *str)
|
|||
return 0;
|
||||
|
||||
tmp = str;
|
||||
while (*tmp != '\0'
|
||||
&& (isalnum(*tmp) || *tmp == '-' || *tmp == '[' || *tmp == ']'
|
||||
|| *tmp == '\\' || *tmp == '`' || *tmp == '^' || *tmp == '{'
|
||||
|| *tmp == '}' || *tmp == '|' || *tmp == '_'))
|
||||
while (*tmp != '\0' && (isalnum(*tmp) || *tmp == '-' || *tmp == '[' ||
|
||||
*tmp == ']' || *tmp == '\\' || *tmp == '`' ||
|
||||
*tmp == '^' || *tmp == '{' || *tmp == '}' ||
|
||||
*tmp == '|'))
|
||||
tmp++;
|
||||
return (*tmp == '\0');
|
||||
}
|
||||
|
@ -214,8 +53,8 @@ int is_valid_username(char *str)
|
|||
return 0;
|
||||
|
||||
tmp = str;
|
||||
while (*tmp != '\0' && *tmp != ' ' && *tmp != '\0' && *tmp != '\r'
|
||||
&& *tmp != '\n')
|
||||
while (*tmp != '\0' && *tmp != ' ' && *tmp != '\0' && *tmp != '\r' &&
|
||||
*tmp != '\n')
|
||||
tmp++;
|
||||
return (*tmp == '\0');
|
||||
}
|
||||
|
@ -229,69 +68,43 @@ char *timestamp(void)
|
|||
time(&tv);
|
||||
tm = localtime(&tv);
|
||||
|
||||
strftime(ts, (size_t)20, "%d-%m-%Y %H:%M:%S", tm);
|
||||
snprintf(ts, 20, "%02d-%02d-%04d %02d:%02d:%02d", tm->tm_mday,
|
||||
tm->tm_mon + 1, tm->tm_year + 1900, tm->tm_hour,
|
||||
tm->tm_min, tm->tm_sec);
|
||||
return ts;
|
||||
}
|
||||
|
||||
char *hrtime(time_t s)
|
||||
{
|
||||
static char ts[20];
|
||||
struct tm *tm;
|
||||
|
||||
if (s == 0)
|
||||
return "never";
|
||||
tm = localtime(&s);
|
||||
|
||||
strftime(ts, (size_t)20, "%d-%m-%Y %H:%M:%S", tm);
|
||||
return ts;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
char *checkmode2text(int v)
|
||||
{
|
||||
switch (v) {
|
||||
case SSL_CHECK_BASIC:
|
||||
return "basic";
|
||||
case SSL_CHECK_CA:
|
||||
return "ca";
|
||||
default:
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
extern FILE *conf_global_log_file;
|
||||
|
||||
void _mylog(int level, char *fmt, va_list ap)
|
||||
{
|
||||
char *prefix;
|
||||
|
||||
if (!conf_log_system)
|
||||
return;
|
||||
|
||||
if (level > conf_log_level)
|
||||
return;
|
||||
|
||||
switch (level) {
|
||||
case LOG_FATAL:
|
||||
prefix = "FATAL: ";
|
||||
break;
|
||||
case LOG_DEBUGVERB:
|
||||
prefix = "DEBUGVERB: ";
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
prefix = "DEBUG: ";
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
prefix = "ERROR: ";
|
||||
break;
|
||||
case LOG_WARN:
|
||||
prefix = "WARNING: ";
|
||||
break;
|
||||
case LOG_INFO:
|
||||
prefix = "";
|
||||
break;
|
||||
default:
|
||||
prefix = "";
|
||||
break;
|
||||
case LOG_FATAL:
|
||||
prefix = "FATAL: ";
|
||||
break;
|
||||
case LOG_DEBUGVERB:
|
||||
prefix = "DEBUG: ";
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
prefix = "DEBUG: ";
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
prefix = "ERROR: ";
|
||||
break;
|
||||
case LOG_WARN:
|
||||
prefix = "WARNING: ";
|
||||
break;
|
||||
case LOG_INFO:
|
||||
prefix = "";
|
||||
break;
|
||||
default:
|
||||
prefix = "";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(conf_global_log_file, "%s %s", timestamp(), prefix);
|
||||
|
@ -306,37 +119,23 @@ void mylog(int level, char *fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
|
||||
if (!conf_log)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
_mylog(level, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
#include <execinfo.h>
|
||||
void dump_trace(void)
|
||||
{
|
||||
void *array[32];
|
||||
int size;
|
||||
|
||||
size = backtrace(array, 32);
|
||||
fflush(conf_global_log_file);
|
||||
backtrace_symbols_fd(array, size, fileno(conf_global_log_file));
|
||||
}
|
||||
#endif
|
||||
|
||||
extern char *conf_pid_file;
|
||||
void fatal(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
_mylog(LOG_FATAL, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
dump_trace();
|
||||
#endif
|
||||
|
||||
exit(200);
|
||||
}
|
||||
|
||||
|
@ -344,24 +143,32 @@ void fatal(char *fmt, ...)
|
|||
* list handling functions
|
||||
*/
|
||||
|
||||
int list_ptr_cmp(const void *a, const void *b)
|
||||
struct list_item {
|
||||
struct list_item *next;
|
||||
struct list_item *prev;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
int list_ptr_cmp(void *a, void *b)
|
||||
{
|
||||
if (a == b)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void list_init(list_t *l, int (*cmp)(const void *, const void *))
|
||||
void list_init(list_t *l, int (*cmp)(void *, void *))
|
||||
{
|
||||
l->first = NULL;
|
||||
l->last = NULL;
|
||||
l->cmp = cmp;
|
||||
}
|
||||
|
||||
list_t *list_new(int (*cmp)(const void *, const void *))
|
||||
list_t *list_new(int (*cmp)(void *, void *))
|
||||
{
|
||||
list_t *l;
|
||||
l = bip_malloc(sizeof(list_t));
|
||||
l = malloc(sizeof(list_t));
|
||||
if (!l)
|
||||
fatal("malloc");
|
||||
list_init(l, cmp);
|
||||
return l;
|
||||
}
|
||||
|
@ -369,7 +176,9 @@ list_t *list_new(int (*cmp)(const void *, const void *))
|
|||
static struct list_item *list_item(void *ptr)
|
||||
{
|
||||
struct list_item *l;
|
||||
l = bip_malloc(sizeof(struct list_item));
|
||||
l = malloc(sizeof(struct list_item));
|
||||
if (!l)
|
||||
fatal("malloc");
|
||||
l->ptr = ptr;
|
||||
l->next = NULL;
|
||||
l->prev = NULL;
|
||||
|
@ -379,10 +188,6 @@ static struct list_item *list_item(void *ptr)
|
|||
void list_add_first(list_t *list, void *ptr)
|
||||
{
|
||||
struct list_item *li;
|
||||
|
||||
assert(list);
|
||||
if (!ptr)
|
||||
fatal("Cannot add NULL ptr to list.");
|
||||
li = list_item(ptr);
|
||||
if (!list->first) {
|
||||
list->first = list->last = li;
|
||||
|
@ -395,8 +200,6 @@ void list_add_first(list_t *list, void *ptr)
|
|||
|
||||
void list_add_first_uniq(list_t *list, void *ptr)
|
||||
{
|
||||
assert(list);
|
||||
assert_msg(ptr, "Cannot add NULL ptr to list.");
|
||||
if (list_get(list, ptr))
|
||||
return;
|
||||
list_add_first(list, ptr);
|
||||
|
@ -405,9 +208,6 @@ void list_add_first_uniq(list_t *list, void *ptr)
|
|||
void list_add_last(list_t *list, void *ptr)
|
||||
{
|
||||
struct list_item *li;
|
||||
|
||||
assert(list);
|
||||
assert_msg(ptr, "Cannot add NULL ptr to list.");
|
||||
li = list_item(ptr);
|
||||
if (!list->first) {
|
||||
list->first = list->last = li;
|
||||
|
@ -420,7 +220,6 @@ void list_add_last(list_t *list, void *ptr)
|
|||
|
||||
void *list_get_first(list_t *list)
|
||||
{
|
||||
assert(list);
|
||||
if (!list->first)
|
||||
return NULL;
|
||||
return list->first->ptr;
|
||||
|
@ -428,7 +227,6 @@ void *list_get_first(list_t *list)
|
|||
|
||||
void *list_get_last(list_t *list)
|
||||
{
|
||||
assert(list);
|
||||
if (!list->last)
|
||||
return NULL;
|
||||
return list->last->ptr;
|
||||
|
@ -437,10 +235,8 @@ void *list_get_last(list_t *list)
|
|||
void *list_remove_first(list_t *list)
|
||||
{
|
||||
struct list_item *l;
|
||||
void *ptr;
|
||||
void *ptr = list_get_first(list);
|
||||
|
||||
assert(list);
|
||||
ptr = list_get_first(list);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
l = list->first;
|
||||
|
@ -454,10 +250,7 @@ void *list_remove_first(list_t *list)
|
|||
void *list_remove_last(list_t *list)
|
||||
{
|
||||
struct list_item *l;
|
||||
void *ptr;
|
||||
|
||||
assert(list);
|
||||
ptr = list_get_last(list);
|
||||
void *ptr = list_get_last(list);
|
||||
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
@ -469,14 +262,36 @@ void *list_remove_last(list_t *list)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void *list_remove_if_exists(list_t *list, const void *ptr)
|
||||
/*
|
||||
static void *list_remove_item(list_t *l, struct list_item *li)
|
||||
{
|
||||
void *ret = li->ptr;
|
||||
if (!li->prev) {
|
||||
if (l->first != li)
|
||||
fatal("list_remove_item");
|
||||
l->first = li->next;
|
||||
} else
|
||||
li->prev->next = li->next;
|
||||
|
||||
if (!li->next) {
|
||||
if (l->last != li)
|
||||
fatal("list_remove_item");
|
||||
l->last = li->prev;
|
||||
} else
|
||||
li->next->prev = li->prev;
|
||||
free(li);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
void *list_remove_if_exists(list_t *list, void *ptr)
|
||||
{
|
||||
list_iterator_t li;
|
||||
int debug = 0;
|
||||
void *ret = 0;
|
||||
|
||||
assert(list);
|
||||
assert_msg(list->cmp, "list does not have a cmp function");
|
||||
if (!list->cmp)
|
||||
fatal("list_remove: list does not have a cmp function\n");
|
||||
|
||||
for (list_it_init(list, &li); list_it_item(&li); list_it_next(&li)) {
|
||||
if (list->cmp(list_it_item(&li), ptr) == 0) {
|
||||
|
@ -491,7 +306,7 @@ void *list_remove_if_exists(list_t *list, const void *ptr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *list_remove(list_t *list, const void *ptr)
|
||||
void *list_remove(list_t *list, void *ptr)
|
||||
{
|
||||
void *ret;
|
||||
if (!(ret = list_remove_if_exists(list, ptr)))
|
||||
|
@ -499,11 +314,12 @@ void *list_remove(list_t *list, const void *ptr)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void *list_get(list_t *list, const void *ptr)
|
||||
void *list_get(list_t *list, void *ptr)
|
||||
{
|
||||
struct list_item *it;
|
||||
|
||||
assert_msg(list->cmp, "list_get: list does not have a cmp function");
|
||||
if (!list->cmp)
|
||||
fatal("list_get: list does not have a cmp function\n");
|
||||
|
||||
for (it = list->first; it; it = it->next) {
|
||||
if (list->cmp(it->ptr, ptr) == 0)
|
||||
|
@ -514,29 +330,30 @@ void *list_get(list_t *list, const void *ptr)
|
|||
|
||||
int list_is_empty(list_t *l)
|
||||
{
|
||||
assert(l);
|
||||
return (l->first ? 0 : 1);
|
||||
}
|
||||
|
||||
void list_it_init(list_t *list, list_iterator_t *ti)
|
||||
{
|
||||
assert(list && ti);
|
||||
ti->list = list;
|
||||
ti->cur = list->first;
|
||||
ti->next = NULL;
|
||||
}
|
||||
|
||||
void list_it_init_last(list_t *list, list_iterator_t *ti)
|
||||
void list_it_next(list_iterator_t *ti)
|
||||
{
|
||||
assert(list && ti);
|
||||
ti->list = list;
|
||||
ti->cur = list->last;
|
||||
ti->next = NULL;
|
||||
if (ti->cur)
|
||||
ti->cur = ti->cur->next;
|
||||
}
|
||||
|
||||
void *list_it_item(list_iterator_t *ti)
|
||||
{
|
||||
if (!ti->cur)
|
||||
return NULL;
|
||||
return ti->cur->ptr;
|
||||
}
|
||||
|
||||
void *list_it_remove(list_iterator_t *li)
|
||||
{
|
||||
assert(li);
|
||||
if (!li->cur)
|
||||
return NULL;
|
||||
|
||||
|
@ -552,34 +369,24 @@ void *list_it_remove(list_iterator_t *li)
|
|||
|
||||
void *ptr = li->cur->ptr;
|
||||
struct list_item *item = li->cur;
|
||||
li->next = li->cur->next;
|
||||
li->cur = NULL;
|
||||
li->cur = li->cur->next;
|
||||
free(item);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void list_free(list_t *t)
|
||||
{
|
||||
assert(t);
|
||||
assert(list_is_empty(t));
|
||||
if (t->first != NULL)
|
||||
fprintf(stderr, "Warning, freeing non empty list\n");
|
||||
free(t);
|
||||
}
|
||||
|
||||
void list_append(list_t *dest, list_t *src)
|
||||
void list_append(list_t *src, list_t *dest)
|
||||
{
|
||||
assert(dest && src);
|
||||
if (src->last == NULL)
|
||||
return;
|
||||
if (dest->first == NULL) {
|
||||
dest->first = src->first;
|
||||
dest->last = src->last;
|
||||
src->first = src->last = NULL;
|
||||
return;
|
||||
}
|
||||
src->first->prev = dest->last;
|
||||
dest->last->next = src->first;
|
||||
dest->last = src->last;
|
||||
src->first = src->last = NULL;
|
||||
list_iterator_t it;
|
||||
|
||||
for (list_it_init(src, &it); list_it_item(&it); list_it_next(&it))
|
||||
list_add_last(dest, list_it_item(&it));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -591,7 +398,7 @@ struct hash_item {
|
|||
void *item;
|
||||
};
|
||||
|
||||
static int hash_item_nocase_cmp(const struct hash_item *a, const char *b)
|
||||
static int hash_item_nocase_cmp(struct hash_item *a, char *b)
|
||||
{
|
||||
return strcasecmp(a->key, b);
|
||||
}
|
||||
|
@ -604,20 +411,16 @@ static int hash_item_cmp(struct hash_item *a, char *b)
|
|||
void hash_init(hash_t *h, int options)
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(h);
|
||||
memset(h, 0, sizeof(hash_t));
|
||||
for (i = 0; i < 256; i++) {
|
||||
switch (options) {
|
||||
case HASH_NOCASE:
|
||||
list_init(&h->lists[i],
|
||||
(int (*)(const void *,
|
||||
const void *))hash_item_nocase_cmp);
|
||||
(int (*)(void*,void*))hash_item_nocase_cmp);
|
||||
break;
|
||||
case HASH_DEFAULT:
|
||||
list_init(&h->lists[i],
|
||||
(int (*)(const void *,
|
||||
const void *))hash_item_cmp);
|
||||
(int (*)(void*,void*))hash_item_cmp);
|
||||
break;
|
||||
default:
|
||||
fatal("wrong hash option %d", options);
|
||||
|
@ -628,20 +431,14 @@ void hash_init(hash_t *h, int options)
|
|||
void hash_clean(hash_t *h)
|
||||
{
|
||||
int i;
|
||||
struct hash_item *hi;
|
||||
|
||||
assert(h);
|
||||
for (i = 0; i < 256; i++) {
|
||||
while ((hi = list_remove_first(&h->lists[i]))) {
|
||||
free(hi->key);
|
||||
free(hi);
|
||||
}
|
||||
while (list_remove_first(&h->lists[i]))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void hash_free(hash_t *h)
|
||||
{
|
||||
assert(h);
|
||||
hash_clean(h);
|
||||
free(h);
|
||||
}
|
||||
|
@ -649,75 +446,60 @@ void hash_free(hash_t *h)
|
|||
hash_t *hash_new(int options)
|
||||
{
|
||||
hash_t *h;
|
||||
h = bip_malloc(sizeof(hash_t));
|
||||
h = malloc(sizeof(hash_t));
|
||||
if (!h)
|
||||
fatal("malloc");
|
||||
hash_init(h, options);
|
||||
return h;
|
||||
}
|
||||
|
||||
/* Now we have a real hash, but we use only the last byte of it :p */
|
||||
static unsigned char hash_func(const char *pkey)
|
||||
static unsigned char hash_func(char *pkey)
|
||||
{
|
||||
char c;
|
||||
unsigned long hash = 5381; /* 5381 & 0xff makes more sense */
|
||||
|
||||
// toupper should not return negative values (only char compatible int)
|
||||
while ((c = *pkey++))
|
||||
hash = ((hash << 5) + hash) ^ (long unsigned)toupper(c);
|
||||
hash = ((hash << 5) + hash) ^ toupper(c);
|
||||
return (unsigned char)hash;
|
||||
}
|
||||
|
||||
void hash_insert(hash_t *hash, const char *key, void *ptr)
|
||||
void hash_insert(hash_t *hash, char *key, void *ptr)
|
||||
{
|
||||
struct hash_item *it;
|
||||
|
||||
assert(hash && key);
|
||||
if (hash_get(hash, key))
|
||||
fatal("Element with key %s already in hash %x\n", key, hash);
|
||||
|
||||
it = bip_malloc(sizeof(struct hash_item));
|
||||
it->key = bip_strdup(key);
|
||||
it = malloc(sizeof(struct hash_item));
|
||||
if (!it)
|
||||
fatal("malloc");
|
||||
it->key = strdup(key);
|
||||
it->item = ptr;
|
||||
list_add_first(&hash->lists[hash_func(key)], it);
|
||||
}
|
||||
|
||||
int hash_includes(hash_t *hash, const char *key)
|
||||
void *hash_get(hash_t *hash, char *key)
|
||||
{
|
||||
struct hash_item *hi;
|
||||
list_t *list;
|
||||
|
||||
assert(hash && key);
|
||||
list = &hash->lists[hash_func(key)];
|
||||
hi = list_get(list, key);
|
||||
return hi != NULL;
|
||||
}
|
||||
|
||||
void *hash_get(hash_t *hash, const char *key)
|
||||
{
|
||||
struct hash_item *hi;
|
||||
list_t *list;
|
||||
|
||||
assert(hash && key);
|
||||
list = &hash->lists[hash_func(key)];
|
||||
list_t *list = &hash->lists[hash_func(key)];
|
||||
hi = list_get(list, key);
|
||||
if (!hi)
|
||||
return NULL;
|
||||
return hi->item;
|
||||
}
|
||||
|
||||
void *hash_remove_if_exists(hash_t *hash, const char *key)
|
||||
void *hash_remove_if_exists(hash_t *hash, char *key)
|
||||
{
|
||||
assert(hash && key);
|
||||
if (hash_get(hash, key) == NULL)
|
||||
return NULL;
|
||||
return hash_remove(hash, key);
|
||||
}
|
||||
|
||||
void *hash_remove(hash_t *hash, const char *key)
|
||||
void *hash_remove(hash_t *hash, char *key)
|
||||
{
|
||||
struct hash_item *it;
|
||||
void *ptr;
|
||||
|
||||
assert(hash && key);
|
||||
it = (struct hash_item *)list_remove(&hash->lists[hash_func(key)], key);
|
||||
if (!it)
|
||||
return NULL;
|
||||
|
@ -727,121 +509,68 @@ void *hash_remove(hash_t *hash, const char *key)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
int hash_is_empty(hash_t *h)
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(h);
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (!list_is_empty(&h->lists[i]))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void hash_it_init(hash_t *h, hash_iterator_t *hi)
|
||||
{
|
||||
assert(h);
|
||||
memset(hi, 0, sizeof(hash_iterator_t));
|
||||
hi->hash = h;
|
||||
|
||||
while (hi->list < 256 && list_is_empty(&h->lists[hi->list]))
|
||||
while (list_is_empty(&h->lists[hi->list]) && hi->list < 256)
|
||||
hi->list++;
|
||||
if (hi->list < 256)
|
||||
list_it_init(&h->lists[hi->list], &hi->lit);
|
||||
hi->cur = h->lists[hi->list].first;
|
||||
else
|
||||
hi->cur = NULL;
|
||||
}
|
||||
|
||||
void hash_it_next(hash_iterator_t *hi)
|
||||
{
|
||||
assert(hi);
|
||||
list_it_next(&hi->lit);
|
||||
if (!list_it_item(&hi->lit)) {
|
||||
do {
|
||||
hi->list++;
|
||||
if (hi->list == 256)
|
||||
return;
|
||||
} while (list_is_empty(&hi->hash->lists[hi->list]));
|
||||
list_it_init(&hi->hash->lists[hi->list], &hi->lit);
|
||||
hash_t *hash = hi->hash;
|
||||
|
||||
hi->cur = hi->cur->next;
|
||||
while (!hi->cur) {
|
||||
hi->list++;
|
||||
if (hi->list == 256) {
|
||||
hi->cur = NULL;
|
||||
return;
|
||||
}
|
||||
hi->cur = hash->lists[hi->list].first;
|
||||
}
|
||||
}
|
||||
|
||||
void *hash_it_item(hash_iterator_t *h)
|
||||
{
|
||||
struct hash_item *hi;
|
||||
|
||||
assert(h);
|
||||
hi = list_it_item(&h->lit);
|
||||
if (!hi)
|
||||
if (!h->cur)
|
||||
return NULL;
|
||||
struct hash_item *hi = h->cur->ptr;
|
||||
return hi->item;
|
||||
}
|
||||
|
||||
const char *hash_it_key(hash_iterator_t *h)
|
||||
char *hash_it_key(hash_iterator_t *h)
|
||||
{
|
||||
struct hash_item *hi;
|
||||
|
||||
assert(h);
|
||||
hi = list_it_item(&h->lit);
|
||||
if (!hi)
|
||||
if (!h->cur)
|
||||
return NULL;
|
||||
struct hash_item *hi = h->cur->ptr;
|
||||
return hi->key;
|
||||
}
|
||||
|
||||
void *hash_it_remove(hash_iterator_t *hi)
|
||||
{
|
||||
struct hash_item *hitem;
|
||||
void *ptr;
|
||||
|
||||
assert(hi);
|
||||
hitem = list_it_remove(&hi->lit);
|
||||
|
||||
ptr = hitem->item;
|
||||
free(hitem->key);
|
||||
free(hitem);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void hash_dump(hash_t *h)
|
||||
{
|
||||
hash_iterator_t it;
|
||||
assert(h);
|
||||
for (hash_it_init(h, &it); hash_it_key(&it); hash_it_next(&it))
|
||||
for (hash_it_init(h, &it); hash_it_item(&it) ;hash_it_next(&it))
|
||||
printf("%s => %p\n", hash_it_key(&it), hash_it_item(&it));
|
||||
}
|
||||
|
||||
list_t *hash_keys(hash_t *hash)
|
||||
{
|
||||
hash_iterator_t hi;
|
||||
list_t *ret;
|
||||
|
||||
assert(hash);
|
||||
ret = list_new(NULL);
|
||||
|
||||
for (hash_it_init(hash, &hi); hash_it_item(&hi); hash_it_next(&hi))
|
||||
list_add_last(ret, bip_strdup(hash_it_key(&hi)));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void hash_rename_key(hash_t *h, const char *oldk, const char *newk)
|
||||
{
|
||||
assert(h && oldk && newk);
|
||||
if (strcmp(oldk, newk) == 0)
|
||||
return;
|
||||
hash_insert(h, newk, hash_remove(h, oldk));
|
||||
}
|
||||
|
||||
char *bip_strmaydup(char *s)
|
||||
char *strmaydup(char *s)
|
||||
{
|
||||
if (!s)
|
||||
return s;
|
||||
return bip_strdup(s);
|
||||
return strdup(s);
|
||||
}
|
||||
|
||||
void strucase(char *s)
|
||||
{
|
||||
while (*s) {
|
||||
*s = (char)toupper(*s); // toupper, safe to cast to char
|
||||
*s = toupper(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
@ -851,81 +580,3 @@ int ischannel(char p)
|
|||
return (p == '#' || p == '&' || p == '+' || p == '!');
|
||||
}
|
||||
|
||||
void array_init(array_t *a)
|
||||
{
|
||||
memset(a, 0, sizeof(array_t));
|
||||
}
|
||||
|
||||
array_t *array_new(void)
|
||||
{
|
||||
array_t *a;
|
||||
|
||||
a = bip_malloc(sizeof(array_t));
|
||||
array_init(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
void array_ensure(array_t *a, int index)
|
||||
{
|
||||
assert(a && index >= 0);
|
||||
|
||||
if (array_includes(a, index))
|
||||
return;
|
||||
a->elemv = bip_realloc(a->elemv, sizeof(void *) * (size_t)(index + 1));
|
||||
// a->elemc should be lower than index + 1
|
||||
memset(a->elemv + a->elemc, 0,
|
||||
sizeof(void *) * (size_t)(index + 1 - a->elemc));
|
||||
a->elemc = index + 1;
|
||||
}
|
||||
|
||||
const void *array_drop(array_t *a, int index)
|
||||
{
|
||||
int i;
|
||||
const void *ret;
|
||||
|
||||
assert(a && array_includes(a, index));
|
||||
|
||||
ret = a->elemv[index];
|
||||
for (i = index; i < array_count(a) - 1; i++)
|
||||
a->elemv[i] = a->elemv[i + 1];
|
||||
a->elemc--;
|
||||
return ret;
|
||||
}
|
||||
|
||||
array_t *array_extract(array_t *a, int index, int upto)
|
||||
{
|
||||
array_t *ret;
|
||||
int i;
|
||||
|
||||
assert(a && array_includes(a, index));
|
||||
if (upto == -1)
|
||||
upto = a->elemc;
|
||||
assert((index == 0 && upto == 0) || array_includes(a, upto - 1));
|
||||
assert(index <= upto);
|
||||
|
||||
ret = array_new();
|
||||
if (index == upto)
|
||||
return ret;
|
||||
|
||||
/* here we have index < upto */
|
||||
array_ensure(ret, upto - index - 1);
|
||||
for (i = 0; i < ret->elemc; i++)
|
||||
ret->elemv[i] = a->elemv[i + index];
|
||||
return ret;
|
||||
}
|
||||
|
||||
void array_deinit(array_t *a)
|
||||
{
|
||||
assert(a);
|
||||
if (a->elemv)
|
||||
free(a->elemv);
|
||||
array_init(a);
|
||||
}
|
||||
|
||||
void array_free(array_t *a)
|
||||
{
|
||||
assert(a);
|
||||
if (a->elemv)
|
||||
free(a->elemv);
|
||||
free(a);
|
||||
}
|
||||
|
|
198
src/util.h
198
src/util.h
|
@ -2,8 +2,7 @@
|
|||
* $Id: util.h,v 1.35 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
|
@ -16,10 +15,9 @@
|
|||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Warning: must be in order, 0 = less output */
|
||||
#define LOG_STD -1
|
||||
#define LOG_FATAL 0
|
||||
#define LOG_ERROR 1
|
||||
#define LOG_WARN 2
|
||||
|
@ -31,93 +29,39 @@
|
|||
#define HASH_NOCASE 1
|
||||
#define HASH_DEFAULT 0
|
||||
|
||||
#define SOFT_FAIL 0
|
||||
#define HARD_FAIL 1
|
||||
|
||||
void mylog(int level, char *fmt, ...);
|
||||
void _mylog(int level, char *fmt, va_list ap);
|
||||
void fatal(char *fmt, ...);
|
||||
char *timestamp(void);
|
||||
struct hash_item;
|
||||
struct list_item;
|
||||
|
||||
struct list_item {
|
||||
struct list_item *next;
|
||||
struct list_item *prev;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
typedef struct list {
|
||||
struct list_item *first;
|
||||
struct list_item *last;
|
||||
int (*cmp)();
|
||||
} list_t;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
typedef struct list_iterator {
|
||||
list_t *list;
|
||||
struct list_item *cur;
|
||||
struct list_item *next;
|
||||
} list_iterator_t;
|
||||
|
||||
/* our hash is also a list */
|
||||
typedef struct hash {
|
||||
list_t lists[256];
|
||||
} hash_t;
|
||||
|
||||
typedef struct hash_iterator {
|
||||
int list;
|
||||
list_iterator_t lit;
|
||||
struct hash_item *cur;
|
||||
struct list_item *cur;
|
||||
hash_t *hash;
|
||||
} hash_iterator_t;
|
||||
|
||||
typedef struct array {
|
||||
int elemc;
|
||||
const void **elemv;
|
||||
} array_t;
|
||||
|
||||
#define MOVE_STRING(dest, src) \
|
||||
do { \
|
||||
if (dest) \
|
||||
free(dest); \
|
||||
(dest) = (src); \
|
||||
(src) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define FREE(a) \
|
||||
free(a); \
|
||||
(a) = NULL;
|
||||
|
||||
#define MAYFREE(a) \
|
||||
do { \
|
||||
if (a) { \
|
||||
free(a); \
|
||||
(a) = NULL; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define assert(condition) \
|
||||
do { \
|
||||
if (!(condition)) \
|
||||
fatal("Failed assertion in " __FILE__ \
|
||||
"(%d): " #condition, \
|
||||
__LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define assert_msg(condition, msg) \
|
||||
do { \
|
||||
if (!(condition)) \
|
||||
fatal("%s in " __FILE__ "(%d): " #condition, (msg), \
|
||||
__LINE__); \
|
||||
} while (0)
|
||||
|
||||
void list_init(list_t *list, int (*cmp)(const void *, const void *));
|
||||
int list_ptr_cmp(const void *a, const void *b);
|
||||
list_t *list_new(int (*cmp)(const void *, const void *));
|
||||
void *list_remove(list_t *list, const void *ptr);
|
||||
void *list_remove_if_exists(list_t *list, const void *ptr);
|
||||
void *list_get(list_t *list, const void *ptr);
|
||||
void list_init(list_t *list, int (*cmp)(void*,void*));
|
||||
int list_ptr_cmp(void *a, void *b);
|
||||
list_t *list_new(int (*cmp)(void *, void *));
|
||||
void *list_remove(list_t *list, void *ptr);
|
||||
void *list_remove_if_exists(list_t *list, void *ptr);
|
||||
void *list_get(list_t *list, void *ptr);
|
||||
void list_add_first(list_t *list, void *ptr);
|
||||
void list_add_first_uniq(list_t *list, void *ptr);
|
||||
void list_add_last(list_t *list, void *ptr);
|
||||
|
@ -126,131 +70,31 @@ void *list_get_last(list_t *list);
|
|||
void *list_remove_first(list_t *list);
|
||||
void *list_remove_last(list_t *list);
|
||||
void list_it_init(list_t *list, list_iterator_t *ti);
|
||||
void list_it_init_last(list_t *list, list_iterator_t *ti);
|
||||
void list_it_next(list_iterator_t *ti);
|
||||
void *list_it_item(list_iterator_t *ti);
|
||||
void *list_it_remove(list_iterator_t *li);
|
||||
void list_free(list_t *t);
|
||||
void list_append(list_t *dest, list_t *src);
|
||||
void list_copy(list_t *src, list_t *dest);
|
||||
void list_append(list_t *src, list_t *dest);
|
||||
int list_is_empty(list_t *l);
|
||||
|
||||
static inline void list_it_next(list_iterator_t *ti)
|
||||
{
|
||||
assert(ti);
|
||||
if (ti->cur) {
|
||||
if (ti->next)
|
||||
fatal("list_it_next: inconsistent iterator state");
|
||||
ti->cur = ti->cur->next;
|
||||
} else if (ti->next) {
|
||||
ti->cur = ti->next;
|
||||
ti->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void *list_it_item(list_iterator_t *ti)
|
||||
{
|
||||
assert(ti);
|
||||
if (!ti->cur)
|
||||
return NULL;
|
||||
return ti->cur->ptr;
|
||||
}
|
||||
|
||||
|
||||
void hash_init(hash_t *h, int);
|
||||
void hash_free(hash_t *h);
|
||||
void hash_clean(hash_t *h);
|
||||
hash_t *hash_new(int options);
|
||||
void hash_insert(hash_t *hash, const char *key, void *ptr);
|
||||
int hash_includes(hash_t *hash, const char *key);
|
||||
void *hash_get(hash_t *, const char *key);
|
||||
void *hash_remove(hash_t *hash, const char *key);
|
||||
void *hash_remove_if_exists(hash_t *hash, const char *key);
|
||||
int hash_is_empty(hash_t *h);
|
||||
void hash_insert(hash_t *hash, char *key, void *ptr);
|
||||
void *hash_get(hash_t *, char *key);
|
||||
void *hash_remove(hash_t *hash, char *key);
|
||||
void *hash_remove_if_exists(hash_t *hash, char *key);
|
||||
void hash_it_init(hash_t *hash, hash_iterator_t *i);
|
||||
void hash_it_next(hash_iterator_t *hi);
|
||||
void *hash_it_item(hash_iterator_t *h);
|
||||
const char *hash_it_key(hash_iterator_t *h);
|
||||
void *hash_it_remove(hash_iterator_t *li);
|
||||
list_t *hash_keys(hash_t *hash);
|
||||
void hash_rename_key(hash_t *h, const char *oldk, const char *newk);
|
||||
char *hash_it_key(hash_iterator_t *h);
|
||||
|
||||
int is_valid_nick(char *str);
|
||||
int is_valid_username(char *str);
|
||||
char *bip_strmaydup(char *s);
|
||||
char *strmaydup(char *s);
|
||||
|
||||
void strucase(char *s);
|
||||
int ischannel(char p);
|
||||
char *hrtime(time_t t);
|
||||
#ifdef HAVE_LIBSSL
|
||||
char *checkmode2text(int v);
|
||||
#endif
|
||||
#define bool2text(v) ((v) ? "true" : "false")
|
||||
void *bip_malloc(size_t size);
|
||||
void *bip_calloc(size_t nmemb, size_t size);
|
||||
void *bip_realloc(void *ptr, size_t size);
|
||||
void bip_cfree(const void *ptr);
|
||||
char *bip_strdup(const char *str);
|
||||
char *bip_strcat_fit(size_t *remaining, char *str, const char *str2);
|
||||
char *bip_strcatf_fit(size_t *remaining, char *str, const char *str2, ...);
|
||||
void bip_clock_gettime(clockid_t clockid, struct timespec *tp);
|
||||
#define array_each(a, idx, ptr) \
|
||||
for ((idx) = 0; (idx) < (a)->elemc \
|
||||
&& (((ptr) = bip_strdup(array_get((a), (idx)))) || 1); \
|
||||
(idx)++)
|
||||
|
||||
void array_init(array_t *a);
|
||||
array_t *array_new(void);
|
||||
void array_ensure(array_t *a, int index);
|
||||
array_t *array_extract(array_t *a, int index, int upto);
|
||||
void array_deinit(array_t *a);
|
||||
void array_free(array_t *a);
|
||||
const void *array_drop(array_t *a, int index);
|
||||
static inline int array_count(array_t *a)
|
||||
{
|
||||
assert(a);
|
||||
return a->elemc;
|
||||
}
|
||||
|
||||
static inline int array_includes(array_t *a, int index)
|
||||
{
|
||||
assert(a && index >= 0);
|
||||
return a->elemc > index;
|
||||
}
|
||||
|
||||
static inline void array_set(array_t *a, int index, void *ptr)
|
||||
{
|
||||
assert(a);
|
||||
array_ensure(a, index);
|
||||
a->elemv[index] = ptr;
|
||||
}
|
||||
|
||||
static inline const void *array_get(array_t *a, int index)
|
||||
{
|
||||
assert(a && array_includes(a, index));
|
||||
return a->elemv[index];
|
||||
}
|
||||
|
||||
static inline void array_push(array_t *a, void *ptr)
|
||||
{
|
||||
int idx;
|
||||
|
||||
assert(a);
|
||||
idx = a->elemc;
|
||||
array_ensure(a, idx);
|
||||
a->elemv[idx] = ptr;
|
||||
}
|
||||
|
||||
static inline void *array_pop(array_t *a)
|
||||
{
|
||||
assert(a);
|
||||
if (a->elemc == 0)
|
||||
return NULL;
|
||||
if (a->elemc == 1) {
|
||||
void *ptr = bip_strdup(a->elemv[0]);
|
||||
free(a->elemv);
|
||||
a->elemv = NULL;
|
||||
a->elemc = 0;
|
||||
return ptr;
|
||||
}
|
||||
return (void *)bip_strdup(a->elemv[--a->elemc]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Base64 encoding/decoding (RFC1341)
|
||||
* Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2022 Loïc Gomez
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "base64.h"
|
||||
|
||||
static const unsigned char base64_table[65] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
/**
|
||||
* base64_encode - Base64 encode
|
||||
* @src: Data to be encoded
|
||||
* @len: Length of the data to be encoded
|
||||
* @out_len: Pointer to output length variable, or %NULL if not used
|
||||
* Returns: Allocated buffer of out_len bytes of encoded data,
|
||||
* or %NULL on failure
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer. Returned buffer is
|
||||
* nul terminated to make it easier to use as a C string. The nul terminator is
|
||||
* not included in out_len.
|
||||
*
|
||||
* BIP change: remove line returns.
|
||||
*/
|
||||
unsigned char *base64_encode(const unsigned char *src, size_t len,
|
||||
size_t *out_len)
|
||||
{
|
||||
unsigned char *out, *pos;
|
||||
const unsigned char *end, *in;
|
||||
size_t olen;
|
||||
int line_len;
|
||||
|
||||
olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
|
||||
olen += olen / 72; /* line feeds */
|
||||
olen++; /* nul termination */
|
||||
if (olen < len)
|
||||
return NULL; /* integer overflow */
|
||||
out = malloc(olen);
|
||||
if (out == NULL)
|
||||
return NULL;
|
||||
|
||||
end = src + len;
|
||||
in = src;
|
||||
pos = out;
|
||||
line_len = 0;
|
||||
while (end - in >= 3) {
|
||||
*pos++ = base64_table[in[0] >> 2];
|
||||
*pos++ = base64_table[((in[0] & 0x03) << 4) | (in[1] >> 4)];
|
||||
*pos++ = base64_table[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
|
||||
*pos++ = base64_table[in[2] & 0x3f];
|
||||
in += 3;
|
||||
line_len += 4;
|
||||
/*
|
||||
* BIP change: remove line returns.
|
||||
if (line_len >= 72) {
|
||||
*pos++ = '\n';
|
||||
line_len = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (end - in) {
|
||||
*pos++ = base64_table[in[0] >> 2];
|
||||
if (end - in == 1) {
|
||||
*pos++ = base64_table[(in[0] & 0x03) << 4];
|
||||
*pos++ = '=';
|
||||
} else {
|
||||
*pos++ = base64_table[((in[0] & 0x03) << 4)
|
||||
| (in[1] >> 4)];
|
||||
*pos++ = base64_table[(in[1] & 0x0f) << 2];
|
||||
}
|
||||
*pos++ = '=';
|
||||
line_len += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* BIP change: remove line returns.
|
||||
if (line_len)
|
||||
*pos++ = '\n';
|
||||
*/
|
||||
|
||||
*pos = '\0';
|
||||
if (out_len)
|
||||
*out_len = (size_t)(pos - out);
|
||||
return out;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* Base64 encoding/decoding (RFC1341)
|
||||
* Copyright (c) 2005, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2022 Loïc Gomez
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
unsigned char *base64_encode(const unsigned char *src, size_t len,
|
||||
size_t *out_len);
|
||||
|
||||
#endif /* BASE64_H */
|
|
@ -0,0 +1 @@
|
|||
timestamp
|
|
@ -1,20 +0,0 @@
|
|||
Notes about systemd unit files for bip.
|
||||
|
||||
Distro specific commandline configuration is provided by installing a script
|
||||
named. A default script named bip_env.sh is provided.
|
||||
|
||||
This should write /run/sysconfig/bip based on configuration
|
||||
information such as in /etc/sysconfig/bip or /etc/defaults/bip. It is run once
|
||||
by bip-config.service.
|
||||
|
||||
Distro specific path for bip_env.sh script must be set using a
|
||||
bip-config.service.d/distrib.conf unit file drop-in:
|
||||
[Service]
|
||||
ExecStart=/path/to/bip_env.sh
|
||||
|
||||
bip_env.sh try some default paths for the default configuration file: either
|
||||
/etc/default/bip or /etc/sysconfig/bip.
|
||||
Optionaly, the default configuration file path can be set too:
|
||||
[Service]
|
||||
ExecStart=/path/to/bip_env.sh
|
||||
Environment=BIP_DEFAULT_CONFIG='/path/to/default/bip'
|
|
@ -1,12 +0,0 @@
|
|||
[Unit]
|
||||
Description=Preprocess Bip configuration
|
||||
After=local-fs.target
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
# Packagers must define:
|
||||
# - ExecStart=/path/to/bip_env.sh
|
||||
# - Environment='BIP_DEFAULT_CONFIG=/path/to/default/bip'
|
||||
# using a unit file drop-in bip-config.service.d/<distrib>.conf
|
|
@ -1,24 +0,0 @@
|
|||
[Unit]
|
||||
Description=Bip IRC Proxy
|
||||
Documentation=man:bip(1) man:bip.conf(5)
|
||||
Requires=network.target
|
||||
|
||||
Wants=bip-config.service
|
||||
After=bip-config.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/run/sysconfig/bip
|
||||
|
||||
Type=forking
|
||||
User=bip
|
||||
Group=bip
|
||||
ExecStartPre=/bin/sh -c '[ ${ENABLED:-1} != 0 ]'
|
||||
ExecStart=/usr/bin/bip $DAEMON_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
RuntimeDirectory=bip
|
||||
RuntimeDirectoryMode=0750
|
||||
KillMode=process
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Create /run/sysconfig/bip from default configuration file, for
|
||||
# bip-config.service
|
||||
|
||||
# BIP_DEFAULT_CONFIG environment variable can be defined by packagers in a
|
||||
# drop-in override of bip-config.service unit
|
||||
if [ -n "${BIP_DEFAULT_CONFIG}" ]; then
|
||||
# try some default paths
|
||||
if [ -r /etc/default/bip ]; then
|
||||
BIP_DEFAULT_CONFIG=/etc/default/bip
|
||||
. "${BIP_DEFAULT_CONFIG}"
|
||||
elif [ -r /etc/sysconfig/bip ]; then
|
||||
BIP_DEFAULT_CONFIG=/etc/sysconfig/bip
|
||||
. "${BIP_DEFAULT_CONFIG}"
|
||||
fi
|
||||
else
|
||||
. "${BIP_DEFAULT_CONFIG}"
|
||||
fi
|
||||
|
||||
ENABLED=${ENABLED:-1}
|
||||
|
||||
mkdir -p /run/sysconfig
|
||||
{
|
||||
echo ENABLED=${ENABLED}
|
||||
DAEMON_HOME=${DAEMON_HOME:-/var/lib/bip}
|
||||
DAEMON_CONFIG=${DAEMON_CONFIG:-/etc/bip/bip.conf}
|
||||
echo "DAEMON_ARGS=${DAEMON_ARGS:--f '${DAEMON_CONFIG}' -s '${DAEMON_HOME}'}"
|
||||
} > /run/sysconfig/bip
|
||||
|
||||
if [ ${ENABLED} = 0 ]; then
|
||||
echo "INFO: BIP is explicitely disabled (ENABLED == 0) in" \
|
||||
"'${BIP_DEFAULT_CONFIG}'."
|
||||
else
|
||||
if [ -n "${DAEMON_USER}" -o -n "${DAEMON_GROUP}" ]; then
|
||||
echo "ERROR: Using systemd, DAEMON_USER and DAEMON_GROUP could not" \
|
||||
"be defined using the default configuration file. A drop-in" \
|
||||
"override of bip-config.service unit need to be created instead."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
|
@ -1,5 +0,0 @@
|
|||
TESTS = check_line
|
||||
check_PROGRAMS = check_line
|
||||
check_line_SOURCES = check_line.c $(top_builddir)/src/line.h
|
||||
check_line_CFLAGS = @CHECK_CFLAGS@ $(OPENSSL_CFLAGS)
|
||||
check_line_LDADD = $(top_builddir)/src/libbip.a $(top_builddir)/src/libbiplex.a @CHECK_LIBS@ $(OPENSSL_LIBS)
|
|
@ -1,134 +0,0 @@
|
|||
#include <check.h>
|
||||
#include "../src/line.h"
|
||||
|
||||
START_TEST(test_line_init)
|
||||
{
|
||||
struct line line;
|
||||
irc_line_init(&line);
|
||||
irc_line_append(&line, "line");
|
||||
char *hi_string = irc_line_to_string(&line);
|
||||
ck_assert_str_eq(hi_string, "line\r\n");
|
||||
free(hi_string);
|
||||
_irc_line_deinit(&line);
|
||||
|
||||
struct line *line2 = irc_line_new();
|
||||
irc_line_append(line2, "line");
|
||||
hi_string = irc_line_to_string(line2);
|
||||
ck_assert_str_eq(hi_string, "line\r\n");
|
||||
free(hi_string);
|
||||
irc_line_free(line2);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_line_parse)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
ck_assert_int_eq(irc_line_count(line), 4);
|
||||
ck_assert(irc_line_includes(line, 0));
|
||||
ck_assert(irc_line_includes(line, 3));
|
||||
ck_assert(!irc_line_includes(line, 4));
|
||||
ck_assert_str_eq(line->origin, "origin");
|
||||
ck_assert_str_eq(irc_line_elem(line, 0), "COMMAND");
|
||||
ck_assert_str_eq(irc_line_elem(line, 1), "parameter1");
|
||||
ck_assert_str_eq(irc_line_elem(line, 2), "parameter2");
|
||||
ck_assert_str_eq(irc_line_elem(line, 3), "multi word parameter\r\n");
|
||||
irc_line_free(line);
|
||||
|
||||
line = irc_line_new_from_string(
|
||||
"COMMAND parameter1 parameter2 :multi word parameter\r\n");
|
||||
ck_assert_int_eq(irc_line_count(line), 4);
|
||||
ck_assert(irc_line_includes(line, 0));
|
||||
ck_assert(irc_line_includes(line, 3));
|
||||
ck_assert(!irc_line_includes(line, 4));
|
||||
ck_assert_str_eq(irc_line_elem(line, 0), "COMMAND");
|
||||
ck_assert_str_eq(irc_line_elem(line, 1), "parameter1");
|
||||
ck_assert_str_eq(irc_line_elem(line, 2), "parameter2");
|
||||
ck_assert_str_eq(irc_line_elem(line, 3), "multi word parameter\r\n");
|
||||
irc_line_free(line);
|
||||
|
||||
line = irc_line_new_from_string(":origin COMMAND\r\n");
|
||||
ck_assert_str_eq(line->origin, "origin");
|
||||
ck_assert_int_eq(irc_line_count(line), 1);
|
||||
ck_assert(irc_line_includes(line, 0));
|
||||
ck_assert(!irc_line_includes(line, 1));
|
||||
ck_assert_str_eq(irc_line_elem(line, 0), "COMMAND\r\n");
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_elem_equals)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
ck_assert(irc_line_elem_equals(line, 0, "COMMAND"));
|
||||
ck_assert(irc_line_elem_case_equals(line, 0, "command"));
|
||||
ck_assert(!irc_line_elem_equals(line, 0, "notcommand"));
|
||||
ck_assert(!irc_line_elem_case_equals(line, 0, "notcommand"));
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_line_pop)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
char *top = irc_line_pop(line);
|
||||
ck_assert_str_eq(top, "multi word parameter\r\n");
|
||||
free(top);
|
||||
top = irc_line_pop(line);
|
||||
ck_assert_str_eq(top, "parameter2");
|
||||
free(top);
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_line_drop)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
irc_line_drop(line, 1);
|
||||
ck_assert(irc_line_elem_equals(line, 0, "COMMAND"));
|
||||
ck_assert(irc_line_elem_equals(line, 1, "parameter2"));
|
||||
irc_line_drop(line, 0);
|
||||
ck_assert(irc_line_elem_equals(line, 0, "parameter2"));
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
Suite *money_suite(void)
|
||||
{
|
||||
Suite *s;
|
||||
TCase *tc_core;
|
||||
|
||||
s = suite_create("bip");
|
||||
|
||||
tc_core = tcase_create("core");
|
||||
|
||||
tcase_add_test(tc_core, test_line_init);
|
||||
tcase_add_test(tc_core, test_line_parse);
|
||||
tcase_add_test(tc_core, test_elem_equals);
|
||||
tcase_add_test(tc_core, test_line_pop);
|
||||
suite_add_tcase(s, tc_core);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int number_failed;
|
||||
Suite *s;
|
||||
SRunner *sr;
|
||||
|
||||
s = money_suite();
|
||||
sr = srunner_create(s);
|
||||
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
number_failed = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
|
@ -0,0 +1,223 @@
|
|||
#! /bin/sh
|
||||
# ylwrap - wrapper for lex/yacc invocations.
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, 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.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case "$1" in
|
||||
'')
|
||||
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
--basedir)
|
||||
basedir=$2
|
||||
shift 2
|
||||
;;
|
||||
-h|--h*)
|
||||
cat <<\EOF
|
||||
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
|
||||
|
||||
Wrapper for lex/yacc invocations, renaming files as desired.
|
||||
|
||||
INPUT is the input file
|
||||
OUTPUT is one file PROG generates
|
||||
DESIRED is the file we actually want instead of OUTPUT
|
||||
PROGRAM is program to run
|
||||
ARGS are passed to PROG
|
||||
|
||||
Any number of OUTPUT,DESIRED pairs may be used.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v|--v*)
|
||||
echo "ylwrap $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# The input.
|
||||
input="$1"
|
||||
shift
|
||||
case "$input" in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
# Absolute path; do nothing.
|
||||
;;
|
||||
*)
|
||||
# Relative path. Make it absolute.
|
||||
input="`pwd`/$input"
|
||||
;;
|
||||
esac
|
||||
|
||||
pairlist=
|
||||
while test "$#" -ne 0; do
|
||||
if test "$1" = "--"; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
pairlist="$pairlist $1"
|
||||
shift
|
||||
done
|
||||
|
||||
# The program to run.
|
||||
prog="$1"
|
||||
shift
|
||||
# Make any relative path in $prog absolute.
|
||||
case "$prog" in
|
||||
[\\/]* | ?:[\\/]*) ;;
|
||||
*[\\/]*) prog="`pwd`/$prog" ;;
|
||||
esac
|
||||
|
||||
# FIXME: add hostname here for parallel makes that run commands on
|
||||
# other machines. But that might take us over the 14-char limit.
|
||||
dirname=ylwrap$$
|
||||
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
|
||||
mkdir $dirname || exit 1
|
||||
|
||||
cd $dirname
|
||||
|
||||
case $# in
|
||||
0) $prog "$input" ;;
|
||||
*) $prog "$@" "$input" ;;
|
||||
esac
|
||||
ret=$?
|
||||
|
||||
if test $ret -eq 0; then
|
||||
set X $pairlist
|
||||
shift
|
||||
first=yes
|
||||
# Since DOS filename conventions don't allow two dots,
|
||||
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
|
||||
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
|
||||
y_tab_nodot="no"
|
||||
if test -f y_tab.c || test -f y_tab.h; then
|
||||
y_tab_nodot="yes"
|
||||
fi
|
||||
|
||||
# The directory holding the input.
|
||||
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
|
||||
# Quote $INPUT_DIR so we can use it in a regexp.
|
||||
# FIXME: really we should care about more than `.' and `\'.
|
||||
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
|
||||
|
||||
while test "$#" -ne 0; do
|
||||
from="$1"
|
||||
# Handle y_tab.c and y_tab.h output by DOS
|
||||
if test $y_tab_nodot = "yes"; then
|
||||
if test $from = "y.tab.c"; then
|
||||
from="y_tab.c"
|
||||
else
|
||||
if test $from = "y.tab.h"; then
|
||||
from="y_tab.h"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test -f "$from"; then
|
||||
# If $2 is an absolute path name, then just use that,
|
||||
# otherwise prepend `../'.
|
||||
case "$2" in
|
||||
[\\/]* | ?:[\\/]*) target="$2";;
|
||||
*) target="../$2";;
|
||||
esac
|
||||
|
||||
# We do not want to overwrite a header file if it hasn't
|
||||
# changed. This avoid useless recompilations. However the
|
||||
# parser itself (the first file) should always be updated,
|
||||
# because it is the destination of the .y.c rule in the
|
||||
# Makefile. Divert the output of all other files to a temporary
|
||||
# file so we can compare them to existing versions.
|
||||
if test $first = no; then
|
||||
realtarget="$target"
|
||||
target="tmp-`echo $target | sed s/.*[\\/]//g`"
|
||||
fi
|
||||
# Edit out `#line' or `#' directives.
|
||||
#
|
||||
# We don't want the resulting debug information to point at
|
||||
# an absolute srcdir; it is better for it to just mention the
|
||||
# .y file with no path.
|
||||
#
|
||||
# We want to use the real output file name, not yy.lex.c for
|
||||
# instance.
|
||||
#
|
||||
# We want the include guards to be adjusted too.
|
||||
FROM=`echo "$from" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
|
||||
TARGET=`echo "$2" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
|
||||
|
||||
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
|
||||
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
|
||||
|
||||
# Check whether header files must be updated.
|
||||
if test $first = no; then
|
||||
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
|
||||
echo "$2" is unchanged
|
||||
rm -f "$target"
|
||||
else
|
||||
echo updating "$2"
|
||||
mv -f "$target" "$realtarget"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# A missing file is only an error for the first file. This
|
||||
# is a blatant hack to let us support using "yacc -d". If -d
|
||||
# is not specified, we don't want an error when the header
|
||||
# file is "missing".
|
||||
if test $first = yes; then
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
shift
|
||||
shift
|
||||
first=no
|
||||
done
|
||||
else
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
# Remove the directory.
|
||||
cd ..
|
||||
rm -rf $dirname
|
||||
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
Loading…
Reference in New Issue