Subversion Repositories SvarDOS

Rev

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

Rev 2205 Rev 2206
Line 141... Line 141...
141
    *availrows = screen_getheight() - 1;
141
    *availrows = screen_getheight() - 1;
142
  }
142
  }
143
}
143
}
144
 
144
 
145
 
145
 
-
 
146
static void dir_print_dirprefix(const char *p) {
-
 
147
  unsigned char t, lastbkslash;
-
 
148
  char buff[2] = {0, 0};
-
 
149
 
-
 
150
  /* find the last backslash of path */
-
 
151
  lastbkslash = 0;
-
 
152
  for (t = 0; p[t] != 0; t++) {
-
 
153
    if (p[t] == '\\') lastbkslash = t;
-
 
154
  }
-
 
155
 
-
 
156
  /* print path until last bkslash */
-
 
157
  do {
-
 
158
    *buff = *p;
-
 
159
    output(buff);
-
 
160
    p++;
-
 
161
  } while (lastbkslash-- != 0);
-
 
162
}
-
 
163
 
-
 
164
 
146
/* print the "Directory of C:\ABC\.... string using a buffer with possible
165
/* print the "Directory of C:\ABC\.... string using a buffer with possible
147
 * file pattern garbage trailing */
166
 * file pattern garbage trailing */
148
static void dir_print_dirof(const char *p, unsigned short *availrows, unsigned char pagination) {
167
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};
168
  char buff[2] = {0, 0};
151
  const char *dirof = svarlang_str(37,20); /* Directory of % */
169
  const char *dirof = svarlang_str(37,20); /* Directory of % */
152
 
170
 
153
  outputnl("");
171
  outputnl("");
154
  if (pagination) dir_pagination(availrows);
172
  if (pagination) dir_pagination(availrows);
Line 161... Line 179...
161
  }
179
  }
162
 
180
 
163
  if (*dirof != '%') return;
181
  if (*dirof != '%') return;
164
  dirof++;
182
  dirof++;
165
 
183
 
166
  /* find the last backslash of path */
-
 
167
  lastbkslash = 0;
-
 
168
  for (t = 0; p[t] != 0; t++) {
-
 
169
    if (p[t] == '\\') lastbkslash = t;
-
 
170
  }
-
 
171
  if (lastbkslash == 0) return;
-
 
172
 
-
 
173
  /* print path until last bkslash */
184
  /* print path until last bkslash */
174
  do {
-
 
175
    *buff = *p;
-
 
176
    output(buff);
185
  dir_print_dirprefix(p);
177
    p++;
-
 
178
  } while (lastbkslash-- != 0);
-
 
179
 
186
 
180
  /* print the rest of the dirof string */
187
  /* print the rest of the dirof string */
181
  while (*dirof != 0) {
188
  while (*dirof != 0) {
182
    *buff = *dirof;
189
    *buff = *dirof;
183
    output(buff);
190
    output(buff);
Line 896... Line 903...
896
          availrows++; /* wide mode is the only one that does not write one line per file */
903
          availrows++; /* wide mode is the only one that does not write one line per file */
897
        }
904
        }
898
        break;
905
        break;
899
 
906
 
900
      case DIR_OUTPUT_BARE:
907
      case DIR_OUTPUT_BARE:
-
 
908
        /* if /B used in combination with /S then files are displayed with full path */
-
 
909
        if (req.flags & DIR_FLAG_RECUR) dir_print_dirprefix(buf->path);
901
        outputnl(dta->fname);
910
        outputnl(dta->fname);
902
        break;
911
        break;
903
    }
912
    }
904
 
913
 
905
    if (req.flags & DIR_FLAG_PAUSE) dir_pagination(&availrows);
914
    if (req.flags & DIR_FLAG_PAUSE) dir_pagination(&availrows);