Compare commits

...

3 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 717c301207
lxdrgen: fix decapitalization
decapitalize() is typically called on snaketocamel() output,
which always makes the first letter uppercase.
2023-06-28 16:24:59 +02:00
Přemysl Eric Janouch 091f92bab3
liberty-xui: fix a build warning
On macOS, TIOCGWINSZ seems to be defined earlier.
2023-06-28 16:24:59 +02:00
Přemysl Eric Janouch 556c25855e
Fix a CMake warning 2023-06-20 01:24:29 +02:00
3 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,5 @@
project (liberty C)
cmake_minimum_required (VERSION 2.8.12)
project (liberty C)
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)

View File

@ -47,9 +47,9 @@
#include <unicase.h>
#include <termios.h>
#ifndef TIOCGWINSZ
#ifdef HAVE_RESIZETERM
#include <sys/ioctl.h>
#endif // ! TIOCGWINSZ
#endif // HAVE_RESIZETERM
// ncurses is notoriously retarded for input handling, and in past versions
// used to process mouse events unreliably. Moreover, rxvt-unicode only

View File

@ -1,6 +1,6 @@
# lxdrgen.awk: an XDR-derived code generator for network protocols.
#
# Copyright (c) 2022, Přemysl Eric Janouch <p@janouch.name>
# Copyright (c) 2022 - 2023, Přemysl Eric Janouch <p@janouch.name>
# SPDX-License-Identifier: 0BSD
#
# Usage: env LC_ALL=C awk -f lxdrgen.awk -f lxdrgen-{c,go,mjs}.awk \
@ -28,9 +28,10 @@ function snaketocamel(s) {
}
function decapitalize(s) {
if (match(s, /[[:upper:]][[:lower:]]/)) {
if (match(s, /^[[:upper:]][[:lower:]]/))
return tolower(substr(s, 1, 1)) substr(s, 2)
}
if (match(s, /^[[:upper:]]$/))
return tolower(s)
return s
}