windows to unix
来源:互联网 发布:idea 新建java类 编辑:程序博客网 时间:2024/06/16 06:19
/***************************************************************************
* *
* File: DOS to UNIX TEXT CONVERT *
* Function: This program demostrating text convert managment *
* *
* Author: Long Yun Liang *
* Copyright (c) 12,26,1996 All rights reserved *
* *
***************************************************************************/
#include <stdio.h>
//#include <prototypes.h>
FILE * infile;
FILE * outfile;
char infilename [128];
char outfilename [128];
int mode = 1;
void filter ()
{
int ok = 1;
int ch;
long fsize;
do
{
ok = 1;
printf ("\n\nSource text filename : ");
if (mode) scanf ("%s",infilename); else printf ("%s\n",infilename);
if ((infile = fopen (infilename,"rb")) == NULL)
{
printf ("Can't open %s\n",infilename);
ok = 0;
mode = 1;
}
}
while (!ok) ;
do
{
ok = 1;
printf ("\nTarget text filename : ");
if (mode) scanf ("%s",outfilename); else printf ("%s\n",outfilename);
if ((outfile = fopen (outfilename,"rb+")) == NULL)
{
printf ("Can't open %s\n",outfilename);
ok = 0;
mode = 1;
}
}
while (!ok) ;
fsize=0;
while ((ch=fgetc (infile))!= EOF)
{
if (ch=='\x0d') continue;
else fputc (ch,outfile);
fsize++;
}
chsize (fileno(outfile),fsize);
fclose (infile);
fclose (outfile);
printf ("\nFinished .\n\n");
}
void main (int argc,char *argv[])
{
int choice;
if (argc>3) {
printf ("Text Convert Utility Version 1.20\n");
printf ("Copyright (c) Software Engineering 1994-1996. All rights reserved.\n\n");
printf ("Usage: CODE InputFile OutputFile\n");
return ;
}
else if (argc==2) {
strcpy (infilename,argv[1]);
strcpy (outfilename,argv[1]);
mode = 0;
}
else if (argc==3) {
strcpy (infilename,argv[1]);
strcpy (outfilename,argv[2]);
mode = 0;
}
else mode = 1;
printf ("DOS to UNIX Text Convert Utility Version 1.20\n");
printf ("Copyright (c) Software Engineering 1996. All rights reserved.");
filter ();
}
echo "DOS to UNIX Text Convert Utility Version 1.20"
echo "Copyright (c) Software Engineering 1996 .\n"
if test $# -lt 1
then
echo "Usage: D2U FileName\n "
elif test -r $1
then
dos2unix $1 temp$$
mv temp$$ $1
echo "Finished .\n"
else
echo "File not found .\n"
fi
- windows to unix
- How to convert from windows timestamp to unix timestamp
- Introduction to Microsoft Windows Services for UNIX 3.5
- How to Convert Windows/DOS Text Files to Linux/UNIX Format
- 跨平台(unix/linux to windows)ftp传送tar文件时候,必要使用binary模式。
- How to delete or rename listener.log based on Windows or Unix platforms
- Windows Services for UNIX
- Windows,Unix and Linux
- Unix和Windows区别
- Unix vs Windows
- windows,unix简史
- Unix和Windows区别
- unix.......shell.......windows?
- Unix和Windows比较
- Windows Unix Toolkit
- 【Unix】Unix与Windows编程对比一览
- UNIX Commands Used to Debug
- Please help to Unix-Center
- C++标准IO库
- fiddler不能监听 localhost和 127.0.0.1的问题
- 阅读器中,给部分区域添加 透明层
- Win7、Ubuntu双系统出现“unknown filesystem”提示和“grub rescue”命令行,修改启动引导的·方法。
- 系统升级程序和客户端升级程序
- windows to unix
- C语言 JSON 解析库 - MJSON使用介绍
- Nginx配置文件详细说明
- ASP.Net Web.Config文件配置之连接默认错误页
- 疲惫的时候请停下看看
- GIT服务器的搭建【简单版】
- Alias Method for Sampling
- 修改iis 使得浏览器可直接下载图片
- App Icons on iPad and iPhone(iPad和iPhone应用程序图标)