1
0
mirror of https://github.com/systemd/systemd synced 2026-04-22 23:15:20 +02:00

Compare commits

..

No commits in common. "27a5281f4b58d4556dfae392957cc190555f663a" and "9c9a6123d78885f89775c4103fb6b3a1f0b8572b" have entirely different histories.

5 changed files with 49 additions and 54 deletions

View File

@ -4,8 +4,6 @@
# Explicitly enable certain checks which are hidden by default # Explicitly enable certain checks which are hidden by default
queries: queries:
- exclude: cpp/missing-return
# LGTM does not handle assert_not_reached() gracefully...
- include: cpp/bad-strncpy-size - include: cpp/bad-strncpy-size
- include: cpp/declaration-hides-variable - include: cpp/declaration-hides-variable
- include: cpp/inconsistent-null-check - include: cpp/inconsistent-null-check

View File

@ -4,7 +4,7 @@ project('systemd', 'c',
version : '250', version : '250',
license : 'LGPLv2+', license : 'LGPLv2+',
default_options: [ default_options: [
'c_std=gnu11', 'c_std=gnu99',
'prefix=/usr', 'prefix=/usr',
'sysconfdir=/etc', 'sysconfdir=/etc',
'localstatedir=/var', 'localstatedir=/var',

View File

@ -74,56 +74,56 @@ const char *special_glyph(SpecialGlyph code) {
/* UTF-8 */ /* UTF-8 */
[true] = { [true] = {
/* The following are multiple glyphs in both ASCII and in UNICODE */ /* The following are multiple glyphs in both ASCII and in UNICODE */
[SPECIAL_GLYPH_TREE_VERTICAL] = u8" ", [SPECIAL_GLYPH_TREE_VERTICAL] = "\342\224\202 ", /* │ */
[SPECIAL_GLYPH_TREE_BRANCH] = u8"├─", [SPECIAL_GLYPH_TREE_BRANCH] = "\342\224\234\342\224\200", /* ├─ */
[SPECIAL_GLYPH_TREE_RIGHT] = u8"└─", [SPECIAL_GLYPH_TREE_RIGHT] = "\342\224\224\342\224\200", /* └─ */
[SPECIAL_GLYPH_TREE_SPACE] = u8" ", [SPECIAL_GLYPH_TREE_SPACE] = " ", /* */
[SPECIAL_GLYPH_TREE_TOP] = u8"┌─", [SPECIAL_GLYPH_TREE_TOP] = "\u250C\342\224\200", /* ┌─ */
/* Single glyphs in both cases */ /* Single glyphs in both cases */
[SPECIAL_GLYPH_TRIANGULAR_BULLET] = u8"", [SPECIAL_GLYPH_TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
[SPECIAL_GLYPH_BLACK_CIRCLE] = u8"", [SPECIAL_GLYPH_BLACK_CIRCLE] = "\342\227\217", /* ● */
[SPECIAL_GLYPH_WHITE_CIRCLE] = u8"", [SPECIAL_GLYPH_WHITE_CIRCLE] = "\u25CB", /* ○ */
[SPECIAL_GLYPH_MULTIPLICATION_SIGN] = u8"×", [SPECIAL_GLYPH_MULTIPLICATION_SIGN] = "\u00D7", /* × */
[SPECIAL_GLYPH_CIRCLE_ARROW] = u8"", [SPECIAL_GLYPH_CIRCLE_ARROW] = "\u21BB", /* ↻ */
[SPECIAL_GLYPH_BULLET] = u8"", [SPECIAL_GLYPH_BULLET] = "\342\200\242", /* • */
[SPECIAL_GLYPH_MU] = u8"μ", /* actually called: GREEK SMALL LETTER MU */ [SPECIAL_GLYPH_MU] = "\316\274", /* μ (actually called: GREEK SMALL LETTER MU) */
[SPECIAL_GLYPH_CHECK_MARK] = u8"", [SPECIAL_GLYPH_CHECK_MARK] = "\342\234\223", /* ✓ */
[SPECIAL_GLYPH_CROSS_MARK] = u8"", /* actually called: BALLOT X */ [SPECIAL_GLYPH_CROSS_MARK] = "\342\234\227", /* ✗ (actually called: BALLOT X) */
[SPECIAL_GLYPH_LIGHT_SHADE] = u8"", [SPECIAL_GLYPH_LIGHT_SHADE] = "\342\226\221", /* ░ */
[SPECIAL_GLYPH_DARK_SHADE] = u8"", [SPECIAL_GLYPH_DARK_SHADE] = "\342\226\223", /* ▒ */
[SPECIAL_GLYPH_SIGMA] = u8"Σ", [SPECIAL_GLYPH_SIGMA] = "\316\243", /* Σ */
[SPECIAL_GLYPH_ARROW_UP] = u8"", /* actually called: UPWARDS ARROW */ [SPECIAL_GLYPH_ARROW_UP] = "\u2191", /* ↑ (actually called: UPWARDS ARROW) */
[SPECIAL_GLYPH_ARROW_DOWN] = u8"", /* actually called: DOWNWARDS ARROW */ [SPECIAL_GLYPH_ARROW_DOWN] = "\u2193", /* ↓ (actually called: DOWNWARDS ARROW) */
/* Single glyph in Unicode, two in ASCII */ /* Single glyph in Unicode, two in ASCII */
[SPECIAL_GLYPH_ARROW_RIGHT] = u8"", /* actually called: RIGHTWARDS ARROW */ [SPECIAL_GLYPH_ARROW_RIGHT] = "\342\206\222", /* → (actually called: RIGHTWARDS ARROW) */
/* Single glyph in Unicode, three in ASCII */ /* Single glyph in Unicode, three in ASCII */
[SPECIAL_GLYPH_ELLIPSIS] = u8"", /* actually called: HORIZONTAL ELLIPSIS */ [SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … (actually called: HORIZONTAL ELLIPSIS) */
/* Three glyphs in Unicode, five in ASCII */ /* Three glyphs in Unicode, five in ASCII */
[SPECIAL_GLYPH_EXTERNAL_LINK] = u8"[🡕]", /* actually called: NORTH EAST SANS-SERIF ARROW, enclosed in [] */ [SPECIAL_GLYPH_EXTERNAL_LINK] = "[\360\237\241\225]", /* 🡕 (actually called: NORTH EAST SANS-SERIF ARROW, enclosed in []) */
/* These smileys are a single glyph in Unicode, and three in ASCII */ /* These smileys are a single glyph in Unicode, and three in ASCII */
[SPECIAL_GLYPH_ECSTATIC_SMILEY] = u8"😇", /* actually called: SMILING FACE WITH HALO */ [SPECIAL_GLYPH_ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 (actually called: SMILING FACE WITH HALO) */
[SPECIAL_GLYPH_HAPPY_SMILEY] = u8"😀", /* actually called: GRINNING FACE */ [SPECIAL_GLYPH_HAPPY_SMILEY] = "\360\237\230\200", /* 😀 (actually called: GRINNING FACE) */
[SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = u8"🙂", /* actually called: SLIGHTLY SMILING FACE */ [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 (actually called: SLIGHTLY SMILING FACE) */
[SPECIAL_GLYPH_NEUTRAL_SMILEY] = u8"😐", /* actually called: NEUTRAL FACE */ [SPECIAL_GLYPH_NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 (actually called: NEUTRAL FACE) */
[SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = u8"🙁", /* actually called: SLIGHTLY FROWNING FACE */ [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 (actually called: SLIGHTLY FROWNING FACE) */
[SPECIAL_GLYPH_UNHAPPY_SMILEY] = u8"😨", /* actually called: FEARFUL FACE */ [SPECIAL_GLYPH_UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨 (actually called: FEARFUL FACE) */
[SPECIAL_GLYPH_DEPRESSED_SMILEY] = u8"🤢", /* actually called: NAUSEATED FACE */ [SPECIAL_GLYPH_DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 (actually called: NAUSEATED FACE) */
/* This emoji is a single character cell glyph in Unicode, and three in ASCII */ /* This emoji is a single character cell glyph in Unicode, and three in ASCII */
[SPECIAL_GLYPH_LOCK_AND_KEY] = u8"🔐", /* actually called: CLOSED LOCK WITH KEY */ [SPECIAL_GLYPH_LOCK_AND_KEY] = "\360\237\224\220", /* 🔐 (actually called: CLOSED LOCK WITH KEY) */
/* This emoji is a single character cell glyph in Unicode, and two in ASCII */ /* This emoji is a single character cell glyph in Unicode, and two in ASCII */
[SPECIAL_GLYPH_TOUCH] = u8"👆", /* actually called: BACKHAND INDEX POINTING UP */ [SPECIAL_GLYPH_TOUCH] = "\360\237\221\206", /* 👆 (actually called: BACKHAND INDEX POINTING UP) */
/* These three emojis are single character cell glyphs in Unicode and also in ASCII. */ /* These three emojis are single character cell glyphs in Unicode and also in ASCII. */
[SPECIAL_GLYPH_RECYCLING] = u8"♻️", /* actually called: UNIVERSAL RECYCLNG SYMBOL */ [SPECIAL_GLYPH_RECYCLING] = "\u267B\uFE0F ", /* ♻️ (actually called: UNIVERSAL RECYCLNG SYMBOL) */
[SPECIAL_GLYPH_DOWNLOAD] = u8"⤵️", /* actually called: RIGHT ARROW CURVING DOWN */ [SPECIAL_GLYPH_DOWNLOAD] = "\u2935\uFE0F ", /* ⤵️ (actually called: RIGHT ARROW CURVING DOWN) */
[SPECIAL_GLYPH_SPARKLES] = u8"", [SPECIAL_GLYPH_SPARKLES] = "\u2728", /* ✨ */
}, },
}; };

View File

@ -55,21 +55,21 @@ typedef struct StatusInfo {
static const char* chassis_string_to_glyph(const char *chassis) { static const char* chassis_string_to_glyph(const char *chassis) {
if (streq_ptr(chassis, "laptop")) if (streq_ptr(chassis, "laptop"))
return u8"💻"; /* Personal Computer */ return "\U0001F4BB"; /* Personal Computer */
if (streq_ptr(chassis, "desktop")) if (streq_ptr(chassis, "desktop"))
return u8"🖥️"; /* Desktop Computer */ return "\U0001F5A5"; /* Desktop Computer */
if (streq_ptr(chassis, "server")) if (streq_ptr(chassis, "server"))
return u8"🖳"; /* Old Personal Computer */ return "\U0001F5B3"; /* Old Personal Computer */
if (streq_ptr(chassis, "tablet")) if (streq_ptr(chassis, "tablet"))
return u8""; /* Ideograph tool, implement; draw up, write, looks vaguely tabletty */ return "\u5177"; /* Ideograph tool, implement; draw up, write, looks vaguely tabletty */
if (streq_ptr(chassis, "watch")) if (streq_ptr(chassis, "watch"))
return u8""; /* Watch */ return "\u231A"; /* Watch */
if (streq_ptr(chassis, "handset")) if (streq_ptr(chassis, "handset"))
return u8"🕻"; /* Left Hand Telephone Receiver */ return "\U0001F57B"; /* Left Hand Telephone Receiver */
if (streq_ptr(chassis, "vm")) if (streq_ptr(chassis, "vm"))
return u8"🖴"; /* Hard disk */ return "\U0001F5B4"; /* Hard disk */
if (streq_ptr(chassis, "container")) if (streq_ptr(chassis, "container"))
return u8""; /* Ballot Box */ return "\u2610"; /* Ballot Box */
return NULL; return NULL;
} }

View File

@ -11,9 +11,6 @@
#include "terminal-util.h" #include "terminal-util.h"
#define ANSI_WHITE_ON_BLACK "\033[40;37;1m" #define ANSI_WHITE_ON_BLACK "\033[40;37;1m"
#define UNICODE_FULL_BLOCK u8"█"
#define UNICODE_LOWER_HALF_BLOCK u8"▄"
#define UNICODE_UPPER_HALF_BLOCK u8"▀"
static void *qrcode_dl = NULL; static void *qrcode_dl = NULL;
@ -33,7 +30,7 @@ static void print_border(FILE *output, unsigned width) {
fputs(ANSI_WHITE_ON_BLACK, output); fputs(ANSI_WHITE_ON_BLACK, output);
for (unsigned x = 0; x < 4 + width + 4; x++) for (unsigned x = 0; x < 4 + width + 4; x++)
fputs(UNICODE_FULL_BLOCK, output); fputs("\342\226\210", output);
fputs(ANSI_NORMAL "\n", output); fputs(ANSI_NORMAL "\n", output);
} }
@ -53,7 +50,7 @@ static void write_qrcode(FILE *output, QRcode *qr) {
fputs(ANSI_WHITE_ON_BLACK, output); fputs(ANSI_WHITE_ON_BLACK, output);
for (unsigned x = 0; x < 4; x++) for (unsigned x = 0; x < 4; x++)
fputs(UNICODE_FULL_BLOCK, output); fputs("\342\226\210", output);
for (unsigned x = 0; x < (unsigned) qr->width; x++) { for (unsigned x = 0; x < (unsigned) qr->width; x++) {
bool a, b; bool a, b;
@ -64,15 +61,15 @@ static void write_qrcode(FILE *output, QRcode *qr) {
if (a && b) if (a && b)
fputc(' ', output); fputc(' ', output);
else if (a) else if (a)
fputs(UNICODE_LOWER_HALF_BLOCK, output); fputs("\342\226\204", output);
else if (b) else if (b)
fputs(UNICODE_UPPER_HALF_BLOCK, output); fputs("\342\226\200", output);
else else
fputs(UNICODE_FULL_BLOCK, output); fputs("\342\226\210", output);
} }
for (unsigned x = 0; x < 4; x++) for (unsigned x = 0; x < 4; x++)
fputs(UNICODE_FULL_BLOCK, output); fputs("\342\226\210", output);
fputs(ANSI_NORMAL "\n", output); fputs(ANSI_NORMAL "\n", output);
} }