code:
# The Saboteur's Cookbook

A guide to running Sabotage for the experienced Linux user.

### Butch, the build manager

`butch` is a collection of shell-scripts wrapping around a 700 LOC C
program written from scratch named `butch-core`.

It handles package downloads, checksums, builds and dependencies in a
relatively sane manner.

It supports the following commands:

	install [<package> ... ]  # build and install <packages>
	download [<package> ... ] # download tarballs required by <packages>
	rebuild [<package> ... ]  # rebuild already installed <packages>

	relink <package>          # create symlinks for an unlinked <package>
	unlink <package>          # remove symlinks to a specific <package>
	genfilelist <package>     # create filelist for <package>

	pack [--method] <package> # create a binary archive of <package>
	unpack <filename>         # install binary archive <filename> created with pack
	builddeps <package>       # build and install dependencies of package

	list                      # list installed packages
	files <package>           # show files installed by <package>
	mirrors <package>         # print mirrors for <package>
	owner <file>              # print which package owns a <file>
	users <package>           # print packages with <package> for dependency

	checksum <package>        # print checksums of files for a <package>
	checkdownloads            # verify all package download links
	checktarballs             # verify the downloaded package tarballs

	printsec <pkg> <section>  # print the specified <section> of <package>
	search <term>             # search for <term> in packages (grep syntax)

	dlinfo <url>              # download url, print initial butch recipe

	update                    # rebuild installed packages with new recipes

`butch` will start up to sixteen download threads and up to two build threads.

By default, `butch` uses the system's `wget`. To enable HTTPS support install
the `stage2` package, which adds `libressl` and `ca-certificates` to the system.
You may also use `curl` by exporting `USE_CURL=1`. For best results, download
all packages before the install process.

`butch` defaults to installing built packages into `/opt/$packagename`. Files
are then symlinked into a user-definable path, defaulting to `/`. Finally, the
package name and hash of its recipe are then written to `/var/lib/butch.db`.

The `/opt` path can be overridden by adding the variable `butch_staging_dir` to
the config file and setting it to the desired value. It must consist of a single
component, for example `/foo` `/app` or `/Packages`. The staging dir will
always be used inside the filesystem root specified in the used config.

`butch` may also be used for system configuration, eschewing the package
building features by simply calling `exit 0` at the conclusion of a package
recipe. This will avoid the above package installation procedure.

To completely remove a package:

	$ rm -rf /opt/$pkg
	$ butch unlink $pkg
	$ sed -i '/$pkg/d' /var/lib/butch.db # ... or edit by hand.

### /src, the heart of the system

`/src` is the default path where `butch` searches for and builds packages.

	/src
	/src/pkg        # package recipes, used by butch
	/src/KEEP       # patches and other files referenced from scripts
	/src/build      # package build directory. Safe to empty from time to time
	/src/filelists  # per-package file lists, referenced by `butch unlink`
	/src/logs       # per-package download and build logs
	/src/tarballs   # upstream package tarballs
	/src/utils      # sabotage utilities and helper scripts

`butch` requires `/src/pkg`,`/src/KEEP` and `/src/config`. It will fail to
start if they are missing. The rest of this directory is optional with caveats.

Erasing `/src/filelists` will break `butch unlink <package>` for existing
packages.

`find . -type f -or -type l > /src/filelists/$packagename.txt` from
the installation directory recovers the list.

Erasing `/src/utils` will lose scripts for cross-compilation, writing recipes,
managing chroots and other functionality. Each script contains brief
documentation explaining usage.

There is no issue erasing `/src/tarballs`, `/src/logs` or `/src/build` beyond
the obvious.

It is suggested to clone the upstream repo as `/src/sabotage`:

	$ git clone git://github.com/sabotage-linux/sabotage /src/sabotage
	$ rm -rf /src/KEEP /src/pkg
	$ ln -sf /src/sabotage/KEEP /src/KEEP
	$ ln -sf /src/sabotage/pkg /src/pkg

You can issue a `git pull` in `/src/sabotage` to update to the latest version of
recipes and utilities.

### Writing recipes

	[mirrors]
	[vars]
	[deps]
	[build]

`butch` recipes are plain text files that contain one or more labeled headers
and their associated data. The above four sections are central to an assortment
of different possible recipes. This section details their use.

	[mirrors]
	<url #1>
	...
	<url #n>

	[vars]
	filesize=<bytes>
	sha512=<sha 512 hash>
	tardir=<directory name the tar extracts to, if it differs from the tar name>
	tarball=<optionally specified, if needed>

`[mirrors]` and `[vars]` are optional, but must be included together as a set.
HTTP(S) is the only valid protocol for `[mirrors]`. `tardir` and `tarball` are
optional directives and are usually omitted.

The `[vars]` section is copied verbatim to the top of these generated scripts and
may contain shell code.

The `utils/dlinfo` script is useful in generating the above sections for you.

	[deps]
	<package #1>
	...
	<package #n>

	[deps.host]
	<package #1>
	...
	<package #n>

	[deps.run]
	<package #1>
	...
	<package #n>

Any combination of the above three headers may optionally be present.

`[deps]` is the standard list of dependencies required by the recipe.
`[deps.host]` are dependencies required on the host for cross-compilation.
`[deps.run]` are requirements to run the package on the target system.

	[build]
	<shell instructions to build application>

Shell instructions inside [build] will be performed by butch during
installation. Specifying `butch_do_relocate=false` inside `[build]` will
prevent the post-build linking of files. If the`[build]` phase calls `exit`,
`butch` will not perform any post-build activities at all.

These recipe elements combine with `KEEP/butch_download_template.txt` as a
`build/dl_package.sh` script. They also join
`KEEP/butch_template_configure_cached.txt` to form `build/build_package.sh`.

Metapackages containing only a `[mirrors]` & `[vars]`, `[deps]` or `[build]`
section are useful.

### Variables and Templates

Sabotage provides environment variables used for scripts and recipes, sourced
from `/src/config`. This section describes them in detail.

The `stage1` values are provided here, along with a brief description of the variable.

        SABOTAGE_BUILDDIR="/tmp/sabotage"

Defines where the `./build-stage0` script builds a chroot.

	A=x86_64

Selects an architecture to build for. 'i386', 'arm', 'mips' and 'powerpc' are
other options.

	CC=gcc
	HOSTCC=gcc

The C compiler used. `gcc` is currently the only compiler tested and supported.

	MAKE_THREADS=1

The number of threads to pass to make via the -j flag.

        BUTCH_BIN="/a/path/to/butch-core"

If not set, `./build-stage0` will download and build `butch`. On systems lacking a
proper libc, you may need to statically build `butch` yourself then specify it with
this variable.

	R=/               # `R` is the system root that butch will link packages into
	S=/src            # `S` is the source directory for `butch`
	K=/src/KEEP       # `K` is a directory of needed files and patches
	C=/src/tarballs   # `C` is the downloaded tarball cache
	LOGPATH=/src/logs # `LOGPATH` is where everything is logged

Internal paths, useful when writing scripts and recipes. You should leave these
all as-is, this is the intended way.

	BUTCH_BUILD_TEMPLATE="$K"/butch_template_configure_cached.txt

The build template. It creates packages in `$R/opt/$package_name` and
optionally supplies a `config.cache` file to speed up some from-source
compilation recipes. Review the template to see its configurable options.

	BUTCH_DOWNLOAD_TEMPLATE="$K"/butch_download_template.txt

The download template. It downloads, tests and unpacks tarballs.

        STAGE=1

Used during the bootstrap process by scripts to determine the current stage.
Leave this alone.

### Installing the system

See the wiki page "Bootstrap to HD Image" or `utils/write-hd-image`.

### Encrypted file systems

Install the `cryptsetup` package, then follow this guide to setup your partitions:

http://wiki.centos.org/HowTos/EncryptedFilesystem

Add appropriate entries in `/etc/crypttab` and `/etc/fstab`.
On startup, Sabotage's `rc.boot` will mount them.

## System Administration

Sabotage does things a bit differently than your usual Linux distribution!

### The file system

Sabotage does not follow the Filesystem Hierarchy Standard.

For legacy support, `/usr` is a symlink to `/` and `/sbin` is a symlink to
`/bin`.
Install software with `--prefix=/` when possible.
The times of a separate root partition are long over.

`/local` is provided to users, use it wisely.
 Software not packaged by Sabotage should not touch stuff outside of `/local`,
it could break on updates.

Use `/srv/$SERVICE/$VHOST` for all server data.

### The init system

Sabotage uses `runit` as init system, though we use Busybox init to start
`runsvdir`.
See: http://busybox.net/~vda/init_vs_runsv.html

The base system has a few services:

* dmesg - logs kernel messages
* sshd  - opensshd, down by default
* tty2, tty3, tty4 - three gettys
* crond - cron daemon

You will find these in `/var/service`, which are symlinks to `/etc/service`.

You can start services with `sv u $SERVICE` or take them down with
`sv d $SERVICE`.
By default, all services in `/var/service` start at boot time.
If they have an empty `down` file in their directory, you'll have to start them
manually.
If you don't want to use a service at all, best remove the symlink to
`/etc/service`.

Find out what's running with `sv s /var/service/*`.

Look into the service directories to find out how to add your own services.
Note that you must tell them not to daemonize!

For the rest of `runit`, refer to the documentation at:

	http://smarden.org/runit/index.html

### Logging

There is no syslog support, services should use `svlogd` to log into `/var/log`.

To use `svlogd` ensure your service script dumps the service's output to
stdout/stderr.

Examples: `/etc/service/crond/run` and `/etc/service/dmesg/run`

You can inspect the logs by looking at `/var/log/$SERVICE/current`.

For example, kernel messages are in `/var/log/dmesg/current`.

You can look at all logs with `sort /var/log/*/current |less`.

For more information, see `runit` docs.

### Transfering packages

Packages can be transfered and installed on another system than the one they
were built on. basically it's sufficient to copy the build host's directory
`/opt/packagename` to the target's `/opt`, (use cp -a to preserve symlinks) and
then call `butch relink packagename` on the target.
An entry should be added to `/var/lib/butch.db`, so butch knows that it's
already installed (the sha512sum can be copied from another package's entry).
The commands `butch pack packagename` and `butch unpack filename` automate this
task on the build and target host, respectively.

### Other advice

#### Start sshd

* Execute `sv u sshd`.

#### Linux console keyboard layout

* Execute `loadkeys`, then follow the instructions.

#### For X

* Edit `/etc/xinitrc`, or copy it to `~/.xinitrc` and edit that.
  There's a commented line suggesting how to change `setxkbmap` invocation.
* Uncomment and change the two-letter country code to your country.
* Edit `/bin/X` and enable QEMU or VirtualBox settings, if needed, otherwise
  your controls won't work!
* Execute `startx`.

#### Using a WLAN

* Install `wpa-supplicant`.
* Edit `/etc/wpa_supplicant.conf` for WiFi config.
* Edit `/etc/wpa_connect_action.sh` for IP address settings.
* Execute `sv u wpa_supplicant`.
* To keep the service up permanently, execute
  `rm /etc/service/wpa_supplicant/down`.

#### Getting a DHCP IP address

* Execute `dhclient eth0`.

#### Setting a static IP address

* Execute `ifconfig eth0 192.168.0.2 netmask 255.255.255.0`.
* Execute `route add default gw 192.168.0.1`.

You can put the above into a script which `/etc/rc.local` can execute at boot
time.

#### Wine

Wine builds on Sabotage i386.
To use it on x86_64, one needs to use packages built on i386 Sabotage.

For example, the following 32-bit packages are required to run simple Delphi
programs:

	wine
	musl
	alsa-lib #for sound support
	freetype
	libpng
	libsm
	libx11
	libxau
	libxcb
	libxext
	libxi
	libxrender
	ncurses
	zlib-dynamic

You can get them off `/opt` from a Sabotage i386 image or rootfs.
From `musl` we need `libc.so`.
We also need everything from the `wine` package and the `lib/.so` from all
other packages.
Make a directory to put the stuff, we use `/32bit` here.

	$ mkdir -p /32bit/lib
	$ mv musl-i386/lib/libc.so /32bit/lib
	$ ln -sf /32bit/lib/libc.so /lib/ld-musl-i386.so.1
	$ echo "/32bit/lib:/32bit/wine/lib" > /etc/ld-musl-i386.path
	$ cd /32bit
	$ tar xf wine.i386.tar.xz
	$ for p in `cat 32bit-packages.txt`; do tar xf "$p".i386.tar.xz; mv "$p"/lib/* lib/; rm -rf lib/pkgconfig; done
	$ rm lib/*.a

Now it should be possible to use `/32bit/wine/bin/wine` to execute Windows
programs.
Here`s a pre-made package that includes the work from the above steps:

	http://mirror.wzff.de/sabotage/bin/wine-i386-bundle.tar.xz

	sha512sum: 2475ac72f62a7d611ab1ca14a6a58428bd07339f81e384bf1bbbd0187b2467c371f79fee9d028149eebd3c6a80999e5676364d1bc8054022f89de8cc66169b84

You only need to create the `ld-musl-i386.so` symlink and the entry in
`/etc/ld-musl-i386.path`

#### Timezones

The `timezones` package installs timezone description files into
`/share/zoneinfo`.
`musl` supports timezones via the POSIX `TZ` environment variable.
You should set it in your `~/.profile` or in `/etc/profile`.
`glibc` also supports `/etc/localtime`, which is a copy or symlink of one of
the zoneinfo files.

Example values for `TZ`:

	# Reads `/share/zoneinfo/Europe/Berlin` the first time an app calls localtime().
	TZ=Europe/Berlin
	# Reads `/etc/localtime` the first time an app calls localtime().
	TZ=/etc/localtime
	# Will set the timezone to GMT+2. (POSIX reverses the meaning of +/-)
	TZ=GMT-2
	# Like Europe/Berlin, except it reads no file.
	# The string is the last "line" from the zoneinfo file.
	TZ="CET-1CEST,M3.5.0,M10.5.0/3"

#### hwclock and ntp

When `rc.boot` executes, the system clock is set to the hardware clock using
`hwclock -u -s`, where `-u` stands for UTC.
`hwclock -u -r` can read the actual hardware clock, adjusted to the users' `TZ`.
If you want to see the actual UTC clock value, set `TZ=UTC` and then
`hwclock -u -r`.

if your hardware clock is off, you can fix it by using
`ntpd -dnq -p pool.ntp.org` to get the actual time, then write it to BIOS using
`hwclock -u -w`.


code:
Section "Module"
    Load "exa"
    Load "wfb"

    Load "dri"
    Load "dri2"
    Load "glx"

    Load "int10"
    Load "vbe"
    Load "fb"
    Load "shadowfb"
    Load "shadow"
    Load "vgahw"
    Load "evdev"
    Load "fbdevhw"
EndSection

repo_name: aarf/bkauler

license: unknown


code:
--- 9base-6.org/bc/bc.y	2014-08-14 22:49:08.870556001 +0200
+++ 9base-6/bc/bc.y	2014-08-15 01:10:42.396569431 +0200
@@ -4,7 +4,6 @@
 	#include	<bio.h>

 	#define	bsp_max	5000
-
 	Biobuf	*in;
 	Biobuf	bstdin;
 	Biobuf	bstdout;
@@ -66,7 +65,7 @@
 	int	cflag;
 	int	sflag;

-	char*	bundle(int, ...);
+	char*	bundle(void*, int, ...);
 	void	conout(char*, char*);
 	int	cpeek(int, int, int);
 	int	getch(void);
@@ -74,9 +73,9 @@
 	char*	getf(char*);
 	void	getout(void);
 	void	output(char*);
-	void	pp(char*);
+	void	pp(void*, char*);
 	void	routput(char*);
-	void	tp(char*);
+	void	tp(void*, char*);
 	void	yyerror(char*, ...);
 	int	yyparse(void);

@@ -91,7 +90,7 @@
 }

 %type	<cptr>	pstat stat stat1 def slist dlets e ase nase
-%type	<cptr>	slist re fprefix cargs eora cons constant lora
+%type	<cptr>	re fprefix cargs eora cons constant lora
 %type	<cptr>	crs

 %token	<cptr>	LETTER EQOP _AUTO DOT
@@ -118,7 +117,7 @@
 	}
 |	def dargs ')' '{' dlist slist '}'
 	{
-		ttp = bundle(6, pre, $6, post , "0", numb[lev], "Q");
+		ttp = bundle(&yyval, 6, pre, $6, post , "0", numb[lev], "Q");
 		conout(ttp, (char*)$1);
 		rcrs = crs;
 		output("");
@@ -134,72 +133,72 @@
 |	nase
 	{
 		if(sflag)
-			bundle(2, $1, "s.");
+			bundle(&yyval, 2, $1, "s.");
 	}

 pstat:
 	stat1
 	{
 		if(sflag)
-			bundle(2, $1, "0");
+			bundle(&yyval, 2, $1, "0");
 	}
 |	nase
 	{
 		if(!sflag)
-			bundle(2, $1, "ps.");
+			bundle(&yyval, 2, $1, "ps.");
 	}

 stat1:
 	{
-		bundle(1, "");
+		bundle(&yyval, 1, "");
 	}
 |	ase
 	{
-		bundle(2, $1, "s.");
+		bundle(&yyval, 2, $1, "s.");
 	}
 |	SCALE '=' e
 	{
-		bundle(2, $3, "k");
+		bundle(&yyval, 2, $3, "k");
 	}
 |	SCALE EQOP e
 	{
-		bundle(4, "K", $3, $2, "k");
+		bundle(&yyval, 4, "K", $3, $2, "k");
 	}
 |	BASE '=' e
 	{
-		bundle(2, $3, "i");
+		bundle(&yyval, 2, $3, "i");
 	}
 |	BASE EQOP e
 	{
-		bundle(4, "I", $3, $2, "i");
+		bundle(&yyval, 4, "I", $3, $2, "i");
 	}
 |	OBASE '=' e
 	{
-		bundle(2, $3, "o");
+		bundle(&yyval, 2, $3, "o");
 	}
 |	OBASE EQOP e
 	{
-		bundle(4, "O", $3, $2, "o");
+		bundle(&yyval, 4, "O", $3, $2, "o");
 	}
 |	QSTR
 	{
-		bundle(3, "[", $1, "]P");
+		bundle(&yyval, 3, "[", $1, "]P");
 	}
 |	_BREAK
 	{
-		bundle(2, numb[lev-bstack[bindx-1]], "Q");
+		bundle(&yyval, 2, numb[lev-bstack[bindx-1]], "Q");
 	}
 |	_PRINT e
 	{
-		bundle(2, $2, "ps.");
+		bundle(&yyval, 2, $2, "ps.");
 	}
 |	_RETURN e
 	{
-		bundle(4, $2, post, numb[lev], "Q");
+		bundle(&yyval, 4, $2, post, numb[lev], "Q");
 	}
 |	_RETURN
 	{
-		bundle(4, "0", post, numb[lev], "Q");
+		bundle(&yyval, 4, "0", post, numb[lev], "Q");
 	}
 |	'{' slist '}'
 	{
@@ -207,28 +206,28 @@
 	}
 |	FFF
 	{
-		bundle(1, "fY");
+		bundle(&yyval, 1, "fY");
 	}
 |	_IF crs BLEV '(' re ')' stat
 	{
 		conout($7, $2);
-		bundle(3, $5, $2, " ");
+		bundle(&yyval, 3, $5, $2, " ");
 	}
 |	_WHILE crs '(' re ')' stat BLEV
 	{
-		bundle(3, $6, $4, $2);
+		bundle(&yyval, 3, $6, $4, $2);
 		conout($$, $2);
-		bundle(3, $4, $2, " ");
+		bundle(&yyval, 3, $4, $2, " ");
 	}
 |	fprefix crs re ';' e ')' stat BLEV
 	{
-		bundle(5, $7, $5, "s.", $3, $2);
+		bundle(&yyval, 5, $7, $5, "s.", $3, $2);
 		conout($$, $2);
-		bundle(5, $1, "s.", $3, $2, " ");
+		bundle(&yyval, 5, $1, "s.", $3, $2, " ");
 	}
 |	'~' LETTER '=' e
 	{
-		bundle(3, $4, "S", $2);
+		bundle(&yyval, 3, $4, "S", $2);
 	}

 fprefix:
@@ -238,7 +237,7 @@
 	}

 BLEV:
-	=
+	'='
 	{
 		--bindx;
 	}
@@ -247,7 +246,7 @@
 	stat
 |	slist tail stat
 	{
-		bundle(2, $1, $3);
+		bundle(&yyval, 2, $1, $3);
 	}

 tail:
@@ -260,31 +259,31 @@
 re:
 	e EQ e
 	{
-		$$ = bundle(3, $1, $3, "=");
+		$$ = bundle(&yyval, 3, $1, $3, "=");
 	}
 |	e '<' e
 	{
-		bundle(3, $1, $3, ">");
+		bundle(&yyval, 3, $1, $3, ">");
 	}
 |	e '>' e
 	{
-		bundle(3, $1, $3, "<");
+		bundle(&yyval, 3, $1, $3, "<");
 	}
 |	e NE e
 	{
-		bundle(3, $1, $3, "!=");
+		bundle(&yyval, 3, $1, $3, "!=");
 	}
 |	e GE e
 	{
-		bundle(3, $1, $3, "!>");
+		bundle(&yyval, 3, $1, $3, "!>");
 	}
 |	e LE e
 	{
-		bundle(3, $1, $3, "!<");
+		bundle(&yyval, 3, $1, $3, "!<");
 	}
 |	e
 	{
-		bundle(2, $1, " 0!=");
+		bundle(&yyval, 2, $1, " 0!=");
 	}

 nase:
@@ -294,19 +293,19 @@
 	}
 |	cons
 	{
-		bundle(3, " ", $1, " ");
+		bundle(&yyval, 3, " ", $1, " ");
 	}
 |	DOT cons
 	{
-		bundle(3, " .", $2, " ");
+		bundle(&yyval, 3, " .", $2, " ");
 	}
 |	cons DOT cons
 	{
-		bundle(5, " ", $1, ".", $3, " ");
+		bundle(&yyval, 5, " ", $1, ".", $3, " ");
 	}
 |	cons DOT
 	{
-		bundle(4, " ", $1, ".", " ");
+		bundle(&yyval, 4, " ", $1, ".", " ");
 	}
 |	DOT
 	{
@@ -314,176 +313,176 @@
 	}
 |	LETTER '[' e ']'
 	{
-		bundle(3, $3, ";", geta($1));
+		bundle(&yyval, 3, $3, ";", geta($1));
 	}
 |	LETTER INCR
 	{
-		bundle(4, "l", $1, "d1+s", $1);
+		bundle(&yyval, 4, "l", $1, "d1+s", $1);
 	}
 |	INCR LETTER
 	{
-		bundle(4, "l", $2, "1+ds", $2);
+		bundle(&yyval, 4, "l", $2, "1+ds", $2);
 	}
 |	DECR LETTER
 	{
-		bundle(4, "l", $2, "1-ds", $2);
+		bundle(&yyval, 4, "l", $2, "1-ds", $2);
 	}
 |	LETTER DECR
 	{
-		bundle(4, "l", $1, "d1-s", $1);
+		bundle(&yyval, 4, "l", $1, "d1-s", $1);
 	}
 |	LETTER '[' e ']' INCR
 	{
-		bundle(7, $3, ";", geta($1), "d1+" ,$3, ":" ,geta($1));
+		bundle(&yyval, 7, $3, ";", geta($1), "d1+" ,$3, ":" ,geta($1));
 	}
 |	INCR LETTER '[' e ']'
 	{
-		bundle(7, $4, ";", geta($2), "1+d", $4, ":", geta($2));
+		bundle(&yyval, 7, $4, ";", geta($2), "1+d", $4, ":", geta($2));
 	}
 |	LETTER '[' e ']' DECR
 	{
-		bundle(7, $3, ";", geta($1), "d1-", $3, ":", geta($1));
+		bundle(&yyval, 7, $3, ";", geta($1), "d1-", $3, ":", geta($1));
 	}
 |	DECR LETTER '[' e ']'
 	{
-		bundle(7, $4, ";", geta($2), "1-d", $4, ":" ,geta($2));
+		bundle(&yyval, 7, $4, ";", geta($2), "1-d", $4, ":" ,geta($2));
 	}
 |	SCALE INCR
 	{
-		bundle(1, "Kd1+k");
+		bundle(&yyval, 1, "Kd1+k");
 	}
 |	INCR SCALE
 	{
-		bundle(1, "K1+dk");
+		bundle(&yyval, 1, "K1+dk");
 	}
 |	SCALE DECR
 	{
-		bundle(1, "Kd1-k");
+		bundle(&yyval, 1, "Kd1-k");
 	}
 |	DECR SCALE
 	{
-		bundle(1, "K1-dk");
+		bundle(&yyval, 1, "K1-dk");
 	}
 |	BASE INCR
 	{
-		bundle(1, "Id1+i");
+		bundle(&yyval, 1, "Id1+i");
 	}
 |	INCR BASE
 	{
-		bundle(1, "I1+di");
+		bundle(&yyval, 1, "I1+di");
 	}
 |	BASE DECR
 	{
-		bundle(1, "Id1-i");
+		bundle(&yyval, 1, "Id1-i");
 	}
 |	DECR BASE
 	{
-		bundle(1, "I1-di");
+		bundle(&yyval, 1, "I1-di");
 	}
 |	OBASE INCR
 	{
-		bundle(1, "Od1+o");
+		bundle(&yyval, 1, "Od1+o");
 	}
 |	INCR OBASE
 	{
-		bundle(1, "O1+do");
+		bundle(&yyval, 1, "O1+do");
 	}
 |	OBASE DECR
 	{
-		bundle(1, "Od1-o");
+		bundle(&yyval, 1, "Od1-o");
 	}
 |	DECR OBASE
 	{
-		bundle(1, "O1-do");
+		bundle(&yyval, 1, "O1-do");
 	}
 |	LETTER '(' cargs ')'
 	{
-		bundle(4, $3, "l", getf($1), "x");
+		bundle(&yyval, 4, $3, "l", getf($1), "x");
 	}
 |	LETTER '(' ')'
 	{
-		bundle(3, "l", getf($1), "x");
+		bundle(&yyval, 3, "l", getf($1), "x");
 	}
-|	LETTER = {
-		bundle(2, "l", $1);
+|	LETTER '=' {
+		bundle(&yyval, 2, "l", $1);
 	}
 |	LENGTH '(' e ')'
 	{
-		bundle(2, $3, "Z");
+		bundle(&yyval, 2, $3, "Z");
 	}
 |	SCALE '(' e ')'
 	{
-		bundle(2, $3, "X");
+		bundle(&yyval, 2, $3, "X");
 	}
 |	'?'
 	{
-		bundle(1, "?");
+		bundle(&yyval, 1, "?");
 	}
 |	SQRT '(' e ')'
 	{
-		bundle(2, $3, "v");
+		bundle(&yyval, 2, $3, "v");
 	}
 |	'~' LETTER
 	{
-		bundle(2, "L", $2);
+		bundle(&yyval, 2, "L", $2);
 	}
 |	SCALE
 	{
-		bundle(1, "K");
+		bundle(&yyval, 1, "K");
 	}
 |	BASE
 	{
-		bundle(1, "I");
+		bundle(&yyval, 1, "I");
 	}
 |	OBASE
 	{
-		bundle(1, "O");
+		bundle(&yyval, 1, "O");
 	}
 |	'-' e
 	{
-		bundle(3, " 0", $2, "-");
+		bundle(&yyval, 3, " 0", $2, "-");
 	}
 |	e '+' e
 	{
-		bundle(3, $1, $3, "+");
+		bundle(&yyval, 3, $1, $3, "+");
 	}
 |	e '-' e
 	{
-		bundle(3, $1, $3, "-");
+		bundle(&yyval, 3, $1, $3, "-");
 	}
 |	e '*' e
 	{
-		bundle(3, $1, $3, "*");
+		bundle(&yyval, 3, $1, $3, "*");
 	}
 |	e '/' e
 	{
-		bundle(3, $1, $3, "/");
+		bundle(&yyval, 3, $1, $3, "/");
 	}
 |	e '%' e
 	{
-		bundle(3, $1, $3, "%%");
+		bundle(&yyval, 3, $1, $3, "%%");
 	}
 |	e '^' e
 	{
-		bundle(3, $1, $3, "^");
+		bundle(&yyval, 3, $1, $3, "^");
 	}

 ase:
 	LETTER '=' e
 	{
-		bundle(3, $3, "ds", $1);
+		bundle(&yyval, 3, $3, "ds", $1);
 	}
 |	LETTER '[' e ']' '=' e
 	{
-		bundle(5, $6, "d", $3, ":", geta($1));
+		bundle(&yyval, 5, $6, "d", $3, ":", geta($1));
 	}
 |	LETTER EQOP e
 	{
-		bundle(6, "l", $1, $3, $2, "ds", $1);
+		bundle(&yyval, 6, "l", $1, $3, $2, "ds", $1);
 	}
 |	LETTER '[' e ']' EQOP e
 	{
-		bundle(9, $3, ";", geta($1), $6, $5, "d", $3, ":", geta($1));
+		bundle(&yyval, 9, $3, ";", geta($1), $6, $5, "d", $3, ":", geta($1));
 	}

 e:
@@ -494,14 +493,14 @@
 	eora
 |	cargs ',' eora
 	{
-		bundle(2, $1, $3);
+		bundle(&yyval, 2, $1, $3);
 	}

 eora:
 	e
 |	LETTER '[' ']'
 	{
-		bundle(2, "l", geta($1));
+		bundle(&yyval, 2, "l", geta($1));
 	}

 cons:
@@ -527,7 +526,7 @@
 	}

 crs:
-	=
+	'='
 	{
 		$$ = cp;
 		*cp++ = '<';
@@ -557,21 +556,21 @@
 dargs:
 |	lora
 	{
-		pp((char*)$1);
+		pp(&yyval, (char*)$1);
 	}
 |	dargs ',' lora
 	{
-		pp((char*)$3);
+		pp(&yyval, (char*)$3);
 	}

 dlets:
 	lora
 	{
-		tp((char*)$1);
+		tp(&yyval, (char*)$1);
 	}
 |	dlets ',' lora
 	{
-		tp((char*)$3);
+		tp(&yyval, (char*)$3);
 	}

 lora:
@@ -809,10 +808,11 @@
 }

 char*
-bundle(int a, ...)
+bundle(void *vyyval, int a, ...)
 {
 	int i;
 	char **q;
+	YYSTYPE *yyval = vyyval;
 	va_list arg;

 	i = a;
@@ -827,7 +827,7 @@
 	}
 	*bsp_nxt++ = 0;
 	va_end(arg);
-	yyval.cptr = (char*)q;
+	yyval->cptr = (char*)q;
 	return (char*)q;
 }

@@ -883,23 +883,25 @@
 }

 void
-pp(char *s)
+pp(void* vyyval, char *s)
 {
+	YYSTYPE *yyval = vyyval;
 	/* puts the relevant stuff on pre and post for the letter s */
-	bundle(3, "S", s, pre);
-	pre = yyval.cptr;
-	bundle(4, post, "L", s, "s.");
-	post = yyval.cptr;
+	bundle(yyval, 3, "S", s, pre);
+	pre = yyval->cptr;
+	bundle(yyval, 4, post, "L", s, "s.");
+	post = yyval->cptr;
 }

 void
-tp(char *s)
+tp(void *vyyval, char *s)
 {
+	YYSTYPE *yyval = vyyval;
 	/* same as pp, but for temps */
-	bundle(3, "0S", s, pre);
-	pre = yyval.cptr;
-	bundle(4, post, "L", s, "s.");
-	post = yyval.cptr;
+	bundle(yyval, 3, "0S", s, pre);
+	pre = yyval->cptr;
+	bundle(yyval, 4, post, "L", s, "s.");
+	post = yyval->cptr;
 }

 void


code:
diff -Naur 9base-6/ed/ed.c 9base-6.new/ed/ed.c
--- 9base-6/ed/ed.c	2010-06-04 03:46:05.000000000 -0700
+++ 9base-6.new/ed/ed.c	2013-08-09 08:08:30.476590391 -0700
@@ -94,7 +94,7 @@
 int	getchr(void);
 int	getcopy(void);
 int	getfile(void);
-Rune*	getline(int);
+static Rune*	getline(int);
 int	getnum(void);
 int	getsub(void);
 int	gettty(void);
@@ -1005,7 +1005,7 @@
 	fchange = 1;
 }

-Rune*
+static Rune*
 getline(int tl)
 {
 	Rune *lp, *bp;


code:
#!/bin/sh
# hack, hack !

usefbdev=false

export DISPLAY=:0

if $usefbdev ; then

machine=qemu
#machine=vbox

if [ "$machine" = "qemu"  ]  ; then
  keyb=event1
  mouse=event2
else
  # settings for virtual box
  keyb=event2
  mouse=event3
fi

# for physical devices (non-emulator),
# take a look at "cat /proc/bus/input/devices" to get hints
# about the evdev ids. look for things like event1, event6, ...

exec Xfbdev -retro  :0 -keybd evdev,,device=/dev/input/$keyb \
  -mouse evdev,,device=/dev/input/$mouse

else
	exec Xorg -nolisten tcp
fi

path: KEEP/X


code:
--- abiword.orig/src/Makefile	2013-09-01 04:58:46.534849475 +0000
+++ abiword-2.8.2/src/Makefile	2013-09-01 06:24:03.026627153 +0000
@@ -500,7 +500,7 @@
 	$(WP_CPPFLAGS) \
 	-DABIWORD_DATADIR="\"$(ABIWORD_DATADIR)\""

-libabiword_2_8_la_LDFLAGS = $(DEPS_LIBS) --no-undefined -avoid-version \
+libabiword_2_8_la_LDFLAGS = $(DEPS_LIBS) -avoid-version \
 	-export-dynamic $(am__append_6)
 libabiword_2_8_la_LIBADD = $(opt_libs) plugins/libplugins.la \
 	text/fmt/xp/libxp.la text/ptbl/xp/libxp.la \
@@ -535,7 +535,6 @@

 #AbiWord_LDFLAGS = \
 #	$(DEPS_LIBS) \
-#	--no-undefined \
 #	-avoid-version \
 #	-export-dynamic \
 #	-headerpad_max_install_names
@@ -551,7 +550,6 @@

 abiword_LDFLAGS = \
 	$(platform_ldflags) \
-	--no-undefined      \
 	-avoid-version      \
 	-export-dynamic


code:
diff -up abiword-2.8.6/plugins/bmp/xp/ie_impGraphic_BMP.cpp.png15 abiword-2.8.6/plugins/bmp/xp/ie_impGraphic_BMP.cpp
--- abiword-2.8.6/plugins/bmp/xp/ie_impGraphic_BMP.cpp.png15	2012-02-27 15:39:39.258617605 -0500
+++ abiword-2.8.6/plugins/bmp/xp/ie_impGraphic_BMP.cpp	2012-02-27 15:48:37.830936901 -0500
@@ -191,7 +191,14 @@ UT_Error IE_ImpGraphic_BMP::_convertGrap

 	/* Clean Up Memory Used */

+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	int num_palette;
+	png_colorp palette;
+	png_get_PLTE(m_pPNG, m_pPNGInfo, &palette, &num_palette);
+	FREEP(palette);
+#else
 	FREEP(m_pPNGInfo->palette);
+#endif
 	DELETEP(pBB);
 	png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);

@@ -313,7 +320,11 @@ UT_Error IE_ImpGraphic_BMP::Initialize_P
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in the png_create_read_struct() earlier.
 	 */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		/* Free all of the memory associated with the png_ptr and info_ptr */
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
@@ -332,7 +343,11 @@ UT_Error IE_ImpGraphic_BMP::Initialize_P
 	UT_Error IE_ImpGraphic_BMP::Convert_BMP_Pallet(UT_ByteBuf* pBB)
 	{
 		/* Reset error handling for libpng */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+		if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 		if (setjmp(m_pPNG->jmpbuf))
+#endif
 		{
 			png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
 			return UT_ERROR;
@@ -372,7 +387,11 @@ UT_Error IE_ImpGraphic_BMP::Initialize_P
 UT_Error IE_ImpGraphic_BMP::Convert_BMP(UT_ByteBuf* pBB)
 {
 	/* Reset error handling for libpng */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+        if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
 		return UT_ERROR;
diff -up abiword-2.8.6/plugins/garble/xp/abiword-garble-png.cpp.png15 abiword-2.8.6/plugins/garble/xp/abiword-garble-png.cpp
--- abiword-2.8.6/plugins/garble/xp/abiword-garble-png.cpp.png15	2012-02-27 15:31:30.178868169 -0500
+++ abiword-2.8.6/plugins/garble/xp/abiword-garble-png.cpp	2012-02-27 15:36:17.795368497 -0500
@@ -79,7 +79,11 @@ bool abiword_document::garble_png( void*
 		png_set_strip_alpha( png_ptr );
 		png_set_interlace_handling( png_ptr );
 		png_set_bgr( png_ptr );
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+		rowbytes = png_get_rowbytes( png_ptr, info_ptr );
+#else
 		rowbytes = info_ptr->rowbytes;
+#endif
 		png_destroy_read_struct( &png_ptr, &info_ptr, NULL );
 	}

diff -up abiword-2.8.6/src/af/util/xp/ut_png.cpp.png15 abiword-2.8.6/src/af/util/xp/ut_png.cpp
--- abiword-2.8.6/src/af/util/xp/ut_png.cpp.png15	2012-02-27 15:11:18.599397989 -0500
+++ abiword-2.8.6/src/af/util/xp/ut_png.cpp	2012-02-27 15:12:20.560859433 -0500
@@ -71,7 +71,11 @@ bool UT_PNG_getDimensions(const UT_ByteB
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in the png_create_read_struct() earlier.
 	 */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(png_ptr)))
+#else
 	if (setjmp(png_ptr->jmpbuf))
+#endif
 	{
 		/* Free all of the memory associated with the png_ptr and info_ptr */
 		png_destroy_read_struct(&png_ptr, &info_ptr, static_cast<png_infopp>(NULL));
diff -up abiword-2.8.6/src/wp/impexp/gtk/ie_impGraphic_GdkPixbuf.cpp.png15 abiword-2.8.6/src/wp/impexp/gtk/ie_impGraphic_GdkPixbuf.cpp
--- abiword-2.8.6/src/wp/impexp/gtk/ie_impGraphic_GdkPixbuf.cpp.png15	2012-02-27 15:24:23.959572417 -0500
+++ abiword-2.8.6/src/wp/impexp/gtk/ie_impGraphic_GdkPixbuf.cpp	2012-02-27 15:26:42.549367943 -0500
@@ -185,7 +185,11 @@ UT_Error IE_ImpGraphic_GdkPixbuf::import
 /** needed for the stejmp context */
 UT_Error IE_ImpGraphic_GdkPixbuf::_png_write(GdkPixbuf * pixbuf)
 {
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		DELETEP(m_pPngBB);
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
@@ -446,7 +450,11 @@ UT_Error IE_ImpGraphic_GdkPixbuf::Initia
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in the png_create_read_struct() earlier.
 	 */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		/* Free all of the memory associated with the png_ptr and info_ptr */
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);


code:
--- Makefile.org
+++ Makefile
@@ -24,8 +24,8 @@

 PROGS       = afl-gcc afl-as afl-fuzz afl-showmap afl-tmin afl-gotcpu

-CFLAGS     ?= -O3 -funroll-loops
-CFLAGS     += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \
+CFLAGS     = $(USER_CFLAGS)
+CFLAGS     += -Wall -Wno-pointer-sign \
 	      -DAFL_PATH=\"$(HELPER_PATH)\" -DDOC_PATH=\"$(DOC_PATH)\" \
 	      -DBIN_PATH=\"$(BIN_PATH)\" -DVERSION=\"$(VERSION)\"


code:
--- aiksaurus-1.2.1/base/aiksaurus.t.cpp
+++ aiksaurus-1.2.1/base/aiksaurus.t.cpp
@@ -24,6 +24,7 @@
 #include "config.h"
 #include <iostream>
 #include <string>
+#include <cstdlib>
 using namespace std;
 using AiksaurusImpl::AsciiCompare;

--- aiksaurus-1.2.1/gtk/src/Display.cpp
+++ aiksaurus-1.2.1/gtk/src/Display.cpp
@@ -22,6 +22,7 @@
 #include "Meaning.h"
 #include "DialogMediator.h"
 #include "Exception.h"
+#include <cstring>
 using namespace std;

 namespace AiksaurusGTK_impl
--- aiksaurus-1.2.1/gtk/src/gtkAiksaur.t.cpp
+++ aiksaurus-1.2.1/gtk/src/gtkAiksaur.t.cpp
@@ -23,6 +23,7 @@
 #include <gtk/gtk.h>
 #include <iostream>
 #include <string>
+#include <cstdlib>
 using namespace std;

 int main(int argc, char** argv)


code:
#!/bin/sh

# fill in values taken from iwlist scan
channel=11
ownmac=00:ba:db:01:00:00
ap_mac=00:ca:fe:00:00:00
essid=victim
wlanif=wlan0
# monitor interface assigned by airmon-ng(mon0)/airmon-zc(wlan0mon)
monitor=${wlanif}mon

# you can override the above values by putting them into ./aircrack-vars.sh
[ -e ./aircrack-vars.sh ] && . ./aircrack-vars.sh

[ x$1 = x ] && {
	echo "usage: $0 [mon|monz|test|dump|assoc|arp(r)|crack(k)|deauth|stopmon|stopmonz|powerup]"
	echo "run each of the commands in the above order"
	echo "and all of them except the first 2 in an own term"
	echo "deauth requires as additional parameter the mac of the client"
	echo "monz/stopmonz use the new airmon-zc tool which works better with"
	echo "recent kernels, but it uses wlan0mon instead of mon0 as dev name"
	echo "powerup boosts the txpower to 30 mw which can be handy but may be illegal"
	exit 1
}

[ x$1 = xpowerup ] && {
	[ -z "$2" ] && {
	echo "powerup requires a wlan interface name as second param"
	echo "note that boosting your power to 30mw may be illegal, consult your lawyer"
	exit 1
	}
	# set regulatory domain to BOLIVIA and boost txpower to max
	# http://null-byte.wonderhowto.com/how-to/hack-wi-fi-creating-evil-twin-wireless-access-point-eavesdrop-data-0147919/
	iw reg set BO && iwconfig $2 txpower 30 && \
	echo "successfully set tx power of $2 to 30mw" && exit 0
	exit 1
}

[ x$ap_mac = x00:ca:fe:00:00:00 ] && {
	echo "error: you need to create a local config file, see $0 source:" >&2
	head -n 12 "$0" | tail -n 10
	exit 1
}

[ x$1 = xmon ] && airmon-ng start $wlanif $channel
[ x$1 = xmonz ] && airmon-zc start $wlanif $channel

# all of the below commands require that monitor device was set up with "mon"

# test injection
[ x$1 = xtest ] && aireplay-ng -9 -a $ap_mac -e "$essid" $monitor

# capture traffic - you need to capture at least 20-40K IVs
[ x$1 = xdump ] && airodump-ng -c $channel --bssid $ap_mac -w output $monitor

# associate with ap - you eventually want to call this in a loop with sleep 60
[ x$1 = xassoc ] && aireplay-ng -1 0 -a $ap_mac -e "$essid" -h $ownmac $monitor

# arp attack
[ x$1 = xarp ] && aireplay-ng -3 -b $ap_mac -h $ownmac $monitor

# if you already captured an arp packet in a previous run
if [ x$1 = xarpr ] ; then
	repl=
	for i in replay_arp*.cap ; do
		if [ -e "$i" ] && [ $(wc -c "$i" | cut -d " " -f 1) -gt 64 ] ; then
			repl="$i"
			break
		fi
	done
	[ -n "$repl" ] && aireplay-ng -3 -b $ap_mac -h $ownmac -r "$repl" $monitor
	[ -z "$repl" ] && echo "no sufficient capture file found"
fi

[ x$1 = xcrack ] && aircrack-ng -b $ap_mac output*.cap

# alternate crack method - doesn't stop when out of IVs but apparently
# requires a lot more of them
[ x$1 = xcrackk ] && aircrack-ng -K -b $ap_mac output*.cap

# deauth a connected client to force a wpa-handshake to be established
if [ x$1 = xdeauth ] ; then
	if [ x$2 = x ] ; then
		echo "need client mac address!" >&2
		exit 1
	fi
	aireplay-ng -0 1 -a $ap_mac -c $2 $monitor
fi

[ x$1 = xstopmon ] && airmon-ng stop $monitor
[ x$1 = xstopmonz ] && airmon-zc stop $monitor

path: KEEP/aircrack-ng-frontend


code:
--- alsa-lib-1.0.25/src/pcm/mask_inline.h
+++ alsa-lib-1.0.25.patched/src/pcm/mask_inline.h
@@ -20,6 +20,7 @@
  */

 #include <sys/types.h>
+#include <strings.h>

 #define MASK_INLINE static inline


code:
--- alsa-utils-1.0.25/alsamixer/mixer_widget.c
+++ alsa-utils-1.0.25.patched/alsamixer/mixer_widget.c
@@ -18,6 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */

+#include <strings.h>
 #include "aconfig.h"
 #include <stdlib.h>
 #include <string.h>


code:
--- a/modules/ssl/ssl_engine_init.c.orig	2014-07-15 18:48:00.382044224 +0200
+++ b/modules/ssl/ssl_engine_init.c	2014-07-15 18:48:35.452335112 +0200
@@ -275,9 +275,11 @@ apr_status_t ssl_init_Engine(server_rec
             return ssl_die(s);
         }

+#ifdef ENGINE_CTRL_CHIL_SET_FORKCHECK
         if (strEQ(mc->szCryptoDevice, "chil")) {
             ENGINE_ctrl(e, ENGINE_CTRL_CHIL_SET_FORKCHECK, 1, 0, 0);
         }
+#endif

         if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
             ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01889)
--- a/modules/ssl/ssl_engine_rand.c.orig	2014-07-15 18:49:13.853653603 +0200
+++ b/modules/ssl/ssl_engine_rand.c	2014-07-15 18:49:49.180946663 +0200
@@ -86,9 +86,11 @@ int ssl_rand_seed(server_rec *s, apr_poo
                  * seed in contents provided by the external
                  * Entropy Gathering Daemon (EGD)
                  */
+#ifdef HAVE_SSL_RAND_EGD
                 if ((n = RAND_egd(pRandSeed->cpPath)) == -1)
                     continue;
                 nDone += n;
+#endif
             }
             else if (pRandSeed->nSrc == SSL_RSSRC_BUILTIN) {
                 struct {
diff -ru httpd-2.4.10.org/modules/ssl/ssl_engine_init.c httpd-2.4.10/modules/ssl/ssl_engine_init.c
--- httpd-2.4.10.org/modules/ssl/ssl_engine_init.c	2014-10-20 16:22:09.583948111 +0000
+++ httpd-2.4.10/modules/ssl/ssl_engine_init.c	2014-10-20 16:25:36.763958655 +0000
@@ -830,7 +830,7 @@
         }
     }

-    n = SSL_CTX_use_certificate_chain(mctx->ssl_ctx,
+    n = _SSL_CTX_use_certificate_chain(mctx->ssl_ctx,
                                       (char *)chain,
                                       skip_first, NULL);
     if (n < 0) {
@@ -977,7 +977,7 @@
                 return APR_EGENERAL;
             }
         } else {
-            if ((SSL_CTX_use_certificate_chain_file(mctx->ssl_ctx,
+            if ((_SSL_CTX_use_certificate_chain_file(mctx->ssl_ctx,
                                                     certfile) < 1)) {
                 ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(02562)
                              "Failed to configure certificate %s (with chain),"
diff -ru httpd-2.4.10.org/modules/ssl/ssl_util_ssl.c httpd-2.4.10/modules/ssl/ssl_util_ssl.c
--- httpd-2.4.10.org/modules/ssl/ssl_util_ssl.c	2014-10-20 16:22:09.583948111 +0000
+++ httpd-2.4.10/modules/ssl/ssl_util_ssl.c	2014-10-20 16:25:36.782958656 +0000
@@ -460,7 +460,7 @@
  * format, possibly followed by a sequence of CA certificates that
  * should be sent to the peer in the SSL Certificate message.
  */
-int SSL_CTX_use_certificate_chain(
+int _SSL_CTX_use_certificate_chain(
     SSL_CTX *ctx, char *file, int skipfirst, pem_password_cb *cb)
 {
     BIO *bio;
diff -ru httpd-2.4.10.org/modules/ssl/ssl_util_ssl.h httpd-2.4.10/modules/ssl/ssl_util_ssl.h
--- httpd-2.4.10.org/modules/ssl/ssl_util_ssl.h	2014-10-20 16:22:09.582948111 +0000
+++ httpd-2.4.10/modules/ssl/ssl_util_ssl.h	2014-10-20 16:25:36.782958656 +0000
@@ -69,7 +69,7 @@
 BOOL        SSL_X509_match_name(apr_pool_t *, X509 *, const char *, BOOL, server_rec *);
 BOOL        SSL_X509_INFO_load_file(apr_pool_t *, STACK_OF(X509_INFO) *, const char *);
 BOOL        SSL_X509_INFO_load_path(apr_pool_t *, STACK_OF(X509_INFO) *, const char *);
-int         SSL_CTX_use_certificate_chain(SSL_CTX *, char *, int, pem_password_cb *);
+int         _SSL_CTX_use_certificate_chain(SSL_CTX *, char *, int, pem_password_cb *);
 char       *SSL_SESSION_id2sz(unsigned char *, int, char *, int);

 #endif /* __SSL_UTIL_SSL_H__ */


code:
--- aria2-1.19.0.org/src/SocketCore.cc
+++ aria2-1.19.0/src/SocketCore.cc
@@ -33,6 +33,7 @@
  */
 /* copyright --> */
 #include "SocketCore.h"
+#include "LogFactory.h"

 #ifdef HAVE_IPHLPAPI_H
 # include <iphlpapi.h>
@@ -630,7 +631,7 @@
 #ifndef __MINGW32__
 # define CHECK_FD(fd)                                                   \
   if(fd < 0 || FD_SETSIZE <= fd) {                                      \
-    logger_->warn("Detected file descriptor >= FD_SETSIZE or < 0. "     \
+    A2_LOG_WARN("Detected file descriptor >= FD_SETSIZE or < 0. "     \
                   "Download may slow down or fail.");                   \
     return false;                                                       \
   }


code:
--- arp-scan-1.9.org/arp-scan.c
+++ arp-scan-1.9/arp-scan.c
@@ -482,7 +482,7 @@
 /*
  *      Display initial message.
  */
-   printf("Starting %s with %u hosts (http://www.nta-monitor.com/tools/arp-scan/)\n",
+   printf("Starting %s with %u hosts\n",
           PACKAGE_STRING, num_hosts);
 /*
  *      Display the lists if verbose setting is 3 or more.
@@ -604,8 +604,8 @@
    elapsed_seconds = (elapsed_time.tv_sec*1000 +
                       elapsed_time.tv_usec/1000) / 1000.0;

-   printf("Ending %s: %u hosts scanned in %.3f seconds (%.2f hosts/sec). %u responded\n",
-          PACKAGE_STRING, num_hosts, elapsed_seconds,
+   printf("%u hosts scanned in %.3f seconds (%.2f hosts/sec). %u responded.\n",
+          num_hosts, elapsed_seconds,
           num_hosts/elapsed_seconds, responders);
    if (debug) {print_times(); printf("main: End\n");}
    return 0;


code:
--- attr-2.4.47.org/include/xattr.h
+++ attr-2.4.47/include/xattr.h
@@ -30,8 +30,13 @@
 #define XATTR_CREATE  0x1       /* set value, fail if attr already exists */
 #define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */

+#ifndef __THROW
+#define __THROW
+#endif

-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif

 extern int setxattr (const char *__path, const char *__name,
 		      const void *__value, size_t __size, int __flags) __THROW;
@@ -58,6 +63,8 @@
 extern int lremovexattr (const char *__path, const char *__name) __THROW;
 extern int fremovexattr (int __filedes,   const char *__name) __THROW;

-__END_DECLS
+#ifdef __cplusplus
+}
+#endif

 #endif	/* __XATTR_H__ */


code:
--- audacity-src-2.0.2.org/lib-src/FileDialog/gtk/FileDialogPrivate.cpp	2013-01-02 20:38:15.152000003 +0000
+++ audacity-src-2.0.2/lib-src/FileDialog/gtk/FileDialogPrivate.cpp	2013-01-07 20:09:45.727000002 +0000
@@ -219,7 +219,7 @@
                                              gtk_action,
                                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                              ok_btn_stock, GTK_RESPONSE_ACCEPT,
-                                             NULL);
+                                             (void *) 0);

       // Allow pressing "Enter" key for default action
       gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);


code:
--- audacity-src-2.0.2.org/src/TrackPanel.cpp	2013-01-02 20:38:15.235000003 +0000
+++ audacity-src-2.0.2/src/TrackPanel.cpp	2013-01-07 22:04:02.421000002 +0000
@@ -7295,7 +7295,7 @@
       wxArrayString rates;
       wxComboBox *cb;

-      rate.Printf(wxT("%d"), lrint(((WaveTrack *) mPopupMenuTarget)->GetRate()));
+      rate.Printf(wxT("%ld"), lrint(((WaveTrack *) mPopupMenuTarget)->GetRate()));

       rates.Add(wxT("8000"));
       rates.Add(wxT("11025"));
@@ -7547,7 +7547,7 @@
          /* i18n-hint: (noun) The size of the typeface*/
          S.AddPrompt(_("Face size"));
          sc = new wxSpinCtrl(&dlg, wxID_ANY,
-                             wxString::Format(wxT("%d"), fontsize),
+                             wxString::Format(wxT("%ld"), (long) fontsize),
                              wxDefaultPosition,
                              wxDefaultSize,
                              wxSP_ARROW_KEYS,
--- audacity-src-2.0.2.org/src/commands/Validators.h	2013-01-02 20:38:15.222000003 +0000
+++ audacity-src-2.0.2/src/commands/Validators.h	2013-01-07 22:00:15.952000004 +0000
@@ -201,7 +201,7 @@
    }
    virtual wxString GetDescription() const
    {
-      return wxString::Format(wxT("between %d and %d"), mLower, mUpper);
+      return wxString::Format(wxT("between %f and %f"), mLower, mUpper);
    }
    virtual Validator *GetClone() const
    {
--- audacity-src-2.0.2.org/lib-src/libnyquist/nyquist/xlisp/xlisp.h	2013-01-02 20:38:15.166000003 +0000
+++ audacity-src-2.0.2/lib-src/libnyquist/nyquist/xlisp/xlisp.h	2013-01-07 22:10:13.035000003 +0000
@@ -190,7 +190,7 @@
 #define LOCAL		static
 #endif
 #ifndef AFMT
-#define AFMT		"%x"
+#define AFMT		"%lx"
 #endif
 #ifndef FIXTYPE
 #define FIXTYPE		long
--- audacity-src-2.0.2.org/lib-src/libnyquist/nyquist/nyqsrc/add.c	2013-01-02 20:38:15.177000003 +0000
+++ audacity-src-2.0.2/lib-src/libnyquist/nyquist/nyqsrc/add.c	2013-01-07 22:13:07.764000002 +0000
@@ -126,7 +126,7 @@
          * if a sound has terminated)
          */
 A	nyquist_printf(
- "add[%p,%p] (s1_s2_nn) %p: logically_stopped %d, logical_stop_cnt %d, s1 logical_stop_cnt %d, s2 logical_stop_cnt %d \n",
+ "add[%p,%p] (s1_s2_nn) %p: logically_stopped %d, logical_stop_cnt %d, s1 logical_stop_cnt %ld, s2 logical_stop_cnt %ld \n",
                susp->s1, susp->s2, susp, susp->logically_stopped,
                (int) susp->susp.log_stop_cnt,
                susp->s1->logical_stop_cnt,
--- audacity-src-2.0.2.org/src/Sequence.cpp	2013-01-02 20:38:15.231000003 +0000
+++ audacity-src-2.0.2/src/Sequence.cpp	2013-01-07 22:30:14.574000004 +0000
@@ -1099,7 +1099,7 @@

    if (result != len)
    {
-      wxLogWarning(wxT("Expected to read %d samples, got %d samples."), len, result);
+      wxLogWarning(wxT("Expected to read %ld samples, got %ld samples."), (long) len, (long) result);
       if (result < 0)
          result = 0;
       ClearSamples(buffer, format, result, len-result);
@@ -1826,11 +1826,11 @@
    for (i = 0; i < mBlock->GetCount(); i++) {
       SeqBlock* pSeqBlock = mBlock->Item(i);
       *dest += wxString::Format
-         (wxT("   Block %3d: start %8d, len %8d, refs %d, "),
+         (wxT("   Block %3d: start %8ld, len %8ld, refs %ld, "),
           i,
-          pSeqBlock->start,
-          pSeqBlock->f ? pSeqBlock->f->GetLength() : 0,
-          pSeqBlock->f ? mDirManager->GetRefCount(pSeqBlock->f) : 0);
+          (long) pSeqBlock->start,
+          (long) (pSeqBlock->f ? pSeqBlock->f->GetLength() : 0),
+          (long) (pSeqBlock->f ? mDirManager->GetRefCount(pSeqBlock->f) : 0));

       if (pSeqBlock->f)
          *dest += pSeqBlock->f->GetFileName().GetFullName();
@@ -1847,7 +1847,7 @@
    }
    if (pos != mNumSamples)
       *dest += wxString::Format
-         (wxT("ERROR mNumSamples = %d\n"), mNumSamples);
+         (wxT("ERROR mNumSamples = %ld\n"), (long) mNumSamples);
 }

 // static
--- audacity-src-2.0.2.org/src/LabelTrack.cpp	2013-01-02 20:38:15.230000003 +0000
+++ audacity-src-2.0.2/src/LabelTrack.cpp	2013-01-07 22:31:47.921000004 +0000
@@ -2150,7 +2150,7 @@
          {
             if (nValue < 0)
             {
-               wxLogWarning(wxT("Project shows negative number of labels: %d"), nValue);
+               wxLogWarning(wxT("Project shows negative number of labels: %ld"), (long) nValue);
                return false;
             }
             mLabels.Clear();
--- audacity-src-2.0.2.org/src/Menus.cpp	2013-01-02 20:38:15.228000003 +0000
+++ audacity-src-2.0.2/src/Menus.cpp	2013-01-07 22:33:14.664000004 +0000
@@ -6444,7 +6444,7 @@
       wxArrayString rates;
       wxComboBox *cb;

-      rate.Printf(wxT("%d"), lrint(mRate));
+      rate.Printf(wxT("%ld"), lrint(mRate));

       rates.Add(wxT("8000"));
       rates.Add(wxT("11025"));
--- audacity-src-2.0.2.org/src/Shuttle.cpp	2013-01-02 20:38:15.225000003 +0000
+++ audacity-src-2.0.2/src/Shuttle.cpp	2013-01-07 22:34:25.101000002 +0000
@@ -189,7 +189,7 @@
    else
    {
       /// \todo Fix for long long values.
-      mValueString = wxString::Format(wxT("%d"),iValue);
+      mValueString = wxString::Format(wxT("%ld"), (long)iValue);
       return ExchangeWithMaster( Name );
    }
    return true;
--- audacity-src-2.0.2.org/src/import/Import.cpp	2013-01-02 20:38:15.225000003 +0000
+++ audacity-src-2.0.2/src/import/Import.cpp	2013-01-07 22:42:00.801000003 +0000
@@ -278,7 +278,7 @@
                val.Append (wxT(":"));
          }
       }
-      name.Printf (wxT("/ExtImportItems/Item%d"), i);
+      name.Printf (wxT("/ExtImportItems/Item%lu"), (unsigned long) i);
       gPrefs->Write (name, val);
       gPrefs->Flush();
    }
@@ -287,7 +287,7 @@
    more to delete.*/
    i = this->mExtImportItems->Count();
    do {
-     name.Printf (wxT("/ExtImportItems/Item%d"), i);
+     name.Printf (wxT("/ExtImportItems/Item%lu"), (unsigned long) i);
      // No item to delete?  Then it's time to finish.
      if (!gPrefs->Read(name, &val))
         break;
--- audacity-src-2.0.2.org/src/toolbars/DeviceToolBar.cpp	2013-01-02 20:38:15.234000003 +0000
+++ audacity-src-2.0.2/src/toolbars/DeviceToolBar.cpp	2013-01-07 22:44:22.487000002 +0000
@@ -618,7 +618,7 @@
                name = _("2 (Stereo) Input Channels");
             }
             else {
-               name = wxString::Format(wxT("%d"), j + 1);
+               name = wxString::Format(wxT("%lu"), (unsigned long) j + 1);
             }
             mInputChannels->Append(name);
          }
--- audacity-src-2.0.2.org/src/widgets/FileHistory.cpp	2013-01-02 20:38:15.223000003 +0000
+++ audacity-src-2.0.2/src/widgets/FileHistory.cpp	2013-01-07 22:47:01.610000004 +0000
@@ -142,7 +142,7 @@
    // Stored in reverse order
    int n = mHistory.GetCount() - 1;
    for (size_t i = 1; i <= mHistory.GetCount(); i++) {
-      config.Write(wxString::Format(wxT("file%02d"), i), mHistory[n--]);
+      config.Write(wxString::Format(wxT("file%02lu"), (unsigned long) i), mHistory[n--]);
    }

    config.SetPath(wxT(".."));
--- audacity-src-2.0.2.org/src/import/ImportFFmpeg.cpp	2013-01-02 20:38:15.225000003 +0000
+++ audacity-src-2.0.2/src/import/ImportFFmpeg.cpp	2013-01-07 22:50:00.779000003 +0000
@@ -539,7 +539,9 @@
       if (mScs[s]->m_stream->start_time != int64_t(AV_NOPTS_VALUE) && mScs[s]->m_stream->start_time > 0)
       {
          stream_delay = mScs[s]->m_stream->start_time;
-         wxLogError(wxT("Stream %d start_time = %d, that would be %f milliseconds."), s, mScs[s]->m_stream->start_time, double(mScs[s]->m_stream->start_time)/AV_TIME_BASE*1000);
+         wxLogError(wxT("Stream %lld start_time = %lld, that would be %f milliseconds."),
+                         (long long) s, (long long) mScs[s]->m_stream->start_time,
+                         double(mScs[s]->m_stream->start_time)/AV_TIME_BASE*1000);
       }
       if (stream_delay != 0)
       {
--- audacity-src-2.0.2.org/src/effects/ladspa/LoadLadspa.cpp	2013-01-02 20:38:15.220000003 +0000
+++ audacity-src-2.0.2/src/effects/ladspa/LoadLadspa.cpp	2013-01-07 22:51:17.953000003 +0000
@@ -146,7 +146,7 @@
       data = mainFn(index);
       while(data) {

-         wxString uniqid = wxString::Format(wxT("%08x-%s"), data->UniqueID, LAT1CTOWX(data->Label).c_str());
+         wxString uniqid = wxString::Format(wxT("%08lx-%s"), data->UniqueID, LAT1CTOWX(data->Label).c_str());
          if (uniq.Index(uniqid) == wxNOT_FOUND) {
             uniq.Add(uniqid);
             std::set<wxString> categories;
--- audacity-src-2.0.2.org/lib-src/libnyquist/nyquist/nyqsrc/sndwritepa.c	2013-01-02 20:38:15.179000003 +0000
+++ audacity-src-2.0.2/lib-src/libnyquist/nyquist/nyqsrc/sndwritepa.c	2013-01-07 22:59:39.935000003 +0000
@@ -138,7 +138,7 @@
 {
     char msgbuffer[256];
     if (err != paNoError) {
-        sprintf(msgbuffer, "%s, error %ld, %s.", problem, err,
+        sprintf(msgbuffer, "%s, error %ld, %s.", problem, (long) err,
                             Pa_GetErrorText(err));
         xlerrprint("warning", NULL, msgbuffer, s_unbound);
         return true;
@@ -267,7 +267,7 @@
                            "using PCM instead\n");
         } /* no break here, fall through to SND_MODE_PCM... */
     default:
-        nyquist_printf("s-save: unrecognized mode (%d), using PCM\n",
+        nyquist_printf("s-save: unrecognized mode (%ld), using PCM\n",
                        mode);
         /* no break, fall through as SND_MODE_PCM */
     case SND_MODE_PCM:
@@ -278,7 +278,7 @@
         else {
             sf_mode = SF_FORMAT_PCM_16;
             nyquist_printf(
-                    "s-save: bad bits parameter (%d), using 16-bit PCM\n",
+                    "s-save: bad bits parameter (%ld), using 16-bit PCM\n",
                     bits);
         }
         break;
@@ -300,7 +300,7 @@
         else {
             sf_mode = SF_FORMAT_DPCM_16;
             nyquist_printf(
-                    "s-save: bad bits parameter (%d), using 16-bit DPCM\n",
+                    "s-save: bad bits parameter (%ld), using 16-bit DPCM\n",
                     bits);
         }
         break;
@@ -445,25 +445,25 @@
     rslt = sf_seek(sndfile, frames, SEEK_SET);
     if (rslt < 0) {
         sprintf(error, "snd_overwrite: cannot seek to frame %lld of %s",
-                frames, filename);
+                (long long) frames, filename);
         xlabort(error);
     }
     if (sf_info->channels != channels) {
         sprintf(error, "%s%ld%s%ld%s",
                 "snd_overwrite: number of channels in sound (",
-                channels,
+                (long) channels,
                 ") does not match\n    number of channels in file (",
-                sf_info->channels, ")");
+                (long) sf_info->channels, ")");
         sf_close(sndfile);
         xlabort(error);
     }

     if (sf_info->samplerate != srate) {
-        sprintf(error, "%s%g%s%ld%s",
+        sprintf(error, "%s%ld%s%ld%s",
                 "snd_overwrite: sample rate in sound (",
                 srate,
                 ") does not match\n    sample rate in file (",
-                sf_info->samplerate,
+                (long) sf_info->samplerate,
                 ")");
         sf_close(sndfile);
         xlabort(error);
@@ -746,7 +746,7 @@
         for (i = 0; i < chans; i++) {
             if (state[i].cnt == 0) {
                 if (sndwrite_trace) {
-                    nyquist_printf("CALLING SOUND_GET_NEXT ON CHANNEL %ld (%x)\n",
+                    nyquist_printf("CALLING SOUND_GET_NEXT ON CHANNEL %ld (%lx)\n",
 				   i, (unsigned long) state[i].sound); /* jlh 64 bit issue */
                     sound_print_tree(state[i].sound);
                 }


code:
--- audacity-src-2.0.2.org/lib-src/libnyquist/nyquist/cmt/midifns.c	2013-01-02 20:38:15.181000003 +0000
+++ audacity-src-2.0.2/lib-src/libnyquist/nyquist/cmt/midifns.c	2013-01-02 20:40:16.772000003 +0000
@@ -110,17 +110,6 @@
 #define BREAKTEST
 #endif

-#ifdef __APPLE__
-#include <sys/types.h>
-#include <sys/time.h>
-#include <errno.h>
-#else
-#ifdef UNIX
-#ifndef UNIX_IRIX
-#include "sys/time.h"
-#include "sys/timeb.h"
-#include "cmtio.h"
-#else
 #include <sys/types.h>
 #include <sys/time.h>
 #include <errno.h>
@@ -129,9 +118,6 @@
 #include <midi.h>
 #include <midiio.h>
 #endif /* UNIX_IRIX_MIDIFNS */
-#endif  /* UNIX_IRIX */
-#endif /* UNIX */
-#endif /* __APPLE__ */

 #ifdef ITC
 static int ignore_realtime = 0;


code:
diff -Naur bc-1.06.95/bc/main.c bc-1.06.95-patched_debian/bc/main.c
--- bc-1.06.95/bc/main.c	2006-09-05 10:39:31.000000000 +0800
+++ bc-1.06.95-patched_debian/bc/main.c	2011-07-28 20:41:08.000000000 +0800
@@ -358,6 +358,9 @@
   errno = save;
 #else
   write (1, "\n(interrupt) Exiting bc.\n", 26);
+#ifdef READLINE
+  rl_initialize (); /* Clear readline buffer */
+#endif
 #if defined(LIBEDIT)
   if (edit != NULL)
     el_end(edit);
diff -Naur bc-1.06.95/bc/y.tab.h bc-1.06.95-patched_debian/bc/y.tab.h
--- bc-1.06.95/bc/y.tab.h	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/bc/y.tab.h	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,137 @@
+/* A Bison parser, made by GNU Bison 2.3.  */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     ENDOFLINE = 258,
+     AND = 259,
+     OR = 260,
+     NOT = 261,
+     STRING = 262,
+     NAME = 263,
+     NUMBER = 264,
+     ASSIGN_OP = 265,
+     REL_OP = 266,
+     INCR_DECR = 267,
+     Define = 268,
+     Break = 269,
+     Quit = 270,
+     Length = 271,
+     Return = 272,
+     For = 273,
+     If = 274,
+     While = 275,
+     Sqrt = 276,
+     Else = 277,
+     Scale = 278,
+     Ibase = 279,
+     Obase = 280,
+     Auto = 281,
+     Read = 282,
+     Random = 283,
+     Warranty = 284,
+     Halt = 285,
+     Last = 286,
+     Continue = 287,
+     Print = 288,
+     Limits = 289,
+     UNARY_MINUS = 290,
+     HistoryVar = 291,
+     Void = 292
+   };
+#endif
+/* Tokens.  */
+#define ENDOFLINE 258
+#define AND 259
+#define OR 260
+#define NOT 261
+#define STRING 262
+#define NAME 263
+#define NUMBER 264
+#define ASSIGN_OP 265
+#define REL_OP 266
+#define INCR_DECR 267
+#define Define 268
+#define Break 269
+#define Quit 270
+#define Length 271
+#define Return 272
+#define For 273
+#define If 274
+#define While 275
+#define Sqrt 276
+#define Else 277
+#define Scale 278
+#define Ibase 279
+#define Obase 280
+#define Auto 281
+#define Read 282
+#define Random 283
+#define Warranty 284
+#define Halt 285
+#define Last 286
+#define Continue 287
+#define Print 288
+#define Limits 289
+#define UNARY_MINUS 290
+#define HistoryVar 291
+#define Void 292
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 54 "bc.y"
+{
+	char	 *s_value;
+	char	  c_value;
+	int	  i_value;
+	arg_list *a_value;
+       }
+/* Line 1489 of yacc.c.  */
+#line 130 "y.tab.h"
+	YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
diff -Naur bc-1.06.95/debian/bc.menu bc-1.06.95-patched_debian/debian/bc.menu
--- bc-1.06.95/debian/bc.menu	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/bc.menu	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1 @@
+?package(bc):needs="text" section="Applications/Science/Mathematics" title="Bc" hints="Calculators" command="/usr/bin/bc"
diff -Naur bc-1.06.95/debian/bc.postinst bc-1.06.95-patched_debian/debian/bc.postinst
--- bc-1.06.95/debian/bc.postinst	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/bc.postinst	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# This is the postinst script for the Debian GNU/Linux bc package
+#
+# Written by John G. Hasler
+# Previous versions written by Dirk Eddelbuettel, Bill Mitchell,
+# Austin Donnelly and James Troup
+
+set -e
+
+#DEBHELPER#
+
+case "$1" in
+	configure)
+		if [ -x "`which update-menus 2>/dev/null`" ]; then
+        		update-menus
+		fi
+	;;
+    	abort-remove|abort-deconfigure|abort-upgrade)
+    		# Nothing to undo
+	;;
+
+    *)
+	echo "postinst called with unknown argument \`$1'" >&2
+	;;
+esac
diff -Naur bc-1.06.95/debian/bc.postrm bc-1.06.95-patched_debian/debian/bc.postrm
--- bc-1.06.95/debian/bc.postrm	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/bc.postrm	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,23 @@
+#! /bin/sh
+#
+# This is the postrm script for the Debian GNU/Linux bc package
+#
+# Written by John G. Hasler
+# Previous versions written by Dirk Eddelbuettel, Bill Mitchell,
+# Austin Donnelly and James Troup
+
+set -e
+
+#DEBHELPER#
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ 	if [ -x /usr/bin/update-menus ]
+ 	then
+ 	    update-menus
+ 	fi
+        ;;
+    *)
+	echo "postrm called with unknown argument \`$1'" >&2
+	;;
+esac
diff -Naur bc-1.06.95/debian/changelog bc-1.06.95-patched_debian/debian/changelog
--- bc-1.06.95/debian/changelog	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/changelog	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,463 @@
+bc (1.06.95-2) unstable; urgency=low
+
+  * Fixed errors in debian/rules that prevented info files from
+    being correctly generated.
+
+ -- John G. Hasler <jhasler@debian.org>  Thu, 15 Oct 2009 12:17:23 -0500
+
+bc (1.06.95-1) unstable; urgency=low
+
+  * New upstream release
+    Closes: #538419: New bc upstream version 1.06.95
+
+    Fixed libreadline build dependencies.
+
+    Cleaned up maintscripts, brought package up to current
+    standards-version, fixed menu entries, patched texi files
+    to add @dircategory lines.
+
+ -- John G. Hasler <jhasler@debian.org>  Tue, 06 Oct 2009 13:57:38 -0500
+
+bc (1.06.94-3) unstable; urgency=low
+
+  * Added "-pbc" to dh_installdirs line for bc in debian/rules.
+    Fixes build failure with "-j3".
+
+ -- John Hasler <jhasler@debian.org>  Sun, 02 Dec 2007 14:46:56 -0600
+
+bc (1.06.94-2) unstable; urgency=low
+
+  * Uncommented dh_md5sums in debian/rules.
+
+  * Corrected menu entries.
+
+ -- John Hasler <jhasler@debian.org>  Fri, 05 Oct 2007 12:29:18 -0500
+
+bc (1.06.94-1) unstable; urgency=low
+
+  * New upstream release
+
+    Code cleanup upstream has fixed these
+    Closes: #357728: bc: Segfaults
+    Closes: #221781: dc: precision >= 1000000000 does not work
+    Closes: #429156: dc: segfaults when generating primes
+    Closes: #296232: dc directory' should print an error
+    Closes: #301921: 'man bc' typos: "environent", "specifing"
+
+  * Patched use_quit() in main.c to run rl_initialize().
+    Closes: #287210: bc: Interrupt should reset the input line
+
+  * BC_LINE_LENGTH=0 disables the multi-line feature.
+    Closes: #245899: bc: BC_LINE_LENGTH=0 or similar for ``do never split''
+    should be added, or the manpage should be fixed
+
+  * Upstream says this in correct POSIX behavior.
+    Closes: #388487: bc: scale strangeness
+
+  * Applied patch from Justin Pryzby.
+    Closes: #374818: dc: maintscript prerm arguments
+
+  * Remove '-s' from calls to install in debian/rules.  Fixes both bc and dc.
+    Closes: #436578: bc: not handling nostrip build option (policy 10.1) sid/i386
+
+  * Upstream has removed the '-E' option.
+    Closes: #389345: dc: man page formatting bug
+
+  * Added -DDONTEXIT to debian/rules as it is not the default.
+
+  * Man page typos fixed upstream.
+
+  * Added home page (such as it is) to descriptions.
+
+  * Fixed make distclean call in debian/rules.
+
+ -- John Hasler <jhasler@debian.org>  Thu,  23 Aug 2007 15:18:09 -0500
+
+bc (1.06-20) unstable; urgency=low
+
+  * Had already fixed menu titles but failed to close the bug.
+    Closes: #320605: Conformance with menu policy
+
+  * Also had fixed typos.
+    Closes: #301921: 'man bc' typos: "environent", "specifing"
+
+ -- John Hasler <jhasler@debian.org>  Sat,  7 Oct 2006 10:45:18 -0500
+
+bc (1.06-19) unstable; urgency=low
+
+  * Fixed libreadline dependency.
+    Closes: #326385: please rebuild with libreadline5-dev as build dependency
+
+ -- John Hasler <jhasler@debian.org>  Thu, 17 Nov 2005 15:41:52 -0600
+
+bc (1.06-18) unstable; urgency=low
+
+  * Corrected link in copyright file.
+
+  * Fixed capitalization in menu titles.
+    Closes: #320605: Conformance with menu policy
+
+ -- John Hasler <jhasler@debian.org>  Sun, 28 Aug 2005 18:36:46 -0500
+
+bc (1.06-17) unstable; urgency=low
+
+  * New maintainer.
+
+ -- John Hasler <jhasler@debian.org>  Sat, 15 Jan 2005 18:20:00 -0600
+
+bc (1.06-16) unstable; urgency=low
+
+  * debian/rules: Applied patch by NIIBE Yutaka <gniibe@fsij.org> to
+    distinguish between GNU types build and host  (Closes: #285304)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun, 19 Dec 2004 18:08:47 -0600
+
+bc (1.06-15) unstable; urgency=low
+
+  * configure.in: Patch was supposed to be '-I -8' (Closes: #237957)
+  * Also ran autoconf2.50 to re-create configure
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Thu, 29 Apr 2004 20:54:22 -0500
+
+bc (1.06-14) unstable; urgency=low
+
+  * configure.in: Applied patch by Andreas Jochens to invoke flex
+    with argument '-I 8' instead of '-I8'  (Closes: #237957)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Mon, 26 Apr 2004 19:55:50 -0500
+
+bc (1.06-13) unstable; urgency=low
+
+  * bc/bc.y: Apply patch by Matt Kraai to fix flex issues (Closes: #236991)
+  * debian/control: Upgraded to Standards-Version: 3.6.1
+  * debian/dc.menu: Quoted one more argument (thanks, lintian)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Wed, 10 Mar 2004 21:34:02 -0600
+
+bc (1.06-12) unstable; urgency=low
+
+  * configure.in: Avoid time skew via AM_MAINTAINER_MODE (Closes: #208195)
+  * {bc,dc,lib}/Makefile.am: s/CFLAGS/AM_CFLAGS/,s/YFLAGS/AM_YFLAGS/
+  * Ran 'aclocal; autoconf; automake-1.7 --gnu --add-missing --copy'
+  * doc/bc.1: Patch by N. Francois with two minor corrections (Closes: #215292)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Tue, 14 Oct 2003 20:43:21 -0500
+
+bc (1.06-11) unstable; urgency=low
+
+  * doc/dc.{1,texi}: Applied upstream patch by Ken Pizzini (Closes: #100344)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Mon, 12 May 2003 16:01:32 -0500
+
+bc (1.06-10) unstable; urgency=low
+
+  * dc/{dc.c,eval.c,dc-proto.h}: Added new upstream patch by Ken Pizzini
+    which fixes one old and one new bug report(Closes: #135029, #191663)
+  * dc/dc.c: Corrected function argument to pointer to string
+  * debian/control: Increased Standards-Version to 3.5.9
+  * debian/dc_factor: New example script
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Fri,  9 May 2003 20:20:29 -0500
+
+bc (1.06-9) unstable; urgency=low
+
+  * dc/dc.c, doc/dc.1: Applied patch by Terran Melconian
+    <terran@consistent.org> for an additional command-line argument,
+    and rc file handling; also forwarded upstream (Closes: #167274)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Fri,  1 Nov 2002 23:51:51 -0600
+
+bc (1.06-8) unstable; urgency=low
+
+  * debian/control: Priority changed to standard as per overrides file
+  * debian/control: Standards-Version upgraded to 3.5.0
+  * debian/copyright: Debian/GNU Linux typo fix (lintian)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sat, 13 Apr 2002 11:33:49 -0500
+
+bc (1.06-7) unstable; urgency=low
+
+  * bc/scan.l, bc/scan.c: Commented out three declarations that are now
+    also in libreadline 4.2; mini-patch sent upstream (Closes: #100178)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sat,  9 Jun 2001 06:03:33 -0500
+
+bc (1.06-6) unstable; urgency=low
+
+  * The "surprise, another build-depends bug" upload
+  * debian/control: Added bison to Build-Depends (Closes: #86977)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Thu, 22 Feb 2001 20:43:44 -0600
+
+bc (1.06-5) unstable; urgency=low
+
+  * The "there's yet another in the pipeline" revisions
+  * bc/bc.y: Another small patch from upstream
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Mon, 19 Feb 2001 20:05:31 -0600
+
+bc (1.06-4) unstable; urgency=low
+
+  * The "Let's make it three uploads in twenty-four hours" revisison
+  * debian/control: Added file, flex, texinfo, libreadline4-dev (Closes: #86593)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Mon, 19 Feb 2001 08:26:45 -0600
+
+bc (1.06-3) unstable; urgency=low
+
+  * bc/load.c: Another small patch from upstream
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun, 18 Feb 2001 23:04:08 -0600
+
+bc (1.06-2) unstable; urgency=low
+
+  * bc/main.c: Applied modified patch from the upstream and CVSh, supplied
+    in response the to the bug supplied with the bug report (Closes: #86425)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun, 18 Feb 2001 10:06:05 -0600
+
+bc (1.06-1) unstable; urgency=low
+
+  * Upgraded to new upstream release 1.06 (Closes: #82207)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun, 14 Jan 2001 23:03:26 -0600
+
+bc (1.05a-13) unstable; urgency=low
+
+  * debian/control: Build-Depends on texi2html, not tetex-bin (Closes: #81196)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Thu,  4 Jan 2001 20:38:12 -0600
+
+bc (1.05a-12) unstable; urgency=low
+
+  * debian/control: Added Build-Depends
+  * debian/dc.menu: Added hints="Calculator" (Closes: #80012)
+  * debian/bc.menu: Added hints="Calculator" (Closes: #80050)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Tue, 19 Dec 2000 22:09:44 -0600
+
+bc (1.05a-11) frozen; urgency=low
+
+  * Argh, 1.05a-10 was meant for frozen - this really closes #57908.
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun, 13 Feb 2000 17:05:49 -0500
+
+bc (1.05a-10) unstable; urgency=low
+
+  * Rebuilt against libreadline4 (Closes: #57908)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun, 13 Feb 2000 00:17:31 -0500
+
+bc (1.05a-9) unstable; urgency=low
+
+  * Applied upstream patch by Ken Pizzini <ken@halcyon.com> to correct the
+    dc.1 manual page (Closes: #48881)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Wed,  3 Nov 1999 22:10:33 -0500
+
+bc (1.05a-8) unstable; urgency=low
+
+  * Applied another upstream patch by Phil Nelson <phil@cs.wwu.edu>; this
+    one improves the cosine and cosine and bessel functions
+
+  * debian/rules: make sure we link bc with readline (Closes: #46535)
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sun,  3 Oct 1999 17:00:38 -0400
+
+bc (1.05a-7) unstable; urgency=low
+
+  * Applied new upstream patch by Phil Nelson <phil@cs.wwu.edu> to improve
+    the raise operation. Thanks to Aaron Digulla <dia@unix.swx.ch> for the
+    report.
+
+  * debian/rules: Adapted to use /usr/share/ following the recommendation
+    on FHS transition from the Technical Committee
+  * debian/rules: Test for debhelper >= 2.0.40 for FHS compliance
+  * debian/control: Upgraded to Debian Policy 3.0.1
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Sat,  2 Oct 1999 09:14:41 -0400
+
+bc (1.05a-6) unstable; urgency=low
+
+  * debian/control: Actually changed maintainer name
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Fri,  4 Jun 1999 22:54:45 -0400
+
+bc (1.05a-5) unstable; urgency=low
+
+  * New maintainer
+  * debian/rules: Converted to debhelper
+  * debian/*: Added doc-base support for dc
+  * debian/{bc,dc}.{post,pre}{inst,rm}: Cosmetic changes
+
+ -- Dirk Eddelbuettel <edd@debian.org>  Fri, 28 May 1999 23:47:40 -0400
+
+bc (1.05a-4) unstable; urgency=low
+
+  * debian/control (Standards-Version): updated to 2.5.0.0.
+  * configure.in: changed test for readline to use READLINELIB and not
+    LIBS so we can link just bc with readline (as dc doesn't use it).
+    [#31473]
+  * bc/Makefile.am (LDADD): add @READLINELIB@.
+
+ -- James Troup <james@nocrew.org>  Sat, 16 Jan 1999 15:19:32 +0000
+
+bc (1.05a-3) frozen unstable; urgency=high
+
+  * bc/scan.l (rl_len): int not char, to allow input > 128 characters in
+    length without crashing.  Reported by Wakko Warner
+    <wakko@ani.animx.ml.org>, Jeff Noxon <jeff@planetfall.com> and Camm
+    Maguire <camm@enhanced.com>.  [#23304, #24113, #27731]
+
+ -- James Troup <james@nocrew.org>  Mon,  9 Nov 1998 02:45:00 +0000
+
+bc (1.05a-2) unstable; urgency=low
+
+  * debian/control (Maintainer): new address.
+  * debian/copyright: ditto.
+  * Recompile with ncurses4.
+
+ -- James Troup <james@nocrew.org>  Fri, 23 Oct 1998 18:27:44 +0100
+
+bc (1.05a-1) unstable; urgency=low
+
+  * New upstream version.
+  * debian/control (Standards-Version): updated to 2.4.1.0.
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Tue, 30 Jun 1998 00:54:37 +0200
+
+bc (1.04-4) unstable; urgency=low
+
+  * debian/copyright: correct the FSF's address.
+  * debian/copyright: refer to bc source package, not hello.
+  * debian/control (Standards-Version): updated to 2.4.0.0.
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Mon,  2 Mar 1998 18:10:02 +0000
+
+bc (1.04-3) unstable; urgency=low
+
+  * Uses pristine upstream source.
+  * Added menu entries.
+  * debian/control: Updated Standards-Version to 2.3.0.1.
+  * debian/control: Shortened dc's long description.
+  * debian/rules: No longer uses {,}.
+  * debian/rules: Compile with -g and -Wall.
+  * debian/rules: Split binary-arch into binary-bc and binary-dc.
+  * debian/rules: Lots of other minor changes.
+  * bc/scan.l: Don't use readline when not interactive. (Patch from
+    Andreas Schwab).  This fixes the problem of bc echoing it's input
+    when used in a pipe [#16069]
+  * Test/timetest: correct location of bc. (Patch from Karl Heuer)
+  * lib/number.c: Fix for broken sqrt function. (Patch from Phil Nelson)
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Mon, 29 Dec 1997 19:34:45 +0000
+
+bc (1.04-2) unstable; urgency=low
+
+  * Rebuilt with libc6.
+  * Compiled with readline.
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Mon, 30 Jun 1997 01:21:23 +0100
+
+bc (1.04-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Wed, 30 Apr 1997 17:18:39 +0100
+
+bc (1.03-14) unstable; urgency=low
+
+  * Made bc flush its output unconditionally (bug #6986).
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Thu, 13 Feb 1997 16:56:49 +0000
+
+bc (1.03-13) unstable; urgency=low
+
+  * Corrected location of example files (bug #7041).
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Mon, 3 Feb 1997 02:50:29 +0000
+
+bc (1.03-12) unstable; urgency=low
+
+  * Corrected priority (optional -> important).
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Fri, 31 Jan 1997 00:59:11 +0000
+
+bc (1.03-11) unstable; urgency=low
+
+  * New maintainer.
+  * Updated to Standards-Version 2.1.1.2.
+  * Included Austin Donnelly's fix for bug #6463.
+  * Fixed dc.1 so mandb can parse it (bug #4991).
+
+ -- James Troup <jjtroup@comp.brad.ac.uk>  Thu, 30 Jan 1997 04:07:04 +0000
+
+Changes for bc-1.03-10:
+	elf package
+	* added dependency on libc5
+
+Changes for bc-1.03-9:
+	* rebuilt for elf
+
+Changes for bc-1.03-8:
+
+Priority:  Routine
+Changes:  Various administrative changes
+ changed extended description for the bc package to the one used by GNU.
+ renamed source package debian.* files
+ added SECTON field to control files
+ added /usr/doc/dc with dc.texinfo man Makefile
+
+Changes for bc-1.03-7:
+
+1.  Fixed problem with debian.rules sed invocation for debian.control
+
+2.  Remove several files created by the build in debian.rules clean:
+
+Changes for bc-1.03-6:
+
+1.  Cleaned up control file descriptions and extended descriptions.
+
+Changes for bc-1.03-5:
+
+1.  Changed mode of man pages from 755 to 644
+
+Changes for bc-1.03-4:
+
+1.  In debian.rules, added code to fix broken "orig" target.
+    (This was most likely broken by my bc-1.03-3 changes) (??)
+
+Changes for bc-1.03-3:
+
+1.  In debian.rules:
+
+    Changed the "d = 2" to "d = 3" to change the bc-1.03-
+    line in the control files from 2 to 3.
+
+    Changed references to source package files control.bc and
+    control.dc to pre-pend "debian." to those names.
+
+    Changed references to source package files control.bc and
+    control.dc to pre-pend "debian." to those names.
+
+    Changed references to source package files postinst.dc and
+    postrm.dc to pre-pend "debian." to those names.
+
+    Added dependency on clean to source and diff targets.
+
+    Moved "make distclean" to the last action in the clean target
+    to prevent a failure here from aborting the preceeding cleanup.
+
+2.  Renamed files
+
+    control.bc to debian.control.bc
+    control.dc to debian.control.bc
+    postinst.dc to debian.postinst.bc
+    postrm.dc to debian.postrm.bc
+
+3.  In debian.control.* changed maintainer name.
+
+This file documents changes since maintenamce of this package
+was taken over by Bill Mitchell <mitchell@mdd.comm.mot.com>
+beginning with bc-1.03-3.
+
diff -Naur bc-1.06.95/debian/compat bc-1.06.95-patched_debian/debian/compat
--- bc-1.06.95/debian/compat	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/compat	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1 @@
+7
diff -Naur bc-1.06.95/debian/control bc-1.06.95-patched_debian/debian/control
--- bc-1.06.95/debian/control	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/control	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,28 @@
+Source: bc
+Section: math
+Priority: standard
+Maintainer: John G. Hasler <jhasler@debian.org>
+Standards-Version: 3.8.3
+Build-Depends: bison, debhelper (>= 7), file, flex, libreadline-dev | libreadline6-dev | libreadline5-dev, texi2html, texinfo
+
+Package: bc
+Architecture: any
+Depends: ${shlibs:Depends}, dpkg (>= 1.15.4) | install-info
+Description: The GNU bc arbitrary precision calculator language
+ GNU bc is an interactive algebraic language with arbitrary precision which
+ follows the POSIX 1003.2 draft standard, with several extensions including
+ multi-character variable names, an `else' statement and full Boolean
+ expressions.  GNU bc does not require the separate GNU dc program.
+ Home page: http://directory.fsf.org/GNU/bc.html
+
+Package: dc
+Architecture: any
+Depends: ${shlibs:Depends}, dpkg (>= 1.15.4) | install-info
+Description: The GNU dc arbitrary precision reverse-polish calculator
+ GNU dc is a reverse-polish desk calculator which supports unlimited
+ precision arithmetic.  It also allows you to define and call macros.
+ .
+ A reverse-polish calculator stores numbers on a stack. Entering a number
+ pushes it on the stack.  Arithmetic operations pop arguments off the
+ stack and push the results.
+ Home page: http://directory.fsf.org/GNU/bc.html
diff -Naur bc-1.06.95/debian/copyright bc-1.06.95-patched_debian/debian/copyright
--- bc-1.06.95/debian/copyright	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/copyright	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,60 @@
+This is Debian GNU/Linux's prepackaged version of the FSF's GNU bc and dc
+utilities. GNU bc is an interactive algebraic language with arbitrary
+precision. GNU dc is a reverse-polish desk calculator which supports
+unlimited precision arithmetic. bc was written by Phil Nelson, Ken Pizzini
+wrote dc.
+
+bc was previously maintained by Bill Mitchell, Austin Donnelly, James
+Troup, and Dirk Eddelbuettel.  The current package was put together by John
+G. Hasler <jhasler@debian.org> from the GNU sources from
+http://ftp.us.xemacs.org/pub/mirrors/gnu/alpha/gnu/bc/
+Changes are documented in the changelog.Debian file, and below.
+
+James Troup, the previous maintainer made the following changes :-
+
+o adding support for the Debian package maintenance scheme, by adding
+  various debian/* files.
+o bc/scan.l (rc_len): define as int not char, to allow input > 128
+  characters in length without crashing.
+o configure.in: changed test for readline to use READLINELIB and not
+  LIBS so we can link just bc with readline (as dc doesn't use it).
+o bc/Makefile.am (LDADD): add @READLINELIB@
+
+
+Program Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software
+Foundation, Inc.
+Modifications for Debian Copyright (C) 1997, 1998, 1999 James Troup.
+Further modifications for Debian Copyright (C) 1999 Dirk Eddelbuettel.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License with your
+Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with the
+Debian GNU/Linux bc source package as the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA.
+
+
+Manual (dc.info) Copyright (C) 1984 Free Software Foundation, Inc.
+
+Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
diff -Naur bc-1.06.95/debian/dc.doc-base bc-1.06.95-patched_debian/debian/dc.doc-base
--- bc-1.06.95/debian/dc.doc-base	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/dc.doc-base	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,14 @@
+Document: dc
+Title: The GNU DC arbitrary precision calculator
+Author: Ken Pizzini
+Abstract: GNU dc is a reverse-polish desk calculator which supports unlimited
+ precision arithmetic.  It also allows you to define and call macros.
+ Normally DC reads from the standard input; if any command arguments are
+ given to it, they are filenames, and DC reads and executes the contents
+ of the files instead of reading from standard input.  All normal output
+ is to standard output; all error messages are written to standard error.
+Section: Science/Mathematics
+
+Format: HTML
+Index: /usr/share/doc/dc/dc.html
+Files: /usr/share/doc/dc/dc.html
diff -Naur bc-1.06.95/debian/dc_factor bc-1.06.95-patched_debian/debian/dc_factor
--- bc-1.06.95/debian/dc_factor	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/dc_factor	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Example taken from http://www.cs.unh.edu/~charpov/Programming/DC/
+# and minimally modified to use dc -e '...' instead of echo '...' | dc
+#
+# Usage:
+#    Invoke as 'dc_factor $ARG' and $ARG will be factored
+# Example:
+#     $ ./dc_factor 123456789
+#     3
+#     3
+#     3607
+#     3803
+#
+# Dirk Eddelbuettel <edd@debian.org>  09 May 2003
+
+dc -e "$1[p]s2[lip/dli%0=1dvsr]s12sid2%0=13sidvsr[dli%0=1lrli2+dsi!>.]ds.xd1<2"
diff -Naur bc-1.06.95/debian/dc.menu bc-1.06.95-patched_debian/debian/dc.menu
--- bc-1.06.95/debian/dc.menu	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/dc.menu	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1 @@
+?package(dc):needs="text" title="Dc" section="Applications/Science/Mathematics" hints="Calculators" command="/usr/bin/dc"
diff -Naur bc-1.06.95/debian/dc.postinst bc-1.06.95-patched_debian/debian/dc.postinst
--- bc-1.06.95/debian/dc.postinst	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/dc.postinst	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# This is the postinst script for the Debian GNU/Linux dc package
+#
+# Written by John G. Hasler
+# Previous versions written by Dirk Eddelbuettel, Bill Mitchell,
+# Austin Donnelly and James Troup
+
+set -e
+
+#DEBHELPER#
+
+case "$1" in
+	configure)
+		if [ -x "`which update-menus 2>/dev/null`" ]; then
+        		update-menus
+		fi
+	;;
+    	abort-remove|abort-deconfigure|abort-upgrade)
+    		# Nothing to undo
+	;;
+
+    *)
+	echo "postinst called with unknown argument \`$1'" >&2
+	;;
+esac
diff -Naur bc-1.06.95/debian/dc.postrm bc-1.06.95-patched_debian/debian/dc.postrm
--- bc-1.06.95/debian/dc.postrm	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/dc.postrm	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,23 @@
+#! /bin/sh
+#
+# This is the postrm script for the Debian GNU/Linux dc package
+#
+# Written by John G. Hasler
+# Previous versions written by Dirk Eddelbuettel, Bill Mitchell,
+# Austin Donnelly and James Troup
+
+set -e
+
+#DEBHELPER#
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ 	if [ -x /usr/bin/update-menus ]
+ 	then
+ 	    update-menus
+ 	fi
+        ;;
+    *)
+	echo "postrm called with unknown argument \`$1'" >&2
+	;;
+esac
diff -Naur bc-1.06.95/debian/menu.bc bc-1.06.95-patched_debian/debian/menu.bc
--- bc-1.06.95/debian/menu.bc	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/menu.bc	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1 @@
+?package(units):needs="text" section="Applications/Science/Mathematics" title="Bc" command="bc"
diff -Naur bc-1.06.95/debian/menu.dc bc-1.06.95-patched_debian/debian/menu.dc
--- bc-1.06.95/debian/menu.dc	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/menu.dc	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1 @@
+?package(units):needs="text" section="Applications/Science/Mathematics" title="Dc" command="dc"
diff -Naur bc-1.06.95/debian/rules bc-1.06.95-patched_debian/debian/rules
--- bc-1.06.95/debian/rules	1970-01-01 08:00:00.000000000 +0800
+++ bc-1.06.95-patched_debian/debian/rules	2011-07-28 20:41:08.000000000 +0800
@@ -0,0 +1,118 @@
+#!/usr/bin/make -f
+# 							-*- makefile -*-
+# debian/rules file for the Debian/GNU bc package
+# Copyright 1999 - 2004 by Dirk Eddelbuettel <edd@debian.org>
+
+package1 = bc
+package2 = dc
+deb_bc  := $(CURDIR)/debian/$(package1)
+deb_dc  := $(CURDIR)/debian/$(package2)
+
+DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+CONFARGS = --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+#export DH_VERBOSE=1
+
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	./configure --prefix=/usr --with-readline $(CONFARGS)
+	$(MAKE) CFLAGS="-O2 -g -Wall -D_POSIX_SOURCE -DDOT_IS_LAST -DDONTEXIT"
+	(cd doc; texi2html -monolithic -expandinfo -number $(package1).texi)
+	(cd doc; texi2html -monolithic -expandinfo -number $(package2).texi)
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp install-stamp
+	[ ! -f Makefile ] || $(MAKE) distclean
+	dh_clean			config.log confdefs.h doc/dc.html
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_installdirs
+	# Add here commands to install the package into debian/tmp.
+	#$(MAKE) prefix=`pwd`/debian/tmp/usr install
+#	dh_movefiles
+	touch install-stamp
+
+binary-indep: build install
+
+binary-arch: build binary-arch-bc binary-arch-dc
+
+binary-arch-bc:
+
+	dh_testdir -pbc
+	dh_prep
+	dh_installdirs -pbc 			usr/bin usr/share/info
+	dh_testroot -pbc
+	install -p -m 0755 bc/bc		$(deb_bc)/usr/bin/.
+	install -p -m 0644 doc/bc.info		$(deb_bc)/usr/share/info/.
+	dh_installdocs -pbc			NEWS README AUTHORS doc/bc.html
+	dh_installexamples -pbc 		Examples/*
+	dh_installmenu -pbc
+#	dh_installemacsen -pbc
+#	dh_installinit -pbc
+#	dh_installcron -pbc
+	dh_installman -pbc       		doc/bc.1
+#	dh_undocumented
+	dh_installchangelogs -pbc		ChangeLog
+	dh_strip -pbc
+	dh_link -pbc
+	dh_compress -pbc
+	dh_fixperms -pbc
+	# You may want to make some executables suid here.
+#	dh_suidregister -pbc
+	dh_installdeb -pbc
+#	dh_makeshlibs -pbc
+	dh_shlibdeps -pbc
+	dh_gencontrol -pbc
+	dh_md5sums -pbc
+	dh_builddeb -pbc
+
+binary-arch-dc:
+
+	dh_testdir -pdc
+	dh_prep
+	dh_installdirs -pdc			usr/bin usr/share/info
+	dh_testroot -pdc
+	install -p -m 0755 dc/dc		$(deb_dc)/usr/bin/.
+	install -p -m 0644 doc/dc.info		$(deb_dc)/usr/share/info/.
+	dh_installdocs -pdc			NEWS README AUTHORS \
+						doc/dc.html
+	dh_installexamples -pdc 		debian/dc_factor
+	dh_installmenu -pdc
+#	dh_installemacsen -pdc
+#	dh_installinit -pdc
+#	dh_installcron -pdc
+	dh_installman -pdc      		doc/dc.1
+#	dh_undocumented
+	dh_installchangelogs -pdc		ChangeLog
+	dh_strip -pdc
+	dh_link -pdc
+	dh_compress -pdc
+	dh_fixperms -pdc
+	# You may want to make some executables suid here.
+#	dh_suidregister -pdc
+	dh_installdeb -pdc
+#	dh_makeshlibs -pdc
+	dh_shlibdeps -pdc
+	dh_gencontrol -pdc
+	dh_md5sums -pdc
+	dh_builddeb -pdc
+
+source diff:
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
+
+
diff -Naur bc-1.06.95/doc/bc.info bc-1.06.95-patched_debian/doc/bc.info
--- bc-1.06.95/doc/bc.info	2006-09-05 10:39:39.000000000 +0800
+++ bc-1.06.95-patched_debian/doc/bc.info	2011-07-28 20:41:08.000000000 +0800
@@ -1,5 +1,6 @@
-This is bc.info, produced by makeinfo version 4.8 from bc.texi.
+This is bc.info, produced by makeinfo version 4.13 from bc.texi.

+INFO-DIR-SECTION Math
 START-INFO-DIR-ENTRY
 * bc: (bc).                    An arbitrary precision calculator language.
 END-INFO-DIR-ENTRY
@@ -1002,29 +1003,29 @@

 Tag Table:
-Node: Top181
-Node: Introduction473
-Node: Description638
-Node: Command Line Options2097
-Node: Basic Elements2667
-Node: Numbers2842
-Node: Variables3610
-Node: Comments4724
-Node: Expressions5470
-Node: About Expressions and Special Variables5754
-Node: Basic Expressions7495
-Node: Relational Expressions10441
-Node: Boolean Expressions11451
-Node: Precedence12011
-Node: Special Expressions13176
-Node: Statements14563
-Node: Pseudo Statements21192
-Node: Functions21845
-Node: Math Library Functions27008
-Node: Examples27723
-Node: Readline and Libedit Options29707
-Node: Comparison with Other Implementations30738
-Node: Limits35990
-Node: Environment Variables37247
+Node: Top204
+Node: Introduction496
+Node: Description661
+Node: Command Line Options2120
+Node: Basic Elements2690
+Node: Numbers2865
+Node: Variables3633
+Node: Comments4747
+Node: Expressions5493
+Node: About Expressions and Special Variables5777
+Node: Basic Expressions7518
+Node: Relational Expressions10464
+Node: Boolean Expressions11474
+Node: Precedence12034
+Node: Special Expressions13199
+Node: Statements14586
+Node: Pseudo Statements21215
+Node: Functions21868
+Node: Math Library Functions27031
+Node: Examples27746
+Node: Readline and Libedit Options29730
+Node: Comparison with Other Implementations30761
+Node: Limits36013
+Node: Environment Variables37270

 End Tag Table
diff -Naur bc-1.06.95/doc/bc.texi bc-1.06.95-patched_debian/doc/bc.texi
--- bc-1.06.95/doc/bc.texi	2006-06-11 16:16:52.000000000 +0800
+++ bc-1.06.95-patched_debian/doc/bc.texi	2011-07-28 20:41:08.000000000 +0800
@@ -9,12 +9,13 @@
 @c This file has the new style title page commands.
 @c Run `makeinfo' rather than `texinfo-format-buffer'.

-@smallbook
+@c smallbook

 @c tex
 @c \overfullrule=0pt
 @c end tex

+@dircategory Math
 @ifinfo
 @direntry
 * bc: (bc).                    An arbitrary precision calculator language.
diff -Naur bc-1.06.95/doc/dc.1 bc-1.06.95-patched_debian/doc/dc.1
--- bc-1.06.95/doc/dc.1	2006-06-12 05:39:26.000000000 +0800
+++ bc-1.06.95-patched_debian/doc/dc.1	2011-07-28 20:41:08.000000000 +0800
@@ -501,6 +501,10 @@
 because the 2 was stored in an instance of 0:a that
 was later popped.
 .SH
+FILES
+\fI~/.dcrc\fP        The commands in this file will be executed when dc is
+first run.
+.SH
 BUGS
 .PP
 Email bug reports to
diff -Naur bc-1.06.95/doc/dc.info bc-1.06.95-patched_debian/doc/dc.info
--- bc-1.06.95/doc/dc.info	2006-09-05 10:39:39.000000000 +0800
+++ bc-1.06.95-patched_debian/doc/dc.info	2011-07-28 20:41:08.000000000 +0800
@@ -1,5 +1,6 @@
-This is dc.info, produced by makeinfo version 4.8 from dc.texi.
+This is dc.info, produced by makeinfo version 4.13 from dc.texi.

+INFO-DIR-SECTION Math
 START-INFO-DIR-ENTRY
 * dc: (dc).                   Arbitrary precision RPN "Desktop Calculator".
 END-INFO-DIR-ENTRY
@@ -462,18 +463,18 @@

 Tag Table:
-Node: Top1109
-Node: Introduction1688
-Node: Invocation3037
-Node: Printing Commands3888
-Node: Arithmetic5933
-Node: Stack Control8850
-Node: Registers9334
-Ref: Registers-Footnote-110302
-Node: Parameters10454
-Node: Strings11719
-Node: Status Inquiry14876
-Node: Miscellaneous15936
-Node: Reporting bugs16909
+Node: Top1132
+Node: Introduction1711
+Node: Invocation3060
+Node: Printing Commands3911
+Node: Arithmetic5956
+Node: Stack Control8873
+Node: Registers9357
+Ref: Registers-Footnote-110325
+Node: Parameters10477
+Node: Strings11742
+Node: Status Inquiry14899
+Node: Miscellaneous15959
+Node: Reporting bugs16932

 End Tag Table
diff -Naur bc-1.06.95/doc/dc.texi bc-1.06.95-patched_debian/doc/dc.texi
--- bc-1.06.95/doc/dc.texi	2006-06-11 16:15:54.000000000 +0800
+++ bc-1.06.95-patched_debian/doc/dc.texi	2011-07-28 20:41:08.000000000 +0800
@@ -22,6 +22,7 @@
 @syncodeindex pg fn
 @syncodeindex tp fn

+@dircategory Math
 @ifinfo
 @direntry
 * dc: (dc).                   Arbitrary precision RPN ``Desktop Calculator''.


code:
--- db-5.3.21.org/dist/configure	2012-09-29 19:57:08.668000002 +0000
+++ db-5.3.21/dist/configure	2012-09-29 20:10:28.304000001 +0000
@@ -21387,7 +21387,7 @@
 	# x86_64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
+#include <stdlib.h>
 int
 main ()
 {
@@ -22458,7 +22458,7 @@
 if test "$db_cv_atomic" = no; then
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
+#include <stdlib.h>
 int
 main ()
 {
@@ -23433,6 +23433,7 @@
 /* end confdefs.h.  */

 #include <sys/time.h>
+#include <time.h>
 int
 main ()
 {


code:
#!/bin/sh
# (C) 2016 rofl0r, licensed under the MIT license.
# the wave sound chunk was created with milkytracker's instrument editor
# and is licensed under the CC0 license.

write_silence() {
	local c="$1"
	while test $c -gt 16 ; do
		echo -ne "\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x7f"
		c=$(($c - 16))
	done
	while test $c -gt 0 ; do
		echo -ne "\x7f"
		c=$(($c - 1))
	done
}

write_chunk() {
echo -ne "\x7F\x7E\x7F\x7E\x7F\x7E\x7E\x7C\x7B\x7A\x79\x7A\x7B\x7D\x7F\x82"
echo -ne "\x85\x87\x88\x88\x87\x85\x81\x7D\x78\x74\x71\x6F\x70\x72\x76\x7C"
echo -ne "\x82\x89\x8E\x92\x94\x92\x8E\x88\x81\x78\x70\x6A\x66\x64\x67\x6C"
echo -ne "\x74\x7D\x88\x91\x99\x9D\x9E\x9B\x94\x8A\x7E\x72\x67\x5F\x5B\x5B"
echo -ne "\x5F\x68\x74\x81\x8F\x9B\xA4\xA9\xA8\xA2\x97\x88\x79\x69\x5C\x53"
echo -ne "\x4F\x51\x59\x66\x76\x88\x99\xA7\xB0\xB3\xB0\xA6\x97\x85\x71\x5F"
echo -ne "\x50\x47\x45\x49\x55\x67\x7B\x90\xA4\xB4\xBD\xBE\xB6\xA7\x94\x7F"
echo -ne "\x69\x58\x4A\x44\x46\x4E\x5B\x6E\x82\x95\xA5\xB0\xB5\xB2\xAA\x9C"
echo -ne "\x8B\x79\x68\x5A\x51\x4E\x51\x59\x66\x76\x86\x95\xA2\xA9\xAA\xA7"
echo -ne "\x9F\x92\x84\x75\x68\x5E\x59\x58\x5C\x64\x6F\x7C\x88\x93\x9C\xA0"
echo -ne "\xA0\x9C\x95\x8A\x7F\x74\x6B\x65\x61\x62\x66\x6D\x76\x80\x88\x90"
echo -ne "\x95\x97\x96\x92\x8C\x84\x7C\x76\x70\x6C\x6B\x6D\x70\x75\x7B\x81"
echo -ne "\x86\x8A\x8C\x8D\x8B\x89\x85\x80\x7C\x79\x76\x75\x75\x76\x79\x7B"
echo -ne "\x7E\x80\x82\x83\x83\x83\x82\x81\x7F\x7F\x7E\x7F\x7F\x7E\x7F"
}
bswap() {
	awk -v a="$1" \
	'BEGIN{print substr(a,7,2) substr(a,5,2) substr(a,3,2) substr(a,1,2);exit}'
}
escape_hex_word() {
	awk -v a="$1" \
	'BEGIN{print "\\x" substr(a,1,2) "\\x" substr(a,3,2) "\\x" substr(a,5,2) "\\x" substr(a,7,2);exit}'
}
write_hex_word() {
	echo -ne $(escape_hex_word $1)
}
write_word_le() {
	local h=$(printf "%08x" "$1")
	h=$(bswap $h)
	write_hex_word $h
}
write_header() {
	local sz="$1"
	echo -ne "RIFF"
	write_word_le $(($sz + 36))
	echo -ne "WAVEfmt "
	echo -ne "\x10\x00\x00\x00\x01\x00\x01\x00\xAB\x20\x00\x00\xAB\x20\x00\x00"
	echo -ne "\x01\x00\x08\x00data"
	write_word_le $sz
}
gen_wave() {
	local chunksz=223
	local chunkrep=10
	local sil=10
	local reps=1
	local dsize=$(($reps * ($chunksz * ($chunkrep + $sil))))
	local i=0
	write_header $dsize
	while test $i -lt $reps ; do
		local j=0
		while test $j -lt $chunkrep ; do
			write_chunk
			j=$(($j + 1))
		done
		write_silence $(($chunksz * $sil))
		i=$(($i + 1))
	done
}

gen_tune() {
	tmp=$(mktemp -u).wav
	gen_wave > "$tmp"
}
play_tune() {
	aplay "$tmp">/dev/null 2>&1
}
clear_tune() {
	rm "$tmp"
}
usage() {
cat << EOF >&2
sabotage alarmclock v1.0 (C) 2016 rofl0r
----------------------------------------
usage: $0 [--st=N] [--rep=N] hh:mm

will play an alarm tune using aplay at the specified time
(in european format i.e. hour values between 00 and 24).
if hour or minute are less than 10, a leading zero is required
(i.e. 08:05 rather than 8:5).

optional arguments:
--st  to adjust the sleep time in seconds between clock checks (default: $st)
--rep to adjust the number of times the sound is played        (default: $rep)

examples:
$0 --rep=10 --st=5 09:00
$0 18:25

make sure to activate your speakers and set the volume using alsamixer.
you can test the audio effect and volume with
$0 --test

current time: $(date "+%T (%Z)")
EOF
exit 1
}

st=29
rep=60

for p ; do
	case "$p" in
	--test)  gen_tune ; play_tune ; clear_tune ; exit 0 ;;
	--st=[0-9]*)  st=$(printf "%s" "$p"|cut -d "=" -f 2) ;;
	--rep=[0-9]*) rep=$(printf "%s" "$p"|cut -d "=" -f 2) ;;
	[0-2][0-9]:[0-5][0-9]) atime="$p" ;;
	*) usage ;;
	esac
done

[ -z "$atime" ] && usage

type aplay>/dev/null || \
{ echo "error: aplay not found. install alsa-utils." ; exit 1 ; }

ah=$(echo $atime | cut -d ":" -f 1)
am=$(echo $atime | cut -d ":" -f 2)

while : ; do
	ch=$(date +%H)
	cm=$(date +%M)
	if test x$ch = x$ah -a x$am = x$cm ; then
		gen_tune
		i="$rep"
		while test $i -gt 0 ; do
			play_tune
			i=$(($i - 1))
		done
		clear_tune
		return 0
	fi
	sleep $st
done

path: KEEP/bin/alarmclock


code:
#!/bin/sh
curr=$(cat /sys/class/power_supply/battery/charge_now)
full=$(cat /sys/class/power_supply/battery/charge_full)
printf "charge: %d%% (%d/%d)\n" $(($curr / ($full / 100))) "$curr" "$full"

path: KEEP/bin/battery