Commit Graph

12 Commits

Author SHA1 Message Date
Karel Zak 3a07505a39 lib/jsonwrt: remove fputs_quoted_json_* functions from include/carefulputc.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-06 16:05:56 +02:00
Karel Zak 58b510e580 libsmartcols: sanitize variable names on export output
The shells are very restrictive about variable names, only [:alnum:]
chars are allowed (and alphabetic chars as the first char).  The
library will replace "bad" chars with "_". The char '%' at the end is
replaced by _PCT.

Addresses: https://github.com/karelzak/util-linux/issues/1201
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-12-03 12:14:10 +01:00
Rosen Penev 76b680b1a9
Remove isascii usage
There is a c_isascii function that can be used.

isascii is deprecated and not available with some libcs like uClibc-ng
where it can be compile time disabled.
2019-08-08 12:12:55 -07:00
Nik Nyby a7da792223 Fix typo in carefulputc.h
Signed-off-by: Nik Nyby <nikolas@gnu.org>
2017-10-25 00:19:19 -04:00
Karel Zak 1ca2661bb8 libsmartcols: Corrected JSON escaping
Based on patch set https://github.com/karelzak/util-linux/pull/331
from Fordi.

Addresses: https://github.com/karelzak/util-linux/issues/330
Co-Author: Bryan Elliott <fordiman@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-02 12:05:05 +02:00
Karel Zak 6a768b5516 libsmartcols: keep JSON field names lower-case
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-05 11:58:42 +02:00
Karel Zak cca51b9e45 include/carefulputc: encode also ' and $ in fputs_quoted() output
This change is important for commands linked with libsmartcols (e.g. lsblk(1))
to make it more safe for crazy scenarios like

   eval $(lsblk --fs --pairs /dev/sdb1)

where the command returns NAME="value" from filesystem LABELS (etc.)

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-27 13:36:09 +01:00
Sami Kerola c6d2d74ea0 include: simplify fputc_careful() in carefulputc.h
New version of comparisions does the same thing as the old without being
quite as difficult to understand.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:01 +01:00
Benno Schulenberg 459e95f391 include/carefulputc: remove a duplicate include
Also tweak a comment.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-05-06 11:09:22 +02:00
Karel Zak 78a3b0af30 include/carefulputc: cleanup and add fputs_{quoted,nonblank}()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03 12:29:16 +02:00
Sami Kerola ada6c48f06 include: carefulput: print determined char when unprintable char is found
This is done to allow reuse of the functin in last(1).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-23 10:58:48 +02:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00