diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-24 23:50:43 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-24 23:50:43 +0200 |
| commit | 65ba7113e3da696f8e2ebf48658b1f71967d030b (patch) | |
| tree | d2ffb0b4db727c37c707c888caf17f24fbd1d645 /libbb | |
| parent | d526b118977808c773dcb876368e4a440f74b62f (diff) | |
| download | busybox-w32-65ba7113e3da696f8e2ebf48658b1f71967d030b.tar.gz busybox-w32-65ba7113e3da696f8e2ebf48658b1f71967d030b.tar.bz2 busybox-w32-65ba7113e3da696f8e2ebf48658b1f71967d030b.zip | |
libbb: handle \S in /etc/issue
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/login.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libbb/login.c b/libbb/login.c index 8f080b775..5a7acfcf0 100644 --- a/libbb/login.c +++ b/libbb/login.c | |||
| @@ -45,6 +45,45 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | |||
| 45 | if (c == '\\' || c == '%') { | 45 | if (c == '\\' || c == '%') { |
| 46 | c = fgetc(fp); | 46 | c = fgetc(fp); |
| 47 | switch (c) { | 47 | switch (c) { |
| 48 | //From getty manpage (* - supported by us) | ||
| 49 | //======================================== | ||
| 50 | //4 or 4{interface} | ||
| 51 | // Insert the IPv4 address of the network interface (example: \4{eth0}). | ||
| 52 | // If the interface argument is not specified, then select the first | ||
| 53 | // fully configured (UP, non-LOOPBACK, RUNNING) interface. | ||
| 54 | //6 or 6{interface} -- The same as \4 but for IPv6. | ||
| 55 | //b -- Insert the baudrate of the current line. | ||
| 56 | //*d -- Insert the current date. | ||
| 57 | //*t -- Insert the current time. | ||
| 58 | //e or e{name} | ||
| 59 | // Translate the human-readable name to an escape sequence and insert it | ||
| 60 | // (for example: \e{red}Alert text.\e{reset}). If the name argument | ||
| 61 | // is not specified, then insert \033. The currently supported names are: | ||
| 62 | // black, blink, blue, bold, brown, cyan, darkgray, gray, green, halfbright, | ||
| 63 | // lightblue, lightcyan, lightgray, lightgreen, lightmagenta, lightred, | ||
| 64 | // magenta, red, reset, reverse, and yellow. Unknown names are ignored. | ||
| 65 | //*s | ||
| 66 | // Insert the system name (the name of the operating system - `uname -s`) | ||
| 67 | //*S or S{VARIABLE} | ||
| 68 | // Insert the VARIABLE data from /etc/os-release. | ||
| 69 | // If the VARIABLE argument is not specified, use PRETTY_NAME. | ||
| 70 | // If PRETTY_NAME is not in /etc/os-release, \S is the same as \s. | ||
| 71 | //*l -- Insert the name of the current tty line. | ||
| 72 | //*m -- Insert the architecture identifier of the machine: `uname -m`. | ||
| 73 | //*n -- Insert the nodename of the machine: `uname -n`. | ||
| 74 | //*o -- Insert the NIS domainname of the machine. Same as `hostname -d'. | ||
| 75 | //*O -- Insert the DNS domainname of the machine. | ||
| 76 | //*r -- Insert the release number of the OS: `uname -r`. | ||
| 77 | //u -- Insert the number of current users logged in. | ||
| 78 | //U -- Insert the string "1 user" or "N users" (current users logged in). | ||
| 79 | //*v -- Insert the version of the OS, e.g. the build-date etc: `uname -v`. | ||
| 80 | //We also implement: | ||
| 81 | //*D -- same as \O "DNS domainname" | ||
| 82 | //*h -- same as \n "nodename" | ||
| 83 | |||
| 84 | case 'S': | ||
| 85 | /* minimal implementation, not reading /etc/os-release */ | ||
| 86 | /*FALLTHROUGH*/ | ||
| 48 | case 's': | 87 | case 's': |
| 49 | outbuf = uts.sysname; | 88 | outbuf = uts.sysname; |
| 50 | break; | 89 | break; |
| @@ -65,6 +104,7 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | |||
| 65 | #if defined(__linux__) | 104 | #if defined(__linux__) |
| 66 | case 'D': | 105 | case 'D': |
| 67 | case 'o': | 106 | case 'o': |
| 107 | case 'O': | ||
| 68 | outbuf = uts.domainname; | 108 | outbuf = uts.domainname; |
| 69 | break; | 109 | break; |
| 70 | #endif | 110 | #endif |
