Created
March 31, 2023 22:17
-
-
Save zdimension/e315b972b0f81e706db9a563e1d4acc0 to your computer and use it in GitHub Desktop.
list function calls in a C file and look up in man
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
isatty (3) - test whether a file descriptor refers to a terminal | |
open (2) - open and possibly create a file | |
dup2 (2) - duplicate a file descriptor | |
close (2) - close a file descriptor | |
sigaction (2) - examine and change a signal action | |
execvp (3) - execute a file |
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
cheatsheet (){ grep -oP '(\w+)(?=\()' $1 | xargs whatis -s 2,3 2>/dev/null; } |
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
isatty(STDIN_FILENO) test whether a file descriptor refers to a terminal | |
open("/dev/null", O_WRONLY) open and possibly create a file | |
dup2(fd, STDIN_FILENO) duplicate a file descriptor | |
close(fd) close a file descriptor | |
sigaction(SIGHUP, &sa, NULL) examine and change a signal action | |
execvp(argv[1], &argv[1]) execute a file |
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
cheatsheet (){ perl -ne'while(/(\w+)\((?:[^)(]+|(?R))*+\)/g){if(!$a{$1}){$n=$&;$a{$1}=1;`whatis -s2,3 $1 2>/dev/null`=~/-(.*)/&&printf"%-65s $1\n",$n}}' $1; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment