added musuid
This commit is contained in:
parent
ff94d81541
commit
bfb3d3b2fb
2
clean.sh
2
clean.sh
@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f obj/* bin/* mutils.c mutils
|
||||
rm -f obj/* bin/* mutils.c mutils musuid
|
||||
|
@ -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"
|
||||
|
@ -51,4 +51,3 @@ char *mu_mode_2_str(mode_t file_mode) {
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
@ -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
27
scripts/musuid.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user