Merged silc_1_0_branch to trunk.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 23 Apr 2005 13:32:20 +0000 (13:32 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 23 Apr 2005 13:32:20 +0000 (13:32 +0000)
cvs -z3 update -j silc_trunk_merged_silc_1_0_branch_4 -j silc_1_0_branch

55 files changed:
CHANGES
Makefile.ad
README.DIST
apps/autodist/CHANGES [new file with mode: 0644]
apps/autodist/TODO [new file with mode: 0644]
apps/autodist/autodist.conf
apps/autodist/autodist.in
apps/autodist/configure.ad
apps/autodist/doc/Makefile.am
apps/autodist/doc/autodist.1.in [new file with mode: 0644]
apps/autodist/doc/autodist.texi
apps/autodist/tests/Makefile.am
apps/autodist/tests/autodist1.test
apps/autodist/tests/autodist2.test
apps/autodist/tests/autodist3.test [new file with mode: 0755]
apps/autodist/tests/autodist4.test [new file with mode: 0755]
apps/autodist/tests/autodist5.test [new file with mode: 0755]
apps/silcd/command.c
apps/silcd/command_reply.c
apps/silcd/configure.ad [new file with mode: 0644]
apps/silcd/idlist.c
apps/silcd/idlist.h
apps/silcd/packet_send.c
apps/silcd/server.c
apps/silcd/server_internal.h
apps/silcd/server_query.c
apps/silcd/server_util.c
apps/silcd/server_util.h
apps/silcd/serverconfig.c
apps/silcd/silcd.c
configure.ad
distdir/autodist
distdir/client
distdir/common
distdir/post-dist [new file with mode: 0644]
distdir/post-process-dist [new file with mode: 0644]
distdir/server
distdir/toolkit
doc/Makefile.ad
includes/silcincludes.h.in
lib/Makefile.ad
lib/configure.ad
lib/doc/LIBINDEX
lib/silcclient/client.c
lib/silcclient/client_attrs.c
lib/silcclient/silcclient.h
lib/silccore/silcidcache.c
lib/silccore/silcidcache.h
lib/silccore/silcmessage.c
lib/silccore/silcmessage.h
lib/silcutil/silcapputil.c
scripts/silcdoc/gen_index.php
scripts/silcdoc/silcdoc
util/robodoc/Source/config.h [deleted file]
win32/libsilc/libsilc.def

diff --git a/CHANGES b/CHANGES
index fa8a3230e41200c56bb8f9c066cb40328725e488..baa76976ec81ad6840411b329770317b81371ab5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,27 @@
+Fri Apr 22 12:21:44 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Use silc_server_send_command_reply to send replies instead
+         of encoding packet itself.  Affected file silcd/command.c.
+
+       * Added command sending and receiving statistics to server.
+         Affected files in silcd/.
+
+       * GCC 4 warning fixes.  -Wno-pointer-sign option is now used
+         with GCC, for it not to warn about pointer signedness.
+
+Tue Apr 19 11:57:35 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added context to the SilcIDCache destructor.  Affected
+         files are lib/silccore/silcidcache.[ch],
+         lib/silcclient/client.c and silcd/server.c.
+
+Mon Apr 18 09:53:28 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added pkg-config check to configure.
+
+       * The PublicKeyDir must not be used with Admin block in server
+         config.  Affected file silcd/serverconfig.c.
+
 Sat Apr 16 20:23:48 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
 
        * Added Autodist.
index 1ffcbca2bd4e42140935430d44abfca22d678523..e76466de5db6f39a2c5ff02e91e4aed6968bc34e 100644 (file)
@@ -137,7 +137,7 @@ toolkit-install:
        -mkdir -p $(docdir)/toolkit/
        -$(INSTALL_DATA) $(srcdir)/doc/toolkit/* $(docdir)/toolkit
        -$(INSTALL_DATA) $(srcdir)/lib/doc/*.gif $(docdir)/toolkit
-       -cp -R $(srcdir)/tutorial $(prefix)
+       -cp -R $(srcdir)/tutorial $(docdir)
 #endif SILC_DIST_TOOLKIT
 
 install-data-hook:             \
index e5264ef8fdfa5e0994b1c84b95012778bafb6f5b..f741abe1140403cfd786fee586c5e22a4c6f9f29 100644 (file)
@@ -6,24 +6,16 @@ tree and how to package distributions for releasing.  This also defines
 the procedure what one should do when distribution is created for
 releasing.
 
-
-The 'distributions' file
-========================
-
-The 'distributions' file descibres all distributions that can be created 
-from the SILC CVS source tree.  You should read that file if you want to 
-learn how to create new distributions.  The file already defines the main 
-distributions that can be created from the soure tree.  These are the 
-'client', 'server' and 'toolkit' distributions.
+The distdir/ directory contains all distributions that can be created
+from the source tree.  The distdir/default cannot be packaged, it must
+be used only for development.
 
 
 Preparing distribution
 ======================
 
-The SILC CVS source tree must be prepared before it can be configured, 
-compiled and packaged.  The ./prepare script is used to prepare 
-distribution for configuration, compilation and packaging.  To prepare a 
-specific distribution with specific version, give command:
+To prepare a specific distribution with specific version for packaging,
+give command:
 
        autodist <name> <version>
 
diff --git a/apps/autodist/CHANGES b/apps/autodist/CHANGES
new file mode 100644 (file)
index 0000000..7f9bf01
--- /dev/null
@@ -0,0 +1,50 @@
+Sat Apr 23 12:49:09 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Autodist 1.2.1.
+
+       * Fixed 'noprocess' sed script.
+
+Fri Apr 22 20:23:06 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Autodist 1.2.
+
+       * Various 'cat' optimizations.
+
+       * More test cases in tests/.
+
+       * No Autodist header for "other" '.ad' files as we don't know 
+         what the file contains.
+
+       * No non-source distdef format processing for source files
+         anymore.
+
+Tue Apr 19 17:12:09 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Remove extra ' ' and '\t' when joining backslashed lines.
+
+       * Fixed argument delivery to hook scripts.
+
+Mon Apr 18 21:05:42 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Process '*.ad' files before calling autoconf and automake.
+
+       * Various shell compatibility kludges added.
+
+Mon Apr 18 20:06:24 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Autodist 1.1.
+
+       * All 'local' variables must be at the start of function for
+         compatibility.
+
+Sun Apr 17 20:08:28 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added TODO.
+
+       * Added pre-process-dist-hook and post-process-dist-hook.
+
+       * Added autodist.1.
+
+Sun Apr 16 23:00:02 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * First release, Autodist 1.0.
diff --git a/apps/autodist/TODO b/apps/autodist/TODO
new file mode 100644 (file)
index 0000000..e3e00ea
--- /dev/null
@@ -0,0 +1,16 @@
+TODO In Autodist
+================
+
+o Autodist should produce output file when 'license-header' is used for
+  files that _was not_ re-licensed.  This would be useful to check if
+  there are files in the distribution with wrong license.
+
+o Better 'license-header' implementation.
+
+o Perhaps ability to partially re-license the source tree.  Now all files
+  will be processed if 'license-header' is used.
+
+o Better 'noprocess' so that it would work with directories recursively,
+  such as noprocess foo/bar, would not process anything under foo/bar.
+
+o Perhaps output autodist.log when processing the source tree.
index 4748b0e344ede8b0bc59d2355610dbbe3e2f9ac9..cbf17b5c7b1fca26c125d967f30a1952f8e6abf5 100644 (file)
@@ -36,7 +36,7 @@ AUTOCONF="autoconf"
 # Location of the automake tool.  If this is omitted the Autodist will not
 # run automake.  User need to run it manually then.
 #
-AUTOMAKE="automake -a"
+AUTOMAKE="automake -a -c"
 
 # Location of the libtoolize tool.  This option should be omitted if your
 # source tree does not use libtool.
index 27e6c22247dc15ee1b04c3fd2a7ad71919c88bfa..2e8a361498693d01395340acc9abd003f645a958 100755 (executable)
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
+###############################################################################
+# Shell compatibility
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  # Despite of this, we have managed to segfault some zsh's.
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+
 ###############################################################################
 # Global variables
 
@@ -60,7 +101,7 @@ distdefs=
 undistdefs=
 
 # All distribution options
-options=
+doptions=
 opt_template=false
 opt_no_dist=false
 opt_no_inherit=false
@@ -74,11 +115,13 @@ excludes=
 # All noprocesses
 noprocess=
 
-# All pre, post pre-dist and post-dist hooks
+# All hooks
 pre_hooks=
 post_hooks=
 pre_dist_hooks=
 post_dist_hooks=
+pre_p_dist_hooks=
+post_p_dist_hooks=
 
 # Distribution license and license header
 license=
@@ -181,26 +224,29 @@ ad_create_distdefs_h()
 
   fname=$DISTDEFS
   rm -f $fname
-  echo "/*" > $fname
-  echo "  Automatically generated by Autodist $ver.  Do not edit." >> $fname
-  echo >> $fname
-  echo "  Generated: `date` by `whoami`" >> $fname
-  echo "  Distribution: $distribution" >> $fname
-  echo "  License: $license" >> $fname
-  echo "*/" >> $fname
-  echo >> $fname
-  echo "#ifndef _"$DP"_DISTDEFS_H" >> $fname
-  echo "#define _"$DP"_DISTDEFS_H" >> $fname
-  echo >> $fname
+  cat > $fname <<EOF
+/*
+  Automatically generated by Autodist $ver.  Do not edit.
+
+  Generated: `date` by `whoami`
+  Distribution: $distribution
+  License: $license
+*/
+
+#ifndef _`echo $DP`_DISTDEFS_H
+#define _`echo $DP`_DISTDEFS_H
+
+EOF
 
   for i in $distdefs
   do
     echo "#define $i 1" >>$fname
   done
 
-  echo >> $fname
-  echo "#endif /* _"$DP"_DISTDEFS_H */" >> $fname
+  cat >> $fname <<EOF
 
+#endif /* _`echo $DP`_DISTDEFS_H */
+EOF
   ad_debug "<ad_create_distdefs_h"
 }
 
@@ -212,14 +258,19 @@ ad_create_distdefs_h()
 #
 ad_make_configure()
 {
-  ad_debug ">ad_make_configure"
   local run_autoconf=false
 
+  ad_debug ">ad_make_configure"
+
   rm -f configure
 
   if test "$ACLOCAL"; then
     ad_debug "Running aclocal"
-    $ACLOCAL 1>/dev/null 2>/dev/null
+    if test x$debug = xtrue; then
+      $ACLOCAL
+    else
+      $ACLOCAL 1>/dev/null 2>/dev/null
+    fi
     if test $? != 0; then
       ad_fatal "aclocal failed"
     fi
@@ -268,13 +319,15 @@ ad_make_configure()
 #
 ad_make_configure_ac()
 {
+  local check
+
   ad_debug ">ad_make_configure_ac: $1"
 
   if test '!' -f $1; then
     ad_fatal "The configure file '$1' does not exist"
   fi
 
-  local check="`cat $1 | sed 's/^[     ]*//' | grep -v "^#" | grep -e "AD_INIT"`"
+  check="`sed 's/^[    ]*//' < $1 | grep -v "^#" | grep -e "AD_INIT"`"
   if test -z $check; then
     rm -f configure.ad.cfs
     rm -f $fname $fname.tmp
@@ -294,7 +347,7 @@ ad_make_configure_ac()
   done
 
   if test -f configure.ad.cfs; then
-    local check="`cat $1 | sed 's/^[   ]*//' | grep -v "^#" | grep -e "AD_INCLUDE_CONFIGURE"`"
+    check="`sed 's/^[  ]*//' < $1 | grep -v "^#" | grep -e "AD_INCLUDE_CONFIGURE"`"
     if test -z $check; then
       rm -f configure.ad.cfs
       ad_warning "configure.ad fragments found but 'AD_INCLUDE_CONFIGURE' is not set"
@@ -303,14 +356,16 @@ ad_make_configure_ac()
 
   # Header for configure.ac
   fname="configure.tmp.ac"
-  echo "# Automatically generated by Autodist $ver.  Do not edit." > $fname
-  echo "# To make changes edit the $i file in the source tree." >> $fname
-  echo >> $fname
-  echo "# Source: $i" >> $fname
-  echo "# Generated: `date` by `whoami`" >> $fname
-  echo "# Distribution: $distribution" >> $fname
-  echo "# License: $license" >> $fname
-  echo >> $fname
+  cat > $fname <<EOF
+# Automatically generated by Autodist $ver.  Do not edit.
+# To make changes edit the configure.ad file in the source tree.
+
+# Source: configure.ad
+# Generated: `date` by `whoami`
+# Distribution: $distribution
+# License: $license
+
+EOF
 
   ad_debug "creating configure.ac"
   if test -f configure.ad.cfs; then
@@ -330,7 +385,7 @@ ad_make_configure_ac()
 
   # Remove any trailing backslashes
   if test -f "$fname"; then
-    cat $fname | sed -e :a -e '/\\$/N; s/\\\n//; ta' > configure.ac
+    sed -e :a -e '/\\$/N; s/[  ]*\\\n//; ta' < $fname > configure.ac
   else
     cp -p $fname.tmp configure.ac
   fi
@@ -376,14 +431,16 @@ ad_make_makefile_ams()
     fname=`echo $ff | sed s/\.ad//`
 
     # Header for the Makefile.am
-    echo "# Automatically generated by Autodist $ver from Makefile.ad.  Do not edit." > $fname.am
-    echo "# To make changes edit the $ff file in the source tree." >> $fname.am
-    echo >> $fname.am
-    echo "# Source: $ff" >> $fname.am
-    echo "# Generated: `date` by `whoami`" >> $fname.am
-    echo "# Distribution: $distribution" >> $fname.am
-    echo "# License: $license" >> $fname.am
-    echo >> $fname.am
+  cat > $fname.am <<EOF
+# Automatically generated by Autodist $ver from Makefile.ad.  Do not edit.
+# To make changes edit the $ff file in the source tree.
+
+# Source: $ff
+# Generated: `date` by `whoami`
+# Distribution: $distribution
+# License: $license
+
+EOF
 
     # Run the distribution processing for this Makefile.ad
     ad_debug "Processing $ff to be $fname.am"
@@ -391,7 +448,7 @@ ad_make_makefile_ams()
 
     # Remove any trailing backslashes
     if test -f "$fname.tmp"; then
-      cat $fname.tmp | sed -e :a -e '/\\$/N; s/\\\n//; ta' >> $fname.am
+      sed -e :a -e '/\\$/N; s/[        ]*\\\n//; ta' < $fname.tmp >> $fname.am
     else
       cat $ff >> $fname.am
     fi
@@ -417,16 +474,6 @@ ad_process_ads()
   do
     fname=`echo $i | sed s/\.ad//`
 
-    # Header
-    echo "# Automatically generated by Autodist $ver.  Do not edit." > $fname
-    echo "# To make changes edit the $i file in the source tree." >> $fname
-    echo >> $fname
-    echo "# Source: $i" >> $fname
-    echo "# Generated: `date` by `whoami`" >> $fname
-    echo "# Distribution: $distribution" >> $fname
-    echo "# License: $license" >> $fname
-    echo >> $fname
-
     # Run the distribution processing for this file
     ad_debug "Processing $i to be $fname"
     ad_process_file $i $fname
@@ -453,13 +500,15 @@ ad_process_ads()
 #
 ad_dist_includes()
 {
+  local incs
+
   ad_debug ">ad_dist_includes: $1 $2"
 
   # By default do not expand pathnames
   set -f
 
   # Add : separator at the end
-  local incs="`echo "$1" | sed 's/$/ : /'`"
+  incs="`echo "$1" | sed 's/$/ : /'`"
 
   src=
   dst=
@@ -553,7 +602,7 @@ ad_dist_includes()
       fi
 
       # Recursively call this function with expanded pathnames.  The
-      # reason why we don't let sh by default expand patnames is that
+      # reason why we don't let sh by default expand pathnames is that
       # the include's destination is optional.  If sh expands by default
       # we don't know the destination.  For this reason, we handle the
       # expansion here ourselves.
@@ -639,16 +688,21 @@ ad_process_tree()
 {
   ad_debug ">ad_process_tree: $1"
 
-  # We take all files, other than *.ad, including source files, in case
-  # they use the non-C-compiler-friendly format of distdefs, which is
-  # possible.
-
-  files=`find $am_distdir \! -name \*\.ad`
+  # Take files, except source and .ad files.
+  files=`find $am_distdir \! -name \*\.ad \( \
+       \! -name \*\.[cC] -a \
+       \! -name \*\.[cC][cCpP] -a \
+       \! -name \*\.[cC][xX][xX] -a \
+       \! -name \*\.[cC][pP][pP] -a \
+       \! -name \*\.[cC]++ -a \
+       \! -name \*\.m -a \
+       \! -name \*\.[hH] -a \
+       \! -name \*\.hh \)`
   files=`echo $files | sed 's/$am_distdir//'`
 
   # Take away noprocess list
   if test -f autodist.noprocess; then
-    files=`echo $files | sh autodist.noprocess` || exit 1
+    files=`echo $files" " | sh autodist.noprocess` || exit 1
   fi
 
   for ff in $files
@@ -692,7 +746,7 @@ ad_process_source_tree()
 
   # Take away noprocess list
   if test -f autodist.noprocess; then
-    files=`echo $files | sh autodist.noprocess` || exit 1
+    files=`echo $files" " | sh autodist.noprocess` || exit 1
   fi
 
   for ff in $files
@@ -730,7 +784,7 @@ ad_makedist_makesane()
     ad_fatal "Makefile: No such file or directory"
   fi
 
-  configh=`grep "^CONFIG_HEADER" Makefile | cut -d= -f2 | sed 's/^[ \t]//'`
+  configh=`grep "^CONFIG_HEADER" Makefile | cut -d= -f2 | sed 's/^[    ]*//'`
   touch $am_distdir/$configh.in 1>/dev/null 2>/dev/null
 
   files=`find $am_distdir -name Makefile\.in`
@@ -774,16 +828,19 @@ ad_makedist()
   fi
 
   # Parse the requested distribution
-  distribution=`cat autodist.dist | grep "dist:" | cut -d: -f2`
-  dist_version=`cat autodist.dist | grep "ver:" | cut -d: -f2`
+  distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1
+  dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1
+  am_distdir=`grep "distdir:" < autodist.dist | cut -d: -f2` || exit 1
   ad_parse_distribution $distribution false
   ad_process_distdefs
-  am_distdir="$package-$dist_version"
 
   if test x$opt_no_dist = xtrue; then
     ad_fatal "The '$distribution' distribution cannot be packaged"
   fi
 
+  # Run pre-dist-hooks
+  ad_run_dist_hooks "$pre_dist_hooks"
+
   # Create distribution directory
   ad_debug "Creating distribution directory $am_distdir"
   $MAKE distdir || exit 1
@@ -793,8 +850,8 @@ ad_makedist()
     ad_fatal "Distribution directory $am_distdir not created"
   fi
 
-  # Run pre-dist-hooks
-  ad_run_dist_hooks "$pre_dist_hooks"
+  # Run pre-process-dist-hooks
+  ad_run_dist_hooks "$pre_p_dist_hooks"
 
   # Run excludes
   ad_dist_excludes "$excludes"
@@ -818,8 +875,8 @@ ad_makedist()
   ad_debug "Process distribution tree"
   ad_process_tree $am_distdir
 
-  # Run post-dist-hooks
-  ad_run_dist_hooks "$post_dist_hooks"
+  # Run post-process_dist-hooks
+  ad_run_dist_hooks "$post_p_dist_hooks"
 
   # Make distribution sane
   ad_makedist_makesane
@@ -845,6 +902,9 @@ ad_makedist()
   fi
   rm -f $am_distdir.tar
 
+  # Run post-dist-hooks
+  ad_run_dist_hooks "$post_dist_hooks"
+
   # Cleanup
   rm -rf $am_distdir
   rm -f autodist.noprocess
@@ -912,6 +972,23 @@ ad_clear_options()
 #
 ad_parse_distribution()
 {
+  local inhs
+  local defs
+  local undefs
+  local incs
+  local excs
+  local nops
+  local opts
+  local dname
+  local dpname
+  local bugr
+  local prh
+  local poh
+  local prdh
+  local podh
+  local prpdh
+  local popdh
+
   ad_debug ">ad_parse_distribution: $1 $2"
 
   if test '!' -f $distdir/$1; then
@@ -919,11 +996,11 @@ ad_parse_distribution()
   fi
 
   # Get inherited
-  local inhs=`cat $distdir/$1 | sed 's/^[      ]*//' | grep -v "^#" \
+  inhs=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "inherit " | cut -d' ' -f2 | sort | uniq`
 
   # Get distdefs
-  local defs=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  defs=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
    | grep "define " | cut -d' ' -f2 | sort | uniq`
 
   if test "$inhs" = "" && test "$defs" = ""; then
@@ -931,23 +1008,23 @@ ad_parse_distribution()
   fi
 
   # Get undefined distdefs
-  local undefs=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  undefs=`sed 's/^[    ]*//' < $distdir/$1 | grep -v "^#" \
    | grep "undef " | cut -d' ' -f2 | sort | uniq`
 
   # Get includes
-  local incs=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  incs=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "include " | sed 's/include / : /'`
 
   # Get excludes
-  local excs=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  excs=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "exclude " | cut -d' ' -f2- | sort | uniq`
 
   # Get noprocesses
-  local nops=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  nops=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "noprocess " | cut -d' ' -f2- | sort | uniq`
 
   # Get options
-  local opts=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  opts=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "option " | cut -d' ' -f2- | sort | uniq`
 
   # Check options
@@ -959,13 +1036,13 @@ ad_parse_distribution()
     ad_fatal "Template distribution '$1' cannot be prepared or packaged"
   fi
 
-  ad_debug "inherits=$inhs"
-  ad_debug "distdefs=$defs"
-  ad_debug "includes=$incs"
-  ad_debug "excludes=$excs"
-  ad_debug "noprocess=$nops"
-  ad_debug "undistdefs=$undefs"
-  ad_debug "options=$opts"
+  ad_debug "inherits$inhs"
+  ad_debug "distdefs$defs"
+  ad_debug "includes$incs"
+  ad_debug "excludes$excs"
+  ad_debug "noprocess$nops"
+  ad_debug "undistdefs$undefs"
+  ad_debug "options$opts"
 
   # Expand distdefs from inherited distributions
   for i in $inhs
@@ -984,17 +1061,17 @@ ad_parse_distribution()
   done
 
   # Get license
-  license=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  license=`sed 's/^[   ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "license " | cut -d' ' -f2`
-  licenseh=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+  licenseh=`sed 's/^[  ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "license-header " | sed 's/license-header / : /'`
 
-  ad_debug "license=$license"
-  ad_debug "licenseh=$licenseh"
+  ad_debug "license$license"
+  ad_debug "licenseh$licenseh"
 
   if test x$2 = xfalse; then
     # Get distribution name
-    local dname=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+    dname=`sed 's/^[   ]*//' < $distdir/$1 | grep -v "^#" \
       | grep "name " | cut -d' ' -f2-`
 
     if test "$dname"; then
@@ -1002,7 +1079,7 @@ ad_parse_distribution()
     fi
 
     # Get distribution package name (optional)
-    local dpname=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+    dpname=`sed 's/^[  ]*//' < $distdir/$1 | grep -v "^#" \
      | grep "package " | cut -d' ' -f2`
 
     if test "$dpname"; then
@@ -1012,35 +1089,41 @@ ad_parse_distribution()
     fi
 
     # Get Bug-report email address (optional)
-    local bugr=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+    bugr=`sed 's/^[    ]*//' < $distdir/$1 | grep -v "^#" \
      | grep "bug-report " | cut -d' ' -f2-`
 
     if test "$bugr"; then
       bug_report=$bugr
     fi
 
-    ad_debug "distribution=$distribution"
-    ad_debug "package=$package"
-    ad_debug "bug-report=$bug_report"
+    ad_debug "distribution$distribution"
+    ad_debug "package$package"
+    ad_debug "bug-report$bug_report"
 
     # Get hooks (optional)
-    local prh=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+    prh=`sed 's/^[     ]*//' < $distdir/$1 | grep -v "^#" \
      | grep "pre-hook " | cut -d' ' -f2-`
-    local poh=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
+    poh=`sed 's/^[     ]*//' < $distdir/$1 | grep -v "^#" \
      | grep "post-hook " | cut -d' ' -f2-`
-    local prdh=`cat $distdir/$1 | sed 's/^[       ]*//' | grep -v "^#" \
-     | grep "pre-dist-hook " | sed 's/^[       ]*//' | cut -d' ' -f2-`
-    local podh=`cat $distdir/$1 | grep -v "^#" \
-     | grep "post-dist-hook " | sed 's/^[       ]*//' | cut -d' ' -f2-`
+    prdh=`sed 's/^[    ]*//' < $distdir/$1 | grep -v "^#" \
+     | grep "pre-dist-hook " | cut -d' ' -f2-`
+    podh=`sed 's/^[    ]*//' < $distdir/$1 | grep -v "^#" \
+     | grep "post-dist-hook " | cut -d' ' -f2-`
+    prpdh=`sed 's/^[   ]*//' < $distdir/$1 | grep -v "^#" \
+     | grep "pre-process-dist-hook " | cut -d' ' -f2-`
+    popdh=`sed 's/^[   ]*//' < $distdir/$1 | grep -v "^#" \
+     | grep "post-process-dist-hook " | cut -d' ' -f2-`
 
     pre_hooks="$pre_hooks $prh"
     post_hooks="$post_hooks $poh"
     pre_dist_hooks="$pre_dist_hooks $prdh"
     post_dist_hooks="$post_dist_hooks $podh"
-    options="$options $opts"
+    pre_p_dist_hooks="$pre_p_dist_hooks $prpdh"
+    post_p_dist_hooks="$post_p_dist_hooks $popdh"
+    doptions="$doptions $opts"
 
-    ad_handle_options "$options"
-    ad_debug "options=$options"
+    ad_handle_options "$doptions"
+    ad_debug "options: $doptions"
   fi
 
   # Return to caller
@@ -1071,15 +1154,14 @@ ad_process_distdefs()
     distdefs=`echo $distdefs | sed s/$i//`
   done
 
-  rm -f autodist.tmp.defs autodist.pre.hooks autodist.post.hooks
-  rm -f autodist.pre.dist.hooks autodist.post.dist.hooks
+  rm -f autodist.tmp.defs
 
   # Remove duplicate distdefs
   for i in $distdefs
   do
     echo $i >>autodist.tmp.defs
   done
-  distdefs=`cat autodist.tmp.defs | sort | uniq`
+  distdefs=`sort < autodist.tmp.defs | uniq`
   distdefs=`echo $distdefs`
   rm -f autodist.tmp.defs
 
@@ -1147,19 +1229,22 @@ ad_process_license_header()
 #
 ad_process_noprocess()
 {
-  ad_debug ">ad_process_noprocess"
   local np=false
-
   local n="sed "
 
+  ad_debug ">ad_process_noprocess"
+
+  cur=`pwd`
+  cd $am_distdir || exit 1
   for i in $noprocess
   do
     # Escape
     ie=`echo $i | sed 's/\\//\\\\\//g'` || exit 1
 
-    n="$n -e 's/$am_distdir\\/$ie//'"
+    n="$n -e 's/$am_distdir\\/$ie //'"
     np=true
   done
+  cd $cur || exit 1
 
   rm -f autodist.noprocess
   if test x$np = xtrue; then
@@ -1177,6 +1262,9 @@ ad_process_noprocess()
 ad_process_file()
 {
   local found=false
+  local f
+  local defs
+  local ndefs
 
   # Process only regular files
   if test '!' -f $1; then
@@ -1185,7 +1273,7 @@ ad_process_file()
 
   ad_debug ">ad_process_file: $1 $2"
 
-  local f="autodist.tmp.script"
+  f="autodist.tmp.script"
   rm -f $f
 
   # If license header is provided, replace the license header in the file.
@@ -1194,15 +1282,15 @@ ad_process_file()
   ad_debug "Getting #ifdef's and #ifndef's"
 
   # Get defined distribution defines
-  local defs=`awk "/^#ifdef "$DP"_DIST_|^#else "$DP"_DIST_/ { print; }" \
+  defs=`awk "/^#ifdef "$DP"_DIST_|^#else "$DP"_DIST_/ { print; }" \
     $1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq`
 
   # Get explicitly not-defined distribution defines
-  local ndefs=`awk "/^#ifndef "$DP"_DIST_|^#else !"$DP"_DIST_/ { print; }" \
+  ndefs=`awk "/^#ifndef "$DP"_DIST_|^#else !"$DP"_DIST_/ { print; }" \
     $1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq`
 
-  ad_debug "defs=$defs"
-  ad_debug "ndefs=$ndefs"
+  ad_debug "defs in $1: $defs"
+  ad_debug "ndefs in $1: $ndefs"
 
   # Create the script to include and exclude stuff in the file according
   # to the distribution defines
@@ -1279,6 +1367,9 @@ ad_process_file()
 ad_process_source_file()
 {
   local found=false
+  local f
+  local defs
+  local ndefs
 
   # Process only regular files
   if test '!' -f $1; then
@@ -1287,7 +1378,7 @@ ad_process_source_file()
 
   ad_debug ">ad_process_source_file: $1 $2"
 
-  local f="autodist.tmp.script"
+  f="autodist.tmp.script"
   rm -f $f
 
   # If license header is provided, replace the license header in the file.
@@ -1296,14 +1387,15 @@ ad_process_source_file()
   ad_debug "Getting #ifdef's and #ifndef's"
 
   # Get defined distribution defines
-  local defs=`awk '/^#ifdef SILC_DIST_|^#else \/\* SILC_DIST_/ { print; }' \
+  defs=`awk '/^#ifdef SILC_DIST_|^#else \/\* SILC_DIST_/ { print; }' \
     $1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq`
 
   # Get explicitly not-defined distribution defines
-  local ndefs=`awk '/^#ifndef SILC_DIST_|^#else \/\* \!SILC_DIST_/ { print; }' \
+  ndefs=`awk '/^#ifndef SILC_DIST_|^#else \/\* \!SILC_DIST_/ { print; }' \
     $1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq`
 
-  ad_debug "defs=$defs ndefs=$ndefs"
+  ad_debug "defs in $1: $defs"
+  ad_debug "ndefs in $1: $ndefs"
 
   # Create the script to include and exclude stuff in the file according
   # to the distribution defines
@@ -1386,7 +1478,7 @@ ad_run_hooks()
     if test '!' -f $i; then
       ad_fatal "Hook script $i does not exist"
     fi
-    sh $i $distribution $dist_version $package || exit 1
+    sh $i "$distribution" "$dist_version" "$package" || exit 1
   done
 
   ad_debug "<ad_run_hooks: $1"
@@ -1406,7 +1498,7 @@ ad_run_dist_hooks()
     if test '!' -f $i; then
       ad_fatal "Dist hook script $i does not exist"
     fi
-    sh $i $distribution $dist_version $package $am_distdir || exit 1
+    sh $i "$distribution" "$dist_version" "$package" "$am_distdir" || exit 1
   done
 
   ad_debug "<ad_run_dist_hooks: $1"
@@ -1568,6 +1660,11 @@ ad_make_makefile_ams
 #
 ad_make_configure_ac ./configure.ad
 
+#
+# Process all files with .ad suffix for distribution processing
+#
+ad_process_ads
+
 #
 # Generate configure script
 #
@@ -1578,18 +1675,13 @@ ad_make_configure
 #
 ad_make_makefile_ins
 
-#
-# Process all files with .ad suffix for distribution processing
-#
-ad_process_ads
-
 #
 # Create autodist.dist
 #
 ad_debug "Creating autodist.dist"
 echo "dist:$distfile" > autodist.dist
 echo "ver:$dist_version" >> autodist.dist
-echo "$package-$dist_version" >> autodist.dist
+echo "distdir:$package-$dist_version" >> autodist.dist
 
 #
 # Run post-hooks
index 806ac54fdce464a02ea17d54aedec1dba59d88ae..3f2d1f7244197b2804ef196b617e8779ea65ba05 100644 (file)
@@ -47,6 +47,7 @@ apps/autodist/Makefile
 apps/autodist/autodist
 apps/autodist/makedist
 apps/autodist/doc/Makefile
+apps/autodist/doc/autodist.1
 apps/autodist/tests/Makefile
 )
 #endif SILC_DIST_AUTODIST
index 2ffb4b0c40c4bc24d57aa22283a2c18d7ffe768f..003c074433f42a9ca42105636bbf52a3f46be5e4 100644 (file)
@@ -17,3 +17,6 @@
 
 info_TEXINFOS = autodist.texi
 autodist_TEXINFOS = fdl.texi
+
+man_MANS = autodist.1
+EXTRA_DIST = $(man_MANS)
diff --git a/apps/autodist/doc/autodist.1.in b/apps/autodist/doc/autodist.1.in
new file mode 100644 (file)
index 0000000..333ccb3
--- /dev/null
@@ -0,0 +1,98 @@
+.TH AUTODIST "1" "April 2005" "@PACKAGE_NAME@ @VERSION@" "User Commands"
+.SH NAME
+Autodist \- Source distribution management system
+.SH SYNOPSIS
+.B autodist
+[options] [distribution] [version]
+.PP
+.SH DESCRIPTION
+.PP
+The Autodist is a source distribution management system that allows 
+powerful mechanisms to define what is included in and excluded from a 
+distribution, and what license the distribution is released under.  It is 
+also used to create the actual distribution source packages.  Autodist 
+allows distribution management in file, directory and file content level.  
+Different distributions may include different portions of files, for 
+example, excluding certain features from certain distributions.  It is 
+always guaranteed that anything not defined for the distribution, is 
+removed automatically (files, file content, directories), thus ensuring 
+that nothing is accidentally included in the distribution.
+.PP
+Autodist is closely related to the Autoconf and Automake tools, and 
+complements the features Autoconf and Automake provides.  It is especially 
+targeted into circumstances where multiple distributions are created from 
+one source tree.  The Autoconf and Automake environment is mainly designed 
+for one application per one source tree situations.  Autodist provides 
+mechanisms to create all kinds of distributions that can be created from 
+one source tree.  To be able to use Autodist, the Autoconf and Automake 
+must be installed into the system.
+.PP
+.SH OPTIONS
+.B Operation modes:
+.PP
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Prints the help for the Autodist and exits.
+.PP
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Prints version number and exits.
+.PP
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Verbosely report processing.
+.PP
+.TP
+\fB\-d\fR, \fB\-\-distdir\fR
+Search distributions from <dir> instead of default 'distdir'.
+.PP
+.TP
+\fB\-s\fR, \fB\-\-distdefs\fR \fB[<dist>]\fR
+Prints distribution defines of <dist> and exits.
+.PP
+.TP
+\fB\-i\fR, \fB\-\-init\fR
+Initializes Autodist environment.  Creates the default distribution
+directory 'distdir', 'autodist.conf' configuration file and the
+default distribution 'default', then exits.
+.PP
+.TP
+\fB\-m\fR, \fB\-\-makedist\fR
+Creates and packages distribution
+.PP
+.TP
+\fB\-\-gzip\fR
+Create package compressed with gzip (default)
+.PP
+.TP
+\fB\-\-bzip2\fR
+Create also package compressed with bzip2
+.PP
+.TP
+\fB\-\-compress\fR
+Create also package compressed with compress
+.PP
+.TP
+\fB\-\-zip\fR
+Create also package compressed with zip
+.SH COPYRIGHT
+Copyright \(co 2005 Pekka Riikonen, SILC Project
+.br
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+PURPOSE.
+.SH "SEE ALSO"
+.BR autoconf (1),
+.BR automake (1),
+.PP
+The full documentation for
+.B autodist
+is maintained as a Texinfo manual.  If the
+.B info
+and
+.B autodist
+programs are properly installed at your site, the command
+.IP
+.B info autodist
+.PP
+should give you access to the complete manual.
index 870cc91ff4539f042ff1c750fefd4bea85d9b557..928432e43d25f0fbe69f301f426c93cb0d654548 100644 (file)
@@ -349,7 +349,7 @@ AUTOMAKE="automake -a -c"
 The 'AUTOMAKE' specifies the location of the 'automake' tool.  If
 Autodist should not run 'automake' this option may be removed or set
 to empty value.  User need to then run it manually.  By default, the
-'-a'  and '-c' options are given to 'automake' to add any missing required 
+'-a'  and '-c' options are given to 'automake' to add any missing required
 files.
 
 
@@ -427,7 +427,8 @@ and are ignored.
 
 The 'name' directive defines the name of the distribution.  It is optional
 directive, and if omitted the distribution name will be the name of the
-distfile.
+distfile.  The 'PACKAGE_NAME' define delivered by Autoconf will contain
+this name string.
 
 Example:
 @example
@@ -444,6 +445,8 @@ optional directive, and if omitted the distribution package name will
 be the name of the distribution, if defined, or if omitted, then the name
 of the distfile.  If this directive is omitted then normal GNU convention
 is used to decide the package name, derived from the distribution name.
+The 'PACKAGE_TARNAME' define delivered by Autoconf will contain this
+package name string.
 
 Example:
 @example
@@ -458,8 +461,8 @@ Will create distribution packages named, for example, as
 
 The 'bug-report' directive can be used to define the email address where
 the bug-reports for the distribution should be sent.  The directive is
-optional.  The 'bug-report' email address will be set for the Autoconf
-which will deliver it via AC_INIT macro.
+optional.  The 'PACKAGE_BUGREPORT' define delivered by Autoconf will
+contain this bug report string.
 
 
 @section Directive: license <filename>
@@ -513,8 +516,8 @@ If the new header file has fewer lines that the current header file, all
 of the lines from the current header will not be replaced.  If the new header
 has fewer lines, empty lines must be added to it.  If the new header file
 has more lines than the current header file, the extra lines will not appear
-in the replaced header.  Basic rule is to always make sure the header file
-has equal amount of lines in them.
+in the replaced header.  Basic rule is to always make sure the header 
+files have equal amount of lines in them.
 
 Second limitation is in indentation of the header files.  It is suggested,
 though not mandatory, that the header files have the same indentation as
@@ -524,6 +527,16 @@ the header file should start the license text at the second character also.
 If same indentation is not used the appearance of the replaced header
 may not be perfect.  While this is a cosmetic issue, one still to remember.
 
+Third limitation is that the distribution cannot be partially re-licensed.  
+If the 'license-header' directive is used then all files that have the 
+specified header will be replaced with the new header.  There are 
+currently two ways to not re-license a file;  use different license header 
+in the file than one specified in 'license-header', or specify the file or 
+directory in 'noprocess' directive.  Using 'noprocess' is not possible if 
+the file needs to be otherwise processed for the distribution.  Future 
+versions of Autodist may provide a mechanism to re-license only part of 
+the distribution.
+
 Example current header:
 @example
 --- Start example
@@ -556,7 +569,7 @@ In this example, if the text in the current header file is found in any
 file in the distribution it will be replaced with the new header file.
 Notice that, both header files has same amount of lines (8 lines).
 
-Note that, the current header must match exactly the header used in 
+Note that, the current header must match exactly the header used in
 files.  Otherwise the replacement will not be complete.
 
 
@@ -639,14 +652,14 @@ distribution.  The following options are available.
 template
 @end example
 
-When set, the distribution is a template distribution.  Templates are
-special distributions which cannot be prepared or packaged with Autodist.
-Templates can only be inherited.  Usually, templates are used to define a
-common template distribution for other distributions.  Templates may set
-distdefs, undefines, includes and excludes.  A large software project
-could have several distributions that share a common base.  In this case
-defining the common base as a template distribution and then inheriting
-that distribution makes it easier to manage the distfiles.
+When set, the distribution is a template distribution.  Templates are 
+special distributions which cannot be prepared or packaged with Autodist. 
+Templates can only be inherited.  Usually, templates are used to define a 
+common template distribution for other distributions.  Templates may set 
+distdefs, undefines, includes, excludes and noprocesses.  A large software 
+project could have several distributions that share a common base.  In 
+this case defining the common base as a template distribution and then 
+inheriting that distribution makes it easier to manage the distfiles.
 
 @example
 no-dist
@@ -761,19 +774,22 @@ process a file.  The Autodist will not process the file during
 preparation or during distribution packaging.  This directive is optional.
 One or more file can be specified in the 'noprocess' directive.  Zero or
 more 'noprocess' directives can be used in distribution.  The <filename>
-can be a single file, a single directory or a regular expression that
-will match several files and/or directories.  If directory is specified
-then all files inside the directory will not be processed.
+can be a single file or a regular expression that will match several files.
+Note that, in current Autodist version 'noprocess' cannot be used to
+specify directories.
 
 Example:
 @example
 noprocess autodist.texi
+noprocess apps/foo/*
 @end example
 
-Autodist will not process 'autodist.texi' file.
+Autodist will not process 'autodist.texi' file, and any file that match
+'apps/foo/*'.  Note that, any subdirectory under 'apps/foo/' will not
+match, and will be processed.
 
-Note that, 'noprocess' directive cannot be used to disallow processing
-of any file with '.ad' suffix.
+Also note that, 'noprocess' directive cannot be used to disallow 
+processing of any file with '.ad' suffix.
 
 
 @section Directive: pre-hook <filename> [...]
@@ -805,6 +821,39 @@ executes the script: distribution name, distribution version and package
 name of distribution.  The script may use these arguments if it needs them.
 
 
+@section Directive: pre-process-dist-hook <filename> [...]
+
+The 'pre-process-dist-hook' directive can be used define additional
+scripts that will be run when Autodist has started distribution creation.
+This directive is optional.  One or more scripts may be defined in one
+'pre-process-dist-hook' directive.  Zero or more 'pre-process-dist-hook'
+directives may be set for distribution.  The 'pre-process-dist-hook' hook
+will be run immediately after the Autodist has created the distribution
+directory but has not yet started any distribution processing.
+
+The scripts will get four (4) command line arguments when Autodist
+executes the script: distribution name, distribution version, package
+name of distribution and destination distribution directory name.  The
+script may use these arguments if it needs them.
+
+
+@section Directive: post-process-dist-hook <filename> [...]
+
+The 'post-process-dist-hook' directive can be used define additional
+scripts that will be run when Autodist has finished distribution
+processing.  This directive is optional.  One or more scripts may be
+defined in one 'post-process-dist-hook' directive.  Zero or more
+'post-process-dist-hook' directives may be set for distribution.  The
+'post-process-dist-hook' hook will be run immediately after the Autodist
+has finished processing the destination distribution directory but has not
+yet created the distribution package.
+
+The scripts will get four (4) command line arguments when Autodist
+executes the script: distribution name, distribution version, package
+name of distribution and destination distribution directory name.  The
+script may use these arguments if it needs them.
+
+
 @section Directive: pre-dist-hook <filename> [...]
 
 The 'pre-dist-hook' directive can be used define additional scripts that
@@ -812,8 +861,8 @@ will be run when Autodist has started distribution creation.  This directive
 is optional.  One or more scripts may be defined in one 'pre-dist-hook'
 directive.  Zero or more 'pre-dist-hook' directives may be set for
 distribution.  The 'pre-dist-hook' hook will be run immediately after
-the Autodist has created the distribution directory but has not yet
-started any distribution processing.
+the Autodist has started distribution creation, but has not yet created
+the distribution directory.  This hook is run before 'pre-process-dist-hook'.
 
 The scripts will get four (4) command line arguments when Autodist
 executes the script: distribution name, distribution version, package
@@ -824,12 +873,12 @@ script may use these arguments if it needs them.
 @section Directive: post-dist-hook <filename> [...]
 
 The 'post-dist-hook' directive can be used define additional scripts that
-will be run when Autodist has finished distribution processing.  This
+will be run when Autodist has finished distribution creation.  This
 directive is optional.  One or more scripts may be defined in one
 'post-dist-hook' directive.  Zero or more 'post-dist-hook' directives may
-be set for distribution.  The 'post-dist-hook' hook will be run immediately
-after the Autodist has finished processing the destination distribution
-directory but has not yet created the distribution package.
+be set for distribution.  The 'post-dist-hook' hook will be run
+immediately after the Autodist has finished creating the distribution
+package.  This is the last hook Autodist runs.
 
 The scripts will get four (4) command line arguments when Autodist
 executes the script: distribution name, distribution version, package
@@ -837,6 +886,37 @@ name of distribution and destination distribution directory name.  The
 script may use these arguments if it needs them.
 
 
+@section Running hooks
+
+The Autodist runs the hooks in the following order:
+
+Preparing source tree for configuration and compilation:
+
+@example
+<...Autodist started...>
+pre-hook
+<...preparation...>
+post-hook
+<...Autodist exits...>
+@end example
+
+Creating distribution:
+
+@example
+<...Autodist started...>
+pre-dist-hook
+<...distribution directory created...>
+pre-process-dist-hook
+<...processing all files, processing excludes and includes...>
+post-process-dist-hook
+<...creating distribution package...>
+post-dist-hook
+<...Autodist exits...>
+@end example
+
+When creating distribution the 'pre-hook' and 'post-hook' are not run.
+
+
 @section Example distfile
 
 The following is a simple distfile example.  The example assumes that the
@@ -856,8 +936,8 @@ define SILC_DIST_IRSSI
 undef SILC_DIST_MPI
 exclude doc/draft*
 pre-hook scripts/client-pre-run
-post-dist-hook scripts/client-post-dist-run
-post-dist-hook scripts/client-post-dist-kludge
+post-process-dist-hook scripts/client-post-process
+post-dist-hook scripts/client-post-dist-bin
 @end example
 
 @menu
@@ -969,6 +1049,9 @@ preparation.  They will be processed when creating the distribution package.
 If you need processed files during configuration or compilation then they
 need to have '.ad' suffix.
 
+Note that, the distdef format used in these files must be the non-source
+format.
+
 @menu
 * Distdefines::                 Using distdefs in files
 @end menu
@@ -995,7 +1078,7 @@ configuration and compilation (@pxref{Preparing source tree, , , , }).
 By default the distdefs are named '_DIST_XXX', where 'XXX' is the name of
 distdef.  However, many projects will want to define their own prefix
 for distdefs in the 'autodist.conf' configuration file (@pxref{autodist.conf, , , , }).
-In the following examples a prefix 'SILC' is used, hence the prefix for 
+In the following examples a prefix 'SILC' is used, hence the prefix for
 the distdefs are 'SILC_DIST_'.
 
 The basic format for the distdefs are as follows:
@@ -1037,12 +1120,13 @@ a compiler friendly format, defined below, should be used.
 @end example
 
 Note that, only the format defined above is supported.  Other more complex
-use of the preprocessor directives such as using '&&' and '||' in the '#ifdef'
-or '#ifndef' are not supported, and neither is '#elif'.  Also note, that in
-the compiler friendly format the name of the distdef in comments and the
-use of '!' character in the '#else' branch of '#ifdef' are mandatory.  Also
-note, that the distdef conditionals must be placed at the start of the line,
-they must not be indented.
+use of the preprocessor directives such as using '&&' and '||' in the
+'#ifdef' or '#ifndef' are not supported, and neither is '#elif'.  Also
+note, that the name of the distdef in '#else' and '#endif' directives in
+non-source format and in source format inside C comments (/* */), and the
+use of '!' character in the '#else' branch of '#ifdef'" are mandatory.
+Also note, that the distdef conditionals must be placed at the start of
+the line, they must not be indented.
 
 The following example shows the use of non-source format:
 
@@ -1099,6 +1183,8 @@ The following example shows the use of source code format:
 
 #ifndef SILC_DIST_FOOBAR
   foobar_replacement();
+  foobar_hack_init();
+  foobar_init();
 #else /* SILC_DIST_FOOBAR */
   real_foobar();
 #endif /* SILC_DIST_FOOBAR */
@@ -1115,21 +1201,21 @@ would be:
   real_foobar();
 @end example
 
-Even before processing the source files with Autodist, the preprocessor 
-will respect the preprocessor directives if the code use '#include' to 
-include the distdef header file created by the Autodist (see 
-'autodist.conf' (@pxref{autodist.conf, , , , })).  When the distribution 
-is packaged (@pxref{Creating distribution, , , , }) the Autodist will 
-process the files, and will remove any line not defined to be included.  
+Even before processing the source files with Autodist, the preprocessor
+will respect the preprocessor directives if the code use '#include' to
+include the distdef header file created by the Autodist (see
+'autodist.conf' (@pxref{autodist.conf, , , , })).  When the distribution
+is packaged (@pxref{Creating distribution, , , , }) the Autodist will
+process the files, and will remove any line not defined to be included.
 The preprocessor directives will also be removed.
 
-Because the software project includes the header file with '#include' the 
-distdef header file needs to be present in the distribution, unless it is 
+Because the software project includes the header file with '#include' the
+distdef header file needs to be present in the distribution, unless it is
 placed inside some other '#ifdef' conditional.  If the distribution is
 prepared but not compiled (it is packaged after preparation without
-compilation) then including the distdef header in the source is not 
+compilation) then including the distdef header in the source is not
 necessary.  Including it then in the distribution is not necessary either.
+
 The software project should not use the same name space that distdef
 conditionals use for other than distribution usage.  The Autodist will
 process any line that uses the formats above and has the specified prefix
@@ -1232,14 +1318,14 @@ not using Autodist, then you would do this by running perhaps 'aclocal',
 this process is performed by Autodist, and running these tools manually
 or using 'autogen.sh' script is not necessary.
 
-By default the 'autodist.conf' (@pxref{autodist.conf, , , , }) has defined 
-the tools that will be run by the Autodist when preparing the source tree.  
-These are 'aclocal', 'autoheader', 'autoconf', 'automake' and 
-'libtoolize'.  If you do not whish that Autodist runs some or any of these 
-tools automatically, do not set them in the 'autodist.conf'.  You would 
-then need to run them manually. However, this is not recommended.  If you 
-need to run additional preparation scripts you may set your scripts either 
-in the 'pre-hook' and/or 'post-hook' where you can run what ever 
+By default the 'autodist.conf' (@pxref{autodist.conf, , , , }) has defined
+the tools that will be run by the Autodist when preparing the source tree.
+These are 'aclocal', 'autoheader', 'autoconf', 'automake' and
+'libtoolize'.  If you do not wish that Autodist runs some or any of these
+tools automatically, do not set them in the 'autodist.conf'.  You would
+then need to run them manually. However, this is not recommended.  If you
+need to run additional preparation scripts you may set your scripts either
+in the 'pre-hook' and/or 'post-hook' where you can run what ever
 additional processing you may need to prepare your source tree.
 
 By default the Autodist creates a 'default' distribution when you
@@ -1262,10 +1348,10 @@ distribution run Autodist without any arguments.
 The Autodist will prepare your source tree.  After that you may run
 './configure' and continue to compile with 'make'.
 
-If you do not whish to use the 'default' distribution, or you whish
+If you do not wish to use the 'default' distribution, or you wish
 to do the development in a tree specificly prepared for some specific
 distribution, or you are preparing to create a new distribution package,
-you will need to run the Autodist with the distribution you whish to
+you will need to run the Autodist with the distribution you wish to
 prepare.
 
 @example
@@ -1275,6 +1361,8 @@ prepare.
 This prepares your source tree for 'example-distribution' of version
 '1.0.3'.  After that you may run './configure' and continue to compile
 with 'make'.  If the version is omitted the version will be '0.0'.
+The 'PACKAGE_VERSION' define delivered by Autoconf will contain this
+version.
 
 Note that, running Autodist for preparation merely prepares your source
 tree for the distribution, it does not create an actual distribution
@@ -1288,7 +1376,7 @@ distribution.
 However, the source files, or any other file (except files ending with
 '.ad' suffix) are not processed by the Autodist.  When compiling
 your sources the preprocessor, however, will respect your distdef
-conditionals inside your source files if you include the distdef header
+conditionals inside your source files if you '#include' the distdef header
 file.  This way, even the compiled binaries will be compiled for that
 distribution, even though the source files has not yet been processed
 by the Autodist.  Rest of the files in the distribution will be processed
@@ -1297,6 +1385,12 @@ the distribution you have prepared will behave in your source tree exactly
 the same way as if it was already packaged with Autodist (providing that
 you remember to include the distdef header file in your code).
 
+When preparing the source tree Autodist will create a file 'autodist.dist'
+which will contain information on the prepared distribution.  When
+Creating the distribution that file will be read by the Autodist
+automatically.  That file should not be removed or the distribution
+cannot be packaged.
+
 @menu
 * Creating distribution::       Creating distribution with Autodist
 @end menu
@@ -1309,18 +1403,18 @@ Before creating a new distribution package, you will need to prepare
 the source tree for the distribution you want to create.  After preparing
 your source tree you will be ready to create a new distribution.  The
 Autodist package provides a simple helper script 'makedist' that may
-be used to create the distribution.  However, if you whish, you may
+be used to create the distribution.  However, if you wish, you may
 run the Autodist yourself, as the 'makedist' will call Autodist anyway.
 
-To create a new distribution for the distribution you have prepared for
-run makedist.
+To create a new distribution for the distribution you have prepared for,
+run first './configure' and then 'makedist'.
 
 @example
   makedist
 @end example
 
 This will run the Autodist and create a new distribution package that
-is archived with 'tar' and compressed with 'gzip'.  If you whish to
+is archived with 'tar' and compressed with 'gzip'.  If you wish to
 create packages also compressed with 'bzip2', 'compress' and/or 'zip'
 you may give one or all of the following options:
 
@@ -1332,16 +1426,11 @@ This example would create, in addition of 'tar.gz' package, also a
 'tar.bz2', 'tar.Z' and '.zip' packages.  Current version of Autodist does
 not support archiving with 'shar'.
 
-If you whish to run additional processing for your distributions when
-they are being packaged you may set 'pre-dist-hook' and/or 'post-dist-hook'
-in your distribution file.  Also note that any hooks provided by Automake
-in Makefiles will be run in normal manner.
-
-For additional help, you may give:
-
-@example
-  makedist --help
-@end example
+If you wish to run additional processing for your distributions when they 
+are being packaged you may set 'pre-process-dist-hook', 
+'post-process-dist-hook, 'pre-dist-hook' and/or 'post-dist-hook' in your 
+distribution file.  Also note that any hooks provided by Automake in 
+Makefiles will be run in normal manner.
 
 
 @node Examples
@@ -1356,7 +1445,7 @@ For additional help, you may give:
 @section Single distribution tree example, start to finish
 
 Lets suppose you have a simple source tree with one application,
-called 'foozbar' you whish to release.  While you would probably suffice
+called 'foozbar' you wish to release.  While you would probably suffice
 using Autoconf and Automake features you may still use Autodist.
 
 First, you create the default 'distdir' into your software package:
@@ -1367,7 +1456,7 @@ First, you create the default 'distdir' into your software package:
 
 Then, you create the 'configure.ad' file from your existing 'configure.ac'
 or 'configure.in' file.  If you don't have configure script written yet,
-please refer to the Autoconf manual.  In the 'autodist.ad' you add as
+please refer to the Autoconf manual.  In the 'configure.ad' you add as
 first macro in the file:
 
 @example
@@ -1387,7 +1476,7 @@ define _DIST_FOOZBAR
 This distribution file go into 'distdir/foozbar'.
 
 And there you go.  You have succesfully integrated Autodist into your
-source tree.  If you need to do development and you whish to use the
+source tree.  If you need to do development and you wish to use the
 'default' distribution for that, you should inherit the new 'foozbar'
 distribution in it.  Add the following line in 'distdir/default':
 
@@ -1442,7 +1531,7 @@ directory 'distdir':
 
 Then, you create the 'configure.ad' file from your existing 'configure.ac'
 or 'configure.in' file.  If you don't have configure script written yet,
-please refer to the Autoconf manual.  In the 'autodist.ad' you add as
+please refer to the Autoconf manual.  In the 'configure.ad' you add as
 first macro in the file:
 
 @example
@@ -1484,6 +1573,7 @@ undef _DIST_CRYPTO
 
 @example
 # Common template
+option template
 define _DIST_DOC
 define _DIST_LIB
 define _DIST_MATH
index faf528af340293e005beb7a1bc7414035cfd9433..c1e2ae6532dd10e333584d767869eb78b43892a6 100644 (file)
@@ -19,7 +19,10 @@ AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
 TESTS =                        \
        autodist1.test          \
-       autodist2.test
+       autodist2.test          \
+       autodist3.test          \
+       autodist4.test          \
+       autodist5.test
 
 clean-local:
        -rm -rf test
index 2ea7cc433a29a62bd8e1e2df921ad14a20dab589..f475436d5f060cfec41d8800ec8dd842a00d1fda 100755 (executable)
@@ -22,15 +22,24 @@ Makefile
 )
 AC_OUTPUT
 echo configure.ad ok
+#else !_DIST_DEFAULT
+echo "ERROR"
+exit 1
 #endif _DIST_DEFAULT
 EOF
 
 cat << EOF > Makefile.ad
-SUBDIRS=       \
+SUBDIRS=       \\
 #ifdef _DIST_NODEF
-       nodef   \
+       nodef   \\
+       poa     \\
+       paa     \\
 #endif _DIST_NODEF
-#endif
+       .       \\
+       .       \\
+       .       \\
+       .       \\
+
 EOF
 
 rm -rf distdir subdir
@@ -40,6 +49,9 @@ cat << EOF > subdir/configure.ad
 # subdir/configure.ad fragment
 #ifndef _DIST_NODEF
 echo "_DIST_NODEF ok"
+#else _DIST_NODEF
+echo "ERROR"
+exit 1
 #endif _DIST_NODEF
 EOF
 
index 3a01e4fa70184b45009fbde4823a663f14e1ebf5..16e5f9319a1a47b5caa43315e63f2fc06f125da0 100755 (executable)
@@ -22,15 +22,19 @@ Makefile
 )
 AC_OUTPUT
 echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
 #endif _DIST_TEST
 EOF
 
 cat << EOF > Makefile.ad
-SUBDIRS=       \
+SUBDIRS=       \\
 #ifndef _DIST_TEST
-       nodef   \
+       nodef   \\
 #endif _DIST_TEST
-#endif
+       .       \\
+
 EOF
 
 rm -rf distdir subdir
diff --git a/apps/autodist/tests/autodist3.test b/apps/autodist/tests/autodist3.test
new file mode 100755 (executable)
index 0000000..e70109d
--- /dev/null
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+AUTODIST=../autodist
+
+rm -f ./autodist
+
+echo "Testing with /bin/zsh"
+
+# Change shell to zsh
+if test '!' -f /bin/zsh; then
+  echo "/bin/zsh does not exist, cannot run test"
+  exit 0
+fi
+cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/zsh/' > ./autodist
+
+AUTODIST=../autodist   # from inside tests/test
+
+rm -rf test
+mkdir test
+
+cd test || exit 1
+
+chmod +x $AUTODIST || exit 1
+
+cat << EOF > configure.ad
+AD_INIT
+#ifdef _DIST_TEST
+AC_CANONICAL_BUILD
+AM_INIT_AUTOMAKE
+AC_PREREQ(2.52)
+AC_CONFIG_HEADERS(config.h)
+AD_INCLUDE_CONFIGURE
+AC_CONFIG_FILES(
+Makefile
+)
+AC_OUTPUT
+echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
+#endif _DIST_TEST
+EOF
+
+cat << EOF > Makefile.ad
+SUBDIRS=       \\
+#ifndef _DIST_TEST
+       nodef   \\
+#endif _DIST_TEST
+       .       \\
+
+EOF
+
+rm -rf distdir subdir
+mkdir -p subdir || exit 1
+
+cat << EOF > subdir/configure.ad
+# subdir/configure.ad fragment
+#ifndef _DIST_NODEF
+#ifdef _DIST_TEST
+echo "_DIST_NODEF ok"
+#endif _DIST_TEST
+#endif _DIST_NODEF
+EOF
+
+$AUTODIST -i || exit 1
+if test '!' -d distdir; then
+  echo "error: distdir/ does no exist"
+  exit 1
+fi 
+
+cp -p ../../default distdir || exit 1
+cp -p ../../autodist.conf distdir || exit 1
+
+cat << EOF > distdir/test
+name Test Distribution
+package test-distro
+bug-report test-dist@test.org
+define _DIST_TEST
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+echo "inherit test" >> distdir/default
+
+$AUTODIST || exit 1
+$AUTODIST test 1.0 || exit 1
+
+./configure || exit 1
+make || exit 1
+echo make ok
+
+$AUTODIST -m || exit 1
+
+if test '!' -f test-distro-1.0.tar.gz; then
+  echo "error: makedist failed"
+  exit 1
+fi
+
+echo test ok
+
+# Cleanup
+rm -rf subdir distdir $AUTODIST
+
diff --git a/apps/autodist/tests/autodist4.test b/apps/autodist/tests/autodist4.test
new file mode 100755 (executable)
index 0000000..1de8011
--- /dev/null
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+AUTODIST=../autodist
+
+rm -f ./autodist
+
+echo "Testing with /bin/ksh"
+
+# Change shell to ksh
+if test '!' -f /bin/ksh; then
+  echo "/bin/zsh does not exist, cannot run test"
+  exit 0
+fi
+cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/ksh/' > ./autodist
+
+AUTODIST=../autodist   # from inside tests/test
+
+rm -rf test
+mkdir test
+
+cd test || exit 1
+
+chmod +x $AUTODIST || exit 1
+
+cat << EOF > configure.ad
+AD_INIT
+#ifdef _DIST_TEST
+AC_CANONICAL_BUILD
+AM_INIT_AUTOMAKE
+AC_PREREQ(2.52)
+AC_CONFIG_HEADERS(config.h)
+AD_INCLUDE_CONFIGURE
+AC_CONFIG_FILES(
+Makefile
+)
+AC_OUTPUT
+echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
+#endif _DIST_TEST
+EOF
+
+cat << EOF > Makefile.ad
+SUBDIRS=       \\
+#ifndef _DIST_TEST
+       nodef   \\
+#endif _DIST_TEST
+       .       \\
+
+EOF
+
+rm -rf distdir subdir
+mkdir -p subdir || exit 1
+
+cat << EOF > subdir/configure.ad
+# subdir/configure.ad fragment
+#ifndef _DIST_NODEF
+#ifdef _DIST_TEST
+echo "_DIST_NODEF ok"
+#endif _DIST_TEST
+#endif _DIST_NODEF
+EOF
+
+$AUTODIST -i || exit 1
+if test '!' -d distdir; then
+  echo "error: distdir/ does no exist"
+  exit 1
+fi 
+
+cp -p ../../default distdir || exit 1
+cp -p ../../autodist.conf distdir || exit 1
+
+cat << EOF > distdir/test
+       name Test Distribution
+       package test-distro
+       bug-report test-dist@test.org
+       define _DIST_TEST
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+echo "inherit test" >> distdir/default
+
+$AUTODIST || exit 1
+$AUTODIST test 1.0 || exit 1
+
+./configure || exit 1
+make || exit 1
+echo make ok
+
+$AUTODIST -m || exit 1
+
+if test '!' -f test-distro-1.0.tar.gz; then
+  echo "error: makedist failed"
+  exit 1
+fi
+
+echo test ok
+
+# Cleanup
+rm -rf subdir distdir $AUTODIST
+
diff --git a/apps/autodist/tests/autodist5.test b/apps/autodist/tests/autodist5.test
new file mode 100755 (executable)
index 0000000..58691e3
--- /dev/null
@@ -0,0 +1,104 @@
+#!/bin/sh
+
+AUTODIST=../autodist
+
+rm -f ./autodist
+
+echo "Testing with /bin/ash"
+
+# Change shell to ash
+if test '!' -f /bin/ash; then
+  echo "/bin/zsh does not exist, cannot run test"
+  exit 0
+fi
+cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/ash/' > ./autodist
+
+AUTODIST=../autodist   # from inside tests/test
+
+rm -rf test
+mkdir test
+
+cd test || exit 1
+
+chmod +x $AUTODIST || exit 1
+
+cat << EOF > configure.ad
+AD_INIT
+#ifdef _DIST_TEST
+AC_CANONICAL_BUILD
+AM_INIT_AUTOMAKE
+AC_PREREQ(2.52)
+AC_CONFIG_HEADERS(config.h)
+AD_INCLUDE_CONFIGURE
+AC_CONFIG_FILES(
+Makefile
+)
+AC_OUTPUT
+echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
+#endif _DIST_TEST
+EOF
+
+cat << EOF > Makefile.ad
+SUBDIRS=       \\
+#ifndef _DIST_TEST
+       nodef   \\
+#endif _DIST_TEST
+       .       \\
+
+EOF
+
+rm -rf distdir subdir
+mkdir -p subdir || exit 1
+
+cat << EOF > subdir/configure.ad
+# subdir/configure.ad fragment
+#ifndef _DIST_NODEF
+#ifdef _DIST_TEST
+echo "_DIST_NODEF ok"
+#endif _DIST_TEST
+#endif _DIST_NODEF
+EOF
+
+$AUTODIST -i || exit 1
+if test '!' -d distdir; then
+  echo "error: distdir/ does no exist"
+  exit 1
+fi 
+
+cp -p ../../default distdir || exit 1
+cp -p ../../autodist.conf distdir || exit 1
+
+cat << EOF > distdir/test
+ name Test Distribution
+       package test-distro
+bug-report test-dist@test.org
+define _DIST_TEST
+#define _DIST_NODEF
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+echo "inherit test" >> distdir/default
+
+$AUTODIST || exit 1
+$AUTODIST test 1.0 || exit 1
+
+./configure || exit 1
+make || exit 1
+echo make ok
+
+$AUTODIST -m || exit 1
+
+if test '!' -f test-distro-1.0.tar.gz; then
+  echo "error: makedist failed"
+  exit 1
+fi
+
+echo test ok
+
+# Cleanup
+rm -rf subdir distdir $AUTODIST
+
index 5d94f74b9a02c69d38ed45df0c1b16dc8daabf0c..c11e549777c0eab75d36b8fe2e98df05f0a7475f 100644 (file)
@@ -421,7 +421,7 @@ bool silc_server_command_pending_timed(SilcServer server,
   reply->timeout =
     silc_schedule_task_add(server->schedule, 0,
                           silc_server_command_pending_timeout, reply,
-                          timeout ? timeout : 10, 0,
+                          timeout ? timeout : 12, 0,
                           SILC_TASK_TIMEOUT, SILC_TASK_PRI_LOW);
   silc_dlist_add(server->pending_commands, reply);
 
@@ -488,6 +488,9 @@ silc_server_command_send_status_reply(SilcServerCommandContext cmd,
 {
   SilcBuffer buffer;
 
+  /* Statistics */
+  cmd->server->stat.commands_sent++;
+
   SILC_LOG_DEBUG(("Sending command status %d", status));
 
   buffer =
@@ -514,6 +517,9 @@ silc_server_command_send_status_data(SilcServerCommandContext cmd,
 {
   SilcBuffer buffer;
 
+  /* Statistics */
+  cmd->server->stat.commands_sent++;
+
   SILC_LOG_DEBUG(("Sending command status %d", status));
 
   buffer =
@@ -540,6 +546,9 @@ silc_server_command_send_status_data2(SilcServerCommandContext cmd,
 {
   SilcBuffer buffer;
 
+  /* Statistics */
+  cmd->server->stat.commands_sent++;
+
   SILC_LOG_DEBUG(("Sending command status %d", status));
 
   buffer =
@@ -569,6 +578,9 @@ silc_server_command_pending_error_check(SilcServerCommandContext cmd,
   if (!silc_command_get_status(cmdr->payload, NULL, NULL)) {
     SilcBuffer buffer;
 
+    /* Statistics */
+    cmd->server->stat.commands_sent++;
+
     /* Send the same command reply payload */
     silc_command_set_command(cmdr->payload, silc_command_get(cmd->payload));
     silc_command_set_ident(cmdr->payload,
@@ -623,7 +635,7 @@ SILC_SERVER_CMD_FUNC(nick)
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
   SilcServer server = cmd->server;
-  SilcBuffer packet, nidp, oidp = NULL;
+  SilcBuffer nidp, oidp = NULL;
   SilcClientID *new_id;
   SilcUInt32 nick_len;
   unsigned char *nick, *nickc = NULL;
@@ -720,14 +732,11 @@ SILC_SERVER_CMD_FUNC(nick)
 
  send_reply:
   /* Send the new Client ID as reply command back to client */
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_NICK,
-                                               SILC_STATUS_OK, 0, ident, 2,
-                                               2, nidp->data, nidp->len,
-                                               3, nick, nick_len);
-  silc_server_packet_send(cmd->server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
-                         0, packet->data, packet->len, FALSE);
-
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(cmd->server, cmd->sock,
+                                SILC_COMMAND_NICK,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, nidp->data, nidp->len,
+                                3, nick, nick_len);
   silc_buffer_free(nidp);
   if (oidp)
     silc_buffer_free(oidp);
@@ -746,7 +755,7 @@ silc_server_command_list_send_reply(SilcServerCommandContext cmd,
                                    SilcUInt32 gch_count)
 {
   int i, k;
-  SilcBuffer packet, idp;
+  SilcBuffer idp;
   SilcChannelEntry entry;
   SilcStatus status;
   SilcUInt16 ident = silc_command_get_ident(cmd->payload);
@@ -801,18 +810,13 @@ silc_server_command_list_send_reply(SilcServerCommandContext cmd,
     }
 
     /* Send the reply */
-    packet =
-      silc_command_reply_payload_encode_va(SILC_COMMAND_LIST,
-                                          status, 0, ident, 4,
-                                          2, idp->data, idp->len,
-                                          3, entry->channel_name,
-                                          strlen(entry->channel_name),
-                                          4, topic, topic ? strlen(topic) : 0,
-                                          5, usercount, 4);
-    silc_server_packet_send(cmd->server, cmd->sock,
-                           SILC_PACKET_COMMAND_REPLY, 0, packet->data,
-                           packet->len, FALSE);
-    silc_buffer_free(packet);
+    silc_server_send_command_reply(cmd->server, cmd->sock, SILC_COMMAND_LIST,
+                                  status, 0, ident, 4,
+                                  2, idp->data, idp->len,
+                                  3, entry->channel_name,
+                                  strlen(entry->channel_name),
+                                  4, topic, topic ? strlen(topic) : 0,
+                                  5, usercount, 4);
     silc_buffer_free(idp);
     k++;
   }
@@ -840,18 +844,13 @@ silc_server_command_list_send_reply(SilcServerCommandContext cmd,
     }
 
     /* Send the reply */
-    packet =
-      silc_command_reply_payload_encode_va(SILC_COMMAND_LIST,
-                                          status, 0, ident, 4,
-                                          2, idp->data, idp->len,
-                                          3, entry->channel_name,
-                                          strlen(entry->channel_name),
-                                          4, topic, topic ? strlen(topic) : 0,
-                                          5, usercount, 4);
-    silc_server_packet_send(cmd->server, cmd->sock,
-                           SILC_PACKET_COMMAND_REPLY, 0, packet->data,
-                           packet->len, FALSE);
-    silc_buffer_free(packet);
+    silc_server_send_command_reply(cmd->server, cmd->sock, SILC_COMMAND_LIST,
+                                  status, 0, ident, 4,
+                                  2, idp->data, idp->len,
+                                  3, entry->channel_name,
+                                  strlen(entry->channel_name),
+                                  4, topic, topic ? strlen(topic) : 0,
+                                  5, usercount, 4);
     silc_buffer_free(idp);
     k++;
   }
@@ -879,6 +878,9 @@ SILC_SERVER_CMD_FUNC(list)
     SilcBuffer tmpbuf;
     SilcUInt16 old_ident;
 
+    /* Statistics */
+    cmd->server->stat.commands_sent++;
+
     old_ident = silc_command_get_ident(cmd->payload);
     silc_command_set_ident(cmd->payload, ++server->cmd_ident);
     tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -938,7 +940,7 @@ SILC_SERVER_CMD_FUNC(topic)
   SilcChannelID *channel_id;
   SilcChannelEntry channel;
   SilcChannelClientEntry chl;
-  SilcBuffer packet, idp;
+  SilcBuffer idp;
   unsigned char *tmp;
   SilcUInt32 argc, tmp_len;
   SilcUInt16 ident = silc_command_get_ident(cmd->payload);
@@ -1045,16 +1047,12 @@ SILC_SERVER_CMD_FUNC(topic)
 
   /* Send the topic to client as reply packet */
   idp = silc_id_payload_encode(channel_id, SILC_ID_CHANNEL);
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_TOPIC,
-                                               SILC_STATUS_OK, 0, ident, 2,
-                                               2, idp->data, idp->len,
-                                               3, channel->topic,
-                                               channel->topic ?
-                                               strlen(channel->topic) : 0);
-  silc_server_packet_send(cmd->server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
-                         0, packet->data, packet->len, FALSE);
-
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(cmd->server, cmd->sock, SILC_COMMAND_TOPIC,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, idp->data, idp->len,
+                                3, channel->topic,
+                                channel->topic ?
+                                strlen(channel->topic) : 0);
   silc_buffer_free(idp);
   silc_free(channel_id);
 
@@ -1078,7 +1076,7 @@ SILC_SERVER_CMD_FUNC(invite)
   SilcIDListData idata;
   SilcArgumentPayload args;
   SilcHashTableList htl;
-  SilcBuffer packet, list, tmp2;
+  SilcBuffer list, tmp2;
   SilcBufferStruct alist;
   unsigned char *tmp, *atype = NULL;
   SilcUInt32 len, type, len2;
@@ -1332,15 +1330,12 @@ SILC_SERVER_CMD_FUNC(invite)
 
   /* Send command reply */
   tmp = silc_argument_get_arg_type(cmd->args, 1, &len);
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INVITE,
-                                               SILC_STATUS_OK, 0, ident, 2,
-                                               2, tmp, len,
-                                               3, type && list ?
-                                               list->data : NULL,
-                                               type && list ? list->len : 0);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_INVITE,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, tmp, len,
+                                3, type && list ?
+                                list->data : NULL,
+                                type && list ? list->len : 0);
   silc_buffer_free(list);
 
  out:
@@ -1556,7 +1551,7 @@ SILC_SERVER_CMD_FUNC(info)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SilcServer server = cmd->server;
-  SilcBuffer packet, idp;
+  SilcBuffer idp;
   unsigned char *tmp;
   SilcUInt32 tmp_len;
   char *dest_server = NULL, *server_info = NULL, *server_name;
@@ -1644,6 +1639,9 @@ SILC_SERVER_CMD_FUNC(info)
       SilcBuffer tmpbuf;
       SilcUInt16 old_ident;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -1668,6 +1666,9 @@ SILC_SERVER_CMD_FUNC(info)
       SilcBuffer tmpbuf;
       SilcUInt16 old_ident;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -1709,18 +1710,14 @@ SILC_SERVER_CMD_FUNC(info)
   server_name = entry->server_name;
 
   /* Send the reply */
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INFO,
-                                               SILC_STATUS_OK, 0, ident, 3,
-                                               2, idp->data, idp->len,
-                                               3, server_name,
-                                               strlen(server_name),
-                                               4, server_info,
-                                               server_info ?
-                                               strlen(server_info) : 0);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_INFO,
+                                SILC_STATUS_OK, 0, ident, 3,
+                                2, idp->data, idp->len,
+                                3, server_name,
+                                strlen(server_name),
+                                4, server_info,
+                                server_info ?
+                                strlen(server_info) : 0);
   silc_buffer_free(idp);
 
  out:
@@ -1809,6 +1806,9 @@ SILC_SERVER_CMD_FUNC(stats)
      statistical information. */
   if (!cmd->pending && server->server_type != SILC_ROUTER &&
       !server->standalone) {
+    /* Statistics */
+    cmd->server->stat.commands_sent++;
+
     /* Send request to our router */
     SilcBuffer idp = silc_id_payload_encode(server->router->id,
                                            SILC_ID_SERVER);
@@ -1852,13 +1852,10 @@ SILC_SERVER_CMD_FUNC(stats)
                     SILC_STR_UI_INT(server->stat.router_ops),
                     SILC_STR_END);
 
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_STATS,
-                                               SILC_STATUS_OK, 0, ident, 2,
-                                               2, tmp, tmp_len,
-                                               3, stats->data, stats->len);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
-                         0, packet->data, packet->len, FALSE);
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_STATS,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, tmp, tmp_len,
+                                3, stats->data, stats->len);
   silc_buffer_free(stats);
 
  out:
@@ -2269,6 +2266,9 @@ static void silc_server_command_join_channel(SilcServer server,
   silc_server_packet_send(server, sock, SILC_PACKET_COMMAND_REPLY, 0,
                          reply->data, reply->len, FALSE);
 
+  /* Statistics */
+  cmd->server->stat.commands_sent++;
+
   /* Send JOIN notify to locally connected clients on the channel. If
      we are normal server then router will send or have sent JOIN notify
      already. However since we've added the client already to our channel
@@ -2458,6 +2458,9 @@ SILC_SERVER_CMD_FUNC(join)
            goto out;
          }
 
+         /* Statistics */
+         cmd->server->stat.commands_sent++;
+
          old_ident = silc_command_get_ident(cmd->payload);
          silc_command_set_ident(cmd->payload, ++server->cmd_ident);
          tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -2593,7 +2596,7 @@ SILC_SERVER_CMD_FUNC(motd)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SilcServer server = cmd->server;
-  SilcBuffer packet, idp;
+  SilcBuffer idp;
   char *motd, *dest_server = NULL;
   SilcUInt32 motd_len;
   SilcUInt16 ident = silc_command_get_ident(cmd->payload);
@@ -2633,22 +2636,16 @@ SILC_SERVER_CMD_FUNC(motd)
        goto out;
 
       motd[motd_len] = 0;
-      packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
-                                                   SILC_STATUS_OK, 0,
-                                                   ident, 2,
-                                                   2, idp->data, idp->len,
-                                                   3, motd, motd_len);
+      silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_MOTD,
+                                    SILC_STATUS_OK, 0, ident, 2,
+                                    2, idp->data, idp->len,
+                                    3, motd, motd_len);
     } else {
       /* No motd */
-      packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
-                                                   SILC_STATUS_OK, 0,
-                                                   ident, 1,
-                                                   2, idp->data, idp->len);
+      silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_MOTD,
+                                    SILC_STATUS_OK, 0, ident, 1,
+                                    2, idp->data, idp->len);
     }
-
-    silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                           packet->data, packet->len, FALSE);
-    silc_buffer_free(packet);
     silc_buffer_free(idp);
   } else {
     SilcServerEntry entry;
@@ -2667,6 +2664,9 @@ SILC_SERVER_CMD_FUNC(motd)
       SilcBuffer tmpbuf;
       SilcUInt16 old_ident;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -2694,6 +2694,9 @@ SILC_SERVER_CMD_FUNC(motd)
       SilcBuffer tmpbuf;
       SilcUInt16 old_ident;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -2725,15 +2728,12 @@ SILC_SERVER_CMD_FUNC(motd)
     }
 
     idp = silc_id_payload_encode(entry->id, SILC_ID_SERVER);
-    packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
-                                                 SILC_STATUS_OK, 0, ident, 2,
-                                                 2, idp->data, idp->len,
-                                                 3, entry->motd,
-                                                 entry->motd ?
-                                                 strlen(entry->motd) : 0);
-    silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                           packet->data, packet->len, FALSE);
-    silc_buffer_free(packet);
+    silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_MOTD,
+                                  SILC_STATUS_OK, 0, ident, 2,
+                                  2, idp->data, idp->len,
+                                  3, entry->motd,
+                                  entry->motd ?
+                                  strlen(entry->motd) : 0);
     silc_buffer_free(idp);
   }
 
@@ -2751,7 +2751,6 @@ SILC_SERVER_CMD_FUNC(umode)
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SilcServer server = cmd->server;
   SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
-  SilcBuffer packet;
   unsigned char *tmp_mask, m[4];
   SilcUInt32 mask = 0;
   SilcUInt16 ident = silc_command_get_ident(cmd->payload);
@@ -2814,12 +2813,9 @@ SILC_SERVER_CMD_FUNC(umode)
 
   /* Send command reply to sender */
   SILC_PUT32_MSB(client->mode, m);
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_UMODE,
-                                               SILC_STATUS_OK, 0, ident, 1,
-                                               2, m, sizeof(m));
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_UMODE,
+                                SILC_STATUS_OK, 0, ident, 1,
+                                2, m, sizeof(m));
 
  out:
   silc_server_command_free(cmd);
@@ -2836,7 +2832,7 @@ SILC_SERVER_CMD_FUNC(cmode)
   SilcChannelID *channel_id = NULL;
   SilcChannelEntry channel;
   SilcChannelClientEntry chl;
-  SilcBuffer packet, cidp;
+  SilcBuffer cidp;
   unsigned char *tmp, *tmp_id, *tmp_mask, *chpkdata = NULL;
   char *cipher = NULL, *hmac = NULL, *passphrase = NULL, ulimit[4];
   SilcUInt32 mode_mask = 0, old_mask = 0, tmp_len, tmp_len2, chpklen;
@@ -2924,18 +2920,14 @@ SILC_SERVER_CMD_FUNC(cmode)
     if (channel->channel_pubkeys)
       chpklist = silc_server_get_channel_pk_list(server, channel,
                                                 FALSE, FALSE);
-    packet =
-      silc_command_reply_payload_encode_va(SILC_COMMAND_CMODE,
-                                          SILC_STATUS_OK, 0, ident, 4,
-                                          2, tmp_id, tmp_len2,
-                                          3, m, sizeof(m),
-                                          4, fkey ? fkey->data : NULL,
-                                          fkey ? fkey->len : 0,
-                                          5, chpklist ? chpklist->data : NULL,
-                                          chpklist ? chpklist->len : 0);
-    silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                           packet->data, packet->len, FALSE);
-    silc_buffer_free(packet);
+    silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_CMODE,
+                                  SILC_STATUS_OK, 0, ident, 4,
+                                  2, tmp_id, tmp_len2,
+                                  3, m, sizeof(m),
+                                  4, fkey ? fkey->data : NULL,
+                                  fkey ? fkey->len : 0,
+                                  5, chpklist ? chpklist->data : NULL,
+                                  chpklist ? chpklist->len : 0);
     goto out;
   }
 
@@ -3298,26 +3290,21 @@ SILC_SERVER_CMD_FUNC(cmode)
     chpklist = silc_server_get_channel_pk_list(server, channel, FALSE, FALSE);
 
   /* Send command reply to sender */
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_CMODE,
-                                               SILC_STATUS_OK, 0, ident, 5,
-                                               2, tmp_id, tmp_len2,
-                                               3, tmp_mask, 4,
-                                               4, fkey ? fkey->data : NULL,
-                                               fkey ? fkey->len : 0,
-                                               5, chpklist ? chpklist->data :
-                                               NULL, chpklist ? chpklist->len
-                                               : 0,
-                                               6, (mode_mask &
-                                                   SILC_CHANNEL_MODE_ULIMIT ?
-                                                   ulimit : NULL),
-                                               (mode_mask &
-                                                SILC_CHANNEL_MODE_ULIMIT ?
-                                                sizeof(ulimit) : 0));
-
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_CMODE,
+                                SILC_STATUS_OK, 0, ident, 5,
+                                2, tmp_id, tmp_len2,
+                                3, tmp_mask, 4,
+                                4, fkey ? fkey->data : NULL,
+                                fkey ? fkey->len : 0,
+                                5, chpklist ? chpklist->data :
+                                NULL, chpklist ? chpklist->len
+                                : 0,
+                                6, (mode_mask &
+                                    SILC_CHANNEL_MODE_ULIMIT ?
+                                    ulimit : NULL),
+                                (mode_mask &
+                                 SILC_CHANNEL_MODE_ULIMIT ?
+                                 sizeof(ulimit) : 0));
   silc_buffer_free(cidp);
 
  out:
@@ -3340,7 +3327,7 @@ SILC_SERVER_CMD_FUNC(cumode)
   SilcChannelEntry channel;
   SilcClientEntry target_client;
   SilcChannelClientEntry chl;
-  SilcBuffer packet, idp;
+  SilcBuffer idp;
   unsigned char *tmp_id, *tmp_ch_id, *tmp_mask;
   SilcUInt32 target_mask, sender_mask = 0, tmp_len, tmp_ch_len;
   int notify = FALSE;
@@ -3682,15 +3669,11 @@ SILC_SERVER_CMD_FUNC(cumode)
   }
 
   /* Send command reply to sender */
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_CUMODE,
-                                               SILC_STATUS_OK, 0, ident, 3,
-                                               2, tmp_mask, 4,
-                                               3, tmp_ch_id, tmp_ch_len,
-                                               4, tmp_id, tmp_len);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_CUMODE,
+                                SILC_STATUS_OK, 0, ident, 3,
+                                2, tmp_mask, 4,
+                                3, tmp_ch_id, tmp_ch_len,
+                                4, tmp_id, tmp_len);
   silc_buffer_free(idp);
 
  out:
@@ -3712,7 +3695,7 @@ SILC_SERVER_CMD_FUNC(kick)
   SilcClientID *client_id;
   SilcChannelEntry channel;
   SilcChannelClientEntry chl;
-  SilcBuffer idp, packet;
+  SilcBuffer idp;
   SilcUInt32 tmp_len, target_idp_len, clen;
   SilcUInt16 ident = silc_command_get_ident(cmd->payload);
   unsigned char *tmp, *comment, *target_idp;
@@ -3816,14 +3799,10 @@ SILC_SERVER_CMD_FUNC(kick)
 
 
   /* Send the reply back to the client */
-  packet =
-    silc_command_reply_payload_encode_va(SILC_COMMAND_KICK,
-                                        SILC_STATUS_OK, 0, ident, 2,
-                                        2, tmp, tmp_len,
-                                        3, target_idp, target_idp_len);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_KICK,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, tmp, tmp_len,
+                                3, target_idp, target_idp_len);
 
   /* Send KICKED notify to local clients on the channel */
   idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
@@ -4128,6 +4107,9 @@ SILC_SERVER_CMD_FUNC(watch)
 
       SILC_LOG_DEBUG(("Forwarding WATCH to router"));
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -4386,6 +4368,10 @@ SILC_SERVER_CMD_FUNC(watch)
   /* Distribute the watch list to backup routers too */
   if (server->backup) {
     SilcBuffer tmpbuf;
+
+    /* Statistics */
+    cmd->server->stat.commands_sent++;
+
     old_ident = silc_command_get_ident(cmd->payload);
     silc_command_set_ident(cmd->payload, ++server->cmd_ident);
     tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -4528,7 +4514,7 @@ SILC_SERVER_CMD_FUNC(ban)
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SilcServer server = cmd->server;
   SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
-  SilcBuffer packet, list, tmp2;
+  SilcBuffer list, tmp2;
   SilcChannelEntry channel;
   SilcChannelClientEntry chl;
   SilcChannelID *channel_id = NULL;
@@ -4670,16 +4656,11 @@ SILC_SERVER_CMD_FUNC(ban)
   }
 
   /* Send the reply back to the client */
-  packet =
-    silc_command_reply_payload_encode_va(SILC_COMMAND_BAN,
-                                        SILC_STATUS_OK, 0, ident, 2,
-                                        2, id, id_len,
-                                        3, list ? list->data : NULL,
-                                        list ? list->len : 0);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_BAN,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, id, id_len,
+                                3, list ? list->data : NULL,
+                                list ? list->len : 0);
   silc_buffer_free(list);
 
  out:
@@ -4779,7 +4760,7 @@ SILC_SERVER_CMD_FUNC(users)
   SilcServer server = cmd->server;
   SilcChannelEntry channel;
   SilcChannelID *id = NULL;
-  SilcBuffer packet, idp;
+  SilcBuffer idp;
   unsigned char *channel_id;
   SilcUInt32 channel_id_len;
   SilcBuffer client_id_list;
@@ -4840,6 +4821,9 @@ SILC_SERVER_CMD_FUNC(users)
        !cmd->pending) {
       SilcBuffer tmpbuf;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
 
@@ -4909,23 +4893,19 @@ SILC_SERVER_CMD_FUNC(users)
 
   /* Send reply */
   idp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL);
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_USERS,
-                                               SILC_STATUS_OK, 0, ident, 4,
-                                               2, idp->data, idp->len,
-                                               3, lc, 4,
-                                               4, client_id_list ?
-                                               client_id_list->data : NULL,
-                                               client_id_list ?
-                                               client_id_list->len : 0,
-                                               5, client_mode_list ?
-                                               client_mode_list->data : NULL,
-                                               client_mode_list ?
-                                               client_mode_list->len : 0);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_USERS,
+                                SILC_STATUS_OK, 0, ident, 4,
+                                2, idp->data, idp->len,
+                                3, lc, 4,
+                                4, client_id_list ?
+                                client_id_list->data : NULL,
+                                client_id_list ?
+                                client_id_list->len : 0,
+                                5, client_mode_list ?
+                                client_mode_list->data : NULL,
+                                client_mode_list ?
+                                client_mode_list->len : 0);
   silc_buffer_free(idp);
-  silc_buffer_free(packet);
   if (client_id_list)
     silc_buffer_free(client_id_list);
   if (client_mode_list)
@@ -4944,7 +4924,6 @@ SILC_SERVER_CMD_FUNC(getkey)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SilcServer server = cmd->server;
-  SilcBuffer packet;
   SilcClientEntry client;
   SilcServerEntry server_entry;
   SilcClientID *client_id = NULL;
@@ -4997,6 +4976,9 @@ SILC_SERVER_CMD_FUNC(getkey)
       if (!dest_sock)
        goto out;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -5049,6 +5031,9 @@ SILC_SERVER_CMD_FUNC(getkey)
       SilcBuffer tmpbuf;
       SilcUInt16 old_ident;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       old_ident = silc_command_get_ident(cmd->payload);
       silc_command_set_ident(cmd->payload, ++server->cmd_ident);
       tmpbuf = silc_command_payload_encode_payload(cmd->payload);
@@ -5086,14 +5071,11 @@ SILC_SERVER_CMD_FUNC(getkey)
   }
 
   tmp = silc_argument_get_arg_type(cmd->args, 1, &tmp_len);
-  packet = silc_command_reply_payload_encode_va(SILC_COMMAND_GETKEY,
-                                               SILC_STATUS_OK, 0, ident, 2,
-                                               2, tmp, tmp_len,
-                                               3, pk ? pk->data : NULL,
-                                               pk ? pk->len : 0);
-  silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, FALSE);
-  silc_buffer_free(packet);
+  silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_GETKEY,
+                                SILC_STATUS_OK, 0, ident, 2,
+                                2, tmp, tmp_len,
+                                3, pk ? pk->data : NULL,
+                                pk ? pk->len : 0);
 
  out:
   if (idp)
index b4862c61221ed3d38de4bd46891c810400405ceb..198b7167ef56e7c994c10b8c0a274ed0ab6c5083 100644 (file)
@@ -962,6 +962,9 @@ SILC_SERVER_CMD_REPLY_FUNC(motd)
       if (server->server_type != SILC_SERVER)
        goto out;
 
+      /* Statistics */
+      cmd->server->stat.commands_sent++;
+
       /* entry isn't known so we IDENTIFY it. otherwise the
          silc_server_command_motd won't know about it and tell
          the client that there is no such server */
diff --git a/apps/silcd/configure.ad b/apps/silcd/configure.ad
new file mode 100644 (file)
index 0000000..d758333
--- /dev/null
@@ -0,0 +1,80 @@
+#ifdef SILC_DIST_SERVER
+#
+#  silcd/configure.ad
+#
+#  Author: Pekka Riikonen <priikone@silcnet.org>
+#
+#  Copyright (C) 2000 - 2005 Pekka Riikonen
+#
+#  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; version 2 of the License.
+#
+#  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.
+#
+
+# Logs directory
+#
+LOGSDIR="$silc_prefix/logs"
+AC_ARG_WITH(logsdir,
+  [[  --with-logsdir=DIR      directory for SILC Server logs [PREFIX/logs]]],
+  [
+    case "$withval" in
+      no|yes)
+        ;;
+      *)
+        LOGSDIR="$withval"
+        ;;
+    esac
+  ])
+AC_SUBST(LOGSDIR)
+AC_DEFINE_UNQUOTED([SILC_LOGSDIR], "$LOGSDIR", [SILC_LOGSDIR])
+
+# silcd config file checking
+#
+summary_silcd_configfile="/etc/silc/silcd.conf"
+AC_ARG_WITH(silcd-config-file,
+  [[  --with-silcd-config-file=FILE  use FILE as default configuration file
+                                 for SILC Server [/etc/silc/silcd.conf]]],
+    AC_DEFINE_UNQUOTED([SILC_SERVER_CONFIG_FILE], "$withval", [SILC_SERVER_CONFIG_FILE])
+    summary_silcd_configfile="$withval"
+  )
+
+# silcd pid file checking
+#
+if test "x$localstatedir" != 'x${prefix}/var'; then
+  PIDFILE="$localstatedir/silcd.pid"
+else
+  PIDFILE="$silc_prefix/var/silcd.pid"
+fi
+
+AC_ARG_WITH(silcd-pid-file,
+  [[  --with-silcd-pid-file=FILE     use FILE as default pid file for SILC
+                                 Server [/var/run/silcd.pid]]],
+  [
+    case "$withval" in
+      no|yes)
+        ;;
+      *)
+        PIDFILE="$withval"
+        ;;
+    esac
+  ])
+AC_SUBST(PIDFILE)
+
+#ifdef SILC_DIST_TOOLKIT
+if test x$without_silcd = xfalse ; then
+#endif SILC_DIST_TOOLKIT
+  AC_CONFIG_FILES(
+silcd/Makefile
+doc/example_silcd.conf
+)
+#ifdef SILC_DIST_TOOLKIT
+fi
+#endif SILC_DIST_TOOLKIT
+
+silcd="yes"
+#endif SILC_DIST_SERVER
index 621c4c4ffccc8600c8db86416e5c3bf5b9b7c40c..0a1561ce63dc62f5fb631d1c33d76af1bb94f876 100644 (file)
@@ -407,7 +407,6 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
   SILC_LOG_DEBUG(("Start"));
 
   if (entry) {
-    /* Remove from cache. Destructor callback deletes stuff. */
     if (!silc_idcache_del_by_context(id_list->clients, entry)) {
       SILC_LOG_DEBUG(("Unknown client, did not delete"));
       return FALSE;
@@ -435,12 +434,19 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
 /* ID Cache destructor */
 
 void silc_idlist_client_destructor(SilcIDCache cache,
-                                  SilcIDCacheEntry entry)
+                                  SilcIDCacheEntry entry,
+                                  void *context)
 {
+  SilcServer server = context;
   SilcClientEntry client;
 
   client = (SilcClientEntry)entry->context;
   if (client) {
+    /* Remove this client from the public key hash list */
+    if (client->data.public_key)
+      silc_hash_table_del_by_context(server->pk_hash,
+                                    client->data.public_key, client);
+
     assert(!silc_hash_table_count(client->channels));
     silc_free(client->nickname);
     silc_free(client->servername);
@@ -448,6 +454,8 @@ void silc_idlist_client_destructor(SilcIDCache cache,
     silc_free(client->userinfo);
     silc_free(client->id);
     silc_free(client->attrs);
+    if (client->data.public_key)
+      silc_pkcs_public_key_free(client->data.public_key);
     silc_hash_table_free(client->channels);
 
     memset(client, 'A', sizeof(*client));
index cff9c43c161f1dc219339e142bd48e2fbc6c99ba..0c4d0a60808c4b1a885893e93c259bb686734a17 100644 (file)
@@ -616,7 +616,8 @@ silc_idlist_replace_client_id(SilcServer server,
                              SilcIDList id_list, SilcClientID *old_id,
                              SilcClientID *new_id, const char *nickname);
 void silc_idlist_client_destructor(SilcIDCache cache,
-                                  SilcIDCacheEntry entry);
+                                  SilcIDCacheEntry entry,
+                                  void *context);
 SilcChannelEntry
 silc_idlist_add_channel(SilcIDList id_list, char *channel_name, int mode,
                        SilcChannelID *id, SilcServerEntry router,
index a7b13f0d099a64de8e61a853f513ae63049d1f7e..42a936e05c04606b707221e3b42726d43dfc1881 100644 (file)
@@ -1923,6 +1923,9 @@ void silc_server_send_command(SilcServer server,
   SilcBuffer packet;
   va_list ap;
 
+  /* Statistics */
+  server->stat.commands_sent++;
+
   va_start(ap, argc);
 
   packet = silc_command_payload_encode_vap(command, ident, argc, ap);
@@ -1946,12 +1949,15 @@ void silc_server_send_command_reply(SilcServer server,
   SilcBuffer packet;
   va_list ap;
 
+  /* Statistics */
+  server->stat.commands_sent++;
+
   va_start(ap, argc);
 
   packet = silc_command_reply_payload_encode_vap(command, status, error,
                                                 ident, argc, ap);
   silc_server_packet_send(server, sock, SILC_PACKET_COMMAND_REPLY, 0,
-                         packet->data, packet->len, TRUE);
+                         packet->data, packet->len, FALSE);
   silc_buffer_free(packet);
   va_end(ap);
 }
@@ -1972,6 +1978,9 @@ void silc_server_send_dest_command_reply(SilcServer server,
   SilcBuffer packet;
   va_list ap;
 
+  /* Statistics */
+  server->stat.commands_sent++;
+
   va_start(ap, argc);
 
   packet = silc_command_reply_payload_encode_vap(command, status, error,
index 2c3875a5c12bc8826866dcbfbe418621fddc5a20..cf5ddde8a3c2f1cb4a774b270240e9a459597f45 100644 (file)
@@ -278,7 +278,7 @@ bool silc_server_init_secondary(SilcServer server)
 
 bool silc_server_init(SilcServer server)
 {
-  int sock;
+  int sock = -1;
   SilcServerID *id;
   SilcServerEntry id_entry;
   SilcIDListPurge purge;
@@ -343,22 +343,22 @@ bool silc_server_init(SilcServer server)
   /* Initialize ID caches */
   server->local_list->clients =
     silc_idcache_alloc(0, SILC_ID_CLIENT, silc_idlist_client_destructor,
-                      FALSE, TRUE);
+                      server, FALSE, TRUE);
   server->local_list->servers =
-    silc_idcache_alloc(0, SILC_ID_SERVER, NULL, FALSE, TRUE);
+    silc_idcache_alloc(0, SILC_ID_SERVER, NULL, NULL, FALSE, TRUE);
   server->local_list->channels =
-    silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, FALSE, TRUE);
+    silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, NULL, FALSE, TRUE);
 
   /* These are allocated for normal server as well as these hold some
      global information that the server has fetched from its router. For
      router these are used as they are supposed to be used on router. */
   server->global_list->clients =
     silc_idcache_alloc(0, SILC_ID_CLIENT, silc_idlist_client_destructor,
-                      FALSE, TRUE);
+                      server, FALSE, TRUE);
   server->global_list->servers =
-    silc_idcache_alloc(0, SILC_ID_SERVER, NULL, FALSE, TRUE);
+    silc_idcache_alloc(0, SILC_ID_SERVER, NULL, NULL, FALSE, TRUE);
   server->global_list->channels =
-    silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, FALSE, TRUE);
+    silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, NULL, FALSE, TRUE);
 
   /* Init watcher lists */
   server->watcher_list =
@@ -2862,6 +2862,7 @@ void silc_server_packet_parse_type(SilcServer server,
      */
     if (packet->flags & SILC_PACKET_FLAG_LIST)
       break;
+    server->stat.commands_received++;
     silc_server_command_process(server, sock, packet);
     break;
 
@@ -2873,6 +2874,7 @@ void silc_server_packet_parse_type(SilcServer server,
      */
     if (packet->flags & SILC_PACKET_FLAG_LIST)
       break;
+    server->stat.commands_received++;
     silc_server_command_reply(server, sock, packet);
     break;
 
@@ -5079,6 +5081,8 @@ void silc_server_announce_watches(SilcServer server,
     if (!client || !client->id)
       continue;
 
+    server->stat.commands_sent++;
+
     idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
     args = silc_buffer_alloc_size(2);
     silc_buffer_format(args,
@@ -5718,6 +5722,7 @@ SILC_TASK_CALLBACK(silc_server_get_stats)
 
   if (!server->standalone) {
     SILC_LOG_DEBUG(("Retrieving stats from router"));
+    server->stat.commands_sent++;
     idp = silc_id_payload_encode(server->router->id, SILC_ID_SERVER);
     packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
                                            ++server->cmd_ident, 1,
index ebbeadab6be30a6f35f6343e6f70271247206f03..b92f80f3471daf9928a9aa009bd08ded54b39f4a 100644 (file)
@@ -4,12 +4,11 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2003 Pekka Riikonen
+  Copyright (C) 1997 - 2005 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
+  the Free Software Foundation; version 2 of the License.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -62,6 +61,8 @@ typedef struct {
   SilcUInt32 packets_sent;               /* Sent SILC packets */
   SilcUInt32 packets_received;           /* Received SILC packets */
   SilcUInt32 conn_num;                   /* Number of connections */
+  SilcUInt32 commands_sent;              /* Commands/replies sent */
+  SilcUInt32 commands_received;                  /* Commands/replies received */
 } SilcServerStatistics;
 
 /*
index a248600953631b6993644b96b3a47a42a334ee81..f54145da589c2cd00c4601e13bc4d36101bde079 100644 (file)
@@ -294,6 +294,9 @@ void silc_server_query_send_router(SilcServer server, SilcServerQuery query)
 
   SILC_LOG_DEBUG(("Forwarding the query to router for processing"));
 
+  /* Statistics */
+  server->stat.commands_sent++;
+
   /* Send WHOIS command to our router */
   old_ident = silc_command_get_ident(query->cmd->payload);
   silc_command_set_ident(query->cmd->payload, ++server->cmd_ident);
@@ -336,6 +339,9 @@ void silc_server_query_send_router_reply(void *context, void *reply)
 
     SILC_LOG_DEBUG(("Sending error to original query"));
 
+    /* Statistics */
+    server->stat.commands_sent++;
+
     /* Send the same command reply payload which contains the error */
     silc_command_set_command(cmdr->payload, query->querycmd);
     silc_command_set_ident(cmdr->payload,
@@ -407,16 +413,18 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
       }
 
       /* Check nickname */
-      tmp = silc_identifier_check(query->nickname, strlen(query->nickname),
-                                 SILC_STRING_UTF8, 128, &tmp_len);
-      if (!tmp) {
-       silc_server_query_send_error(server, query,
-                                    SILC_STATUS_ERR_BAD_NICKNAME, 0);
-       silc_server_query_free(query);
-       return;
+      if (tmp) {
+       tmp = silc_identifier_check(query->nickname, strlen(query->nickname),
+                                   SILC_STRING_UTF8, 128, &tmp_len);
+       if (!tmp) {
+         silc_server_query_send_error(server, query,
+                                      SILC_STATUS_ERR_BAD_NICKNAME, 0);
+         silc_server_query_free(query);
+         return;
+       }
+       silc_free(query->nickname);
+       query->nickname = tmp;
       }
-      silc_free(query->nickname);
-      query->nickname = tmp;
 
     } else {
       /* Parse the IDs included in the query */
@@ -1100,6 +1108,9 @@ void silc_server_query_resolve(SilcServer server, SilcServerQuery query,
        r->argc++;
       }
 
+      /* Statistics */
+      server->stat.commands_sent++;
+
       /* Send WHOIS command */
       res_cmd = silc_command_payload_encode(SILC_COMMAND_WHOIS,
                                            r->argc, r->arg, r->arg_lens,
@@ -1968,6 +1979,9 @@ SilcClientEntry silc_server_query_client(SilcServer server,
       always_resolve) {
     SilcBuffer buffer, idp;
 
+    /* Statistics */
+    server->stat.commands_sent++;
+
     if (client) {
       client->data.status |= SILC_IDLIST_STATUS_RESOLVING;
       client->data.status &= ~SILC_IDLIST_STATUS_RESOLVED;
index 46cf87aa619cf6f9e4d5bb7a77d0b722dc1d1d7e..1f202168f5e55317be877f49083c5c4e1d1caa16 100644 (file)
@@ -1093,66 +1093,6 @@ bool silc_server_client_on_channel(SilcClientEntry client,
                              (void *)chl);
 }
 
-/* Checks string for bad characters and returns TRUE if they are found. */
-
-bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len)
-{
-  int i;
-
-  for (i = 0; i < name_len; i++) {
-    if (!isascii(name[i]))
-      return TRUE;
-    if (name[i] <= 32) return TRUE;
-    if (name[i] == ' ') return TRUE;
-    if (name[i] == '*') return TRUE;
-    if (name[i] == '?') return TRUE;
-    if (name[i] == ',') return TRUE;
-    if (name[i] == '@') return TRUE;
-    if (name[i] == '!') return TRUE;
-  }
-
-  return FALSE;
-}
-
-/* Same as silc_server_name_bad_chars but check for channel names. */
-
-bool silc_server_name_bad_chchars(const char *name, SilcUInt32 name_len)
-{
-  int i;
-
-  for (i = 0; i < name_len; i++) {
-    if (!isascii(name[i]))
-      return TRUE;
-    if (name[i] <= 32) return TRUE;
-    if (name[i] == ' ') return TRUE;
-    if (name[i] == '*') return TRUE;
-    if (name[i] == '?') return TRUE;
-    if (name[i] == ',') return TRUE;
-  }
-
-  return FALSE;
-}
-
-/* Modifies the `name' if it includes bad characters and returns new
-   allocated name that does not include bad characters. */
-
-char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len)
-{
-  int i;
-  char *newname = strdup(name);
-
-  for (i = 0; i < name_len; i++) {
-    if (!isascii(newname[i])) newname[i] = '_';
-    if (newname[i] <= 32) newname[i] = '_';
-    if (newname[i] == ' ') newname[i] = '_';
-    if (newname[i] == '*') newname[i] = '_';
-    if (newname[i] == '?') newname[i] = '_';
-    if (newname[i] == ',') newname[i] = '_';
-  }
-
-  return newname;
-}
-
 /* Find number of sockets by IP address indicated by `ip'. Returns 0 if
    socket connections with the IP address does not exist. */
 
index 62b3d60fef2527d0c76e14f23fa2d783345e83e9..1c9c5ee09a5291a1f6e2e8b72115a35bf7e6a294 100644 (file)
@@ -94,14 +94,6 @@ bool silc_server_client_on_channel(SilcClientEntry client,
                                   SilcChannelEntry channel,
                                   SilcChannelClientEntry *chl);
 
-/* Checks string for bad characters and returns TRUE if they are found. */
-bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len);
-bool silc_server_name_bad_chchars(const char *name, SilcUInt32 name_len);
-
-/* Modifies the `nick' if it includes bad characters and returns new
-   allocated nickname that does not include bad characters. */
-char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len);
-
 /* Find number of sockets by IP address indicated by `ip'. Returns 0 if
    socket connections with the IP address does not exist. */
 SilcUInt32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip,
index 0afc3f39d67f77aaaf67d490672dc8c5a26c27f1..545a39ffc91396eeba5d85e8cd2fbdffbbfc9432 100644 (file)
@@ -921,12 +921,6 @@ SILC_CONFIG_CALLBACK(fetch_admin)
       goto got_err;
     }
   }
-  else if (!strcmp(name, "publickeydir")) {
-    if (!my_parse_publickeydir((char *) val, (void *)&tmp->publickeys)) {
-      got_errno = SILC_CONFIG_EPRINTLINE;
-      goto got_err;
-    }
-  }
   else
     return SILC_CONFIG_EINTERNAL;
   return SILC_CONFIG_OK;
@@ -1286,7 +1280,6 @@ static const SilcConfigTable table_admin[] = {
   { "nick",            SILC_CONFIG_ARG_STRE,   fetch_admin,    NULL },
   { "passphrase",      SILC_CONFIG_ARG_STR,    fetch_admin,    NULL },
   { "publickey",       SILC_CONFIG_ARG_STR,    fetch_admin,    NULL },
-  { "publickeydir",    SILC_CONFIG_ARG_STR,    fetch_admin,    NULL },
   { "port",            SILC_CONFIG_ARG_INT,    fetch_admin,    NULL },
   { "params",          SILC_CONFIG_ARG_STR,    fetch_admin,    NULL },
   { 0, 0, 0, 0 }
index 86d75b553536e0c8aa2cfe215003ec570ac1bfd5..10222098a6d152a058fae57afb43ebda638211b4 100644 (file)
@@ -4,12 +4,11 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2003 Pekka Riikonen
+  Copyright (C) 1997 - 2005 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
+  the Free Software Foundation; version 2 of the License.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -302,6 +301,8 @@ SILC_TASK_CALLBACK(dump_stats)
   STAT_OUTPUT("  Authentication failures : %d", silcd->stat.auth_failures);
   STAT_OUTPUT("  Packets sent            : %d", silcd->stat.packets_sent);
   STAT_OUTPUT("  Packets received        : %d", silcd->stat.packets_received);
+  STAT_OUTPUT("  Commands sent           : %d", silcd->stat.commands_sent);
+  STAT_OUTPUT("  Commands received       : %d", silcd->stat.commands_received);
   STAT_OUTPUT("  Connections             : %d", silcd->stat.conn_num);
 
 #undef STAT_OUTPUT
@@ -398,7 +399,7 @@ SILC_TASK_CALLBACK(dump_stats)
                  (unsigned char *)"N/A", client_entry->id ?
                  silc_id_render(client_entry->id, SILC_ID_CLIENT) : "N/A",
                  client_entry->data.status, server_entry ?
-                 server_entry->server_name ? server_entry->server_name : 
+                 server_entry->server_name ? server_entry->server_name :
                  "N/A" : "local");
          if (!silc_idcache_list_next(list, &id_cache))
            break;
@@ -419,7 +420,7 @@ SILC_TASK_CALLBACK(dump_stats)
                  (unsigned char *)"N/A", client_entry->id ?
                  silc_id_render(client_entry->id, SILC_ID_CLIENT) : "N/A",
                  client_entry->data.status, server_entry ?
-                 server_entry->server_name ? server_entry->server_name : 
+                 server_entry->server_name ? server_entry->server_name :
                  "N/A" : "local");
          if (!silc_idcache_list_next(list, &id_cache))
            break;
index 410d19f23c4205d405c4eba874ac7a3c1693220e..b7affd6fd5e0548da9729d5ff96d46a9224554e7 100644 (file)
@@ -25,6 +25,7 @@ AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 
 AC_PROG_LN_S
+AC_PROG_EGREP
 AC_SUBST(LN_S)
 AC_PATH_PROG(sedpath, sed)
 
@@ -43,7 +44,9 @@ case "$target" in
     ;;
 esac
 
-CFLAGS=
+# Control compiler optimizations
+CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
+
 AC_PROG_CC
 AC_C_INLINE
 AC_C_CONST
@@ -287,6 +290,7 @@ if test "$GCC"; then
     SILC_ADD_CFLAGS(-g -O2)
   fi
   SILC_ADD_CFLAGS(-Wall -finline-functions)
+  SILC_ADD_CFLAGS(-Wno-pointer-sign)
 else
   # Other compilers
   case "$target" in
@@ -426,57 +430,6 @@ AC_SUBST(MODULESDIR)
 AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
 #endif SILC_DIST_SIM
 
-#ifdef SILC_DIST_SERVER
-# Logs directory
-#
-LOGSDIR="$silc_prefix/logs"
-AC_ARG_WITH(logsdir,
-  [[  --with-logsdir=DIR      directory for SILC Server logs [PREFIX/logs]]],
-  [
-    case "$withval" in
-      no|yes)
-        ;;
-      *)
-        LOGSDIR="$withval"
-        ;;
-    esac
-  ])
-AC_SUBST(LOGSDIR)
-AC_DEFINE_UNQUOTED([SILC_LOGSDIR], "$LOGSDIR", [SILC_LOGSDIR])
-
-# silcd config file checking
-#
-summary_silcd_configfile="/etc/silc/silcd.conf"
-AC_ARG_WITH(silcd-config-file,
-  [[  --with-silcd-config-file=FILE  use FILE as default configuration file
-                                 for SILC Server [/etc/silc/silcd.conf]]],
-    AC_DEFINE_UNQUOTED([SILC_SERVER_CONFIG_FILE], "$withval", [SILC_SERVER_CONFIG_FILE])
-    summary_silcd_configfile="$withval"
-  )
-
-# silcd pid file checking
-#
-if test "x$localstatedir" != 'x${prefix}/var'; then
-  PIDFILE="$localstatedir/silcd.pid"
-else
-  PIDFILE="$silc_prefix/var/silcd.pid"
-fi
-
-AC_ARG_WITH(silcd-pid-file,
-  [[  --with-silcd-pid-file=FILE     use FILE as default pid file for SILC
-                                 Server [/var/run/silcd.pid]]],
-  [
-    case "$withval" in
-      no|yes)
-        ;;
-      *)
-        PIDFILE="$withval"
-        ;;
-    esac
-  ])
-AC_SUBST(PIDFILE)
-#endif SILC_DIST_SERVER
-
 #ifdef SILC_DIST_COMPILER
 ##
 ##  With/without checkings
@@ -487,7 +440,6 @@ AC_SUBST(PIDFILE)
 compile_libs=true
 
 #ifndef SILC_DIST_TOOLKIT
-
 AC_ARG_WITH(silc-includes, 
   [  --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
   [ac_silc_includes="$withval"], [ac_silc_includes="no"])
@@ -495,25 +447,44 @@ AC_ARG_WITH(silc-libs,
   [  --with-silc-libs=DIR     SILC Toolkit libraries [search in DIR]],
   [ac_silc_libs="$withval"], [ac_silc_libs="no"])
 
-#
-# XXX missing checking the __SILC_WITH_XXX defines from the provided libs
-# in order to determine correct libs to link.
+if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
 
-#
-# XXX missing pkg-config check.
+  # Manually provided libs
+  if test "$ac_silc_includes" != "no"; then
+    compile_libs=false
+    SILC_LIB_INCLUDES="-I$ac_silc_includes"
+  fi
+  if test "$ac_silc_libs" != "no"; then
+    compile_libs=false
+    LIBS="$LIBS -L$ac_silc_libs"
+  fi
 
-if test "$ac_silc_includes" != "no"; then
-  compile_libs=false
-  SILC_LIB_INCLUDES="-I$ac_silc_includes"
-fi
-if test "$ac_silc_libs" != "no"; then
-  compile_libs=false
-  LIBS="$LIBS -L$ac_silc_libs"
-fi
+  # Check libs to link against
+  f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silcincludes.h`
+  if test -n "$f"; then
+    LIBS="$LIBS -lpthread"
+    check_threads=false
+    has_threads=true
+  fi
+  f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silcincludes.h`
+  if test -n "$f"; then
+    LIBS="$LIBS -ldl"
+  fi
 
+else
+  # pkg-config check
+  PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
+  PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
+
+  if test x$compile_libs = xfalse; then
+    LIBS="$LIBS $SILC_LIBS"
+    CFLAGS="$CFLAGS $SILC_CFLAGS"
+    LIBS="$LIBS $SILCCLIENT_LIBS"
+    CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
+  fi
+fi
 #endif SILC_DIST_TOOLKIT
 
-
 # SOCKS4 support checking
 #
 SAVE_LIBS="$LIBS"
@@ -865,7 +836,6 @@ fi
 
 # POSIX threads support
 #
-has_threads=false
 AC_MSG_CHECKING(whether to search for POSIX threads)
 AC_ARG_WITH(pthreads,
   [[  --with-pthreads[=DIR]   use POSIX threads [search in DIR/include and DIR/lib]]],
@@ -889,6 +859,7 @@ AC_ARG_WITH(pthreads,
   ])
 
 if test x$check_threads = xtrue; then
+  has_threads=false
   SAVE_LIBS="$LIBS"
   SAVE_CFLAGS="$CFLAGS"
   SAVE_LDFLAGS="$LDFLAGS"
@@ -1019,7 +990,6 @@ AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
 
 #ifdef SILC_DIST_TOOLKIT
-
 # --without-irssi
 #
 without_irssi=false
@@ -1047,7 +1017,6 @@ AC_ARG_WITH(silcd,
   [
     AC_MSG_RESULT(yes)
   ])
-
 #endif SILC_DIST_TOOLKIT
 
 #ifdef SILC_DIST_CLIENT
@@ -1080,6 +1049,9 @@ AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
 ##  Misc
 ##
 
+# Make enable-shared aware
+AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
+
 # Other configure scripts
 #
 
@@ -1158,19 +1130,6 @@ irssi/Makefile.defines_int
 fi
 #endif SILC_DIST_TOOLKIT
 
-#ifdef SILC_DIST_TOOLKIT
-if test x$without_silcd = xfalse ; then
-#endif SILC_DIST_TOOLKIT
-#ifdef SILC_DIST_SERVER
-  AC_CONFIG_FILES(
-silcd/Makefile
-doc/example_silcd.conf
-)
-#endif SILC_DIST_SERVER
-#ifdef SILC_DIST_TOOLKIT
-fi
-#endif SILC_DIST_TOOLKIT
-
 #ifdef SILC_DIST_TOOLKIT
 AC_CONFIG_FILES(
 silc/Makefile
@@ -1197,7 +1156,6 @@ echo "---------------------------"
 echo " Target host ...................: $target"
 echo " Compiler ......................: $CC"
 echo " CFLAGS ........................: $CFLAGS"
-echo " CPPFLAGS ......................: $CPPFLAGS"
 echo " LDFLAGS .......................: $LDFLAGS"
 echo " LIBS ..........................: $LIBS"
 echo ""
@@ -1221,10 +1179,6 @@ echo " include directory .............: $s_includedir"
 #endif SILC_DIST_INCLUDES
 echo ""
 
-#ifdef SILC_DIST_SERVER
-silcd="yes"
-#endif SILC_DIST_SERVER
-
 #ifdef SILC_DIST_TOOLKIT
 if test x$without_irssi = xtrue; then
   irssi="no"
index 0aa0831ffa373a3950e67879878fb72c9f81fc4e..450a4a075b75e171968b9fb4bd1e9249244aa73a 100644 (file)
@@ -11,8 +11,13 @@ define SILC_DIST_APPS
 include apps/autodist/INSTALL INSTALL
 include apps/autodist/AUTHORS AUTHORS
 include apps/autodist/README README
+include apps/autodist/TODO TODO
+include apps/autodist/CHANGES CHANGES
 exclude apps/autodist/INSTALL apps/autodist/AUTHORS apps/autodist/README
-exclude TODO README.* ltmain.sh
+exclude apps/autodist/TODO apps/autodist/CHANGES
+exclude README.* ltmain.sh
 
-noprocess apps/autodist/doc apps/autodist/tests
+noprocess apps/autodist/doc/* apps/autodist/tests/*
 
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
index 76ec28b164e3c07834723c4387cda522ba29d780..13f35fefcf47a67b51450cdcf1378a583754e621 100644 (file)
@@ -1,7 +1,11 @@
 name Client
 package silc-client
 bug-report silc-devel@lists.silcnet.org
+
 inherit common
 define SILC_DIST_CLIENT
 define SILC_DIST_CLIENTLIB
+
 pre-hook distdir/pre-run
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
index 39a2a5bf5b551e16359211a9ac05bed6ce8dc7b3..3fa00057ccecac8f6ebda94a53aea0eb921c7722 100644 (file)
@@ -7,4 +7,5 @@ define SILC_DIST_DOC
 define SILC_DIST_SIM
 define SILC_DIST_MPI
 define SILC_DIST_MATH
+define SILC_DIST_SFTP
 define SILC_DIST_COMPILER
diff --git a/distdir/post-dist b/distdir/post-dist
new file mode 100644 (file)
index 0000000..c026866
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+distribution=$1
+dist_version=$2
+package=$3
+distdir=$4
+
+if test -f $distdir.tar.gz; then
+  md5sum $distdir.tar.gz > $distdir.tar.gz.md5
+fi
+if test -f $distdir.tar.bz2; then
+  md5sum $distdir.tar.bz2 > $distdir.tar.bz2.md5
+fi
+
diff --git a/distdir/post-process-dist b/distdir/post-process-dist
new file mode 100644 (file)
index 0000000..f6e4f38
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+distribution=$1
+dist_version=$2
+package=$3
+distdir=$4
+
+# Remove all CVS directories, as some may be left when we put directories
+# in EXTRA_DIST or 'include' them in distribution.
+
+if test -d $distdir; then
+  rm -rf `find $distdir -name CVS`
+fi
index 15eaecc4467878a1586c7fb37c48271e76dc2bb5..97f82d34e955ca1e3a8674a994a36f4c22fe758a 100644 (file)
@@ -1,7 +1,10 @@
 name Server
 package silc-server
 bug-report silc-devel@lists.silcnet.org
-license distdir/BSD
-license-header distdir/GPL-header distdir/BSD-header
+
 inherit common
 define SILC_DIST_SERVER
+undef SILC_DIST_SFTP
+
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
index 180ab29a0d80620cfb8952c13f8a704bfc5922d8..de5af055a80a802e9e51450a4cc02cb313d71444 100644 (file)
@@ -1,13 +1,18 @@
 name Toolkit
 package silc-toolkit
 bug-report silc-devel@lists.silcnet.org
+
 inherit common
 inherit client
 inherit server
 define SILC_DIST_TOOLKIT
+
 include README.CVS
 include README.WIN32
 include README.MACOSX
 include silcer
 include tutorial
+
 pre-hook distdir/pre-run
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
index f6c1b5f3377c8d90c3a067c668e7874d0b1f6c33..85e313cdde1887192466bfb01c1a91c24951cc23 100644 (file)
@@ -74,7 +74,6 @@ dist-hook:
 
 #else !SILC_DIST_TOOLKIT
 dist-hook:
-       rm -rf `find $(top_distdir)/doc -name CVS`
        $(SILC_TOP_SRCDIR)/scripts/manpages.pl
        rm draft-riikonen*.txt
        touch draft-riikonen-silc-spec-08.txt
index 8e57209f31bc93dd0135729fa53c5cc1b71ff83b..23e8f340e8b10e4f80bc1c0677226d9854466a15 100644 (file)
@@ -295,9 +295,11 @@ extern "C" {
 #include "silcske_payload.h"
 #include "silcske_groups.h"
 
+#ifdef SILC_DIST_SFTP
 /* SILC SFTP library */
 #include "silcsftp.h"
 #include "silcsftp_fs.h"
+#endif /* SILC_DIST_SFTP */
 
 #ifdef __cplusplus
 }
index 5e12f56ba69bf304f692390b0e9535f5ce553026..c662a01b2e17cf696eaa124b0e85c3c54c533d48 100644 (file)
@@ -28,9 +28,11 @@ SILCLIB_DIRS = \
 #ifdef SILC_DIST_MATH
        silcmath \
 #endif SILC_DIST_MATH
+#ifdef SILC_DIST_SFTP
+       silcsftp \
+#endif SILC_DIST_SFTP
        silcske \
-       silcutil \
-       silcsftp
+       silcutil
 
 SILCLIB = libsilc.a
 
@@ -106,6 +108,6 @@ libsilcclient.a:
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = silc.pc silcclient.pc
 
-EXTRA_DIST = doc silc.pc.in silcclient.pc.in
+EXTRA_DIST = silc.pc.in silcclient.pc.in
 #endif SILC_DIST_TOOLKIT
 
index 9433d0b1a78a70673ac9a9ca1fd5730421581033..ff9e2a3c99acf4d1da9d4a8d7f7fd8112e01808e 100644 (file)
@@ -33,9 +33,11 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcmath"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcmath/mpi"
 #endif SILC_DIST_MPI
 #endif SILC_DIST_MATH
-SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcutil"
+SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
+#ifdef SILC_DIST_SFTP
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsftp"
+#endif SILC_DIST_SFTP
 #ifdef SILC_DIST_SIM
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsim"
 #endif SILC_DIST_SIM
@@ -49,7 +51,7 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
 # Do the releases and library versioning according to following rules:
 #
 #  - If any code has changed in library, increment [LIB]_REVISION
-#  - If functions were added, set [LIB]_REVISION to 0
+#  - If functions were added, removed or changed, set [LIB]_REVISION to 0
 #  - If functions were added, removed or changed, increment [LIB]_CURRENT
 #  - If functions were added, increment [LIB]_AGE
 #  - If functions were removed, set [LIB]_AGE to 0
@@ -66,14 +68,14 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
 LIB_BASE_VERSION=1.0
 
 # libsilc versions
-LIBSILC_CURRENT=4              # prev = 3
+LIBSILC_CURRENT=5              # prev = 4
 LIBSILC_REVISION=0             # prev = 0
-LIBSILC_AGE=3                  # prev = 2
+LIBSILC_AGE=3                  # prev = 3
 
 # libsilcclient versions
-LIBSILCCLIENT_CURRENT=3                # prev = 3
-LIBSILCCLIENT_REVISION=1       # prev = 0
-LIBSILCCLIENT_AGE=2            # prev = 2
+LIBSILCCLIENT_CURRENT=4                # prev = 4
+LIBSILCCLIENT_REVISION=0       # prev = 0
+LIBSILCCLIENT_AGE=3            # prev = 3
 
 # Substitute the version numbers
 AC_SUBST(LIB_BASE_VERSION)
@@ -84,9 +86,7 @@ AC_SUBST(LIBSILCCLIENT_CURRENT)
 AC_SUBST(LIBSILCCLIENT_REVISION)
 AC_SUBST(LIBSILCCLIENT_AGE)
 
-# Make enable-shared aware
-AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
-
+#ifdef SILC_DIST_TOOLKIT
 # Stack trace checking
 #
 AC_MSG_CHECKING(whether to enable stack tracing)
@@ -105,6 +105,7 @@ AC_ARG_ENABLE(stack-trace,
   ],
     AC_MSG_RESULT(no)
   )
+#endif SILC_DIST_TOOLKIT
 
 #
 # Makefile outputs
@@ -127,7 +128,9 @@ lib/silcutil/epoc/Makefile
 #ifdef SILC_DIST_MATH
 lib/silcmath/Makefile
 #endif SILC_DIST_MATH
+#ifdef SILC_DIST_SFTP
 lib/silcsftp/Makefile
+#endif SILC_DIST_SFTP
 #ifdef SILC_DIST_INPLACE
 lib/silcutil/tests/Makefile
 lib/silccrypt/tests/Makefile
index 3cdac009f1ca6d22258eef8a0da8cad6e53e553e..b12935e15116bd1f94dcde7c1eef655e183db990 100644 (file)
@@ -7,7 +7,7 @@
 <br />
 <small>
 Version: @VERSION@<br />
-Copyright &copy; 1997 - 2004 The SILC Project<br />
+Copyright &copy; 1997 - 2005 The SILC Project<br />
 Updated: @DATE@
 </small>
 <br /><br /><br />
index d4546038895c4c10d7c0c85f9b1d234e72f609e5..6119198166981a6afcf073c910356326384c4bcd 100644 (file)
@@ -254,11 +254,11 @@ silc_client_add_connection(SilcClient client,
   conn->remote_port = port;
   conn->context = context;
   conn->internal->client_cache =
-    silc_idcache_alloc(0, SILC_ID_CLIENT, NULL, FALSE, TRUE);
+    silc_idcache_alloc(0, SILC_ID_CLIENT, NULL, NULL, FALSE, TRUE);
   conn->internal->channel_cache = silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL,
-                                                    FALSE, TRUE);
+                                                    NULL, FALSE, TRUE);
   conn->internal->server_cache = silc_idcache_alloc(0, SILC_ID_SERVER, NULL,
-                                                   FALSE, TRUE);
+                                                   NULL, FALSE, TRUE);
   conn->internal->pending_commands = silc_dlist_init();
   conn->internal->ftp_sessions = silc_dlist_init();
 
index fc0821da6ee1268690ec88e29f023ca95909f932..eaf0a233818dc0158bb018fc94cc7182d83357cf 100644 (file)
@@ -218,10 +218,10 @@ bool silc_client_attribute_del(SilcClient client,
 
 /* Return all attributes */
 
-const SilcHashTable silc_client_attributes_get(SilcClient client,
-                                              SilcClientConnection conn)
+SilcHashTable silc_client_attributes_get(SilcClient client,
+                                        SilcClientConnection conn)
 {
-  return (const SilcHashTable)conn->internal->attrs;
+  return conn->internal->attrs;
 }
 
 /* Construct a Requested Attributes buffer. If the `attribute' is zero (0)
index a819389688367d837a29aa6e1aae473d964a72de..d68d6a6fa4479499814a70d0d8539ffe94c2daa6 100644 (file)
@@ -2800,8 +2800,8 @@ bool silc_client_attribute_del(SilcClient client,
  *    payload while traversing the table.
  *
  ***/
-const SilcHashTable silc_client_attributes_get(SilcClient client,
-                                              SilcClientConnection conn);
+SilcHashTable silc_client_attributes_get(SilcClient client,
+                                        SilcClientConnection conn);
 
 /****f* silcclient/SilcClientAPI/silc_client_attributes_request
  *
index da86f7437a5cc51409c6662ebd4c9772b6ec371b..62fb5af0a1b3a7694477d5fe3e1738874ea3b2c1 100644 (file)
@@ -67,6 +67,7 @@ struct SilcIDCacheStruct {
   SilcHashTable name_table;
   SilcHashTable context_table;
   SilcIDCacheDestructor destructor;
+  void *context;
   SilcIdType type;
   unsigned int delete_id : 1;
   unsigned int delete_name : 1;
@@ -102,6 +103,7 @@ struct SilcIDCacheListStruct {
 
 SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
                               SilcIDCacheDestructor destructor,
+                              void *destructor_context,
                               bool delete_id, bool delete_name)
 {
   SilcIDCache cache;
@@ -123,6 +125,7 @@ SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
   cache->context_table = silc_hash_table_alloc(count, silc_hash_ptr, NULL,
                                               NULL, NULL, NULL, NULL, TRUE);
   cache->destructor = destructor;
+  cache->context = destructor_context;
   cache->type = id_type;
   cache->delete_id = delete_id;
   cache->delete_name = delete_name;
@@ -344,7 +347,7 @@ static void silc_idcache_purge_foreach(void *key, void *context,
     if (ret == TRUE) {
       /* Call the destructor */
       if (cache->destructor)
-       cache->destructor(cache, c);
+       cache->destructor(cache, c, cache->context);
 
       /* Free the entry, it has been deleted from the hash tables */
       silc_idcache_destructor(NULL, c, NULL);
@@ -385,7 +388,7 @@ bool silc_idcache_purge_by_context(SilcIDCache cache, void *context)
   if (ret == TRUE) {
     /* Call the destructor */
     if (cache->destructor)
-      cache->destructor(cache, c);
+      cache->destructor(cache, c, cache->context);
 
     /* Free the entry, it has been deleted from the hash tables */
     silc_idcache_destructor(NULL, c, NULL);
index 69c5290f1bdb8a639d2a74c0f56f6b8a9bbca88a..b5612d391e9e3267b30b15add1fff8dd529a0919 100644 (file)
@@ -111,7 +111,8 @@ typedef struct SilcIDCacheListStruct *SilcIDCacheList;
  * SYNOPSIS
  *
  *    typedef void (*SilcIDCacheDestructor)(SilcIDCache cache,
- *                                          SilcIDCacheEntry entry);
+ *                                          SilcIDCacheEntry entry,
+ *                                          void *context);
  *
  * DESCRIPTION
  *
@@ -122,7 +123,8 @@ typedef struct SilcIDCacheListStruct *SilcIDCacheList;
  *
  ***/
 typedef void (*SilcIDCacheDestructor)(SilcIDCache cache,
-                                     SilcIDCacheEntry entry);
+                                     SilcIDCacheEntry entry,
+                                     void *context);
 
 #define SILC_ID_CACHE_EXPIRE 3600
 #define SILC_ID_CACHE_EXPIRE_DEF (time(NULL) + SILC_ID_CACHE_EXPIRE)
@@ -134,7 +136,9 @@ typedef void (*SilcIDCacheDestructor)(SilcIDCache cache,
  * SYNOPSIS
  *
  *    SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
- *                                   SilcIDCacheDestructor destructor);
+ *                                   SilcIDCacheDestructor destructor,
+ *                                   void *destructor_context,
+ *                                   bool delete_id, bool delete_name);
  *
  * DESCRIPTION
  *
@@ -150,6 +154,7 @@ typedef void (*SilcIDCacheDestructor)(SilcIDCache cache,
  ***/
 SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
                               SilcIDCacheDestructor destructor,
+                              void *destructor_context,
                               bool delete_id, bool delete_name);
 
 /****f* silccore/SilcIDCacheAPI/silc_idcache_free
index 2876ab560e7517066df950002c736092f11e755d..32ab2e8344812feeb2e809c1f8a77ffeb96a57da 100644 (file)
@@ -423,10 +423,10 @@ unsigned char *silc_message_get_iv(SilcMessagePayload payload)
 
 /* Return signature of the message */
 
-const SilcMessageSignedPayload
+SilcMessageSignedPayload
 silc_message_get_signature(SilcMessagePayload payload)
 {
-  return (const SilcMessageSignedPayload)payload->sig;
+  return payload->sig;
 }
 
 /******************************************************************************
index ff139decbd61af9d43be8b9e33cec22ea6f8721c..32e40c93498ce3f8582ad6fb4acc5142ff0dd16d 100644 (file)
@@ -343,7 +343,7 @@ unsigned char *silc_message_get_iv(SilcMessagePayload payload);
  *
  * SYNOPSIS
  *
- *    const SilcMessageSignedPayload
+ *    SilcMessageSignedPayload
  *    silc_message_get_signature(SilcMessagePayload payload);
  *
  * DESCRIPTION
@@ -354,10 +354,11 @@ unsigned char *silc_message_get_iv(SilcMessagePayload payload);
  *    could not be retrieved from the message.
  *
  *    The caller SHOULD verify the signature by calling the
- *    silc_message_signed_verify function.
+ *    silc_message_signed_verify function.  Caller must not free the
+ *    returned payload pointer.
  *
  ***/
-const SilcMessageSignedPayload
+SilcMessageSignedPayload
 silc_message_get_signature(SilcMessagePayload payload);
 
 /****f* silccore/SilcMessageAPI/silc_message_signed_payload_parse
index a79ee597549e91a21c7ae838b3cb6335a64e8202..415d591fd22691142a3d606bc02deff916ce7554 100644 (file)
@@ -1,10 +1,10 @@
 /*
 
-  silcapputil.c 
+  silcapputil.c
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2002 Pekka Riikonen
+  Copyright (C) 2002 - 2005 Pekka Riikonen
 
   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
@@ -25,7 +25,7 @@ static char *silc_create_pk_identifier(void)
   char *username = NULL, *realname = NULL;
   char *hostname, email[256];
   char *ident;
-  
+
   /* Get realname */
   realname = silc_get_real_name();
 
@@ -89,7 +89,7 @@ New pair of keys will be created.  Please, answer to following questions.\n\
        alg = silc_get_input("PKCS name (l to list names) [rsa]: ", FALSE);
        if (!alg)
          alg = strdup("rsa");
-    
+
        if (*alg == 'l' || *alg == 'L') {
          char *list = silc_pkcs_get_supported();
          printf("%s\n", list);
@@ -347,8 +347,8 @@ bool silc_show_public_key(const char *pub_filename)
     printf("Organization       : %s\n", ident->org);
   if (ident->country)
     printf("Country            : %s\n", ident->country);
-  printf("Fingerprint (SHA1) : %s\n", fingerprint); 
-  printf("Babbleprint (SHA1) : %s\n", babbleprint); 
+  printf("Fingerprint (SHA1) : %s\n", fingerprint);
+  printf("Babbleprint (SHA1) : %s\n", babbleprint);
 
   fflush(stdout);
 
index 28ddeed9aaccd9b5b698f078e97bd0565c23edc5..a263d059c7d808ec5ed275df3e8b454889bf0758 100644 (file)
@@ -44,7 +44,7 @@
 
 <table border="0" cellspacing="0" cellpadding="6" width="100%">
  <tr valign="top" bgcolor="#dddddd">
-  <td><small>Copyright &copy; 2001 - 2002 SILC Project<br />
+  <td><small>Copyright &copy; 2001 - 2005 SILC Project<br />
     <a href="http://silcnet.org">SILC Project Website</a></small></td>
   <td align="right"><small>
    <a href="index.html">SILC Toolkit Reference Manual</a><br />
@@ -122,7 +122,7 @@ if ($type == 0) {
 </table>
 <table border="0" cellspacing="0" cellpadding="6" width="100%">
  <tr valign="top" bgcolor="#dddddd">
-  <td><small>Copyright &copy; 2001 - 2002 SILC Project<br />
+  <td><small>Copyright &copy; 2001 - 2005 SILC Project<br />
     <a href="http://silcnet.org">SILC Project Website</a></small></td>
   <td align="right"><small>
    <a href="index.html">SILC Toolkit Reference Manual</a><br />
index 57bb940018db6a6450f29c73ab17856235d984f0..9f7bffcea37b942ee9d6c6fc55c8051752820af1 100755 (executable)
@@ -196,7 +196,7 @@ if [ "$TYPE" = "HTML" ]; then
 
   # Generate the top index.html file
   index=`find $SRC -name "LIBINDEX"`
-  version=`grep SILC_VERSION_STRING $SRC/../includes/version_internal.h |cut -d\"  -f2`
+  version=`grep "define SILC_VERSION_STRING" $SRC/../includes/silcversion.h |cut -d\"  -f2`
   curdate=`date`
   sed -e "/@VERSION@/s//$version/" -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html
   sh gen.sh $DST gen_index.php 2 $DST/index.html $DST/index.html
diff --git a/util/robodoc/Source/config.h b/util/robodoc/Source/config.h
deleted file mode 100644 (file)
index 6304664..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Source/config.h.  Generated automatically by configure.  */
-/* Source/config.h.in.  Generated automatically from configure.in by autoheader.  */
-
-/* Define to empty if the keyword does not work.  */
-/* #undef const */
-
-/* Define if you don't have vprintf but do have _doprnt.  */
-/* #undef HAVE_DOPRNT */
-
-/* Define if you have the strftime function.  */
-#define HAVE_STRFTIME 1
-
-/* Define if you have the vprintf function.  */
-#define HAVE_VPRINTF 1
-
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-/* #undef size_t */
-
-/* Define if you have the ANSI C header files.  */
-#define STDC_HEADERS 1
-
-/* Define if you have the strstr function.  */
-#define HAVE_STRSTR 1
-
-/* Name of package */
-#define PACKAGE "robodoc"
-
-/* Version number of package */
-#define VERSION "3.2.3"
-
index 6462608958e71b7d1aaa34723e9479c4a66b9e6c..e47325b028e83a12802335aecd0316736d053e11 100644 (file)
@@ -598,3 +598,5 @@ EXPORTS
        silc_stringprep @ 923;\r
        silc_identifier_check @ 924 ;\r
        silc_identifier_verify @ 925 ;\r
+       silc_channel_name_check @ 926 ;\r
+       silc_channel_name_verify @ 927 ;\r