Subversion Repositories SvarDOS

Rev

Rev 2197 | Rev 2200 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2197 Rev 2198
Line 144... Line 144...
144
 
144
 
145
 
145
 
146
/* add a new dirname to path, C:\XXX\*.EXE + YYY -> C:\XXX\YYY\*.EXE */
146
/* add a new dirname to path, C:\XXX\*.EXE + YYY -> C:\XXX\YYY\*.EXE */
147
static void path_add(char *path, const char *dirname) {
147
static void path_add(char *path, const char *dirname) {
148
  short i, ostatni = -1;
148
  short i, ostatni = -1;
149
  printf("path_add(%s,%s) -> ", path, dirname);
149
  //printf("path_add(%s,%s) -> ", path, dirname);
150
  /* find the last backslash */
150
  /* find the last backslash */
151
  for (i = 0; path[i] != 0; i++) {
151
  for (i = 0; path[i] != 0; i++) {
152
    if (path[i] == '\\') ostatni = i;
152
    if (path[i] == '\\') ostatni = i;
153
  }
153
  }
154
  /* abort on error */
154
  /* abort on error */
Line 156... Line 156...
156
  /* do the trick */
156
  /* do the trick */
157
  /* move ending to the right */
157
  /* move ending to the right */
158
  memcpy_rtl(path + ostatni + strlen(dirname) + 1, path + ostatni, strlen(path + ostatni) + 1);
158
  memcpy_rtl(path + ostatni + strlen(dirname) + 1, path + ostatni, strlen(path + ostatni) + 1);
159
  /* fill in the space with dirname */
159
  /* fill in the space with dirname */
160
  memcpy_ltr(path + ostatni + 1, dirname, strlen(dirname));
160
  memcpy_ltr(path + ostatni + 1, dirname, strlen(dirname));
161
  printf("'%s'\n", path);
161
  //printf("'%s'\n", path);
162
}
162
}
163
 
163
 
164
 
164
 
165
/* take back last dir from path, C:\XXX\YYY\*.EXE -> C:\XXX\*.EXE */
165
/* take back last dir from path, C:\XXX\YYY\*.EXE -> C:\XXX\*.EXE */
166
static void path_back(char *path) {
166
static void path_back(char *path) {
167
  short i, ostatni = -1, przedostatni = -1;
167
  short i, ostatni = -1, przedostatni = -1;
168
  printf("path_back(%s) -> ", path);
168
  //printf("path_back(%s) -> ", path);
169
  /* find the two last backslashes */
169
  /* find the two last backslashes */
170
  for (i = 0; path[i] != 0; i++) {
170
  for (i = 0; path[i] != 0; i++) {
171
    if (path[i] == '\\') {
171
    if (path[i] == '\\') {
172
      przedostatni = ostatni;
172
      przedostatni = ostatni;
173
      ostatni = i;
173
      ostatni = i;
Line 175... Line 175...
175
  }
175
  }
176
  /* abort on error */
176
  /* abort on error */
177
  if (przedostatni == -1) return;
177
  if (przedostatni == -1) return;
178
  /* do the trick */
178
  /* do the trick */
179
  memcpy_ltr(path + przedostatni, path + ostatni, 1 + i - ostatni);
179
  memcpy_ltr(path + przedostatni, path + ostatni, 1 + i - ostatni);
180
  printf("'%s'\n", path);
180
  //printf("'%s'\n", path);
181
}
181
}
182
 
182
 
183
 
183
 
184
/* parse an attr list like "Ar-hS" and fill bitfield into attrfilter_may and attrfilter_must.
184
/* parse an attr list like "Ar-hS" and fill bitfield into attrfilter_may and attrfilter_must.
185
 * /AHS   -> adds S and H to mandatory attribs ("must")
185
 * /AHS   -> adds S and H to mandatory attribs ("must")
Line 653... Line 653...
653
  if (i != 0) {
653
  if (i != 0) {
654
    nls_outputnl_doserr(i);
654
    nls_outputnl_doserr(i);
655
    goto FAIL;
655
    goto FAIL;
656
  }
656
  }
657
 
657
 
-
 
658
  /* volume label and serial */
658
  if (req.format != DIR_OUTPUT_BARE) {
659
  if (req.format != DIR_OUTPUT_BARE) {
659
    drv = buf->path[0];
660
    drv = buf->path[0];
660
    if (drv >= 'a') {
661
    if (drv >= 'a') {
661
      drv -= 'a';
662
      drv -= 'a';
662
    } else {
663
    } else {
663
      drv -= 'A';
664
      drv -= 'A';
664
    }
665
    }
665
    cmd_vol_internal(drv, buf->buff64);
666
    cmd_vol_internal(drv, buf->buff64);
-
 
667
  }
-
 
668
 
-
 
669
  NEXT_ITER: /* re-entry point for /S recursing */
-
 
670
 
-
 
671
  if (req.format != DIR_OUTPUT_BARE) {
666
    sprintf(buf->buff64, svarlang_str(37,20)/*"Directory of %s"*/, buf->path);
672
    sprintf(buf->buff64, svarlang_str(37,20)/*"Directory of %s"*/, buf->path);
667
    /* trim at first '?', if any */
673
    /* trim at first '?', if any */
668
    for (i = 0; buf->buff64[i] != 0; i++) if (buf->buff64[i] == '?') buf->buff64[i] = 0;
674
    for (i = 0; buf->buff64[i] != 0; i++) if (buf->buff64[i] == '?') buf->buff64[i] = 0;
669
    outputnl(buf->buff64);
675
    outputnl(buf->buff64);
670
    outputnl("");
676
    outputnl("");
Line 675... Line 681...
675
  i = path_appendbkslash_if_dir(buf->path);
681
  i = path_appendbkslash_if_dir(buf->path);
676
 
682
 
677
  /* if ends with a \ then append ????????.??? */
683
  /* if ends with a \ then append ????????.??? */
678
  if (buf->path[i - 1] == '\\') strcat(buf->path, "????????.???");
684
  if (buf->path[i - 1] == '\\') strcat(buf->path, "????????.???");
679
 
685
 
680
  NEXT_ITER: /* re-entry point for /S recursing */
-
 
681
 
-
 
682
  /* ask DOS for list of files, but only with allowed attribs */
686
  /* ask DOS for list of files, but only with allowed attribs */
683
  i = findfirst(dta, buf->path, req.attrfilter_may);
687
  i = findfirst(dta, buf->path, req.attrfilter_may);
684
  if (i != 0) {
688
  if (i != 0) {
685
    if (req.flags & DIR_FLAG_RECUR) goto CHECK_RECURS;
689
    if (req.flags & DIR_FLAG_RECUR) goto CHECK_RECURS;
686
    nls_outputnl_doserr(i);
690
    nls_outputnl_doserr(i);