亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

linux仿寫chmod命令

 更新時間:2014年02月16日 14:41:07   作者:  
這篇文章主要介紹了linux仿寫chmod命令的方法,需要的朋友可以參考下

復(fù)制代碼 代碼如下:

#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
int main(int argc,char **argv)
{
 int mode;
 int mode_u;
 int mode_g;
 int mode_o;
 char *path;
 if(argc<3)
 {
  printf("%s <mode num> <target file>\n",argv[0]);;
  exit(0);
 }

 mode = atoi(argv[1]);
 if(mode>777||mode<0)
 {
  printf("mode num error");
  exit(0);
 }
 mode_u = mode/100;
 mode_g = (mode- mode_u*100)/10;
 mode_o = mode -mode_u*100-mode_g*10;
 mode = mode_u*8*8+mode_g*8+mode_o;
 path = argv[2];
 if(chmod(path,mode)==-1)
 {
  perror("chmod error");
  exit(1);
 }
 return 0;
}

相關(guān)文章

最新評論