Last change
on this file since 521 was
494,
checked in by Sam Hocevar, 12 years ago
|
style: remove trailing spaces, fix copyright statements.
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
5 | * |
---|
6 | * This software was released into the Public Domain. As with most public |
---|
7 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #include "config.h" |
---|
12 | |
---|
13 | #include <stdio.h> |
---|
14 | |
---|
15 | /* Jonathan Clark April 5, 93 Converts Unix file for to DOS & vice versa. */ |
---|
16 | |
---|
17 | #define STReq(x,y) (!strcmp(x,y)) |
---|
18 | main(int argc, char **argv) |
---|
19 | { |
---|
20 | FILE *fp,*o; |
---|
21 | int i,strip,add,c; |
---|
22 | char st[100]; |
---|
23 | if (argc<3 || !(STReq(argv[1],"2unix") || STReq(argv[1],"2dos"))) |
---|
24 | { printf("Usage : convert [2unix]|[2dos] files\n"); |
---|
25 | exit(0); |
---|
26 | } |
---|
27 | if (STReq(argv[1],"2unix")) |
---|
28 | { strip=1; add=0; } |
---|
29 | else { strip=0; add=1; } |
---|
30 | printf("Converting...\n"); |
---|
31 | for (i=2; i<argc; i++) |
---|
32 | { |
---|
33 | printf(" %s\n",argv[i]); |
---|
34 | fp=fopen(argv[i],"r"); |
---|
35 | o=fopen("testXDF.out","w"); |
---|
36 | while (!feof(fp)) |
---|
37 | { |
---|
38 | c=fgetc(fp); |
---|
39 | if (c>=0) |
---|
40 | { |
---|
41 | if (c=='\n' && add) { fputc('\r',o); } |
---|
42 | if (!(c=='\r') || !strip) |
---|
43 | fputc(c,o); |
---|
44 | } |
---|
45 | } |
---|
46 | fclose(o); |
---|
47 | fclose(fp); |
---|
48 | sprintf(st,"cp testXDF.out %s",argv[i]); |
---|
49 | system(st); |
---|
50 | unlink("testXDF.out"); |
---|
51 | } |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.