mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Add help dialog to Blinkenlights emulator
This commit is contained in:
parent
02b4a5c824
commit
5f1415af3a
9 changed files with 248 additions and 147 deletions
|
@ -16,8 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
|
@ -37,26 +35,24 @@
|
|||
* @see gc()
|
||||
*/
|
||||
char *(xstrcat)(const char *s, ...) {
|
||||
char *p, b[2];
|
||||
va_list va;
|
||||
size_t i, n, n2, l;
|
||||
size_t n, m;
|
||||
char *p, b[2];
|
||||
p = NULL;
|
||||
i = n = 0;
|
||||
n = 0;
|
||||
va_start(va, s);
|
||||
do {
|
||||
if ((intptr_t)s > 0 && (intptr_t)s <= 255) {
|
||||
b[0] = (unsigned char)(intptr_t)s;
|
||||
b[1] = '\0';
|
||||
s = b;
|
||||
l = 1;
|
||||
m = 1;
|
||||
} else {
|
||||
l = strlen(s);
|
||||
m = strlen(s);
|
||||
}
|
||||
if ((n2 = i + l + 16) >= n) {
|
||||
p = xrealloc(p, (n = n2 + (n2 >> 1)));
|
||||
}
|
||||
memcpy(p + i, s, l + 1);
|
||||
i += l;
|
||||
p = xrealloc(p, n + m + 1);
|
||||
memcpy(p + n, s, m + 1);
|
||||
n += m;
|
||||
} while ((s = va_arg(va, const char *)));
|
||||
va_end(va);
|
||||
return p;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue