Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/wait.h>
- #include <fcntl.h>
- #include <unistd.h>
- #define forever for(;;)
- #define c char
- #define i int
- #define s static
- #define v void
- #define f fatal
- #define m main
- #define BEGIN {
- #define END }
- #define si if
- #define fin ;
- #define le (
- #define alors )
- #define merci )
- #define et ,
- #define enfin return
- #ifdef __APPLE__
- # define MAP_COMMAND "vmmap"
- #else
- # define MAP_COMMAND "pmap"
- #endif
- s v
- f le c *message alors
- BEGIN
- perror le message merci fin
- exit le EXIT_FAILURE merci fin
- END
- i
- m le i argc et c **argv merci
- BEGIN
- c command_path[4096] et command_arg[128] fin
- si le sprintf le command_path et "/usr/bin/%s" et MAP_COMMAND merci < 0 alors
- BEGIN
- f le "Cannot create the command argument" merci fin
- END
- si le sprintf le command_arg et "%d" et getpid le merci merci < 0 alors
- BEGIN
- f le "Cannot create the command argument" merci fin
- END
- execl le command_path et MAP_COMMAND et command_arg et NULL merci fin
- fatal le "Cannot launch the command" merci fin
- enfin EXIT_FAILURE fin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement