Subversion Repositories SvarDOS

Rev

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

Rev 2203 Rev 2204
Line 141... Line 141...
141
    *availrows = screen_getheight() - 1;
141
    *availrows = screen_getheight() - 1;
142
  }
142
  }
143
}
143
}
144
 
144
 
145
 
145
 
-
 
146
/* print the "Directory of C:\ABC\.... string using a buffer with possible
-
 
147
 * file pattern garbage trailing */
-
 
148
static void dir_print_dirof(const char *p, unsigned short *availrows, unsigned char pagination) {
-
 
149
  unsigned char t, lastbkslash;
-
 
150
  char buff[2] = {0, 0};
-
 
151
  const char *dirof = svarlang_str(37,20); /* Directory of % */
-
 
152
 
-
 
153
  /* print string until % */
-
 
154
  while ((*dirof != 0) && (*dirof != '%')) {
-
 
155
    *buff = *dirof;
-
 
156
    output(buff);
-
 
157
    dirof++;
-
 
158
  }
-
 
159
 
-
 
160
  if (*dirof != '%') return;
-
 
161
  dirof++;
-
 
162
 
-
 
163
  /* find the last backslash of path */
-
 
164
  lastbkslash = 0;
-
 
165
  for (t = 0; p[t] != 0; t++) {
-
 
166
    if (p[t] == '\\') lastbkslash = t;
-
 
167
  }
-
 
168
  if (lastbkslash == 0) return;
-
 
169
 
-
 
170
  /* print path until last bkslash */
-
 
171
  do {
-
 
172
    *buff = *p;
-
 
173
    output(buff);
-
 
174
    p++;
-
 
175
  } while (lastbkslash-- != 0);
-
 
176
 
-
 
177
  /* print the rest of the dirof string */
-
 
178
  while (*dirof != 0) {
-
 
179
    *buff = *dirof;
-
 
180
    output(buff);
-
 
181
    dirof++;
-
 
182
  }
-
 
183
 
-
 
184
  outputnl("");
-
 
185
  if (pagination) dir_pagination(availrows);
-
 
186
  outputnl("");
-
 
187
  if (pagination) dir_pagination(availrows);
-
 
188
}
-
 
189
 
-
 
190
 
146
/* add a new dirname to path, C:\XXX\*.EXE + YYY -> C:\XXX\YYY\*.EXE */
191
/* add a new dirname to path, C:\XXX\*.EXE + YYY -> C:\XXX\YYY\*.EXE */
147
static void path_add(char *path, const char *dirname) {
192
static void path_add(char *path, const char *dirname) {
148
  short i, ostatni = -1;
193
  short i, ostatni = -1;
149
  //printf("path_add(%s,%s) -> ", path, dirname);
194
  //printf("path_add(%s,%s) -> ", path, dirname);
150
  /* find the last backslash */
195
  /* find the last backslash */
Line 703... Line 748...
703
  /* ask DOS for list of files, but only with allowed attribs */
748
  /* ask DOS for list of files, but only with allowed attribs */
704
  i = findfirst(dta, buf->path, req.attrfilter_may);
749
  i = findfirst(dta, buf->path, req.attrfilter_may);
705
 
750
 
706
  /* print "directory of" unless /B or /S mode with no match */
751
  /* print "directory of" unless /B or /S mode with no match */
707
  if ((req.format != DIR_OUTPUT_BARE) && (((req.flags & DIR_FLAG_RECUR) == 0) || (i == 0))) {
752
  if ((req.format != DIR_OUTPUT_BARE) && (((req.flags & DIR_FLAG_RECUR) == 0) || (i == 0))) {
708
    unsigned char t;
-
 
709
    sprintf(buf->buff64, svarlang_str(37,20)/*"Directory of %s"*/, buf->path);
-
 
710
    /* trim at first '?', if any */
-
 
711
    for (t = 0; buf->buff64[t] != 0; t++) if (buf->buff64[t] == '?') buf->buff64[t] = 0;
-
 
712
    outputnl(buf->buff64);
-
 
713
    outputnl("");
-
 
714
    if (req.flags & DIR_FLAG_PAUSE) {
753
    dir_print_dirof(buf->path, &availrows, req.flags & DIR_FLAG_PAUSE);
715
      dir_pagination(&availrows);
-
 
716
      dir_pagination(&availrows);
-
 
717
    }
-
 
718
  }
754
  }
719
 
755
 
720
  /* if no file match then abort */
756
  /* if no file match then abort */
721
  if (i != 0) {
757
  if (i != 0) {
722
    if (req.flags & DIR_FLAG_RECUR) goto CHECK_RECURS;
758
    if (req.flags & DIR_FLAG_RECUR) goto CHECK_RECURS;