Multiple changes stderr -> thread_stderr, bug fix in ls

This commit is contained in:
HOLZSCHUCH Nicolas 2020-11-24 19:05:20 +01:00
parent d62e3c660b
commit d46917950b
17 changed files with 50 additions and 48 deletions

View File

@ -13,42 +13,42 @@ let package = Package(
.binaryTarget(
name: "awk",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/awk.xcframework.zip",
checksum: "d5cbe95490a244207c1aea0f7918d9f071d4a8c3a2e9d939fbc160af485c0ba0"
checksum: "bd9cb1dbf46d22ceb3a836a9bf14de70aba60177308bdc0b6eca4d8fa2d91279"
),
.binaryTarget(
name: "curl_ios",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/curl_ios.xcframework.zip",
checksum: "d8780dcf1e64e1abe9bea3d5281c26ebada9c8769c6a75273736aabde5d370d3"
checksum: "ebbc2d1904284482b03a788d4add954887f8830984eac9c46b838a1e08194a8c"
),
.binaryTarget(
name: "files",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/files.xcframework.zip",
checksum: "a3f37618b50d403113d477775811ee4db0c3f27a306a68e9a9f04114698d7e1c"
checksum: "50228e50b31f05ec347897c9cbc758bdc1a8b1a632fc3189e90d8e3ea0fa5875"
),
.binaryTarget(
name: "ios_system",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/ios_system.xcframework.zip",
checksum: "036b35f77bf31c6b651ca5d0944b8219179c954f8d9e73b7bb96e0bd0d438447"
checksum: "a0e925e755e1c7a20d4bfc1a51f76cd6a6aad30e6146287b416ea22a4330315b"
),
.binaryTarget(
name: "shell",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/shell.xcframework.zip",
checksum: "7a8a5ad7496089f45a0f9da39a1f1c44aa1aa1cf913ca57683df27e1798168c4"
checksum: "86c054231e81e3a9696432fa3c654d8bce3b5955844eae2bbd06d13df00fd033"
),
.binaryTarget(
name: "ssh_cmd",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/ssh_cmd.xcframework.zip",
checksum: "315a6448decd4d76c4d92701b15151444dc0261a1b0681b7d95a7d081a39d3fa"
checksum: "64004658541d9a3f2baa3aacca257aa8d9eb9388e1963bac2a7605320952aa13"
),
.binaryTarget(
name: "tar",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/tar.xcframework.zip",
checksum: "ee812634ab1dff10fa79d19782723c1b9624f6ce0146509a91cc3ebff247fb27"
checksum: "d8aff2597e7d4da8654fb470de9eb660968ecff20ef21d439bb244680184d2df"
),
.binaryTarget(
name: "text",
url: "https://github.com/holzschu/ios_system/releases/download/2.6/text.xcframework.zip",
checksum: "b6a733aa525cf191151197c97736a94a65fb0b690b3cba1d6ba65d8f4777bf79"
checksum: "6f710c0dd7ed8ab0fe4fbf3aaaac1f040798eeea1ebc4898aa2c54e19b70d90e"
),
.binaryTarget(
name: "mandoc",

View File

@ -234,19 +234,19 @@ void freetr(Node *p) /* free parse tree */
switch (type(p)) {
ELEAF
LEAF
fprintf(stderr, "Freeing leaf %x\n", p); fflush(stderr);
// fprintf(stderr, "Freeing leaf %x\n", p); fflush(stderr);
xfree(p);
break;
UNARY
freetr(left(p));
fprintf(stderr, "Freeing unary %x\n", p); fflush(stderr);
// fprintf(stderr, "Freeing unary %x\n", p); fflush(stderr);
xfree(p);
break;
case CAT:
case OR:
freetr(left(p));
freetr(right(p));
fprintf(stderr, "Freeing tree %x\n", p); fflush(stderr);
// fprintf(stderr, "Freeing tree %x\n", p); fflush(stderr);
xfree(p);
break;
default: /* can't happen */

View File

@ -211,7 +211,7 @@ diff_main(int argc, char **argv)
break;
case 'l':
// lflag = 1;
fprintf(stderr, "-l option is deactivated on iOS\n");
fprintf(thread_stderr, "-l option is deactivated on iOS\n");
break;
case 'N':
Nflag = 1;
@ -481,7 +481,7 @@ print_status(int val, char *path1, char *path2, const char *entry)
void
usage(void)
{
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: diff [-abdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]\n"
" [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]\n"
" [-I pattern] [-L label] file1 file2\n"

View File

@ -176,7 +176,7 @@ find_main(int argc, char *argv[])
static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
(void)fprintf(thread_stderr, "%s\n%s\n",
"usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]",
" find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]");
exit(1);

View File

@ -128,19 +128,19 @@ queryuser(char *argv[])
{
char *p, resp[256];
(void)fprintf(stderr, "\"%s", *argv);
(void)fprintf(thread_stderr, "\"%s", *argv);
while (*++argv)
(void)fprintf(stderr, " %s", *argv);
(void)fprintf(stderr, "\"? ");
(void)fflush(stderr);
(void)fprintf(thread_stderr, " %s", *argv);
(void)fprintf(thread_stderr, "\"? ");
(void)fflush(thread_stderr);
if (fgets(resp, sizeof(resp), stdin) == NULL)
*resp = '\0';
if ((p = strchr(resp, '\n')) != NULL)
*p = '\0';
else {
(void)fprintf(stderr, "\n");
(void)fflush(stderr);
(void)fprintf(thread_stderr, "\n");
(void)fflush(thread_stderr);
}
return (rpmatch(resp) == 1);
}

View File

@ -208,7 +208,7 @@ chflags_main(int argc, char *argv[])
static void
usage(void)
{
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: chflags [-fhv] [-R [-H | -L | -P]] flags file ...\n");
exit(1);
}

View File

@ -458,11 +458,11 @@ void
chmod_usage(void)
{
#ifdef __APPLE__
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage:\tchmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ...\n"
"\tchmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...\n"); /* add -A and -V when implemented */
#else
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: chmod [-fhv] [-R [-H | -L | -P]] mode file ...\n");
#endif /* __APPLE__ */
exit(1);

View File

@ -310,12 +310,12 @@ usage(void)
{
if (ischown)
(void)fprintf(stderr, "%s\n%s\n",
(void)fprintf(thread_stderr, "%s\n%s\n",
"usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
" file ...",
" chown [-fhv] [-R [-H | -L | -P]] :group file ...");
else
(void)fprintf(stderr, "%s\n",
(void)fprintf(thread_stderr, "%s\n",
"usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
exit(1);
}

View File

@ -145,7 +145,7 @@ chksum_main(int argc, char **argv)
static void
usage(void)
{
(void)fprintf(stderr, "usage: cksum [-o 1 | 2 | 3] [file ...]\n");
(void)fprintf(stderr, " sum [file ...]\n");
(void)fprintf(thread_stderr, "usage: cksum [-o 1 | 2 | 3] [file ...]\n");
(void)fprintf(thread_stderr, " sum [file ...]\n");
exit(1);
}

View File

@ -262,7 +262,7 @@ compress(const char *in, const char *out, int bits)
if (!force && sb.st_size >= isb.st_size) {
if (verbose)
(void)fprintf(stderr, "compress: %s: file would grow; left unmodified\n",
(void)fprintf(thread_stderr, "compress: %s: file would grow; left unmodified\n",
in);
eval = 2;
if (unlink(out))
@ -276,12 +276,12 @@ compress(const char *in, const char *out, int bits)
cwarn("%s", in);
if (verbose) {
(void)fprintf(stderr, "%s: ", out);
(void)fprintf(thread_stderr, "%s: ", out);
if (isb.st_size > sb.st_size)
(void)fprintf(stderr, "%.0f%% compression\n",
(void)fprintf(thread_stderr, "%.0f%% compression\n",
((float)sb.st_size / isb.st_size) * 100.0);
else
(void)fprintf(stderr, "%.0f%% expansion\n",
(void)fprintf(thread_stderr, "%.0f%% expansion\n",
((float)isb.st_size / sb.st_size) * 100.0);
}
}
@ -365,12 +365,12 @@ decompress(const char *in, const char *out, int bits)
if (verbose) {
struct stat isb = sb;
stat(out, &sb);
(void)fprintf(stderr, "%s: ", out);
(void)fprintf(thread_stderr, "%s: ", out);
if (isb.st_size > sb.st_size)
(void)fprintf(stderr, "%.0f%% compression\n",
(void)fprintf(thread_stderr, "%.0f%% compression\n",
((float)sb.st_size / isb.st_size) * 100.0);
else
(void)fprintf(stderr, "%.0f%% expansion\n",
(void)fprintf(thread_stderr, "%.0f%% expansion\n",
((float)isb.st_size / sb.st_size) * 100.0);
}
}
@ -422,7 +422,7 @@ permission(const char *fname)
if (!ios_isatty(STDERR_FILENO))
return (0);
(void)fprintf(stderr, "overwrite %s? ", fname);
(void)fprintf(thread_stderr, "overwrite %s? ", fname);
fflush(stderr);
first = ch = getchar();
while (ch != '\n' && ch != EOF)
@ -434,10 +434,10 @@ void
usage(int iscompress)
{
if (iscompress)
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: compress [-cfv] [-b bits] [file ...]\n");
else
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: uncompress [-cfv] [-b bits] [file ...]\n");
exit(1);
}

View File

@ -760,9 +760,10 @@ static void
printtime(time_t ftime)
{
char longstring[80];
static time_t now;
// iOS: no static members in functions.
static __thread time_t now;
const char *format;
static int d_first = -1;
static __thread int d_first = -1;
if (d_first < 0)
d_first = (*nl_langinfo(D_MD_ORDER) == 'd');

View File

@ -1054,6 +1054,7 @@ int ios_execve(const char *path, char* const argv[], char* envp[]) {
storeEnvironment(envp);
int returnValue = ios_execv(path, argv);
// The environment will be restored to previous value when the thread Id is released.
NSLog(@"Done\n");
return returnValue;
}

View File

@ -592,9 +592,9 @@ run(char **argv)
* followed by a prompt, then prompt them.
*/
if (tflag || pflag) {
(void)fprintf(stderr, "%s", *argv);
(void)fprintf(thread_stderr, "%s", *argv);
for (avec = argv + 1; *avec != NULL; ++avec)
(void)fprintf(stderr, " %s", *avec);
(void)fprintf(thread_stderr, " %s", *avec);
/*
* If the user has asked to be prompted, do so.
*/
@ -613,7 +613,7 @@ run(char **argv)
case 2:
break;
}
(void)fprintf(stderr, "\n");
(void)fprintf(thread_stderr, "\n");
(void)fflush(stderr);
}
exec:
@ -713,7 +713,7 @@ prompt(void)
if ((ttyfp = fopen(_PATH_TTY, "r")) == NULL)
return (2); /* Indicate that the TTY failed to open. */
(void)fprintf(stderr, "?...");
(void)fprintf(thread_stderr, "?...");
(void)fflush(stderr);
if ((response = fgetln(ttyfp, &rsize)) == NULL ||
regcomp(&cre, nl_langinfo(YESEXPR), REG_BASIC) != 0) {
@ -729,7 +729,7 @@ prompt(void)
static void
usage(void)
{
fprintf(stderr,
fprintf(thread_stderr,
"usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]\n"
" [-L number] [-n number [-x]] [-P maxprocs] [-s size]\n"
" [utility [argument ...]]\n");

View File

@ -197,6 +197,6 @@ static void
usage(void)
{
(void)fprintf(stderr, "usage: head [-n lines | -c bytes] [file ...]\n");
(void)fprintf(thread_stderr, "usage: head [-n lines | -c bytes] [file ...]\n");
exit(1);
}

View File

@ -350,7 +350,7 @@ obsolete(char *argv[])
static void
usage(void)
{
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #]"
" [file ...]\n");
exit(1);

View File

@ -370,7 +370,7 @@ obsolete(char *argv[])
static void
usage(void)
{
(void)fprintf(stderr,
(void)fprintf(thread_stderr,
"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
exit(1);
}

View File

@ -295,6 +295,6 @@ word: gotsp = 1;
static void
usage()
{
(void)fprintf(stderr, "usage: wc [-clmw] [file ...]\n");
(void)fprintf(thread_stderr, "usage: wc [-clmw] [file ...]\n");
exit(1);
}