fix
This commit is contained in:
parent
c6b750f966
commit
e1b6a32504
@ -35,9 +35,8 @@ void Compile(const char *src, const char *output_dir) {
|
||||
char *path = MakePath(src, output_dir);
|
||||
printf("[CC] Building %s -> %s\n", src, path);
|
||||
|
||||
if (fork()) {
|
||||
if (fork())
|
||||
execlp(CC, CC, CFLAGS, src, "-o", path, NULL);
|
||||
}
|
||||
|
||||
free(path);
|
||||
}
|
||||
|
@ -19,12 +19,16 @@ int main(const int argc, const char **argv) {
|
||||
|
||||
else {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-')
|
||||
if (argv[i][0] == '-') {
|
||||
if (argv[i][1])
|
||||
break;
|
||||
continue;
|
||||
|
||||
else
|
||||
cat(STDIN_FILENO);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
int fd = open(argv[i], O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "cat: %s %s\n", argv[i], strerror(errno));
|
||||
|
@ -8,8 +8,9 @@ int main(const int argc, const char **argv) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
// https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html
|
||||
// This version does not support -n option and escape-sequences
|
||||
|
||||
/* https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html */
|
||||
/* This version does not support -n option and escape-sequences */
|
||||
putchar('\n');
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,20 +5,13 @@
|
||||
#include <unistd.h>
|
||||
|
||||
int main(const int argc, const char **argv) {
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] != '-')
|
||||
break;
|
||||
|
||||
else if (!strcmp(argv[i], "--help")) {
|
||||
if (argv[argc - 1][0] == '-') {
|
||||
printf("hostname [hostname Set new hostname]\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set hostname */
|
||||
if (argc - i == 1) {
|
||||
if (argc == 2) {
|
||||
if (sethostname(argv[argc - 1], strlen(argv[argc - 1])) < 0) {
|
||||
fprintf(stderr, "hostname: %s\n", strerror(errno));
|
||||
return 1;
|
||||
@ -34,7 +27,6 @@ int main(const int argc, const char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
puts(hostname);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user