zoukankan      html  css  js  c++  java
  • 信息安全系统设计基础第十周总结

     
    echostate.c
    显示输入命令是否可见
    例子

    #include <stdio.h>
    #include <stdlib.h>
    #include <termios.h>

    int main()
    {
    struct termios info;
    int rv;

    rv = tcgetattr( 0, &info ); /* read values from driver */

    if ( rv == -1 ){
    perror( "tcgetattr");
    exit(1);
    }
    if ( info.c_lflag & ECHO )
    printf(" echo is on , since its bit is 1 ");
    else
    printf(" echo is OFF, since its bit is 0 ");

    return 0;
    }

    fileinfo.c

    功能:用来实现显示文件信息

    • finfo_buffer — 返回一个字符串缓冲区的信息
    • finfo_close — 关闭 fileinfo 资源
    • finfo_file — 返回一个文件的信息
    • finfo_open — 创建一个 fileinfo 资源
    • finfo_set_flags — 设置 libmagic 配置选项
    • mime_content_type — 检测文件的 MIME 类型(已废弃)

    例子

    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/stat.h>

    void show_stat_info(char *, struct stat *);

    int main(int argc, char *argv[])
    {
    struct stat info;

    if (argc>1)
    {

    if( stat(argv[1], &info) != -1 ){
    show_stat_info( argv[1], &info );
    return 0;
    }
    else
    perror(argv[1]);
    }
    return 1;
    }
    void show_stat_info(char *fname, struct stat *buf)
    {
    printf(" mode: %o ", buf->st_mode);
    printf(" links: %d ", buf->st_nlink);
    printf(" user: %d ", buf->st_uid);
    printf(" group: %d ", buf->st_gid);
    printf(" size: %d ", (int)buf->st_size);
    printf("modtime: %d ", (int)buf->st_mtime);
    printf(" name: %s ", fname );
    }

    filesize.c

    filesize() 函数返回指定文件的大小

    若成功,则返回文件大小的字节数。若失败,则返回 false 并生成一条 E_WARNING 级的错误

    语法

    filesize(filename)
    参数描述
    filename 必需。规定要检查的文件。

    例子

    #include <stdio.h>
    #include <sys/stat.h>

    int main()
    {
    struct stat infobuf;

    if ( stat( "/etc/passwd", &infobuf) == -1 )
    perror("/etc/passwd");
    else
    printf(" The size of /etc/passwd is %d ", infobuf.st_size );
    }

    setecho.c

    setecho用来改变输入指令是否可见

    set echo off;    //显示start启动的脚本中的每个sql命令,缺省为on

    set echo on             //设置运行命令是是否显示语句

    man

    man命令是Linux下的帮助指令,通过man指令可以查看Linux中的指令帮助、配置文件帮助和编程帮助等信息
    语法:man(选项)(参数)
    选项: -a:在所有的man帮助手册中搜索
            -f:等价于whatis指令,显示给定关键字的简短描述信息
            -P:指定内容时使用分页程序
            -M:指定man手册搜索的路径。
    参数:
            数字:指定从哪本man手册中搜索帮助
            关键字:指定要搜索帮助的关键字
  • 相关阅读:
    C#-使用Tuple传递多个参数
    CentOS 常用命令
    C#-ToString格式化
    java面对对象(六)--内部类、匿名内部类
    JAVA面对对象(五)——接口
    JAVA面对对象(四)——抽象类
    JAVA面对对象(三)——Super、static、final关键字
    Mybatis缓存
    重启博客
    某大神的装修笔记
  • 原文地址:https://www.cnblogs.com/20135305yg/p/4966451.html
Copyright © 2011-2022 走看看