ORT-C-SOURCE(1)

NAME
ort-c-source - produce ort C API implementation

SYNOPSIS
ort-c-source [-jJv] [-h header[,header...]] [-I djv] [-N d] [-S sharedir] [config...]

DESCRIPTION
The ort-c-source utility accepts ort(5) config files, defaulting to standard input, and produces a C implementation of the API generated by ort-c-header(1). Its arguments are as follows:

-h header[,header...]
    Include the set of comma-separated header files header. These headers should be generated by ort-c-header(1).

-I djv
    Which headers are depended upon by -h inclusion. This may include d for database input declarations, j for JSON export declarations, and/or (v) for data validators.

-j  Output JSON output implementation.

-J  Output JSON input implementation.

-v  Output data validator implementation.

-N d
    Disable production of output, which may currently only be d to suppresses the database input implementations.

-S sharedir
    Directory containing external source files used for compatibility. The default is to use the install-time directory.

The complexity of -h and -I is to allow for multiple headers with multiple implementations. For example, a header with the JSON API requires -I j, but the implementation may not specify -j itself, although it must include dependent headers for the JSON API.

By default, the database input and data structures definitions are output with a header file of db.h.

All C code produced by ort-c-source conforms with the style(9) manual of OpenBSD.

  Hashing
The password hashing facility defined in ort(5) is implemented differently on different systems. On OpenBSD, it uses the crypt_newhash(3) and crypt_checkpass(3) functionality. On all other systems, it uses the traditional crypt(3) with an MD5 ("$1") setting. The seed is generated using random(3), so the calling application should invoke srandom(3).

  Portability
The code output by ort-c-source is currently not portable between systems. This is due to code being generated that is available on the system where ort-c-source is executed, for example, whether crypt_newhash() or b64_ntop() are usable. Future version of the system may have flags for generating portable code that bundles in all non-portable functions.

EXIT STATUS

EXAMPLES
In the simplest case, put all C sources and headers (for validation, database routines, and JSON output) into one pair of files. Let foo.ort be the configuration file.

    % ort-c-header -jv foo.ort > db.h
    % ort-c-source -jv foo.ort > db.c

Breaking up into two header and source files: one for basic database functions, the other for JSON output.

    % ort-c-header foo.ort > db.h
    % ort-c-header -g JSON_H -j -Nbd foo.ort > json.h
    % ort-c-source -h db.h > db.c
    % ort-c-source -j -Nd -Idj -h db.h,json.h > json.c

In this more complicated snippet, the json.h file is created without structure or database information using -N, -then json.c needs to include both database and JSON headers (in name, -h, and in the headers those stipulated in source, -I) also while inhibiting database routine creation with -N.

SEE ALSO
ort-c-header(1), ort-c-manpage(1)