Browse Source

Version S 1.0

master
Patrick Foubet 3 weeks ago
parent
commit
dcf0d317cd
31 changed files with 16031 additions and 0 deletions
  1. +9
    -0
      Septime/AUTHORS
  2. +1349
    -0
      Septime/COPYING
  3. +232
    -0
      Septime/ChangeLog
  4. +235
    -0
      Septime/INSTALL
  5. +7
    -0
      Septime/Makefile.am
  6. +782
    -0
      Septime/Makefile.in
  7. +4
    -0
      Septime/NEWS
  8. +72
    -0
      Septime/README
  9. +1135
    -0
      Septime/aclocal.m4
  10. +348
    -0
      Septime/compile
  11. +146
    -0
      Septime/config.h.in
  12. +6776
    -0
      Septime/configure
  13. +97
    -0
      Septime/configure.ac
  14. +791
    -0
      Septime/depcomp
  15. +518
    -0
      Septime/install-sh
  16. +215
    -0
      Septime/missing
  17. +12
    -0
      Septime/src/Makefile.am
  18. +604
    -0
      Septime/src/Makefile.in
  19. +324
    -0
      Septime/src/comsh.c
  20. +55
    -0
      Septime/src/comsh.h
  21. +20
    -0
      Septime/src/debug.h
  22. +76
    -0
      Septime/src/gen_t3.h
  23. +365
    -0
      Septime/src/gen_ypt.h
  24. +133
    -0
      Septime/src/gesip.c
  25. +30
    -0
      Septime/src/gesip.h
  26. +368
    -0
      Septime/src/lich.c
  27. +80
    -0
      Septime/src/lich.h
  28. +181
    -0
      Septime/src/regles.txt
  29. +964
    -0
      Septime/src/scannet.c
  30. +67
    -0
      Septime/src/trace.c
  31. +36
    -0
      Septime/src/trace.h

+ 9
- 0
Septime/AUTHORS View File

@@ -0,0 +1,9 @@
This file lists people who have made significant contribution in the Septime
project. Please see the ChangeLog for specific changes by author.
-------------------------------------------------------------------------

Patrick Foubet <patrick@e2li.org>
* Original program author, stable series maintainer.
* Cohesion of language supervisor. Multiple platform maintainer.



+ 1349
- 0
Septime/COPYING
File diff suppressed because it is too large
View File


+ 232
- 0
Septime/ChangeLog View File

@@ -0,0 +1,232 @@
History of Nife releases :

2022-01-04 - Nife 0.61 is released.
* Added a definition of HUGE for compilers that no longer have it in
math.h. Thanks to Jacques Godfrain Kounkou for his bug report !
* Added some "include" where it was missing.

2019-01-27 - Nife 0.60 is released.
* Updated headers to show that the project is still alive !
* The Nife official site is now : https://www.seriane.org/nife/

2016-08-15 - Nife 0.59 is released.
* Add implementation of data meta-stacks tools for context swapping :
[ and ] for respectively increment and decrement the numerical stack,
{ and } to do theses operations with the character stack,
( and ) to do the same thing with the logical stack,
and [* and ]* to operate on the three stacks.
* Fixed a bug causing an error with network functions netDt> and NetKey.
* The Nife official site is now : http://www.nifesys.org.

2015-08-10 - Nife 0.55 is released.
* Changing the log file contents to be able to use it for debugging.
The log file is in the subdirectory .nife. His name is the type
.nife_PID.log, PID being its number of pid.
We can display the content in real time with tail -f.
The .nifeNS_pid.log and .nifeRPC_PID.log files are those of the
server networks and its bodies.
Log files are deleted at the end of the Nife session unless an error
occured.
* Added "savelog function to save the logs before going out.
* Placing aid debugging functions. All these functions begin with the _
character and are listed with ?libp function.
* Added shell script command, ex/NifeDebugTerms, to facilitate
establishment and closing of the display terminals for the logs.
* Added the possibility, in graphic mode, to open or close
terminals with keys 'home' and 'end'. These functionalities are
based on performance in the window manager of the above script.
* Reorganization of system functions in the function stack.
* Improved tasks and consoles.
* Added the ability to execute external command interactively, with the
character ! at the beginning of the line.

2014-08-31 - Nife 0.51 is released.
* Finalising the version 1.0 of the functions dump and restore with the
definition of the NBLF, Nife Binary Linkable Format.
* Modify some labels to clarify the perception of internal mechanisms.
* Some modifications to avoid unnecessary warnings at compilation.
* Temporary suspension of some functions related to the dynamic aspect
of the language because, used improperly, it could be dangerous.
These functions will be include again, but with more explanations and
examples.

2014-06-27 - Nife 0.49 is released.
* Add DEC, HEX, OCT and BIN functions to define the print mode for the
integers. The default is decimal.
* Modify signals comportment to accept interrupt from terminal to stop
execution in the main (interactive) task.
* Fixed an error in the case of the end: label is before the onerr: one.
* Fixed a bug when a signal "segmentation violation" is catched.
* Add some help facilities suggested by Alain Empain, until his tools
are efficient in Nife.
* Beginning the functions dump and restore with definition of the NBLF,
Nife Binary Linkable Format (just for a Request for Comments ;-).
* The installation has been tested by Gaetan Angely on three ARM SBCs:
Raspberry Pi, Beaglebone Black, ODROID-U3 with Arch Linux ARM.
All information about Arch Linux ARM at http://archlinuxarm.org/.
He have compared with two Intel processors and have published a
benchmak on the two mailing lists.

2014-05-10 - Nife 0.47 is released.
* Beginning an I2C interface for Linux systems, inspired by the Linux
package i2c-tools.
* The I2C interface has been developped and tested by P. Foubet
with his students Elodie Kerfourn and Aymeric Diankouika. They
connected a Raspberry Pi with an Arduino board through the I2C bus
and wrote a Nife program to highlight the data exchange between the
two elements.
* The installation has been tested by Bernard Bonno on a Raspberry Pi
board Model A with Porteus ARM (based on a Slackware ARM 14.0).

2013-09-25 - Nife 0.44 is released.
* Fixed a bug causing a "segmentation violation" during compilation
of the Nife code on some systems as Raspberry Pi A and B and others.
This bug was reported by Bernard Bonno during tests on a Raspberry Pi
Model A with 256 Mo of memory.
* The installation has been tested by Bernard Bonno on a PC i484
with a Linux Porteus 2.0.
All information about Porteus at http://www.porteus.org/.

2013-09-09 - Nife 0.43 is released.
* Establishment of a sub-directory .nife to facilitate debugging and
store temporary files.
* Update some functions dependant on working directory.
* Fixed some bugs in the gplot tools due to new versions of gnuplot.
* The installation has been tested by Patrick Foubet on a Raspberry Pi
board Model B with standard Raspbian (Squeeze).
All information about the board at http://www.raspberrypi.org/faqs.

2012-10-23 - Nife 0.405 is released.
* Fixed a bug in the data transfer protocol STSP.
* Adding Dt indicators in the list giving by ?n function.
* Fixed a bug in the netDt> function.
* The installation has been tested by Patrick Foubet on a Beaglebone
board (Linux beaglebone 3.2.5+ #1 ... armv7l GNU/Linux) lended by the
school ESME Sudria for preparing a course on Linux drivers.
All information about the board at http://beagleboard.org/bone.

2012-09-01 - Nife 0.401 is released.
* Beginning the multi-threading mechanisms based on POSIX thread.
* Adding programmation tools end: and goto_end.
* Increasing error tracking :
- giving the file name and the line number,
- stopping compilation at first error,
- allowing load in load.
- adding functions ?err, noerr, messerr, ?lasterr and onerr: label.
* Dynamic code tools :
- "load to load a file in a user function,
- "exec to compile some code in a user function,
- functions ' and ` to specify names to be executed latter.
* Limit for all names at 24 characters.
* Modifying install variables functions to work in user functions.
* Adding the free-context loop with do mechanisms :
- do_next to bypass a loop in free-context,
- do_leave and *do_leave to leave one or many loops in free-context,
* Updating the sh command to use the SHELL environment variable.

2012-07-05 - Nife 0.341 is released.
* Adding more fonctions to deal with devices with Comedilib :
- write fonction available,
- define a default set of parameters to simplify programs.
* Update documentation for theses new commands.

2012-06-10 - Nife 0.323 is released.
* Continuing distributed systems tools elaborated with Thomas Pabst :
- Adding netCompile to load a Nife file on a remote Nife using NetKey.
If this file contains a call of one or more functions, they will be
executed, and the result will be send on the Net using NetKey.
- Adding NetErr to get the Net Error value.
* Adding the ex directory in src with some program examples :
- gp.nif, an example for gplot functions,
- rpc.nif and rpc2.nif for Nife RPC example.

2012-06-06 - Nife 0.320 is released.
* Beginning of the gplot module for use of gnuplot (www.gnuplot.info).
* adding theses functions :
- gplot and gplotM (multiple) to create gplots,
- gplotCmd to append text to the plot command,
- ?gp to list the gplots,
- del_gplot to delete a gplot,
- gplotAdd and gplotRepl (with replacement) to add values to plots,
- gplotClear to clear a display panel.
* The installation has been tested by Bruno Guilbert on a Fox board G20
(Debian debarm 2.6.38 with CPU Atmel AT91SAM9G20 based on ARM926EJ-S)
with the students TRSE2 of Ingesup-Paris :
All information about the board at www.acmesystems.it.

2012-05-22 - Nife 0.317 is released.
* Adding ndepth giving network stack depth using NetKey,
* Definition of principles for Nife RPC (remote procedure call).
* Adding netExec to execute a function on a remote Nife using NetKey.
* The installation has been tested by Dr Alain Empain (ulg.ac.be) on
Ubuntu Lucid 10.O4 (Linux 2.6.38-15 - x86_64)
* The installation has been tested by Paul Bartoldi (unige.ch) on
Ubuntu 12.O4 LTS (Linux 3.0.0-12 - x86_32)

2012-05-11 - Nife 0.315 is released.
* Beginning of distributed systems tools elaborated with Thomas Pabst :
- automatic evaluation of the dt values at network connection,
- adding netDt> to get the clock difference value beetween "network"
and Nife system.
* The installation has been tested on
Debian Wheezy Testing (Linux 3.2.0-2 - x86_32)

2012-05-04 - Nife 0.311 is released.
* Modifying errors traps to get a better bug resolution.
* The installation has been tested by Bernard Perrin (csem.ch) on
MacOS X Snow Leopard 10.6.8 (Darwin Kernel Vers 10.8.0 - x86_32)

2012-03-16 - Nife 0.307 is released.
* Adding auto-convergent loop : do ... loop
* Adding standards loop : do ... +loop
* Possibility to test the loop level and use indexes I, J and K.
* Adding del_ofunc to delete, by name, the oldest function,
* Adding del_afunc to delete all functions beginning by a prefix,
* Adding "exec to execute a user function giving her name on the
character stack.
* Adding "Var to create a variable giving her name on the character
stack.
* Rename functions sub[] in []-sub and *sub[] in *[]-sub to adopt a
more logical notation.

2012-03-08 - Nife 0.303 is released.
* This release is specially dedicated to my wife Christine.
* Now you can use nife with redirection or pîpe :
nife < fic.nif or cat fic.nif | nife
Thank you to Denis Bodor for the idea !

2012-02-22 - Nife 0.302 is released.
* Christophe Ondrejec has validate the site nife-project.org
* Updating README, NEWS and all informations files.
* The installation has been tested on :
- Debian Lenny (Linux 2.6.26-2 - x86_32)
- Debian Squeeze (Linux 2.6.32-5 - x86_64)
- Mac OS X (Darwin Kernel Version 8.11.1 - x86_32)
- Open BSD (Version 5.0 GENERIC#43 - x86_32)
- Solaris 11 (SunOS v 5.11 - x86_32)
- Fedora Core 15 (Linux 2.6.38-6 - x86_32)
- Open Suze 12.1 (Linux 3.1.0-1 - x86_64)
* Adding a benchmark test.

2012-02-13 - Nife 0.300 is released (internal).
* Upgrading for working on both 32 or 64 bits.
* Upgrading SCS (Sister Chip Signature) to accept data from machine
differents on code or addresses but using compatible datas.
* Integration of the GNU Autotools to generate the packages.

2011-11-13 - Nife 0.212 is released.
* Network tools with STSP (stack to stack protocol) v0.5 :
ie WITH ScS (Sister chip signature) v 1.
* correction of function []trot.
* new function []transp to transpose matrix.

2011-11-09 - Nife 0.209 is released.
* Network tools with STSP (stack to stack protocol) v.0 :
ie without ScS (Sister chip signature).

2011-10-31 - Nife 0.204 is released.

2011-10-26 - Nife 0.200 is released.

2011-09-18 - Nife 0.113 the first public release on Sourceforge.net.


+ 235
- 0
Septime/INSTALL View File

@@ -0,0 +1,235 @@
Installation Instructions
*************************

Copyright (C) 1994 to 2024 Free Software Foundation, Inc.

This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.

Basic Installation
==================

These are generic installation instructions.

The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, 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.)

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.

The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.

The simplest way to compile this package is:

1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.

Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.

2. Type `make' to compile the package.

3. Optionally, type `make check' to run any self-tests that come with
the package.

4. Type `make install' to install the programs and any data files and
documentation.

5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.

Compilers and Options
=====================

Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.

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=c89 CFLAGS=-O2 LIBS=-lposix

*Note Defining Variables::, for more details.

Compiling For Multiple Architectures
====================================

You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.

If you have to use a `make' that does not support 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'.

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.

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.

If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.

Optional Features
=================

Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.

For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.

Specifying the System Type
==========================

There may be some features `configure' 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:

CPU-COMPANY-SYSTEM

where SYSTEM can have one of these forms:

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'.

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.

Defining Variables
==================

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). Here is a another example:

/bin/bash ./configure CONFIG_SHELL=/bin/bash

Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.

`configure' Invocation
======================

`configure' recognizes the following options to control how it operates.

`--help'
`-h'
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'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).

`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.

`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.


+ 7
- 0
Septime/Makefile.am View File

@@ -0,0 +1,7 @@
#####################################################
# Makefile.am for septime project : upper directory #
#####################################################

EXTRA_DIST = src/regles.txt

SUBDIRS=src

+ 782
- 0
Septime/Makefile.in View File

@@ -0,0 +1,782 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2018 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@

#####################################################
# Makefile.am for septime project : upper directory #
#####################################################
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@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 = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-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 \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
COPYING ChangeLog INSTALL NEWS README compile depcomp \
install-sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ADMCOM = @ADMCOM@
ADMCOM2 = @ADMCOM2@
ADMCOM3 = @ADMCOM3@
ADMCOM4 = @ADMCOM4@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COM1 = @COM1@
COM2 = @COM2@
COM3 = @COM3@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
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_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
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@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = src/regles.txt
SUBDIRS = src
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive

.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu 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__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck

$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):

config.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1

stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@

distclean-hdr:
-rm -f config.h stamp-h1

# 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.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
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; \
($(am__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"

ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags

tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
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 || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive

CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique

GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive

cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files

distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files

distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(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 "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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 \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)

dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)

dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)

dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)

dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)

dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)

dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)

dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_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*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(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 \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_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:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive

install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:

clean-generic:

distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-hdr distclean-tags

dvi: dvi-recursive

dvi-am:

html: html-recursive

html-am:

info: info-recursive

info-am:

install-data-am:

install-dvi: install-dvi-recursive

install-dvi-am:

install-exec-am:

install-html: install-html-recursive

install-html-am:

install-info: install-info-recursive

install-info-am:

install-man:

install-pdf: install-pdf-recursive

install-pdf-am:

install-ps: install-ps-recursive

install-ps-am:

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: $(am__recursive_targets) all install-am install-strip

.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-hdr \
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-am uninstall \
uninstall-am

.PRECIOUS: Makefile


# 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:

+ 4
- 0
Septime/NEWS View File

@@ -0,0 +1,4 @@
History of Septime releases :

2024-10-25 - Septime 1.00 the first public release on githell.e2li.org.


+ 72
- 0
Septime/README View File

@@ -0,0 +1,72 @@

Septime - an enhanced version of Octave, currently under development.

Overview
========
This project is part of the E2L Prosecco project.
All details on :
https://www.e2li.org/ProjetProsecco.html

Septime is an application to protect against unwanted connections.
The name of the application comes from fencing. In this noble sport,
parries named after the position in which the hand is held, and there
are eight parries : prime, seconde, tierce, quarte, quinte, sixte,
septime and octave.
The octave and septime are especially useful for warding off low blows! :-)
And what could be baser than taking advantage of people's ignorance to spy
on them and steal their data?

But octave is also GNU software (see https://octave.org ).
So we'll be using septime in future versions.

How to compile and install septime
==================================

Download the septime source code with git :
$ git clone https://githell.e2li.org/Patrick/Kouglof2.git
$ cd Kouglof2/Septime
or donwload a tar.gz file and :
$ tar xvzf septime-x.y.z.tar.gz
$ cd septime-x.y.z

First install some necessary packages :
# in Linux using apt commands :
$ sudo apt install libreadline-dev
$ sudo apt install zlib1g-dev

# in Linux using yum and rmp commands :
$ sudo yum install readline-devel
$ sudo yum install zlib-devel

Second configure and build the program :
$ ./configure
$ make

You can use it by positionning in the source directory and call the
command :
$ cd src
$ ./septime -til -p regles.txt

WARNING !!
make install is possible but not preconized in test version !!
But if you still want to install, don't forget to copy the regles.txt file
to /etc/septime.cfg to avoid passing the file name with the -p option.

Web Page
========
https://www.e2li.org/ProjetProsecco.html

Bug Reports
===========
For general bug reports, send a description of the problem to
septime@e2li.org.

Current Status
==============
septime is in test version.
We are working on porting this application to other consumer systems
such as Android, MasOsX, Windows, ...

Patrick Foubet (septime@e2li.org)



+ 1135
- 0
Septime/aclocal.m4
File diff suppressed because it is too large
View File


+ 348
- 0
Septime/compile View File

@@ -0,0 +1,348 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2018 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, see <https://www.gnu.org/licenses/>.

# 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>.

nl='
'

# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"

file_conv=

# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}

# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}

# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS

if test "$found" != yes; then
lib=$lib.lib
fi
}

# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}

eat=

case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]

Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.

If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.

Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac

ofile=
cfile=

for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done

if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi

# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`

# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15

# Run the compile.
"$@"
ret=$?

if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi

rmdir "$lockdir"
exit $ret

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

+ 146
- 0
Septime/config.h.in View File

@@ -0,0 +1,146 @@
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H

/* Define to 1 if you have the `dup2' function. */
#undef HAVE_DUP2

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD

/* Define to 1 if you have the `readline' library (-lreadline). */
#undef HAVE_LIBREADLINE

/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC

/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H

/* Define to 1 if you have the <readline/history.h> header file. */
#undef HAVE_READLINE_HISTORY_H

/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR

/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the `strrchr' function. */
#undef HAVE_STRRCHR

/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR

/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK

/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H

/* Define to 1 if `fork' works. */
#undef HAVE_WORKING_FORK

/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK

/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H

/* Name of package */
#undef PACKAGE

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the home page for this package. */
#undef PACKAGE_URL

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Version number of package */
#undef VERSION

/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT64_T

/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc

/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t

/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t

/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef uint64_t

/* Define as `fork' if `vfork' does not work. */
#undef vfork

+ 6776
- 0
Septime/configure
File diff suppressed because it is too large
View File


+ 97
- 0
Septime/configure.ac View File

@@ -0,0 +1,97 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT(septime, 1.0, dev@e2li.org)
AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
PROGMISS="NO"
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_AWK
AC_PROG_SED
AC_PROG_GREP
AC_PROG_EGREP
#AC_PROG_SORT
#AC_PROG_UNIQ

AC_CHECK_PROG([COM1], [cut], [/bin/cut])
if test x$COM1 = "x" ; then
AC_MSG_WARN([cut is missing.])
PROGMISS="YES"
fi
AC_CHECK_PROG([COM2], [sort], [/bin/sort])
if test x$COM2 = "x" ; then
AC_MSG_WARN([sort is missing.])
PROGMISS="YES"
fi
AC_CHECK_PROG([COM3], [uniq], [/bin/uniq])
if test x$COM3 = "x" ; then
AC_MSG_WARN([uniq is missing.])
PROGMISS="YES"
fi

AC_CHECK_PROG([ADMCOM], [tcpdump], [/sbin/tcpdump], "",
[$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
if test x$ADMCOM = "x" ; then
AC_MSG_WARN([tcpdump is missing.])
PROGMISS="YES"
fi

AC_CHECK_PROG(ADMCOM2, whois, [/sbin/whois], "",
[$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
if test x$ADMCOM2 = "x" ; then
AC_MSG_WARN([whois is missing.])
PROGMISS="YES"
fi

AC_CHECK_PROG(ADMCOM3, iptables, [/sbin/iptables], "",
[$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
if test x$ADMCOM3 = "x" ; then
AC_MSG_WARN([iptables is missing.])
PROGMISS="YES"
fi

AC_CHECK_PROG(ADMCOM4, ip6tables, [/sbin/ip6tables], "",
[$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
if test x$ADMCOM4 = "x" ; then
AC_MSG_WARN([ip6tables is missing.])
PROGMISS="YES"
fi

if test $PROGMISS = "YES" ; then
AC_MSG_ERROR([All the programs listed above are required to run septime.])
fi



# Checks for libraries.
AC_CHECK_LIB(pthread,pthread_create)
AC_CHECK_LIB(readline,readline)
AC_CHECK_LIB(z,inflate)

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h stdint.h stdlib.h string.h strings.h syslog.h unistd.h])
AC_CHECK_HEADERS([pthread.h])
AC_CHECK_HEADERS([zlib.h])
AC_CHECK_HEADERS([readline/readline.h])
AC_CHECK_HEADERS([readline/history.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT64_T

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_CHECK_FUNCS([dup2 memmove strchr strdup strrchr strstr])

AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT

+ 791
- 0
Septime/depcomp View File

@@ -0,0 +1,791 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2018 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, see <https://www.gnu.org/licenses/>.

# 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 outputting dependencies.
libtool Whether libtool is used (yes/no).

Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac

# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}

# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}

# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}

# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}

# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}

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"

# Avoid interferences from the environment.
gccflag= dashmflag=

# 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

cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi

if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi

if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
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.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;

gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## 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). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - 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 -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# 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.
## 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. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -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 -ne 0; then
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 ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;

xlc)
# 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
;;

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.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi

for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;

tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;

## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d

# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi

if test $stat -ne 0; then
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"
;;

hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi

for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;

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.
set_dir_from "$object"
set_base_from "$object"

if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies 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$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi

stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi

for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;

msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;

msvc7msys)
# 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
;;

#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 "X$1" != 'X--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|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| 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 "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
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.
-arch)
eat=yes ;;
-*|$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"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| 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 "X$1" != 'X--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.
"$@" || exit $?

# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi

IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;

msvcmsys)
# 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
;;

none)
exec "$@"
;;

*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac

exit 0

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

+ 518
- 0
Septime/install-sh View File

@@ -0,0 +1,518 @@
#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2018-03-11.20; # UTC

# 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.

tab=' '
nl='
'
IFS=" $tab$nl"

# Set DOITPROG to "echo" to test this script.

doit=${DOITPROG-}
doit_exec=${doit:-exec}

# Put in absolute file names if you don't have them in your path;
# or use environment vars.

chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}

posix_mkdir=

# Desired mode of installed file.
mode=0755

chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=

src=
dst=
dir_arg=
dst_arg=

copy_on_change=false
is_target_a_directory=possibly

usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...

In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.

Options:
--help display this help and exit.
--version display version info and exit.

-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.

Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"

while test $# -ne 0; do
case $1 in
-c) ;;

-C) copy_on_change=true;;

-d) dir_arg=true;;

-g) chgrpcmd="$chgrpprog $2"
shift;;

--help) echo "$usage"; exit $?;;

-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;

-o) chowncmd="$chownprog $2"
shift;;

-s) stripcmd=$stripprog;;

-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;

-T) is_target_a_directory=never;;

--version) echo "$0 $scriptversion"; exit $?;;

--) shift
break;;

-*) echo "$0: invalid option: $1" >&2
exit 1;;

*) break;;
esac
shift
done

# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.

if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi

if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi

if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi

if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi

if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15

# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;

*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi

for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac

if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else

# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi

if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg

# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi

case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac

obsolete_mkdir_used=false

if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;

*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac

# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi

posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$

trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0

# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
esac

if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else

# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.

case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac

oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS

prefixes=

for d
do
test X"$d" = X && continue

prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done

if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi

if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else

# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_

# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0

# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&

# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&

# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||

# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&

# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1

trap '' 0
fi
done

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

+ 215
- 0
Septime/missing View File

@@ -0,0 +1,215 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Originally written 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, see <https://www.gnu.org/licenses/>.

# 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

case $1 in

--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;

--run)
# Back-compat with the calling convention used by older automake.
shift
;;

-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...

Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.

Options:
-h, --help display this help and exit
-v, --version output version information and exit

Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man

Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.

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

# Run the given program, remember its exit status.
"$@"; st=$?

# If it succeeded, we are done.
test $st -eq 0 && exit 0

# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac

# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi

perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software

program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}

give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`

printf '%s\n' "'$1' is $msg."

configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}

give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2

# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

+ 12
- 0
Septime/src/Makefile.am View File

@@ -0,0 +1,12 @@
######################################
# Makefile.am for septime project #
######################################

bin_PROGRAMS = septime
septime_SOURCES = scannet.c debug.h \
gen_t3.h gen_ypt.h \
gesip.c gesip.h \
lich.c lich.h \
comsh.c comsh.h \
trace.c trace.h


+ 604
- 0
Septime/src/Makefile.in View File

@@ -0,0 +1,604 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2018 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@

######################################
# Makefile.am for septime project #
######################################

VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@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 = septime$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_septime_OBJECTS = scannet.$(OBJEXT) gesip.$(OBJEXT) lich.$(OBJEXT) \
comsh.$(OBJEXT) trace.$(OBJEXT)
septime_OBJECTS = $(am_septime_OBJECTS)
septime_LDADD = $(LDADD)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/comsh.Po ./$(DEPDIR)/gesip.Po \
./$(DEPDIR)/lich.Po ./$(DEPDIR)/scannet.Po \
./$(DEPDIR)/trace.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(septime_SOURCES)
DIST_SOURCES = $(septime_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADMCOM = @ADMCOM@
ADMCOM2 = @ADMCOM2@
ADMCOM3 = @ADMCOM3@
ADMCOM4 = @ADMCOM4@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COM1 = @COM1@
COM2 = @COM2@
COM3 = @COM3@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
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_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
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@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
septime_SOURCES = scannet.c debug.h \
gen_t3.h gen_ypt.h \
gesip.c gesip.h \
lich.c lich.h \
comsh.c comsh.h \
trace.c trace.h

all: all-am

.SUFFIXES:
.SUFFIXES: .c .o .obj
$(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 ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/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__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
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
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p \
; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' \
-e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done

uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' \
`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files

clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)

septime$(EXEEXT): $(septime_OBJECTS) $(septime_DEPENDENCIES) $(EXTRA_septime_DEPENDENCIES)
@rm -f septime$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(septime_OBJECTS) $(septime_LDADD) $(LIBS)

mostlyclean-compile:
-rm -f *.$(OBJEXT)

distclean-compile:
-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comsh.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gesip.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lich.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scannet.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trace.Po@am__quote@ # am--include-marker

$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@

am--depfiles: $(am__depfiles_remade)

.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<

.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`

ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags

tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am

CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique

GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am

cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files

distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(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 "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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)
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:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:

clean-generic:

distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-binPROGRAMS clean-generic mostlyclean-am

distclean: distclean-am
-rm -f ./$(DEPDIR)/comsh.Po
-rm -f ./$(DEPDIR)/gesip.Po
-rm -f ./$(DEPDIR)/lich.Po
-rm -f ./$(DEPDIR)/scannet.Po
-rm -f ./$(DEPDIR)/trace.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags

dvi: dvi-am

dvi-am:

html: html-am

html-am:

info: info-am

info-am:

install-data-am:

install-dvi: install-dvi-am

install-dvi-am:

install-exec-am: install-binPROGRAMS

install-html: install-html-am

install-html-am:

install-info: install-info-am

install-info-am:

install-man:

install-pdf: install-pdf-am

install-pdf-am:

install-ps: install-ps-am

install-ps-am:

installcheck-am:

maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/comsh.Po
-rm -f ./$(DEPDIR)/gesip.Po
-rm -f ./$(DEPDIR)/lich.Po
-rm -f ./$(DEPDIR)/scannet.Po
-rm -f ./$(DEPDIR)/trace.Po
-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 TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
distclean distclean-compile distclean-generic 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 tags-am uninstall uninstall-am \
uninstall-binPROGRAMS

.PRECIOUS: Makefile


# 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:

+ 324
- 0
Septime/src/comsh.c View File

@@ -0,0 +1,324 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* fonctions d'execution de commandes externes */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <string.h>
#include <errno.h>

#include "trace.h"
#include "comsh.h"
#include "lich.h"
#include "debug.h"

/* variables globales maj dans main() */
pid_t pidG;
char * NPROG;

void prAube(void)
{
static char *c;
static int i=0;
c=Y(f03);
printf(Y(f04),c[i++]);
fflush(stdout);
if (i==4) i=0;
}

void Pignore(char * m) { printf(Y(a01),m); }

#define LRES 100
static char * comshr(char *b)
{
pid_t pid;
int n, ret, pic[2];
static char res[LRES];
char *d,*f;
if (pipe(pic) < 0) {
perror(Y(p01)); return NULL;
}
fcntl(pic[0], F_SETFL, O_NONBLOCK);
if ((pid = fork()) < 0) {
perror(Y(p02)); return NULL;
}
if (pid == 0) {
close(pic[0]);
fcntl(pic[1], F_SETFL, O_NONBLOCK);
dup2(pic[1],1);
signal(SIGINT,SIG_IGN);
execl(Y(c02), Y(k00), "-c", b, (char*)0);
perror(Y(p03));
printf(Y(k10));
exit(0);
}
close(pic[1]);
d=res;
f=d+LRES;
while (d < f) {
if ((n=read(pic[0],d,1)) < 1) {
if (errno == EAGAIN) continue;
else break;
}
if (*d == '\n') break;
d++;
}
if (d==f) {
d--;
while (*d != '\n') if (read(pic[0],d,1) != 1) break;
}
*d = '\0';
kill(pid,SIGKILL);
waitpid(pid,&ret,0);
close(pic[0]);
return res;
}

/* fcts utilisant comshr */
char * comWhois(char * ip)
{
char a[50], b[150],*d;
strcpy(a,ip);
d=strrchr(a,(int)'/');
if (d != NULL) *d='\0';
sprintf(b,Y(f38), Y(c03), a, Y(c04));
return comshr(b);
}

int comsh(char *com,int mode)
{
pid_t pid;
int ret;
Tdebug(Y(t09),com);
if ((pid = fork()) < 0) {
perror(Y(p04)); return 99;
}
if (pid == 0) {
if (mode & EX_NOOUT) close(1);
if (mode & EX_NOERR) close(2);
signal(SIGINT,SIG_IGN);
execl(Y(c02), Y(k00), "-c", com, (char *)0);
perror(Y(p05)); exit(98);
}
if (mode & EX_DUREE) {
while (waitpid(pid,&ret,WNOHANG) != pid) {
sleep(1);
prAube();
}
} else waitpid(pid,&ret,0);
return WEXITSTATUS(ret);
}

int exeComA(char * comm)
{
char b[120];
sprintf(b,Y(f39),comm);
return comsh(b,0);
}

/* ### fct de MAJ iptables */

void razIPT(void)
{
char b[90];
/* IPv4 */
sprintf(b,Y(f40),Y(c05));
exeComA(b);
/* IPv6 */
sprintf(b,Y(f40),Y(c06));
exeComA(b);
}

int initIPT(void)
{
int i=0;
char b[90];
razIPT();
/* IPv4 */
sprintf(b,Y(f41),Y(c05),Y(k01));
if (exeComA(b)) {
sprintf(b,Y(f42),Y(c05),Y(k01));
i += exeComA(b);
}
sprintf(b,Y(f43),Y(c05),Y(k03),Y(k01));
i += exeComA(b);
/* IPv6 */
sprintf(b,Y(f41),Y(c06),Y(k02));
if (exeComA(b)) {
sprintf(b,Y(f42),Y(c06),Y(k02));
i += exeComA(b);
}
sprintf(b,Y(f43),Y(c06),Y(k03),Y(k02));
i += exeComA(b);
return i;
}

static int isPresentIP(char * comm, char * ip, char * chain)
{
char buf[100];
sprintf(buf,Y(f44),comm,chain,ip);
if (exeComA(buf) == 0) return 1;
return 0;
}

/* fct derivees de isPresentIP */
int isIPprotegee(int v6, char *ip)
{
if (v6) return isPresentIP(Y(c06),ip,Y(k02));
else return isPresentIP(Y(c05),ip,Y(k01));
}
int isIPbloquee(int v6, char *ip)
{
if (v6) return isPresentIP(Y(c06),ip,Y(k03));
else return isPresentIP(Y(c05),ip,Y(k03));
}


static int retireChain(char * comm, char * ip, char * chain, char * jump)
{
char buf[100];
sprintf(buf,Y(f45),comm,chain, ip, jump);
return exeComA(buf);
}
/* fct derivees de retireChain() */
int derejetIP(int v6, char *ip)
{
if (v6) return retireChain(Y(c06),ip,Y(k03),Y(k04));
else return retireChain(Y(c05),ip,Y(k03),Y(k04));
}
int deprotegeIP(int v6, char *ip)
{
if (v6) return retireChain(Y(c06),ip,Y(k02),Y(k05));
else return retireChain(Y(c05),ip,Y(k01),Y(k05));
}

static int ajouteChain(char * comm, char * ip, char * chain, char * jump)
{
char buf[100];
sprintf(buf,Y(f46),comm,chain, ip, jump);
return exeComA(buf);
}
/* fct derivees de ajouteChain() */
int rejetIP(int v6, char *ip)
{
if (v6) return ajouteChain(Y(c06),ip,Y(k03),Y(k04));
else return ajouteChain(Y(c05),ip,Y(k03),Y(k04));
}
int protegeIP(int v6, char *ip)
{
if (v6) return ajouteChain(Y(c06),ip,Y(k02),Y(k05));
else return ajouteChain(Y(c05),ip,Y(k01),Y(k05));
}

/* commandes interactives */


void comFct(int C, int JCTL, char *cmd)
{
int code=0;
char com[200];
switch(C) {
case FCT_COMe:
if (JCTL) sprintf(com,Y(f05),Y(c01),NPROG,pidG, Y(k08), Y(c14),Y(c07));
else sprintf(com,Y(f06),NPROG,pidG, Y(k08), Y(k09),Y(c14),Y(c07));
break;
case FCT_COME:
if (JCTL) sprintf(com,Y(f07),Y(c01),NPROG,pidG, Y(k11), Y(c15));
else sprintf(com,Y(f08),NPROG,pidG, Y(k11), Y(k09),Y(c15));
break;
case FCT_COML:
if (*(cmd+1) == '\0') {
if (JCTL) sprintf(com,Y(f09),Y(c01),NPROG, pidG,Y(f13),Y(c15));
else sprintf(com,Y(f10),NPROG,pidG, Y(c13),Y(f13),Y(c15));
} else {
if (JCTL) sprintf(com,Y(f11),Y(c01) ,NPROG,pidG,Y(f13),Y(c15),cmd+1);
else sprintf(com,Y(f12),NPROG,pidG, Y(c13),Y(f13),Y(c15),cmd+1);
}
break;
case FCT_COMl:
if (*(cmd+1) != '\0') { /* avec parametre */
if ((*(cmd+1) == '=') && (*(cmd+2) == '\0')) {
printf(Y(e06));
return;
}
if ((*(cmd+1) == '=') && (*(cmd+2) != '\0')) { /* script + param */
sprintf(com,Y(f14),NPROG,pidG,cmd+2,pidG);
comsh(com,0);
sprintf(com,Y(f15),pidG,pidG);
} else {
if (JCTL)
sprintf(com,Y(f16),Y(c01),NPROG,pidG, cmd+1,Y(f32),Y(c16));
else sprintf(com,Y(f17),NPROG,pidG,cmd+1, Y(c13),Y(f32),Y(c16));
}
} else {
if (JCTL)sprintf(com,Y(f18),Y(c01),NPROG,pidG, Y(f32),Y(c16));
else sprintf(com,Y(f19),NPROG,pidG, Y(c13),Y(f32),Y(c16));
}
break;
case FCT_COMinf:
if (JCTL) sprintf(com,Y(f20),Y(c01),NPROG,pidG, Y(f33),Y(c17),Y(c09));
else sprintf(com,Y(f21),NPROG,pidG, Y(c13),Y(f34),Y(c17),Y(c09));
break;
case FCT_COMsup:
if (JCTL) sprintf(com,Y(f22),Y(c01),NPROG,pidG, Y(f35),Y(c17),Y(c09));
else sprintf(com,Y(f23),NPROG,pidG, Y(c13),Y(f36),Y(c17),Y(c09));
break;
case FCT_COMr:
sprintf(com,Y(f24),Y(c05),Y(k03),Y(k06),Y(c18),Y(c10),Y(c11));
if (*(cmd+1) != '\0') {
if ((*(cmd+1) != '?') || (*(cmd+2) != '\0')) Pignore(cmd+1);
else sprintf(com,Y(f25),Y(c05),Y(k03),Y(k06),Y(c18),Y(c07));
}
code = EX_NOERR|EX_DUREE;
break;
case FCT_COMR:
sprintf(com,Y(f26),Y(c06),Y(k06),Y(c19),Y(c08),Y(c12));
if (*(cmd+1) != '\0') {
if ((*(cmd+1) != '?') || (*(cmd+2) != '\0')) Pignore(cmd+1);
else sprintf(com,Y(f27),Y(c06),Y(k06),Y(c19),Y(c07));
}
code = EX_NOERR|EX_DUREE;
break;
case FCT_COMv:
sprintf(com,Y(f28),Y(c05),Y(k01),Y(k07),Y(c18),Y(c10),Y(c11));
if (*(cmd+1) != '\0') {
if ((*(cmd+1) != '?') || (*(cmd+2) != '\0')) Pignore(cmd+1);
else sprintf(com,Y(f29),Y(c05),Y(k01),Y(k07),Y(c18),Y(c07));
}
code = EX_NOERR|EX_DUREE;
break;
case FCT_COMV:
sprintf(com,Y(f30),Y(c06),Y(k02),Y(k07),Y(c19),Y(c08),Y(c12));
if (*(cmd+1) != '\0') {
if ((*(cmd+1) != '?') || (*(cmd+2) != '\0')) Pignore(cmd+1);
else sprintf(com,Y(f31),Y(c06),Y(k02),Y(k07),Y(c19),Y(c07));
}
code = EX_NOERR|EX_DUREE;
break;
default:
printf(Y(a02),C);
return;
}
if (DebugOn) printf(Y(f37),com);
comsh(com,code);
}


+ 55
- 0
Septime/src/comsh.h View File

@@ -0,0 +1,55 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* fonctions d'execution de commandes externes */

#define EX_NOOUT 1
#define EX_NOERR 2
#define EX_DUREE 4
#define EX_SILENT EX_NOOUT|EX_NOERR

#define FCT_COMe 0
#define FCT_COME 1
#define FCT_COML 2
#define FCT_COMl 3
#define FCT_COMr 4
#define FCT_COMR 5
#define FCT_COMv 6
#define FCT_COMV 7
#define FCT_COMinf 8
#define FCT_COMsup 9


/* Var. globales */
extern pid_t pidG;
extern char * NPROG;

extern void prAube(void);
extern void Pignore(char *m);
extern int comsh(char *com,int mode);
extern char * comWhois(char *ip);
extern int exeComA(char *c);
extern void razIPT(void);
extern int initIPT(void);
extern int isIPprotegee(int v6, char *ip);
extern int isIPbloquee(int v6, char *ip);
extern int rejetIP(int v6, char *ip);
extern int protegeIP(int v6, char *ip);
extern int derejetIP(int v6, char *ip);
extern int deprotegeIP(int v6, char *ip);
extern void comFct(int C, int JCTL,char *cmd);

+ 20
- 0
Septime/src/debug.h View File

@@ -0,0 +1,20 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* debug.h */
extern int DebugOn;

+ 76
- 0
Septime/src/gen_t3.h View File

@@ -0,0 +1,76 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#define BYTE unsigned char
extern int DecompressBuf(BYTE*, int, BYTE*, int);
static void gen_t3(char *f)
{
char b[288], bd[408];
int fd, i, nbd;
uint64_t *I;
I=(uint64_t*)b;
for(i=0;i<36;i++) I[i]=0;
I[0]=3513492969511296120LLU;
I[1]=8170400034739160592LLU;
I[2]=16809767885735253328LLU;
I[3]=954806354426269396LLU;
I[4]=11677140802770568717LLU;
I[5]=8483119311209102250LLU;
I[6]=14500313015132833724LLU;
I[7]=5434976581503397511LLU;
I[8]=15612305211765268573LLU;
I[9]=6833910393899315227LLU;
I[10]=15676298103434189467LLU;
I[11]=11763047738657925941LLU;
I[12]=8135878780238290482LLU;
I[13]=3571190931360249148LLU;
I[14]=2745289419384381947LLU;
I[15]=11070637244369314136LLU;
I[16]=3367933370401970519LLU;
I[17]=1538284899570704139LLU;
I[18]=5201194001187900790LLU;
I[19]=6506655753202087076LLU;
I[20]=5788224812616797994LLU;
I[21]=7693230472650450955LLU;
I[22]=14199225627431177273LLU;
I[23]=2035122141195516189LLU;
I[24]=6586295435752144235LLU;
I[25]=15691205496105394387LLU;
I[26]=8087533204979941574LLU;
I[27]=3715239556801399409LLU;
I[28]=3537875595939442738LLU;
I[29]=12035520453502658203LLU;
I[30]=8474825777019822134LLU;
I[31]=4641326122985918427LLU;
I[32]=11240823386667433964LLU;
I[33]=5206122259822366698LLU;
I[34]=12067097100844682614LLU;
nbd = DecompressBuf((BYTE*)b, 280, (BYTE*)bd, 408);
if ((fd=creat(f,0644))==-1) {
perror(f); return;
}
if (write(fd,bd,408)!=nbd) perror(f);
close(fd);
return;
}

+ 365
- 0
Septime/src/gen_ypt.h View File

@@ -0,0 +1,365 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#define BYTE unsigned char
extern int DecompressBuf(BYTE*, int, BYTE*, int);
static void gen_ypt(char *f)
{
char b[2600], bd[5966];
int fd, i, nbd;
uint64_t *I;
I=(uint64_t*)b;
for(i=0;i<325;i++) I[i]=0;
I[0]=4241074652373687416LLU;
I[1]=4673842720217726966LLU;
I[2]=9661055351253429323LLU;
I[3]=15034956258032957953LLU;
I[4]=2041277104835414335LLU;
I[5]=15701758023207901403LLU;
I[6]=5609554890882275591LLU;
I[7]=18001490298152088608LLU;
I[8]=7915931991303688658LLU;
I[9]=3193625324927575606LLU;
I[10]=14374217928335765714LLU;
I[11]=899431473100411847LLU;
I[12]=7475989819533908353LLU;
I[13]=11128500408727418449LLU;
I[14]=6514849499480366277LLU;
I[15]=17316756011002207938LLU;
I[16]=9820959997604946098LLU;
I[17]=17663714849139610819LLU;
I[18]=2594711424723071436LLU;
I[19]=9578839621436505342LLU;
I[20]=14675127248708786516LLU;
I[21]=4802053906989565902LLU;
I[22]=2644695087260195933LLU;
I[23]=1006144219623465609LLU;
I[24]=9542101154816246498LLU;
I[25]=5923902592628227611LLU;
I[26]=2647600128027440137LLU;
I[27]=521314053797951364LLU;
I[28]=17234054309907069762LLU;
I[29]=3787696023530377832LLU;
I[30]=14772138026443583724LLU;
I[31]=15549083239732238508LLU;
I[32]=3770750716842382917LLU;
I[33]=14801136343335915991LLU;
I[34]=1584041337544816125LLU;
I[35]=16450730215177370078LLU;
I[36]=6468249432659704874LLU;
I[37]=15288369258228410351LLU;
I[38]=2939733233879043258LLU;
I[39]=15640278931083451092LLU;
I[40]=7524559997156435404LLU;
I[41]=10159468887844167896LLU;
I[42]=5664021592432282483LLU;
I[43]=18365546934740408851LLU;
I[44]=11375952341113999265LLU;
I[45]=16000961150597287619LLU;
I[46]=5088463810675007418LLU;
I[47]=2405699691768171358LLU;
I[48]=13511615786546327633LLU;
I[49]=9040486883347082656LLU;
I[50]=5980692734036870454LLU;
I[51]=13135232477739925616LLU;
I[52]=123012291666463600LLU;
I[53]=11488703833032635453LLU;
I[54]=9193026459659214579LLU;
I[55]=11479969808470076376LLU;
I[56]=11198249779062341442LLU;
I[57]=2411965669084874736LLU;
I[58]=957814264619271506LLU;
I[59]=12779447650910716831LLU;
I[60]=9859910704426935876LLU;
I[61]=16746826853715665929LLU;
I[62]=16413978016376888499LLU;
I[63]=1968201066273020274LLU;
I[64]=13991624674232639755LLU;
I[65]=8166850916890993573LLU;
I[66]=16042093933677028215LLU;
I[67]=7517955102242657859LLU;
I[68]=2512944949430758978LLU;
I[69]=2362491872325949180LLU;
I[70]=17189161015435676239LLU;
I[71]=15441121987405923384LLU;
I[72]=3108231588607319444LLU;
I[73]=7200265149075643479LLU;
I[74]=11080000552192822067LLU;
I[75]=5387761589658435664LLU;
I[76]=1236984002623212688LLU;
I[77]=1301043804275056664LLU;
I[78]=15286299576342088373LLU;
I[79]=12935675420627162496LLU;
I[80]=12432002784181900044LLU;
I[81]=7613519342822345281LLU;
I[82]=4491173053903755544LLU;
I[83]=7820161253136890729LLU;
I[84]=15437320438243819661LLU;
I[85]=2596114078850612336LLU;
I[86]=1155453309856606156LLU;
I[87]=7050501002974967216LLU;
I[88]=3921099982745790605LLU;
I[89]=3722029341124402993LLU;
I[90]=14552987422893304125LLU;
I[91]=4052109232832521325LLU;
I[92]=7909359501327220233LLU;
I[93]=9219085640106354350LLU;
I[94]=13577215183217081294LLU;
I[95]=5957134707533384427LLU;
I[96]=2867779665060358582LLU;
I[97]=14353229354015441913LLU;
I[98]=708923818376397141LLU;
I[99]=734371637301564537LLU;
I[100]=3238211122495100245LLU;
I[101]=17238154688664757814LLU;
I[102]=11637249994915293808LLU;
I[103]=5158839180261435036LLU;
I[104]=6394746849916746804LLU;
I[105]=18427632580287873726LLU;
I[106]=17722260108629535546LLU;
I[107]=13453912126934108118LLU;
I[108]=16826698591540853269LLU;
I[109]=7439315184196176985LLU;
I[110]=390524409720011801LLU;
I[111]=4507166297166077933LLU;
I[112]=13395447331081582299LLU;
I[113]=17656773121425044637LLU;
I[114]=16896774259664037728LLU;
I[115]=4895202736652261450LLU;
I[116]=13718934499093172735LLU;
I[117]=16644494708553470834LLU;
I[118]=8017323223805049889LLU;
I[119]=2623751519052398419LLU;
I[120]=1652795573607924340LLU;
I[121]=15220220813307204534LLU;
I[122]=1974302559288653960LLU;
I[123]=15075628397705738195LLU;
I[124]=2032263032912719897LLU;
I[125]=13637777867361265714LLU;
I[126]=4691773311486963417LLU;
I[127]=2972667711058981371LLU;
I[128]=15597119617195036995LLU;
I[129]=12057702815841636556LLU;
I[130]=7634950018569142341LLU;
I[131]=9020858503940529720LLU;
I[132]=5937127696597063347LLU;
I[133]=16769454116423682366LLU;
I[134]=2870064533995985587LLU;
I[135]=13108017911424329639LLU;
I[136]=9563444494898222389LLU;
I[137]=10558672078231292851LLU;
I[138]=9895199088252497451LLU;
I[139]=1191948719047260376LLU;
I[140]=8786303655540048187LLU;
I[141]=9645883881183919628LLU;
I[142]=5238276332802295074LLU;
I[143]=7086435123269281137LLU;
I[144]=1770611117441627638LLU;
I[145]=9269310209527579530LLU;
I[146]=11969976854427883369LLU;
I[147]=7391189675297122301LLU;
I[148]=16054531435229025429LLU;
I[149]=12268532518899549324LLU;
I[150]=5697746949105845360LLU;
I[151]=589326825654936822LLU;
I[152]=14304931139663147288LLU;
I[153]=7924519098099973806LLU;
I[154]=191517820658931897LLU;
I[155]=12803146924938695330LLU;
I[156]=7257323377101496405LLU;
I[157]=4736573807061049885LLU;
I[158]=15073189626135442009LLU;
I[159]=14795697644241367269LLU;
I[160]=16101498250439781587LLU;
I[161]=7289259163754542400LLU;
I[162]=41069004506961438LLU;
I[163]=4836237410736758005LLU;
I[164]=10772997560191332305LLU;
I[165]=10761159084181523482LLU;
I[166]=1351268150861560564LLU;
I[167]=5090977789702259061LLU;
I[168]=13845970355480915719LLU;
I[169]=2591826990323560534LLU;
I[170]=2411142778597336775LLU;
I[171]=16849315315571840581LLU;
I[172]=274806574933400005LLU;
I[173]=1330190321051276142LLU;
I[174]=1679249617397517172LLU;
I[175]=13890225798688713559LLU;
I[176]=17062846590641644689LLU;
I[177]=4646390099444655423LLU;
I[178]=10303496916559216052LLU;
I[179]=12928055581931018993LLU;
I[180]=5321753988168027605LLU;
I[181]=11757437510869804178LLU;
I[182]=16373805541246902125LLU;
I[183]=15367062149862790121LLU;
I[184]=7493718842988506760LLU;
I[185]=831977168966468971LLU;
I[186]=4727534888263714652LLU;
I[187]=608394370886801294LLU;
I[188]=6644257942261404200LLU;
I[189]=14391403048712368199LLU;
I[190]=15600725257247164070LLU;
I[191]=5322096322979334437LLU;
I[192]=8466049820790957711LLU;
I[193]=11511187367325289843LLU;
I[194]=10338243110172224159LLU;
I[195]=18104104639810698550LLU;
I[196]=17887117257658224746LLU;
I[197]=5555228918975052361LLU;
I[198]=11250450618237230467LLU;
I[199]=800760107628690039LLU;
I[200]=13336216450411332365LLU;
I[201]=14388044331524698205LLU;
I[202]=946651251490420442LLU;
I[203]=14441024334098608158LLU;
I[204]=6458361066291228316LLU;
I[205]=10167144980955705520LLU;
I[206]=16721130411840717426LLU;
I[207]=7945225597254080304LLU;
I[208]=12413436087918697929LLU;
I[209]=7232339556974716443LLU;
I[210]=11264318930437708689LLU;
I[211]=4526841556519779712LLU;
I[212]=10435299913031345328LLU;
I[213]=10337606335768529741LLU;
I[214]=3152603635297971477LLU;
I[215]=1719150462634517308LLU;
I[216]=10144022023998601754LLU;
I[217]=10848289820064133464LLU;
I[218]=9651328111625316973LLU;
I[219]=3768382467237122583LLU;
I[220]=9732466902727717343LLU;
I[221]=767098271158025880LLU;
I[222]=13761607460778568021LLU;
I[223]=2885360184685957676LLU;
I[224]=12774566386940186195LLU;
I[225]=7574227588949322441LLU;
I[226]=17611283514739896987LLU;
I[227]=10306193588540577474LLU;
I[228]=1506268025282850103LLU;
I[229]=7277163402237830062LLU;
I[230]=17350863693964120622LLU;
I[231]=5312436513333151230LLU;
I[232]=9599790998770091535LLU;
I[233]=8843731485635609335LLU;
I[234]=1576058595690822334LLU;
I[235]=11412218344526168872LLU;
I[236]=9679740775779177043LLU;
I[237]=5531024328034931436LLU;
I[238]=5577256618317717421LLU;
I[239]=5645633814445866629LLU;
I[240]=10856939441873176257LLU;
I[241]=9677017732366773108LLU;
I[242]=11622453572418888668LLU;
I[243]=14934178702857930992LLU;
I[244]=2911257454403527455LLU;
I[245]=8735150915723357407LLU;
I[246]=7897553944338853567LLU;
I[247]=12216203809496359711LLU;
I[248]=11102017850055942538LLU;
I[249]=6485571347382852680LLU;
I[250]=17535982357218320393LLU;
I[251]=13204677382932075389LLU;
I[252]=13905244493785556664LLU;
I[253]=2059384028934660338LLU;
I[254]=16558113762274725485LLU;
I[255]=11215553731965441243LLU;
I[256]=6482703841774926804LLU;
I[257]=11384645764415109425LLU;
I[258]=420738184392912490LLU;
I[259]=105070447355574882LLU;
I[260]=13807330803048003132LLU;
I[261]=10706817364695970647LLU;
I[262]=2302858431082829722LLU;
I[263]=15041078325968459186LLU;
I[264]=4650539105639776792LLU;
I[265]=5487088262829511443LLU;
I[266]=103781362984443684LLU;
I[267]=17441022687734680270LLU;
I[268]=15125955224054567034LLU;
I[269]=2177233700727936692LLU;
I[270]=2278599854545061513LLU;
I[271]=7256406495699980736LLU;
I[272]=16976464982060972338LLU;
I[273]=17926497963230932075LLU;
I[274]=848518275322329347LLU;
I[275]=11177022136769394548LLU;
I[276]=3788112373443124513LLU;
I[277]=14587124811577252551LLU;
I[278]=1573326803865893554LLU;
I[279]=448478744197164620LLU;
I[280]=7888853063109169062LLU;
I[281]=700521322859034130LLU;
I[282]=7999910067829798263LLU;
I[283]=15896006298673115605LLU;
I[284]=8510980793502366489LLU;
I[285]=11091285214246336012LLU;
I[286]=166109839111260069LLU;
I[287]=4550555400158881914LLU;
I[288]=3294908014955865247LLU;
I[289]=7304193512169017045LLU;
I[290]=5494254116705497204LLU;
I[291]=4954970514979536369LLU;
I[292]=7595621239990209150LLU;
I[293]=17209401234228642003LLU;
I[294]=12427481428201750726LLU;
I[295]=2431627459825335254LLU;
I[296]=8567173634029746647LLU;
I[297]=5485820715494736325LLU;
I[298]=12372848324734505520LLU;
I[299]=11867762128936718865LLU;
I[300]=2071859667080908908LLU;
I[301]=17161877711811840923LLU;
I[302]=15887051578694185205LLU;
I[303]=7193941154996379857LLU;
I[304]=1325789168787887540LLU;
I[305]=10435070846010762051LLU;
I[306]=5652807243298705634LLU;
I[307]=4505441241240331179LLU;
I[308]=8429962961150242731LLU;
I[309]=14961563770930095867LLU;
I[310]=5734548877029498510LLU;
I[311]=6057857735986458581LLU;
I[312]=1439550192525181080LLU;
I[313]=13282799172794728285LLU;
I[314]=16209964458264376233LLU;
I[315]=17114525358350983914LLU;
I[316]=17585945366995456945LLU;
I[317]=15875889867565904217LLU;
I[318]=11472581645877636874LLU;
I[319]=9971294587070584199LLU;
I[320]=1468989387411115489LLU;
I[321]=2430282314538853611LLU;
I[322]=521412196686982011LLU;
I[323]=2385769326968806107LLU;
nbd = DecompressBuf((BYTE*)b, 2592, (BYTE*)bd, 5966);
if ((fd=creat(f,0644))==-1) {
perror(f); return;
}
if (write(fd,bd,5966)!=nbd) perror(f);
close(fd);
return;
}

+ 133
- 0
Septime/src/gesip.c View File

@@ -0,0 +1,133 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* gesip.c : fonctions pour la gestion des adresses IPv4 et IPv6 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>

#include "gesip.h"
#include "lich.h"

static int isIP(char *a)
{
struct in_addr S;
struct in6_addr S6;
int r;
if ((r = inet_pton(AF_INET,a, (void *)&S)) == 1) return IP4;
if ((r = inet_pton(AF_INET6,a, (void *)&S6)) == 1) return IP6;
return ERR;
}

static int isIPv4(char *a)
{
struct in_addr S;
int r;
if ((r = inet_pton(AF_INET,a, (void *)&S)) <= 0) return 0;
return 1;
}

static int isIPv6(char *a)
{
struct in6_addr S;
int r;
if ((r = inet_pton(AF_INET6,a, (void *)&S)) <= 0) return 0;
return 1;
}

static void And6(unsigned char *r, unsigned char *a, unsigned char *b) { /* r=a&b */
int i;
for(i = 0; i < 16; i++) r[i] = a[i] & b[i];
}

int valCidr(char * c)
{
char * sn;
if ((sn=strchr(c,(int)'/')) == NULL) return 0;
return atoi(sn+1);
}

int isCidr(char*r)
{
char buf[20], *sn;
int n;
if (strlen(r)>18) return 0;
strcpy(buf,r);
if ((sn=strchr(buf,(int)'/')) == NULL) return 0;
*sn = '\0';
if (!isIPv4(buf)) return 0;
n = atoi(sn+1);
if (n>32) return 0;
return n;
}

int isCidr6(char*r)
{
char buf[52], *sn;
int n;
if (strlen(r)>50) return 0;
strcpy(buf,r);
if ((sn=strchr(buf,(int)'/')) == NULL) return 0;
*sn = '\0';
if (!isIPv6(buf)) return 0;
n = atoi(sn+1);
if (n>128) return 0;
return n;
}

int isSousRes(char*r, char *a)
{
struct in_addr Sa, Sr, Sm;
struct in6_addr S6a, S6r, S6m, S6am, S6rm;
int n, m, i, imax, v6;
unsigned char M[16];
char buf[52],smasq[42],*sn;
if ((v6=isIP(a)) == ERR) return 0;
imax = 4 + (12*v6);
strcpy(buf,r);
if ((sn=strchr(buf,(int)'/')) == NULL) return 0;
*sn = '\0';
n = atoi(sn+1);
/* calcul du masq */
m=n;
for (i=0;i<imax;i++) {
if (m>7) { M[i]=255; m-=8;
} else { M[i]=0;
while (m>=0) M[i] |= 0x80 >> --m;
}
}
if (v6) {
sprintf(smasq,Y(f01), M[0],M[1],M[2],M[3],M[4],M[5],M[6],M[7],
M[8],M[9],M[10],M[11],M[12],M[13],M[14],M[15]);
inet_pton(AF_INET6,smasq, (void *)&S6m);
inet_pton(AF_INET6,a, (void *)&S6a);
inet_pton(AF_INET6,buf, (void *)&S6r);
And6(S6rm.s6_addr, S6r.s6_addr, S6m.s6_addr);
And6(S6am.s6_addr, S6a.s6_addr, S6m.s6_addr);
if (bcmp(S6rm.s6_addr,S6am.s6_addr,16)==0) return 1;
} else {
sprintf(smasq,Y(f02),M[0],M[1],M[2],M[3]);
inet_pton(AF_INET,smasq, (void *)&Sm);
inet_pton(AF_INET,a, (void *)&Sa);
inet_pton(AF_INET,buf, (void *)&Sr);
if ((Sr.s_addr & Sm.s_addr) == (Sa.s_addr & Sm.s_addr)) return 1;
}
return 0;
}


+ 30
- 0
Septime/src/gesip.h View File

@@ -0,0 +1,30 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* gesip.h : fonctions pour la gestion des adresses IPv4 et IPv6 */

/* les codes qui indiquent la famille d'adresses IP */
#define IP4 0
#define IP6 1
#define ERR -1

extern int valCidr(char * c);
extern int isCidr(char*r);
extern int isCidr6(char*r);
extern int isSousRes(char*r, char *a);


+ 368
- 0
Septime/src/lich.c View File

@@ -0,0 +1,368 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* lich.c : listes chainees pour creer les elements (url, ip, ip6 ) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

#include "lich.h"

/* variables globales */
static long LC_SIZE = (long)0;
static long LC_SIZEL = (long)0;
static struct elt * First=FIN; /* depart du chainage */
static pthread_mutex_t mut_Elt = PTHREAD_MUTEX_INITIALIZER;

long getLC_SIZE(void) { return LC_SIZE; }
long getLC_SIZEL(void) { return LC_SIZEL; }
struct elt ** getFirst(void) { return &First; }
pthread_mutex_t * getMutElt(void) { return &mut_Elt; }

struct elt * ajouteElt(char * n, int s)
{
void * M;
struct elt *e, **D;
long sizeMore;
int i,c;
/* creation de l'espace memoire de l'element */
if ((M = malloc(sizeof(struct elt))) == NULL) {
perror(Y(p00)); return FIN;
}
sizeMore = sizeof(struct elt);
e = (struct elt *)M;
/* creation de l'espace memoire de l'url */
if ((M = malloc(strlen(n)+1)) == NULL) {
perror(Y(p00)); return FIN;
}
e->url = (char *)M;
sizeMore += strlen(n)+1;
/* remplissage de l'element */
strcpy(e->url,n);
e->stat = s;
e->ip = VIDE;
e->ip6 = VIDE;
e->next = FIN;
for (i=0;i<ELT_NBN;i++) e->no[i] = 0;
/* boucle sur l'adresse du suivant */
D=&First;
pthread_mutex_lock(&mut_Elt);
while (*D != FIN) {
if ((c=strcmp((*D)->url,n)) > 0) { /* insertion avant */
e->next = *D;
break;
}
if (c == 0) { /* deja present */
pthread_mutex_unlock(&mut_Elt);
free(M);
free((void*)e);
return *D;
}
D = &((*D)->next);
}
*D = e;
LC_SIZE += sizeMore;
pthread_mutex_unlock(&mut_Elt);
return e;
}

static void ajouteLib(struct lib **Lib, char *l)
{
void * M;
struct lib *e,**D;
long sizeMore;
int c;
/* creation de l'espace memoire du libelle */
if ((M = malloc(sizeof(struct lib))) == NULL) {
perror(Y(p00)); return;
}
sizeMore = sizeof(struct lib);
e = (struct lib *)M;
/* creation de l'espace memoire du libelle */
if ((M = malloc(strlen(l)+1)) == NULL) {
perror(Y(p00)); return;
}
sizeMore += strlen(l)+1;
e->lib = (char *)M;
/* remplissage de l'element */
strcpy(e->lib,l);
e->next = VIDE;
D=Lib;
pthread_mutex_lock(&mut_Elt);
while (*D != VIDE) {
if ((c=strcmp((*D)->lib,l)) > 0) { /* insertion avant */
e->next = *D;
break;
}
if (c == 0) { /* deja present */
pthread_mutex_unlock(&mut_Elt);
free(M);
free((void*)e);
return;
}
D = &((*D)->next);
}
*D = e;
LC_SIZE += sizeMore;
pthread_mutex_unlock(&mut_Elt);
}

static void ajouteLibD(struct libd **Lib, char *l, char * l2) /*Libs:l2=NULL*/
{
void * M, *M2;
struct libd *e,**D;
long sizeMore;
int c;
/* creation de l'espace memoire du libelle */
if ((M = malloc(sizeof(struct libd))) == NULL) {
perror(Y(p00)); return;
}
sizeMore = sizeof(struct libd);
e = (struct libd *)M;
/* creation de l'espace memoire du libelle */
if ((M = malloc(strlen(l)+1)) == NULL) {
perror(Y(p00)); return;
}
sizeMore += strlen(l)+1;
e->lib = (char *)M;
if (l2 == NULL) e->lib2 = NULL;
else {
if ((M2 = malloc(strlen(l2)+1)) == NULL) {
perror(Y(p00)); return;
}
sizeMore += strlen(l2)+1;
e->lib2 = (char *)M2;
strcpy(e->lib2,l2);
}
/* remplissage de l'element */
strcpy(e->lib,l);
e->next = VIDD;
D=Lib;
pthread_mutex_lock(&mut_Elt);
while (*D != VIDD) {
if ((c=strcmp((*D)->lib,l)) > 0) { /* insertion avant */
e->next = *D;
break;
}
if (c == 0) { /* deja present */
pthread_mutex_unlock(&mut_Elt);
free(M);
if (l2 != NULL) free(M2);
free((void*)e);
return;
}
D = &((*D)->next);
}
*D = e;
if (l2==NULL) LC_SIZE += sizeMore;
else LC_SIZEL += sizeMore;
pthread_mutex_unlock(&mut_Elt);
}

void ajouteIp(struct elt *E, char *ip, int v6)
{
if (v6) ajouteLib(&(E->ip6), ip);
else ajouteLib(&(E->ip), ip);
}

struct elt * getNum(int n)
{
struct elt **D;
int i;
D=&First;
while (*D != FIN) {
for (i=0; i< ELT_NBN; i++) if ((*D)->no[i] == n) return *D;
D = &((*D)->next);
}
return FIN; /* pas trouve ! */
}

/* Listes Cidr, Cidr6, Allow et Deny */
static struct libd *Libs = VIDD;
static struct libd *Cidr = VIDD;
static struct libd *Cidr6 = VIDD;
static struct lib *Allow = VIDE;
static struct lib *Deny = VIDE;

void ajouteLibs(char * e, char * l) { ajouteLibD(&Libs, e, l); }
void ajouteCidr(char * u) { ajouteLibD(&Cidr,u,NULL); }
void ajouteCidr6(char * u) { ajouteLibD(&Cidr6,u,NULL); }
void ajouteAllow(char * u) { ajouteLib(&Allow,u); }
void ajouteDeny(char * u) { ajouteLib(&Deny,u); }

int estSousDomaine(char * u, char * d)
{
int t, tu;
char *su;
tu = strlen(u);
t = strlen(d);
if (tu < t) return 0;
su = u + tu - t;
if (strcmp(su,d) == 0) {
if (*d == '.') return 1;
if (su==u) return 1;
if (*(su-1)=='.') return 1;
}
return 0;
}

static int addLib2(struct libd **L, char * u, char *l)
{
struct libd **D;
void *M;
int ret=0;
D=L;
pthread_mutex_lock(&mut_Elt);
while (*D != VIDD) {
if (strcmp(u,(*D)->lib)==0) { ret = 1; break; }
D = &((*D)->next);
}
if (ret) {
if ((*D)->lib2 != NULL) free((*D)->lib2);
/* creation de l'espace memoire de lib2 */
if ((M = malloc(strlen(l)+1)) == NULL) perror(Y(p00));
else { /* remplissage de l'element */
(*D)->lib2 = (char *)M;
LC_SIZE += strlen(l)+1;
strcpy((*D)->lib2,l);
}
}
pthread_mutex_unlock(&mut_Elt);
return ret;
}
int addNameCidr(char * u, char *l) { return addLib2(&Cidr,u,l); }
int addNameCidr6(char * u, char *l) { return addLib2(&Cidr6,u,l); }
static char * getEntErr(char c)
{
static char E[8];
E[3]='s';
E[1]=c;
E[2]='%';
*E='?';
E[4]='\0';
return E;
}

static char * getLib2(struct libd **L, char * u, int Lock)
{
struct libd **D;
int ret=0;
D=L;
if (Lock) pthread_mutex_lock(&mut_Elt);
while (*D != VIDD) {
if (strcmp(u,(*D)->lib)==0) { ret = 1; break; }
D = &((*D)->next);
}
if (Lock) pthread_mutex_unlock(&mut_Elt);
if (ret) return (*D)->lib2;
if (Lock == 0) { /* pour l'instant seult libs */
fprintf(stderr,getEntErr('L'),u);
exit(129);
}
return NULL;
}
char * getNameCidr(char * u) { return getLib2(&Cidr,u,1); }
char * getNameCidr6(char * u) { return getLib2(&Cidr6,u,1); }
char * getLibelle(char * e) { return getLib2(&Libs,e,0); }

static int estDans(struct lib **L, char * u)
{
struct lib **D;
int ret=0;
D=L;
pthread_mutex_lock(&mut_Elt);
while (*D != VIDE) {
if (estSousDomaine(u,(*D)->lib)) { ret = 1; break; }
D = &((*D)->next);
}
pthread_mutex_unlock(&mut_Elt);
return ret;
}
int inAllow(char * u) { return estDans(&Allow,u); }
int inDeny(char * u) { return estDans(&Deny,u); }

void listeLib(struct lib **L)
{
struct lib **D;
D=L;
while (*D != VIDE) {
printf(Y(f49),(*D)->lib);
D = &((*D)->next);
}
}

void listeLibD(struct libd **L)
{
struct libd **D;
int i=0;
D=L;
while (*D != VIDD) {
printf(Y(f50),(*D)->lib,(*D)->lib2);
i++;
D = &((*D)->next);
}
printf(Y(f65),i);
}

static void listeLibD2(struct libd **L, char *s)
{
struct libd **D;
int i=0;
char *d;
D=L;
while (*D != VIDD) {
if (*s != '\0') {
if (strstr((*D)->lib,s) == NULL) {
if (strstr((*D)->lib2,s) == NULL) {
D = &((*D)->next); continue;
}
}
}
printf(Y(f66),(*D)->lib);
d = (*D)->lib2;
printf("\"");
while (*d != '\0') {
if (*d == '\n') printf("\\n");
else {
if (*d == '\r') printf("\\r");
else {
if (*d == '\t') printf("\\t");
else {
if (*d == '\e') printf("\\e");
else {
if (*d == '\\') printf("\\");
printf("%c",*d);
}
}
}
}
d++;
}
printf("\"\n");
i++;
D = &((*D)->next);
}
printf(Y(f65),i);
}

void listeAllow(void) { printf(Y(i13)); listeLib(&Allow); }
void listeDeny(void) { printf(Y(i14)); listeLib(&Deny); }
void listeLibs(char *s) { listeLibD2(&Libs,s); }



+ 80
- 0
Septime/src/lich.h View File

@@ -0,0 +1,80 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* lich.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* les structures du chainage des elts */
#define ELT_NBN 4 /* max 16 */
#define ELT_NBITS 0xF
#define ELT_DENY 0x10
#define ELT_INDEN 0x20
#define ELT_ALLOW 0

struct lib { /* stucture d'un libelle */
char *lib; /* le libelle */
struct lib * next; /* adresse du prochain libelle */
};

struct libd { /* stucture d'un libelle double */
char *lib; /* le libelle */
char *lib2; /* le 2eme libelle facultatif */
struct libd * next; /* adresse du prochain libelle */
};

struct elt { /* stucture d'un element */
int stat; /* status (allow/deny, etc ) */
int no[ELT_NBN]; /* no des requetes en cours */
char *url; /* url de l'element */
struct lib *ip; /* adresses IPv4 de l'element */
struct lib *ip6; /* adresses IPv6 de l'element */
struct elt * next; /* adresse du prochain element */
};

#define FIN (struct elt *)NULL
#define VIDE (struct lib *)NULL
#define VIDD (struct libd *)NULL

#define Y(s) (getLibelle(#s))

extern long getLC_SIZE(void);
extern long getLC_SIZEL(void);
extern struct elt ** getFirst(void);
extern pthread_mutex_t * getMutElt(void);

extern struct elt * ajouteElt(char * n, int s);
extern void ajouteIp(struct elt *E, char *ip, int v6);
extern struct elt * getNum(int n);
extern void ajouteAllow(char * u);
extern void ajouteDeny(char * u);
extern int estSousDomaine(char * u, char * d);
extern int addNameCidr(char * u, char *l);
extern int addNameCidr6(char * u, char *l);
extern char * getNameCidr(char * u);
extern char * getNameCidr6(char * u);
extern int inAllow(char * u);
extern int inDeny(char * u);
extern void listeLib(struct lib **L);
extern void listeAllow(void);
extern void listeDeny(void);
extern void ajouteLibs(char * e, char * l);
extern void listeLibs(char *s);
extern char * getLibelle(char * u);


+ 181
- 0
Septime/src/regles.txt View File

@@ -0,0 +1,181 @@
# URLs et domaines acceptes ou rejetes (avec - devant le nom)
.net
-google.org
-google.fr
-adsrvr.org
.org
.fr
windy.com
deepl.com
boursorama.com
boursobank.com
github.com
kimsufi.com
qwant.com
mediadecathlon.com
decathlon.io
docs.rs
gandi.net

# Les CIDRs peuvent etre suivis de ";nom du proprietaire"
#IPV4
3.0.0.0/8;Amazon Technologies Inc.
13.24.0.0/13;Amazon Technologies Inc.
13.244.0.0/14;Amazon Technologies Inc.
13.248.0.0/14;Amazon Technologies Inc.
13.32.0.0/12;Amazon Technologies Inc.
13.48.0.0/13;Amazon Technologies Inc.
13.56.0.0/14;Amazon Technologies Inc.
15.179.0.0/16;Amazon Technologies Inc.
15.180.0.0/14;Amazon Technologies Inc.
15.184.0.0/14;Amazon Technologies Inc.
15.188.0.0/16;Amazon Technologies Inc.
15.196.0.0/14;Amazon Technologies Inc.
15.200.0.0/16;Amazon Technologies Inc.
15.236.0.0/14;Amazon Technologies Inc.
17.0.0.0/8;Apple Inc.
18.128.0.0/9;Amazon Technologies Inc.
18.32.0.0/11;Amazon Technologies Inc.
18.64.0.0/10;Amazon Technologies Inc.
20.0.0.0/11;Microsoft Corporation
20.33.0.0/16;Microsoft Corporation
20.34.0.0/15;Microsoft Corporation
20.36.0.0/14;Microsoft Corporation
20.40.0.0/13;Microsoft Corporation
20.48.0.0/12;Microsoft Corporation
20.64.0.0/10;Microsoft Corporation
20.128.0.0/16;Microsoft Corporation
23.40.112.0/20;Akamai Technologies, Inc.
34.128.0.0/10;Google LLC
34.192.0.0/10;Amazon Technologies Inc.
34.64.0.0/10;Google LLC
35.152.0.0/13;Amazon Technologies Inc.
35.160.0.0/12;Amazon Technologies Inc.
35.176.0.0/13;Amazon Technologies Inc.
35.184.0.0/13;Google LLC
35.192.0.0/12;Google LLC
35.208.0.0/12;Google LLC
35.224.0.0/12;Google LLC
35.240.0.0/13;Google LLC
35.71.128.0/17;Amazon Technologies Inc.
35.71.64.0/18;Amazon Technologies Inc.
35.72.0.0/13;Amazon Technologies Inc.
35.80.0.0/12;Amazon Technologies Inc.
37.157.2.0/24;Adform Secondary DTC IPv4 Network
44.192.0.0/10;Amazon.com, Inc.
47.235.0.0/16;Alibaba Cloud LLC
47.236.0.0/14;Alibaba Cloud LLC
47.240.0.0/14;Alibaba Cloud LLC
47.244.0.0/15;Alibaba Cloud LLC
47.246.0.0/16;Alibaba Cloud LLC
50.31.128.0/17;Geofeed Network Operations
52.0.0.0/10;Amazon Technologies Inc.
52.192.0.0/12;Amazon Technologies Inc.
52.208.0.0/13;Amazon Technologies Inc.
52.216.0.0/14;Amazon Technologies Inc.
52.220.0.0/15;Amazon Technologies Inc.
52.222.128.0/17;Amazon Technologies Inc.
52.223.0.0/17;Amazon Technologies Inc.
52.223.128.0/18;Amazon Technologies Inc.
52.64.0.0/12;Amazon Technologies Inc.
52.84.0.0/14;Amazon Technologies Inc.
52.88.0.0/13;Amazon Technologies Inc.
54.144.0.0/12;Amazon Technologies Inc.
54.160.0.0/11;Amazon Technologies Inc.
54.192.0.0/12;Amazon Technologies Inc.
54.208.0.0/13;Amazon Technologies Inc.
54.216.0.0/14;Amazon Technologies Inc.
54.220.0.0/15;Amazon Technologies Inc.
54.224.0.0/11;Amazon Technologies Inc.
54.64.0.0/11;Amazon Technologies Inc.
63.32.0.0/14;Amazon.com, Inc.
67.55.4.0/22;Distributel Communications Limited
67.55.8.0/21;Distributel Communications Limited
67.55.16.0/20;Distributel Communications Limited
67.55.32.0/19;Distributel Communications Limited
69.173.144.0/20;The Rubicon Project, Inc.
76.223.0.0/17;Amazon.com, Inc.
76.223.128.0/19;Amazon.com, Inc.
76.223.160.0/20;Amazon.com, Inc.
81.17.55.0/24;LeaseWeb Netherlands B.V.
88.221.198.0/24;Akamai Technologies
89.149.192.0/18;LeaseWeb Netherlands B.V.
92.122.166.0/24;Akamai Technologies
99.80.0.0/15;Amazon.com, Inc.
99.85.128.0/17;Amazon.com, Inc.
99.86.0.0/16;Amazon.com, Inc.
99.87.0.0/17;Amazon.com, Inc.
99.87.128.0/18;Amazon.com, Inc.
104.16.0.0/12;Cloudflare, Inc.
104.64.0.0/10;Akamai Technologies, Inc.
104.244.40.0/21;Twitter Inc.
108.128.0.0/13;Amazon.com, Inc.
108.136.0.0/14;Amazon.com, Inc.
142.250.0.0/15;Google LLC
151.101.0.0/16;Fastly, Inc.
152.199.0.0/16;Verizon Business
162.158.0.0/15;Cloudflare, Inc.
172.64.0.0/13;Cloudflare, Inc.
172.217.0.0/16;Google LLC
178.250.1.0/24;Criteo Europe Infrastructures
185.64.189.0/24;Abuce-c PubMatic
185.74.70.0/24;Infomaniak Network SA
185.89.210.0/23;IPAdmin
185.235.86.0/24;Criteo Network Operations Center
185.235.87.0/24;Criteo Network Operations Center
192.124.249.0/24;Sucuri
192.229.128.0/17;Edgecast Inc.
193.8.206.0/24;France Televisions SA
199.59.148.0/22;Twitter Inc.
199.232.0.0/16;Fastly, Inc.
205.251.192.0/18;Amazon.com, Inc.
209.67.0.0/16;CenturyLink Communications, LLC
216.58.192.0/19;Google LLC

# IPv6
2001:1af8::/32;LeaseWeb Netherlands B.V.
2600:9000::/28;Amazon.com, Inc.
2603:1000::/24;Microsoft Corporation
2620:149::/32;Apple Inc.
2a01:e00::/26;Free SAS
2a00:1450:4000::/37;EU metro frontend
2a02:26f0::/29;Akamai International B.V.
2a03:2880::/29;RIPE DBM
2a04:4e40::/29;Fastly, Inc.

# ajouts
arin.net
media.adeo.com
mozilla.com
manomano.com
www.dailymotion.com
aliexpress.com
cloudflare.com
linkinghub.elsevier.com
www.sciencedirect.com
pdf.sciencedirectassets.com
ocsp.usertrust.com
proton.me
hackaday.com
ed-diamond.com
maree.info
stackoverflow.com
villiers.yoga
verisign-grs.com
duckduckgo.com
linux-console.net
opendatasoft.com
mysql.com
mozilla.net
debian.map.fastlydns.net
www.cdiscount.com
experts-exchange.com
stackexchange.com
fnac.com
fnac-static.com
denx.de
siemens.com
hackster.io
bootlin.com
rt-thread.io
lesnumeriques.com

+ 964
- 0
Septime/src/scannet.c View File

@@ -0,0 +1,964 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/*
############################################################
# Projet Kouglof 2 de l'Ecole du Logiciel Libre d'Ivry : #
############################################################

septime.c : version amelioree d'octave. Outil pour scanner l'interface reseau
afin d'analyser les sites auxquels les applications veulent se connecter.
A utiliser avec le fichier regles.txt pour stopper les connexions non voulues

Tous les details sur le site :
https://e2li.org -> menu : Projet Prosecco.

*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <sys/wait.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <errno.h>
#include <syslog.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <zlib.h>

#define BYTE unsigned char

#include "trace.h"
#include "lich.h"
#include "gesip.h"
#include "comsh.h"
#include "gen_t3.h"
#include "gen_ypt.h"

#define F_GETPIPE_SZ 1032
#define F_SETPIPE_SZ 1031
#define DELAYR 20 /* delai avant relance auto */

int DebugOn=0; /* utilise dans d'autres modules */
static int RUN=1, REQ=0, ENDT=0, REINI=0, REPR=0, JCTL=0, LogC=0, WH=1, p1[2];
static char *IFACE=NULL;
static pthread_mutex_t *mut_Elt;
/* quelques constantes chaines */
static pid_t pid;

static void interup (int S)
{
switch(S) {
case SIGINT:
write(p1[1],"\n",1);
REQ=1; return;
break;
case SIGCHLD:
if (waitpid(pid,NULL,WNOHANG) == pid) {
ENDT=1;
write(p1[1],"\n",1);
}
break;
case SIGHUP:
case SIGILL:
case SIGSEGV:
ENDT=S+1;
write(p1[1],"\n",1);
break;
default:
fprintf(stderr,Y(a00),S);
}
}

/* #### les fonctions de compression avec libz : man 3 zlib */

int DecompressBuf(BYTE* src, int nbi, BYTE* dest, int nbo)
{
z_stream zInfo = {0};
zInfo.total_in = zInfo.avail_in = nbi;
zInfo.total_out = zInfo.avail_out = nbo;
zInfo.next_in = src;
zInfo.next_out = dest;
int nErr, nRet = -1;
nErr = inflateInit(&zInfo);
if (nErr == Z_OK) {
nErr = inflate(&zInfo, Z_FINISH);
if (nErr == Z_STREAM_END) nRet = zInfo.total_out;
}
inflateEnd(&zInfo);
return(nRet);
}

/* #### les fonctions adresses IP : cf gesip.c */

static long long NbAddCidrs = 0, NbAddCidrs6=0;

/* #### gestion dynamique des CIDR */

#define NBC 200 /* nb de CIDR */
static char* Tcidr[NBC];
static char* Ncidr[NBC];
static unsigned char Ttip[NBC];
static int iC=0;

static int rejectIP(char*, int);

static int addCidr(char * c, char * n, int v6) /* v6=0 IPv4 sinon IPv6 */
{
int i=iC;
char *r;
if (i==NBC) return i;
Tcidr[i] = (char*)malloc(strlen(c)+1);
strcpy(Tcidr[i],c);
Ttip[i] = (char)v6;
if (n != NULL) r = n;
else r = comWhois(c);
Ncidr[i] = (char*)malloc(strlen(r)+1);
strcpy(Ncidr[i],r);
iC++;
rejectIP(c,v6);
return i;
}

static void delCidr(char * c)
{
int i;
for (i=0; i<iC; i++)
if (strcmp(c,Tcidr[i]) == 0) {
iC--;
if (iC == i) return;
if (iC > 0) {
Tcidr[i] = Tcidr[iC];
Ncidr[i] = Ncidr[iC];
Ttip[i] = Ttip[iC];
}
return;
}
}

static int isAddrInCidr(char * a, int M, int v6)
{
int i;
for(i=0;i<iC;i++) {
if (Ttip[i] != (char)v6) continue;
if (isSousRes(Tcidr[i],a)) {
if (M) syslog(LOG_INFO,Y(f56),a,Tcidr[i],Ncidr[i]);
return 1;
}
}
return 0;
}

static void validCidr(void)
{
int i,j;
char a[52],*p, *g, *w;
for(i=0;i<iC;i++)
for (j=i+1;j<iC;j++) {
if (Ttip[i] != Ttip[j]) continue;
if (valCidr(Tcidr[i]) < valCidr(Tcidr[j])) {
p=Tcidr[i]; g=Tcidr[j];
} else {
p=Tcidr[j]; g=Tcidr[i];
}
strcpy(a,g);
w = strchr(a,(int)'/');
*w = '\0';
w++;
if (isSousRes(p,a)) {
trace(1, Y(t01),p,a,w);
delCidr(g);
}
}
}

static void listCidr(void)
{
int i;
printf(Y(i11), iC, NbAddCidrs,(NbAddCidrs6*(long long)3) / (long long)10);
for (i=0; i<iC; i++) printf(Y(f57), Tcidr[i],Ncidr[i]);
}

static int isDeny(char*u)
{
if (inDeny(u)) return ELT_INDEN|ELT_DENY;
if (inAllow(u)) return ELT_ALLOW;
return ELT_DENY; /* deny par defaut */
}

static void listeAllowS(void)
{
pthread_mutex_lock(mut_Elt);
listeAllow();
pthread_mutex_unlock(mut_Elt);

}
static void listeDenyS(void)
{
pthread_mutex_lock(mut_Elt);
listeDeny();
pthread_mutex_unlock(mut_Elt);

}
static void recaplistes(void)
{
listeDenyS();
listeAllowS();
}

static int litligne(char * line)
{
char *d,*w,*n;
int v;
d=line;
while (*d == ' ') d++;
if (*d == '#') return 1;
if ((n=strchr(line, (int)'\n')) != NULL) *n = '\0';
w=d;
if (*w == '-') w++;
if (strlen(w) == 0) return 1;
if ((n=strchr(w, (int)';')) != NULL) *n++ = '\0';
if ((v=isCidr(w)) > 0) { /* test si CIDR */
addCidr(w,n,IP4);
NbAddCidrs += (long long)(1<<(32-v));
return 1;
}
if ((v=isCidr6(w)) > 0) { /* test si CIDR6 */
addCidr(w,n,IP6);
NbAddCidrs6 += (long long)(1<<(50-v));
return 1;
}
if (*d == '-') {
ajouteDeny(w);
} else {
ajouteAllow(w);
}
return 1;
}

static void lectlibs(void)
{
FILE * fd;
char *f, b[5], *w, *bs;
char *line = NULL;
size_t ll = 0;
int n;
f=b+1;
*f='y';
f[4] = '\0';
*b = f[2]='.';
f[1] = f[3] = 'p';
gen_ypt(--f);
if ((fd = fopen(f,"r")) == NULL) {
perror(f); exit(99);
}
if (unlink(f)) perror(f);
while ((n = getline(&line, &ll, fd)) > 0) {
if (*line == '>') {
if ((w = strchr(line,(int)':')) == NULL) continue;
line[strlen(line)-1]='\0';
*w++ = '\0';
bs = w;
while ((bs = strchr(bs,(int)'\\')) != NULL) {
memmove((void*)(bs),(void*)(bs+1),strlen(bs));
switch(*bs) {
case 'a' :
*bs='\a'; break;
case 'b' :
*bs='\b'; break;
case 'e' :
*bs='\e'; break;
case 'f' :
*bs='\f'; break;
case 'n' :
*bs='\n'; break;
case 'r' :
*bs='\r'; break;
case 't' :
*bs='\t'; break;
case 'v' :
*bs='\v'; break;
}
bs++;
}
if ((strlen(line+1) > 0) && (strlen(w) > 0))
ajouteLibs(line+1,w);
}
}
free((void*)line);
fclose(fd);
}

static int lectliste(char *f)
{
FILE * fd;
char *line = NULL;
size_t ll = 0;
int n;
if ((fd = fopen(f,"r")) == NULL) {
perror(f); return 1;
}
while ((n = getline(&line, &ll, fd)) > 0) {
prAube();
if (!litligne(line)) {
trace(1, Y(t02),line);
}
}
printf(Y(k29));
free(line);
fclose(fd);
validCidr();
if (T3) listCidr();
return 0;
}

static void addElt(int n, struct elt *E)
{
int i;
for (i=0;i<ELT_NBN;i++) if (E->no[i]==n) return;
i = (E->stat) & ELT_NBITS;
E->no[i]=n;
i++;
if (i==ELT_NBN) i=0;
E->stat = ((E->stat) & (int)(~ELT_NBITS)) + i;
}

static void listeElts(int S, char *mot)
{
struct elt **D;
int n=0, t=0, i;
char * aoud, s='.';
D=getFirst();
pthread_mutex_lock(mut_Elt);
while (*D != FIN) {
t++;
/* filtrages */
if (S != -1) {
if (((*D)->stat & ELT_DENY) != S) { D = &((*D)->next); continue; }
}
if (*mot != '\0') {
if (strstr((*D)->url,mot) == NULL) { D = &((*D)->next); continue; }
}
if ((*D)->stat & ELT_DENY) aoud = Y(k13); else aoud = Y(k12);
printf(Y(f51),aoud, (*D)->url, (*D)->stat);
printf(Y(f52),(*D)->no[0]);
for (i=1; i<ELT_NBN; i++) printf(Y(f53),(*D)->no[i]);
printf(Y(f54));
if ((*D)->ip ==VIDE) printf(Y(k30),4); else listeLib(&((*D)->ip));
if ((*D)->ip6==VIDE) printf(Y(k30),6); else listeLib(&((*D)->ip6));
n++;
D = &((*D)->next);
}
pthread_mutex_unlock(mut_Elt);
if (n>1) s='s';
printf(Y(f58),n,s,t);
}

static void modEnsUrl(int Deny, char *Url)
{
struct elt **D;
D=getFirst();
pthread_mutex_lock(mut_Elt);
while (*D != FIN) {
if (estSousDomaine((*D)->url,Url)) {
if (((*D)->stat | ELT_DENY) == Deny) {
D = &((*D)->next); continue;
}
if (Deny) (*D)->stat |= ELT_DENY;
else (*D)->stat &= ~ELT_DENY;
}
D = &((*D)->next);
}
pthread_mutex_unlock(mut_Elt);
}

static int rejectIP(char* ip, int v6)
{
if (isIPbloquee(v6, ip)) return 0;
return rejetIP(v6,ip);
}

static int bloqueIP(char* ip,int v6, int S)
{
if (isIPprotegee(v6,ip)) {
if (S & ELT_INDEN) deprotegeIP(v6,ip);
else return 0; // pour les doubles présences
}
if (isAddrInCidr(ip,0,v6)) return 0;
return rejectIP(ip, v6);
}

static int debloqueIP(char* ip, char * url,int v6)
{
if (isIPbloquee(v6, ip)) derejetIP(v6,ip);
if (isIPprotegee(v6,ip)) return 0;
if (isAddrInCidr(ip,1,v6)) {
if (url != NULL) syslog(LOG_INFO,Y(f59),url,ip);
return protegeIP(v6,ip);
}
return 0;
}

static int rebloqueIP(char* ip) /* pour valider l'adresse ! */
{
return deprotegeIP(IP4,ip);
}

static int verifIPOk(char * l, struct elt *E, int v6)
{
char *s,*d=l;
int S=E->stat;
while ((s=strstr(d, Y(k15))) != NULL) {
s+=2;
if ((d=strchr(s+2, (int)',')) == NULL) break;
*d = '\0';
d++;
ajouteIp(E,s,v6);
if (S&ELT_DENY) bloqueIP(s,v6,S);
else debloqueIP(s,E->url,v6);
}
ajouteIp(E,s,v6);
if (S&ELT_DENY) bloqueIP(s,v6,S);
else debloqueIP(s,E->url,v6);
return 1;
}

static void ajoutParam(char * ficp, char * param)
{
FILE * fw;
fw = fopen(ficp,"a");
fwrite(param,strlen(param),1,fw);
fwrite("\n",1,1,fw);
fclose(fw);
}

static int NBin=0, NBina=0, NBout=0;
static void prInOut(void)
{
printf(Y(f60),NBout+NBin,NBout,NBin,NBina);
printf(Y(f61),getLC_SIZE()+getLC_SIZEL(),getLC_SIZEL());
}

static int confirm(char * q)
{
char *rep=NULL;
size_t lr = 0;
int n;
while (1) {
printf(Y(i15),q);
if ((n = getline(&rep, &lr, stdin)) != 2) continue;
if (*rep == 'O') return 1;
if (*rep == 'o') return 1;
return 0;
}
}

static char FHISTO[20];

static void * fct_com(void * p)
{
int RUN2=1;
char *cmd = NULL, *fauth, *mot, pr[30], com[200];
int n2, v;
fauth = (char*)p;
pidG = getpid();
sprintf(com,Y(f55), Y(k33));
strncpy(FHISTO,com,19);
using_history();
read_history(FHISTO);
while (RUN2) {
if (kill(pid,SIGUSR1) < 0) { /* verif processus acquisition */
ENDT=1;
write(p1[1],"\n",1);
break;
}
free(cmd);
sprintf(pr,Y(f00),Y(k33));
cmd = readline(pr);
if ((n2 = strlen(cmd)) > 0) {
write(p1[1],"\n",1);
add_history(cmd);
switch (*cmd) {
case '+' :
if (*(cmd+1) != '\0') {
if (isCidr(cmd+1) || isCidr6(cmd+1))
printf(Y(e08));
else {
if (litligne(cmd+1)) { /* ajout au fichier fauth */
if (debloqueIP(cmd+1,NULL,IP4)) printf(Y(f62),Y(e07));
else {
modEnsUrl(ELT_ALLOW, cmd+1);
if (confirm(Y(m25)))
ajoutParam(fauth,cmd+1);
listeAllowS();
}
} else printf(Y(e01));
}
} else listeAllowS();
break;
case '-' :
if (*(cmd+1) != '\0') {
if (isCidr(cmd+1) || isCidr6(cmd+1))
printf(Y(e08));
else {
if (litligne(cmd)) { /* ajout au fichier fauth */
if (rebloqueIP(cmd+1)) printf(Y(f62),Y(e07));
else {
modEnsUrl(ELT_DENY, cmd+1);
if (confirm(Y(m25)))
ajoutParam(fauth,cmd);
listeDenyS();
}
} else printf(Y(e01));
}
} else listeDenyS();
break;
case 't' :
if (*(cmd+1) != '\0') {
if ((cmd[1] == '+') || (cmd[1] == '-')) {
if (cmd[1] == '+') v=1;
else v=-1;
if (incrTrace(v))
printf(Y(a03),TMIN,TMAX);
} else printf(Y(e02));
}
prTrace();
break;
case 'c' :
if (*(cmd+1) != '\0') {
if (isCidr(cmd+1) || isCidr6(cmd+1)) {
if (litligne(cmd+1)) {
validCidr(); /* pour info */
if (confirm(Y(m25))) ajoutParam(fauth,cmd+1);
} else printf(Y(e01));
} else Pignore(cmd+1);
}
listCidr();
break;
case 'e' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
comFct(FCT_COMe, JCTL,NULL);
break;
case 'u' :
n2 = -1;
mot=cmd+1;
if (*mot != '\0') {
if (*mot == '+') { n2=0; mot++; }
if (*mot == '-') { n2=ELT_DENY; mot++; }
}
listeElts(n2,mot);
break;
case 'E' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
comFct(FCT_COME, JCTL,NULL);
break;
case 'L' :
if (*(cmd+1) == '!') listeLibs(cmd+2);
else comFct(FCT_COML, JCTL,cmd);
break;
case 'l' :
comFct(FCT_COMl, JCTL,cmd);
prInOut();
break;
case '>' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
comFct(FCT_COMsup, JCTL,NULL);
prInOut();
break;
case '<' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
comFct(FCT_COMinf, JCTL,NULL);
prInOut();
break;
case 'r' :
comFct(FCT_COMr, JCTL,cmd);
break;
case 'R' :
comFct(FCT_COMR, JCTL,cmd);
break;
case 'v' :
comFct(FCT_COMv, JCTL,cmd);
break;
case 'V' :
comFct(FCT_COMV, JCTL,cmd);
break;
case 'N' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
if (confirm(Y(m26))) {
RUN = 0;
REINI = 1;
write(p1[1],"\n",1);
}
break;
case 'S' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
if (confirm(Y(m27))) {
razIPT();
printf(Y(m28));
RUN = 0;
RUN2 = 0;
write(p1[1],"\n",1);
}
break;
case 'Q' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
if (confirm(Y(m29))) {
RUN = 0;
RUN2 = 0;
write(p1[1],"\n",1);
}
break;
case ' ' :
if (*(cmd+1) != '\0') comsh(cmd+1,0);
break;
case 'A' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
printf(Y(m12));
printf(Y(m13));
printf(Y(m14));
break;
case 'P' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
printf(Y(m15));
printf(Y(m16));
printf(Y(m17));
printf(Y(m18));
printf(Y(m19));
printf(Y(m20));
break;
case 'T' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
printf(Y(m21));
if (LogC) {
printf(Y(m22));
printf(Y(m23));
printf(Y(m24));
}
break;
case '?' :
if (*(cmd+1) != '\0') Pignore(cmd+1);
printf(Y(m00),Y(k33),pidG,Y(v00));
prInOut();
default :
printf(Y(m01));
printf(Y(m02));
printf(Y(m03));
printf(Y(m38));
printf(Y(m04));
printf(Y(m05));
printf(Y(m06));
printf(Y(m07));
printf(Y(m08));
printf(Y(m09));
printf(Y(m10));
printf(Y(m11));
break;
}
}
}
if ((WH=write_history(FHISTO))!=0) {
printf(Y(a04),WH);
perror(Y(p12));
}
free(cmd);
sprintf(com,Y(c20),pidG);
comsh(com,0);
/* fin dialogue */
pthread_exit(NULL);
}

static void getIface(void)
{
FILE * fd;
char *line = NULL, *s, *w;
size_t ll = 0;
int n;
if ((fd = fopen(Y(k26),"r")) == NULL) {
perror(Y(p06)); return;
}
while ((n = getline(&line, &ll, fd)) > 0) {
if ((s=strstr(line,Y(k16)))==NULL) continue;
w=line;
while ((*w != ' ') && (*w != '\t')) w++;
*w = '\0';
w++;
while ((*w == ' ') || (*w == '\t')) w++;
if (s==w) { /* ok */
IFACE = (char*)malloc(strlen(line)+1);
strcpy(IFACE,line);
break;
}
}
free(line);
fclose(fd);
}

int main(int N, char * P[])
{
pthread_t thid;
FILE * fp;
struct elt *Elt;
char *analyse, *line = NULL, *cmd = NULL, *s1, *s2;
char *fauth, *strR = "-R", *Pars, strPID[8], **NP;
size_t ll = 0, lc = 0;
ssize_t n,n2;
int Inter=0, i, ie, np=0, opt;
if ((NPROG = strrchr(P[0],(int)'/')) == NULL) NPROG=P[0];
else NPROG++;
lectlibs();
sprintf(strPID,Y(f52),getpid());
fauth = Y(k24);
analyse = Y(k25);
if (exeComA(Y(c22)) == 0) {
fprintf(stderr,Y(e09),analyse); return 1;
}
/* verif. options */
while ((opt = getopt(N, P, Y(k32))) != -1) {
switch (opt) {
case 'd':
DebugOn = 1;
break;
case 'i':
Inter = 1;
break;
case 'l':
LogC = 1;
break;
case 't':
setTrace(TMIN+1);
break;
case 'p':
fauth = optarg;
break;
case 'R':
REPR=1;
np = atoi(optarg);
break;
default: /* '?' */
fprintf(stderr, Y(i01), NPROG);
fprintf(stderr, Y(i02));
fprintf(stderr, Y(i03));
fprintf(stderr, Y(i04));
fprintf(stderr, Y(i05),fauth);
fprintf(stderr, Y(i06));
return 1;
}
}
if ((REPR) && (np != getpid())) {
fprintf(stderr,Y(i07), np);
return 1;
}
if (optind < N) {
fprintf(stderr,Y(i08), P[optind]);
return 1;
}
getIface();
if (REPR) {
while (IFACE==NULL) { sleep(1); getIface(); }
} else {
if (IFACE == NULL) {
fprintf(stderr,Y(i09));
return 9;
}
}
printf(Y(f47), Y(k33), Y(v00), IFACE);
/* verif privilege root */
if ((getuid() > 0) && (geteuid() > 0)) {
fprintf(stderr,Y(i10));
return 2;
}
if (comsh(Y(c00),EX_SILENT) == 0) JCTL=1;
trace(1,Y(t03),fauth);
signal(SIGUSR1,SIG_IGN);
if (pipe(p1) < 0) {
perror(Y(p07)); return 3;
}
openlog(NULL,LOG_PID,0);
if ((REPR==0) && ((np=initIPT())!=0)) {
trace(1, Y(t04),np);
syslog(LOG_WARNING, Y(a05),np);
}
/* lecture des listes */
if (lectliste(fauth)) return 1;
if (T3) recaplistes();
gen_t3(Y(k31));
/* on lance le fils : */
if ((pid = fork()) < 0) {
perror(Y(p08)); return 4;
}
if (pid == 0) {
signal(SIGINT,SIG_IGN);
close(0);
close(p1[0]);
dup2(p1[1],1); /* stdout dans p1 */
dup2(p1[1],2); /* idem stderr */
setsid();
execlp(analyse,analyse,Y(k27),"-i",IFACE,Y(k28),"53",NULL);
perror(Y(p09));
return 5;
}
if (Inter) signal(SIGINT,SIG_IGN);
else signal(SIGINT,interup);
mut_Elt = getMutElt();
sleep(1); /* attend le fils en place */
if (kill(pid,SIGUSR1) < 0) return 6;
signal(SIGCHLD,interup);
signal(SIGHUP,interup);
signal(SIGILL,interup);
signal(SIGSEGV,interup);
/* on analyse la sortie de p1 */
if ((fp = fdopen(p1[0],"r")) == NULL) {
perror(Y(p10)); return 7;
}
fcntl(p1[0], F_SETPIPE_SZ,1048576);
trace(1, Y(t05),NPROG, strPID,pid);
trace(1, Y(t06), (long)fcntl(p1[0], F_GETPIPE_SZ));
np=0;
/* lancement du thread-shell */
if (Inter) {
if (pthread_create(&thid,NULL,fct_com,(void*)fauth) != 0) {
fprintf(stderr,Y(e03)); return 9;
}
}
while (RUN) {
if ((n = getline(&line, &ll, fp)) > 0) {
if (ENDT) {
if (ENDT==1) printf(Y(e04));
break;
}
if (RUN == 0) break;
if ((n==1) && (*line=='\n')) continue;
if (np==0) { np++;
if (REPR) syslog(LOG_INFO,Y(m30));
else syslog(LOG_INFO,Y(m31));
}
/* analyse */
if ((s1=strstr(line, Y(k17))) == NULL) continue;
if (strstr(line, Y(k18)) != NULL) continue; /* ignore PTR */
if (strncmp(s1-3,Y(k19),3) == 0) { /* REPONSE */
if ((s2=strchr(s1+3, (int)':')) == NULL) continue;
NBin++;
*s2 = '\0';
s1 = s2 -1;
while (*s1 != '.') s1--;
np = atoi(s1+1);
s1 = s2+1;
if ((Elt = getNum(np)) != FIN) { /* Elt PRESENT ! */
if ((s2=strstr(s1, Y(k20))) != NULL) { /* IPv4 */
s2++;
s1 = strrchr(s2,(int)' ');
*s1 = '\0';
if (LogC) syslog(LOG_INFO,Y(f63),np,s2);
NBina++;
verifIPOk(s2, Elt, IP4);
} else {
if ((s2=strstr(s1, Y(k21))) != NULL) { /* IPv6 */
s2++;
s1 = strrchr(s2,(int)' ');
*s1 = '\0';
if (LogC) syslog(LOG_INFO,Y(f63),np,s2);
NBina++;
verifIPOk(s2, Elt, IP6);
}
}
} else {
if (NBout == 0) continue;
if ((s2=strstr(s1, Y(k22))) != NULL)
syslog(LOG_WARNING,Y(a06),np,s1,Y(e05));
}
} else { /* DEMANDE */
NBout++;
*s1 = '\0';
s2 = s1 +1;
while (*s1 != '.') s1--;
np = atoi(s1+1);
if ((s1=strstr(s2, Y(k23))) == NULL) continue; /* IPv4 & v6 */
s1 += 3;
s2 = s1 +1;
while (*s2 != ' ') s2++;
*(s2-1) = '\0'; /* on supprime le '.' */
if (LogC) syslog(LOG_INFO,Y(f64),np,s1);
if (strchr(s1, (int)'.') == NULL) { /* il doit en rester 1 */
trace(1, Y(t07),np,s1);
syslog(LOG_WARNING,Y(a07),np,s1);
continue;
}
Elt = ajouteElt(s1,-1);
if (Elt->stat == -1) Elt->stat = isDeny(s1); /* nouveau */
addElt(np,Elt);
}
}
if (REQ) {
printf(Y(m32));
if ((n2 = getline(&cmd, &lc, stdin)) > 0) {
switch (*cmd) {
case 'C' :
REQ = 0;
break;
case 'S' :
RUN = 0;
REQ = 0;
break;
default :
printf(Y(m33));
printf(Y(m34));
break;
}
}
}
}
if (REINI==0) {
if (ENDT==1) syslog(LOG_INFO,Y(m35));
else syslog(LOG_WARNING,Y(m36),ENDT-1);
}
free(line);
free(cmd);
kill(pid,SIGTERM);
fclose(fp);
close(p1[0]);
close(p1[1]);
closelog();
if (RUN && (ENDT||REINI)) { /* relance auto */
trace(1, Y(t08),strPID, DELAYR);
sleep(DELAYR); /* attend N s */
NP = (char**)malloc((sizeof(Pars))*(N+3));
ie=0;
for (i=0;i<N;i++) { NP[i] = P[i]; if (strcmp(P[i],strR) == 0) ie=1; }
if (ie == 0) {
NP[i++]=strR;
NP[i++]=strPID;
}
NP[i]=NULL;
if (WH) write_history(FHISTO);
comsh(Y(c21),0);
execv(P[0],NP);
perror(Y(p11));
}
pthread_join(thid,NULL);
printf(Y(m37));
return 0;
}



+ 67
- 0
Septime/src/trace.c View File

@@ -0,0 +1,67 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* gestion niveau de trace */
#include <stdio.h>
#include <stdarg.h>

#include "trace.h"
#include "lich.h"

static int Trace=0;

/* ### les niveaux de trace */
#define TMIN 0
#define TMAX 3
#define T1 getTrace() > 0
#define T2 getTrace() > 1
#define T3 getTrace() > 2

void setTrace(int v) { Trace = v; }

int incrTrace(int v) {
Trace += v;
if (Trace < TMIN) { Trace = TMIN; return -1; }
if (Trace > TMAX) { Trace = TMAX; return -1; }
return 0;
}

int getTrace(void) { return Trace; }

void prTrace(void) { printf(Y(i12),getTrace()); }

void trace(int N,const char * f, ...)
{
va_list args;
if (N>Trace) return;
va_start(args, f);
printf(Y(f48),N);
vprintf(f, args);
va_end(args);
}

void Tdebug(const char * f, ...)
{
va_list args;
if (DebugOn==0) return;
va_start(args, f);
printf(Y(k14));
vprintf(f, args);
va_end(args);
}


+ 36
- 0
Septime/src/trace.h View File

@@ -0,0 +1,36 @@
/*******************************************************************
Copyright (C) 2011-2024 Patrick H. E. Foubet - S.E.R.I.A.N.E.

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 3 of the License, or 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, see <http://www.gnu.org/licenses/>
*******************************************************************/

/* gestion niveau de trace */

/* ### les niveaux de trace */
#define TMIN 0
#define TMAX 3

#define T1 getTrace() > 0
#define T2 getTrace() > 1
#define T3 getTrace() > 2

extern int DebugOn;

extern void setTrace(int v);
extern int incrTrace(int v);
extern int getTrace(void);
extern void prTrace(void);
extern void trace(int N, const char * format, ...);
extern void Tdebug(const char * format, ...);

Loading…
Cancel
Save