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