Commit graph

30 commits

Author SHA1 Message Date
Kay Sievers a095315b3c build-sys: split internal basic/ library from shared/
basic/      can be used by everything
            cannot use anything outside of basic/

libsystemd/ can use basic/
            cannot use shared/

shared/     can use libsystemd/
2015-06-11 10:52:46 +02:00
Lennart Poettering f3ee629711 util: when unescaping C escape sequences support C++11 \u and \U unicode literals
We simply recode them in utf8.
2015-04-10 11:28:34 +02:00
Tom Gundersen 04166cb7dd shared: utf8 - support decoding the full utf16
We originally only supported the BMP (i.e., we treated UTF-16 as UCS-2).
2014-12-22 20:26:53 +01:00
Tom Gundersen 2bb4c7e384 shared: utf8 - support ucs4 -> utf8
Originally we only supported ucs2, so move the ucs4 version from libsystemd-terminal to shared
and use that everywhere.
2014-12-22 20:26:53 +01:00
Susant Sahani b0ceb53a7d fix compiler warning
src/shared/utf8.c:268:13: warning: unused variable 'd'
[-Wunused-variable]
         int d;
2014-12-16 00:30:34 -05:00
Lennart Poettering e7eebcfc42 shared: add minimal JSON tokenizer 2014-12-15 22:27:15 +01:00
Lennart Poettering 6ed62be0b1 utf8: minor simplifications 2014-12-04 02:36:04 +01:00
Lennart Poettering 3c6d3052d3 utf8: when escaping unprintable unichars, escape the whole unichar, not just the first byte of it 2014-12-04 02:27:14 +01:00
WaLyong Cho fec8457652 utf8: intruduce utf8_escape_non_printable 2014-12-04 02:09:44 +01:00
Lennart Poettering 144b3d9e09 utf8: when looking at the next unichar, honour the size parameter, in utf8_is_printable_newline() 2014-11-07 16:36:14 +01:00
Lennart Poettering 7e8185ef94 fix a couple of more lazy "return -1"
Fix should strictly follow the rule to return negative errno-style
error codes from functions, hence let's fix more "return -1"-style
lazinesses.
2014-08-11 18:35:54 +02:00
Zbigniew Jędrzejewski-Szmek 0ade5ffe27 journal: fix export of messages containing newlines
In "export" format, newlines are significant, and messages containing
newlines must be exported as "binary".
2014-04-05 00:42:01 -04:00
Zbigniew Jędrzejewski-Szmek 550a40eceb core: do not print invalid utf-8 in error messages 2014-02-08 13:07:39 -05:00
Lennart Poettering faaa5728d9 utf8: export utf8 validation functions as part of sd-bus
To write useful bus code clients need to validate utf8 frequently since
the bus reacts allergic to it. Since glibc does not provide any calls
for this, let's provide it as part of libsystemd-bus.
2013-11-07 03:07:40 +01:00
Lennart Poettering 23c62e05b3 utf8: ascii_filter() is unused, let's remove it 2013-11-07 03:06:37 +01:00
Shawn Landden f405e86de3 util, utf8: make ellipsize take multi-byte characters into account
rename old versions to ascii_*

Do not take into account zerowidth characters, but do consider double-wide characters.
Import needed utf8 helper code from glib.

v3: rebase ontop of utf8 restructuring work

[zj: tweak the algorithm a bit, move new code to separate file]
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek a7176505e0 utf8: fix utf8_is_printable 2013-10-05 22:59:43 -04:00
Kay Sievers 036ae95ac4 shared: device-nodes - add include guard 2013-09-24 15:34:57 +02:00
Dave Reisner 8f6ce71fe7 device-nodes: move device node specific code to own file
In the process, rename udev_encode_string which is poorly named for what
it does. It deals specifically with encoding names that udev creates and
has its own rules: utf8 is valid but some ascii is not (e.g. path
separators), and everything else is simply escaped. Rename it to
encode_devnode_name.
2013-09-19 11:50:34 -04:00
Dave Reisner 7991ac34ab shared/utf8: merge implementations, remove cruft
This unifies the utf8 handling code which was previously duplicated in
udev and systemd.
2013-09-19 11:49:03 -04:00
Dave Reisner 02a36bc9a1 move utf8 functions from libudev-private.h to utf8.h
There's now some more obvious overlap amongst the two utf8 validation
functions, but no more than there already was previously.

This also adds some menial tests for anyone who wants to do more
merging of these two in the future.
2013-09-17 16:31:32 -04:00
Zbigniew Jędrzejewski-Szmek 31f7bf1994 logs-show: print multiline messages
[    0.019862] fedora kernel: CPU0: Thermal monitoring enabled (TM1)
[    0.019900] fedora kernel: Last level iTLB entries: 4KB 512, 2MB 0, 4MB 0
                              Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32
                              tlb_flushall_shift: 5
[    0.020118] fedora kernel: Freeing SMP alternatives: 24k freed
2013-06-09 13:49:38 -04:00
Kay Sievers 7b4d7cc082 bootctl: add boot loader and firmware interface tool 2013-02-11 19:35:52 +01:00
Lennart Poettering 2e3d069236 core: if the bootloader supports it, determine firmware and boot loader delay
This allows us to print simple performance data of all parts of the boot now:

- firmware
- boot loader
- kernel
- initrd
- userspace

This only works for bootloaders which support passing TSC data via EFI
variables. As of now that's only gummiboot.
2013-01-19 04:22:09 +01:00
Sami Kerola 23757887f7 licence: remove references to old FSF address
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57206
2012-12-17 11:41:31 +01:00
Dave Reisner fd5b4ca11e shared/utf8: mark char* as const
Avoids compiler warning:

  src/shared/utf8.c: In function 'ascii_filter':
  src/shared/utf8.c:278:16: warning: assignment discards 'const' qualifier
      from pointer target type [enabled by default]
2012-08-10 17:59:39 +02:00
Lennart Poettering 64825d3c58 fix a couple of issues found with llvm-analyze 2012-08-08 23:54:21 +02:00
Zbigniew Jędrzejewski-Szmek ba961854dd journalctl: show any printable Unicode character
This makes sure we are OK in outputting all valid, non-control UTF-8
characters, instead of just printable 7bit ASCII.
2012-07-13 01:07:41 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Kay Sievers d7832d2c6e util: move all to shared/ and split external dependencies in separate internal libraries
Before:
  $ ldd /lib/systemd/systemd-timestamp
  linux-vdso.so.1 =>  (0x00007fffb05ff000)
  libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f90aac57000)
  libcap.so.2 => /lib64/libcap.so.2 (0x00007f90aaa53000)
  librt.so.1 => /lib64/librt.so.1 (0x00007f90aa84a000)
  libc.so.6 => /lib64/libc.so.6 (0x00007f90aa494000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f90aae90000)
  libdl.so.2 => /lib64/libdl.so.2 (0x00007f90aa290000)
  libattr.so.1 => /lib64/libattr.so.1 (0x00007f90aa08a000)
  libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f90a9e6e000)

After:
  $ ldd systemd-timestamp
  linux-vdso.so.1 =>  (0x00007fff3cbff000)
  libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5eaa1c3000)
  librt.so.1 => /lib64/librt.so.1 (0x00007f5ea9fbb000)
  libc.so.6 => /lib64/libc.so.6 (0x00007f5ea9c04000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f5eaa3fc000)
  libdl.so.2 => /lib64/libdl.so.2 (0x00007f5ea9a00000)
  libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5ea97e4000)
2012-04-10 14:13:38 +02:00
Renamed from src/utf8.c (Browse further)