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