rot1fs.fist

来自「Solaris操作系统下的过滤驱动程序, C源码程序.」· FIST 代码 · 共 57 行

FIST
57
字号
%{  /*   * rot1fs: shift each byte by one, which is better   * than rot13 in that every byte is changed, and double-encoding is not   * like decoding (as with rot13).   */%}filter data;encoding_blocksize 1;encoding_type block;debug on;%%%%/* * add 1 to each byte * return the number of bytes written */introt1fs_encode_block(const char *inbuf, char *outbuf, int len, const vnode_t *vp, const vfs_t *vfsp, u_long pagenum){    unsigned char *incp = (unsigned char *) inbuf;    unsigned char *outcp = (unsigned char *) outbuf;    int i;    for (i = 0; i < len; i++, incp++, outcp++)	*outcp = *incp + 1;    return len;}/* * subtract 1 from each byte * return the number of bytes written */introt1fs_decode_block(const char *inbuf, char *outbuf, int len, const vnode_t *vp, const vfs_t *vfsp, u_long pagenum){    unsigned char *incp = (unsigned char *) inbuf;    unsigned char *outcp = (unsigned char *) outbuf;    int i;    for (i = 0; i < len; i++, incp++, outcp++)	*outcp = *incp - 1;    return len;}/* * Local variables: * c-basic-offset: 4 * End: */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?