2 * Copyright (c) 2001 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: dosify.c,v 1.5 2003/07/15 16:17:47 steve Exp $"
24 * This is a simple program to make a dosified copy of the
25 * original. That is, it converts unix style line ends to DOS
26 * style. This is useful for installing text files.
28 * The exact substitution is to replace \n with \r\n. If the line
29 * already ends with \r\n then it is not changed to \r\r\n.
34 int main(int argc
, char*argv
[])
41 fprintf(stderr
, "Usage: %s <input> <output>\n", argv
[0]);
45 ifile
= fopen(argv
[1], "rb");
47 fprintf(stderr
, "Unable to open %s for input.\n", argv
[1]);
51 ofile
= fopen(argv
[2], "wb");
53 fprintf(stderr
, "Unable to open %s for output.\n", argv
[2]);
58 while ((ch
= fgetc(ifile
)) != EOF
) {
60 if ((ch
== '\n') && (pr
!= '\r'))
72 * Revision 1.5 2003/07/15 16:17:47 steve
73 * Fix spelling of ifdef.
75 * Revision 1.4 2003/07/15 03:49:22 steve
78 * Revision 1.3 2002/08/12 01:34:58 steve
79 * conditional ident string using autoconfig.
81 * Revision 1.2 2002/08/11 23:47:04 steve
82 * Add missing Log and Ident strings.
84 * Revision 1.1 2001/08/03 17:06:47 steve
85 * Add install of examples for Windows.