Last active
June 8, 2022 05:06
-
-
Save one2blame/5010e9b49fed5402a1aa3c97b6682b1f to your computer and use it in GitHub Desktop.
Useful print macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
include <stdio.h> | |
#define print_info(string, ...) \ | |
do \ | |
{ \ | |
printf("[*] %s: " string, program_invocation_name, ##__VA_ARGS__); \ | |
} while (0) | |
#define print_err(string, ...) \ | |
do \ | |
{ \ | |
fprintf(stderr, "[!] %s: %s @ %d: " string, \ | |
__FILE__, \ | |
__FUNCTION__, \ | |
__LINE__, \ | |
##__VA_ARGS__); \ | |
} while (0) | |
// Clears the screen | |
#define clrscr() printf("\e[1;1H\e[2J") | |
// I think this is provided by glibc | |
// Just contains the name of the program - argv[0] | |
extern char* program_invocation_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment