File: convert.c

package info (click to toggle)
audacity 1.2.4b-2.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 24,136 kB
  • ctags: 20,445
  • sloc: ansic: 139,567; cpp: 55,998; sh: 24,963; lisp: 3,772; makefile: 1,683; python: 272
file content (59 lines) | stat: -rw-r--r-- 1,391 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* convert.c -- convert between file name notations */


#include "switches.h"
#include "stdio.h"
#include "string.h"
#include "convert.h"

char dir_separator = 
#ifdef MACINTOSH
':';
#endif
#ifdef DOS
'\\';
#endif
#ifdef UNIX
'/';
#endif
#ifdef AMIGA
'/';
#endif
/* Note: syntax error if not one and only one is defined (this is a feature) */


int pauseflag;


/* convert -- convert filename to local naming conventions */
/**/
void convert(char *filename)
{
        int i;
        /* first test for problem characters */
        for (i = strlen(filename); i >= 0; i--) {
                if (filename[i] == ':' || filename[i] == '\\') {
                        fprintf(stderr, "WARNING: %s has one of \":\\\" and may not port.\n",
                                                                                    filename);
                        fprintf(stderr, "         '/' should be used as directory separator.\n");
                        if (PAUSE) getchar();
                }
        }
#ifdef MACINTOSH
        /* prepend a ":" */
        for (i = strlen(filename); i >= 0; i--) {
                filename[i + 1] = filename[i];
        }
        filename[0] = ':';
#endif
#ifndef UNIX
#ifndef AMIGA
    /* replace '/' with local separator */
    for (i = strlen(filename); i >= 0; i--) {
            if (filename[i] == '/') filename[i] = dir_separator;
    }
#endif
#endif
}