manpp: add support for .EX and .EE code blocks
[rofl0r-hardcore-utils.git] / linux32.c
blob7ac8d99d96d75353a2aa7ac46cd6d55c72648257
1 #include <sys/personality.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <stdio.h>
5 #ifdef USE_LIBULZ
6 #include <ulz/stdio-repl.h>
7 #endif
10 #if !defined(_Noreturn) && __STDC_VERSION__+0 < 201112L
11 #ifdef __GNUC__
12 #define _Noreturn __attribute__((noreturn))
13 #else
14 #define _Noreturn
15 #endif
16 #endif
18 #ifndef PER_LINUX32
19 #define PER_LINUX32 8
20 #endif
22 static _Noreturn void die(const char *msg) {
23 dprintf(2, msg);
24 exit(1);
27 static _Noreturn void usage(void) {
28 die("usage: linux32 command [options...]\n"
29 "executes command with options in 32bit linux mode\n"
30 "(uname will report 32bit arch)\n");
33 int main(int argc, char** argv) {
34 if(argc == 1) usage();
35 if(personality(PER_LINUX32) == -1) die("could not set 32bit persona");
36 extern char ** environ;
37 if(execve(argv[1], &argv[1], environ) == -1) perror("execve");
38 return 1;