removed trash-programs

This commit is contained in:
Your Name 2024-05-30 13:57:50 +03:00
parent 4cf8171790
commit bf19c30c3f
9 changed files with 2 additions and 90 deletions

View File

@ -2,3 +2,4 @@
Own implementation of *nix utils
License: wtfpl
Author: 8nl

View File

@ -16,9 +16,6 @@
#define MOUNT_LIST "/proc/mounts"
#define MOUNT_OPT_SIZE 512
/* nologin sleep */
#define NOLOGIN_SLEEP 0
/* colors for ls */
#define LS_DIR_COLOR "\033[1;34m"
#define LS_LINK_COLOR "\033[1;35m"

View File

@ -1,3 +0,0 @@
#!/bin/sh
project_dir=$(pwd)
echo ./*.c $CFLAGS -o $OUTPUT$(basename $project_dir) | xargs $CC

View File

@ -1,16 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int main(void) {
char *p = getlogin();
if (p != NULL) {
puts(p);
return 0;
}
fprintf(stderr, "logname: %s\n", strerror(errno));
return 1;
}

View File

@ -1,3 +0,0 @@
#!/bin/sh
project_dir=$(pwd)
echo ./*.c $CFLAGS -o $OUTPUT$(basename $project_dir) | xargs $CC

View File

@ -1,52 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
long parse_long(const char *str) {
char *ptr = NULL;
long value = strtol(str, &ptr, 10);
if (*ptr) {
fprintf(stderr, "mkfifo: not a number: %s\n", str);
exit(1);
}
else if (value < 1) {
fprintf(stderr, "mknod: number is negative: %s\n", str);
exit(1);
}
return value;
}
int main(int argc, char **argv) {
mode_t mode = 0666;
int opt;
while ((opt = getopt(argc, argv, "m:")) != -1) {
switch (opt) {
case 'm':
mode = parse_long(optarg);
break;
default:
printf("mkfifo [m] [file1 file2...]\n\t-m MODE\n");
return 0;
}
}
argv += optind;
argc -= optind;
for (int i = 0; i < argc; i++) {
if (mkfifo(argv[i], mode)) {
fprintf(stderr, "mkfifo: %s %s\n", argv[i], strerror(errno));
return 1;
}
}
return 0;
}

View File

@ -1,3 +0,0 @@
#!/bin/sh
project_dir=$(pwd)
echo ./*.c $CFLAGS -o $OUTPUT$(basename $project_dir) | xargs $CC

View File

@ -1,9 +0,0 @@
#include <stdio.h>
#include <unistd.h>
#include "config.h"
int main(void) {
printf("nologin: shell disabled\n");
sleep(NOLOGIN_SLEEP);
return 0;
}

View File

@ -58,7 +58,7 @@ int main(int argc, char **argv) {
}
else {
printf("spark [num1 num2...]\n\t[-n Use \\r] [-r Reverse]\n");
printf("spark [rn] [num1 num2...]\n\t-n Use \\r\n\t-r Reverse]\n");
return 0;
}
}