]> andersk Git - config-package-dev.git/blame - encode
Set LC_ALL=C when matching potentially localized dpkg output
[config-package-dev.git] / encode
CommitLineData
ab8e2a67
TA
1#!/usr/bin/perl
2# Encode name of a file in a Debian package name.
3#
ab8e2a67
TA
4# The purpose of this encoding is to cause Debian configuration
5# packages (potentially from different sites) that divert the same
6# configuration file to conflict with each other. Thus, it is
7# important that all sites using this Debian configuration package
8# system use this encoding.
9#
10# This encoding is intended to be human-readable, so that users can
11# determine the cause of conflicts between different configuration
12# packages.
7a1d9a7c
AK
13
14use strict;
15use warnings;
ab8e2a67 16
ab8e2a67 17$ARGV[0] =~ s,^/,,;
7a1d9a7c 18foreach (split('', $ARGV[0])) {
ab8e2a67
TA
19 if (m/[a-z0-9.-]/) {
20 print "$_";
21 } elsif (m/[A-Z]/) {
22 print "+".lc($_)."+";
23 } elsif ($_ eq '/') {
24 print "++";
25 } elsif ($_ eq '_') {
26 print "+-+";
27 } else{
28 print "+x".hex(ord($_))."+";
29 }
30}
This page took 0.260965 seconds and 5 git commands to generate.