source: abuse/trunk/src/imlib/convert.cpp @ 521

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
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
[56]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
[2]13#include <stdio.h>
14
[56]15/* Jonathan Clark April 5, 93   Converts Unix file for to DOS & vice versa. */
16
[2]17#define STReq(x,y) (!strcmp(x,y))
18main(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; }
[494]29  else { strip=0; add=1; }
[2]30  printf("Converting...\n");
[494]31  for (i=2; i<argc; i++)
[2]32  {
33    printf("  %s\n",argv[i]);
[124]34    fp=fopen(argv[i],"r");
[2]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)
[124]43          fputc(c,o);
[2]44      }
45    }
46    fclose(o);
47    fclose(fp);
48    sprintf(st,"cp testXDF.out %s",argv[i]);
49    system(st);
[124]50    unlink("testXDF.out");
51  }
[2]52}
Note: See TracBrowser for help on using the repository browser.