linux whoami cp mv mesg 命令 c語言實現
阿新 • • 發佈:2018-12-14
whoami實現
#include<stdio.h>#include<pwd.h>#include<sys/types.h>#include<unistd.h>int main(){ uid_t id; struct passwd * pa; id=geteuid(); pa=getpwuid(id); printf("%d\n",id); printf("%s\n",pa->pw_name);
return 0;}cp實現
cp實現 /#define S_ISDIR(x) (((x)&STAT_MASK)==STAT_DIR_FLAG)STAT_MASK 001000001010STAT_DIR_FLAG 001000000000