~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/fsdevice/fsdevice-open.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
 
57
57
 
58
58
static int fsdevice_open_directory(vdrive_t *vdrive, unsigned int secondary,
59
 
                                   cbmdos_cmd_parse_t *cmd_parse)
 
59
                                   cbmdos_cmd_parse_t *cmd_parse, char *rname)
60
60
{
61
61
    struct ioutil_dir_s *ioutil_dir;
62
62
    char *mask;
67
67
        fsdevice_error(vdrive, CBMDOS_IPE_NOT_WRITE);
68
68
        return FLOPPY_ERROR;
69
69
    }
 
70
 
 
71
    if (!(mask = strrchr(rname, '/')))
 
72
        mask = rname;
 
73
 
70
74
    /* Test on wildcards.  */
71
 
    if (!(mask = strrchr(cmd_parse->parsecmd, '/')))
72
 
        mask = cmd_parse->parsecmd;
73
 
    if (strchr(mask, '*') || strchr(mask, '?')) {
 
75
    if (cbmdos_parse_wildcard_check(mask, strlen(mask))) {
74
76
        if (*mask == '/') {
75
 
            strcpy(fs_dirmask, mask + 1);
 
77
            strcpy(fs_info[secondary].fs_dirmask, mask + 1);
76
78
            *mask++ = 0;
77
79
        } else {
78
 
            strcpy(fs_dirmask, mask);
79
 
            strcpy(cmd_parse->parsecmd, fsdevice_get_path(vdrive->unit));
 
80
            strcpy(fs_info[secondary].fs_dirmask, mask);
 
81
            lib_free(cmd_parse->parsecmd);
 
82
            cmd_parse->parsecmd = lib_stralloc(fsdevice_get_path(vdrive->unit));
80
83
        }
81
84
    } else {
82
 
        *fs_dirmask = 0;
83
 
        if (!*(cmd_parse->parsecmd))
84
 
            strcpy(cmd_parse->parsecmd, fsdevice_get_path(vdrive->unit));
 
85
        fs_info[secondary].fs_dirmask[0] = '\0';
 
86
        if (!*(cmd_parse->parsecmd)) {
 
87
            lib_free(cmd_parse->parsecmd);
 
88
            cmd_parse->parsecmd = lib_stralloc(fsdevice_get_path(vdrive->unit));
 
89
        }
85
90
    }
86
91
    /* trying to open */
87
92
    ioutil_dir = ioutil_opendir((char *)(cmd_parse->parsecmd));
216
221
    tape = &(fs_info[secondary].tape);
217
222
    tape->name = util_concat(fsdevice_get_path(vdrive->unit), 
218
223
                             FSDEV_DIR_SEP_STR, rname, NULL);
219
 
    charset_petconvstring(tape->name + 
 
224
    charset_petconvstring((BYTE *)(tape->name) + 
220
225
                          strlen(fsdevice_get_path(vdrive->unit))+
221
226
                          strlen(FSDEV_DIR_SEP_STR), 1);
222
227
    tape->read_only = 1;
 
228
    /* Prepare for buffered reads */
 
229
    fs_info[secondary].isbuffered = 0;
 
230
    fs_info[secondary].iseof = 0;
223
231
    if (tape_image_open(tape) < 0) {
224
232
        lib_free(tape->name);
225
233
        tape->name = NULL;
257
265
    return FLOPPY_COMMAND_OK;
258
266
}
259
267
 
260
 
int fsdevice_open(vdrive_t *vdrive, const char *name, int length,
 
268
int fsdevice_open(vdrive_t *vdrive, const BYTE *name, unsigned int length,
261
269
                  unsigned int secondary)
262
270
{
263
 
    char rname[MAXPATHLEN];
264
 
    int status = 0, rc, i;
 
271
    char rname[PATH_MAX];
 
272
    int status = 0, rc;
 
273
    unsigned int i;
265
274
    cbmdos_cmd_parse_t cmd_parse;
266
275
 
267
276
    if (fs_info[secondary].info != NULL)
305
314
    }
306
315
 
307
316
    if (*name == '$') {
308
 
        status = fsdevice_open_directory(vdrive, secondary, &cmd_parse);
 
317
        status = fsdevice_open_directory(vdrive, secondary, &cmd_parse, rname);
309
318
    } else {
310
319
        status = fsdevice_open_file(vdrive, secondary, &cmd_parse, rname);
311
320
    }