- 论坛徽章:
- 0
|
cut++++++++++++++++++++++++++++++++++++++++++cut
/*
* This progrome used to change the 'Enter' from FUCK Windows to UNIX.
* Written by 8lu3 HomePage: http://209.142.209.161/~bluepunk
* mailto: blue@bsdmail.org
*/
#include"sys/types.h"
#include"sys/stat.h"
#include"fcntl.h"
#include"unistd.h"
main(int argc, char *argv[])
{
int fd;
int offset;
int tmp;
char byte;
char fuck_enter = '\x0d';
char unix_enter = '\x0a';
if ((fd = open(argv[1], O_RDWR)) == -1) {
printf("open file fail!\n"
} else {
printf("Open file success,fd number is: %d\n", fd);
while (read(fd, &byte, 1) != 0)
if (byte == fuck_enter) {
offset = lseek(fd, 0, SEEK_CUR);
offset--;
lseek(fd, offset, SEEK_SET);
write(fd, &unix_enter, 1);
offset++;
lseek(fd, offset, SEEK_SET);
}
}
close(fd);
};
cut+++++++++++++++++++++++++++++++++++++++++++cut |
|