LENCODE

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
EXIT STATUS
NOTES
SEE ALSO
COPYRIGHT

NAME

lencode - associates a code to a provided value

SYNOPSIS

lencode [OPTION]... [FILE]...

DESCRIPTION

lencode may be used to create (or retrieve if already present) an association between a value (typically rather large) and a short code. This association must be done before ldecode(1) is called with the code (with same assocation_file and context) to retrieve the corresponding value.

The value must be passed to stdin. The generated (or retrieved) code corresponding to the value is output on stdout.

If generated, the code is generated after a checksum computed on the passed value in hexadecimal, with a length at least min_length (default is 1), but may be longer in case of conflict.

table may be:

a key

found in lmake.config.codecs in which case it is a local source file or an external dir.

a local source file

(symbolic links are followed) recording the association table.

an external dir

recording the association table.

In the former case, when an external dir, it must lie within a source dir. An external dir may contain a file LMAKE/file_sync containing one of none, dir or sync for choosing the method to ensure proper consistent operations. In absence of such a file, file_sync is determined automatically if possible from the filesystem type.

The dir must have read/write/execute access to any user needing to use the codec service, and if such accsses are at group level (but not other), it must have its setgid bit set.

Associations are usually created using lencode or lmake.encode but not necessarily (they can be created by hand).

Usage and use cases are more extensively documented the full open-lmake documentation.

OPTIONS

-t table, --table=table

table may be:

a key

found in lmake.config.codecs in which case it is a local source file or an external dir.

a local source file

(symbolic links are followed) recording the association table.

an external dir

recording the association table.

In the former case, when an external dir, it must lie within a source dir. An external dir may contain a file LMAKE/file_sync containing one of none, dir or sync for choosing the method to ensure proper consistent operations. In absence of such a file, file_sync is determined automatically if possible from the filesystem type.
-l
min_len, --min-len=min_len

specifies the minimum code length to use to encode value

The dir must read/write/execute access to any user needing to use the codec service, and if such accsses are at group level (but not other), it must have its setgid bit set.

EXAMPLES

touch my_codec_file

git add my_codec_file

lencode my_codec_file my_context 3 <<EOF

first line

second line

EOF

==>

3ab

ldecode my_codec_file my_context 3ab

==>

first line

second line

EXIT STATUS

lencode exits with a status of zero if the code could be decoded. Else it exits with a non-zero status:

1

the code was not found with given file and context

2

internal error, should not occur

11

bad usage : command line options and arguments coul not be parsed

NOTES

(1)

The same functionality is provided with the lmake.encode python function.

(2)

lencode and ldecode(1) are useful tools when the flow implies files whose names are impractical. This is a way to transform long filenames into much shorter ones by keeping an association table to retrieve long info from short codes.

(3)

Using this functionality may imply git(1) conflicts on the association table (when a local source) when several users independently create associations in their repos. This is fully dealt with and the only thing left to the user is to accept the resolution of the conflict without any action.

SEE ALSO

lautodep(1), lcache_repair(1), lcache_server(1), lcheck_deps(1), lcodec_repair(1), lcollect(1), ldebug(1), ldecode(1), ldepend(1), lforget(1), lmake(1), lmark(1), lmake_repair(1), lmake_server(1), lrun_cc(1), lshow(1), ltarget(1), xxhsum(1)

The python module lmake.

The full open-lmake documentation in <open-lmake-installation-dir>/docs/index.html.

COPYRIGHT

Copyright © 2023-2026, Doliam. This file is part of open-lmake.

open-lmake is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.

open-lmake is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.