libosmocore/include/osmocom
Neels Hofmeyr 04eb56f146 add osmo_quote_str(),osmo_quote_str_buf() and test
Rationale: with osmo_escape_str(), you get the escaped contents of the string,
but not so graceful handling of NULL strings. The caller needs to quote it, and
for NULL strings not quote it.

osmo_quote_str() is like osmo_escape_str() but always quotes a non-NULL string,
and for a NULL string returns a literal NULL, i.e. it should (tm) give the
exact C representation of a string.

That's useful in testing, to show exactly what char* situation we have, without
jumping through hoops like
  if (str)
  	printf("\"%s\"", osmo_escape_str(str, -1));
  else
  	printf("NULL");

Copy the unit test for osmo_escape_str() and adjust. To indicate that the
double quotes are returned by osmo_quote_str(), use single quotes in the test
printf()s.

I considered allowing to pick the quoting characters by further arguments, but
that complicates things: we'd need to escape the quoting characters. Just
hardcode double quotes like C.

Change-Id: I6f1b3709b32c23fc52f70ad9ecc9439c62b02a12
2018-04-09 15:56:14 +00:00
..
codec libosmocodec: implement ECU (Error Concealment Unit) for FR 2018-01-15 20:12:03 +00:00
coding coding: Add BER-reporting RACH decode functions 2018-02-26 12:26:38 +01:00
core add osmo_quote_str(),osmo_quote_str_buf() and test 2018-04-09 15:56:14 +00:00
crypt add osmo_auth_c3() (separate from gsm_milenage()) 2017-12-18 23:05:24 +00:00
ctrl ctrl: fix deferred commands (and hence fix osmo-bts-sysmo 'clock-info' cmd) 2018-04-05 03:11:49 +02:00
gprs Add function to properly encode RAI 2018-01-08 13:02:07 +00:00
gsm gsm0480: copy the raw USSD data, its DCS and length 2018-04-04 20:22:13 +07:00
sim doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
vty ports.h: Add VTY and CTRL ports for osmo-trx 2018-02-22 08:03:06 +00:00