ad2c(1) ad2c(1)
NAME
ad2c - convert resource files to C declarations
SYNOPSIS
ad2c [ files ]
DESCRIPTION
Ad2c converts X resource files into C declarations, appro-
priate for inclusion as fallback resources. The program
is a sed script which is effectively a finite state
machine, escaping quotes and backslashes (and newlines
where necessary), and adding quotes and commas as needed
for array initialization.
It reads from the given files (or stdin if none are given)
and writes the C declarations to stdout.
USAGE
The following example shows a typical use of ad2c to
ensure that an application always has the latest version
of its resources compiled into the executable. Suppose
the application defaults file is named "Foobar.ad", for
application foobar. Then the following lines in a Make-
file or Imakefile will indicate how and when to run ad2c:
Foobar.ad.h: Foobar.ad
ad2c Foobar.ad >Foobar.ad.h
The resulting C strings should be included (say in "foo-
bar.c"):
static char fallback_resources[] = {
#include "Foobar.ad.h"
}
Running makedepend or adding the line
foobar.c: Foobar.ad.h
to the Makefile or Imakefile will ensure that "foobar.c"
is recompiled when necessary (ie., whenever "Foobar.ad"
changes).
RETURN VALUE
Ad2c returns as for sed.
DISCLAIMER
This software is provided as is with no warranty expressed
or implied. I hope you find it useful, but I won't be
held responsable for any damage that may occur from read-
ing, compiling, installing or using it.
You are free to use any part of this code for other pur-
poses. It would be nice if you could keep my name on some
22 Jul 1991 1
ad2c(1) ad2c(1)
part of whatever the final product is.
AUTHOR
George Ferguson, ferguson@cs.rochester.edu.
Man page by Joseph Beckenbach, jerbil@ultra.com. Usage
section added by George Ferguson.
22 Jul 1991 2