micro-utils/scripts/musuid.c

28 lines
518 B
C
Raw Normal View History

2024-09-01 13:43:41 +00:00
#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;
}