added musuid

This commit is contained in:
Your Name 2024-09-01 16:43:41 +03:00
parent ff94d81541
commit bfb3d3b2fb
5 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh
rm -f obj/* bin/* mutils.c mutils
rm -f obj/* bin/* mutils.c mutils musuid

View File

@ -4,6 +4,10 @@
/* (cat tee wc xargs rev split cp) text buffer */
#define BUF_SIZE 32000
#ifdef _MUSUID_C
#define MUTILS_PATH "/bin/mutils"
#endif
#ifdef _SHRED_C
/* source of random (shred) */
#define RAND_SOURCE "/dev/urandom"

View File

@ -51,4 +51,3 @@ char *mu_mode_2_str(mode_t file_mode) {
return mode;
}

View File

@ -42,3 +42,4 @@ int main(int argc, char **argv) {
EOF
echo $CFLAGS | xargs $CC -Iconfigs -Ilibmu mutils.c obj/*.o bin/*.c -o mutils
echo $CFLAGS | xargs $CC -Iconfigs scripts/musuid.c -o musuid

27
scripts/musuid.c Normal file
View File

@ -0,0 +1,27 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#define _MUSUID_C
#include "config.h"
const char *progs[] = {"su", "ping"};
int main(int argc, char **argv) {
if (argc == 1) {
fputs("musuid: missing operand\n", stderr);
return 1;
}
argc--;
argv++;
/* RUN */
for (size_t i = 0; i < sizeof(progs) / sizeof(char *); i++)
if (!strcmp(argv[0], progs[i]))
execv(MUTILS_PATH, argv);
fprintf(stderr, "musuid: unknown command: %s\n", argv[0]);
return 1;
}