Subversion Repositories SvarDOS

Rev

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

Rev 528 Rev 533
Line 106... Line 106...
106
    *availrows = screen_getheight() - 1;
106
    *availrows = screen_getheight() - 1;
107
  }
107
  }
108
}
108
}
109
 
109
 
110
 
110
 
111
static int cmd_dir(struct cmd_funcparam *p) {
111
static enum cmd_result cmd_dir(struct cmd_funcparam *p) {
112
  const char *filespecptr = NULL;
112
  const char *filespecptr = NULL;
113
  struct DTA *dta = (void *)0x80; /* set DTA to its default location at 80h in PSP */
113
  struct DTA *dta = (void *)0x80; /* set DTA to its default location at 80h in PSP */
114
  unsigned short i;
114
  unsigned short i;
115
  unsigned short availrows;  /* counter of available rows on display (used for /P) */
115
  unsigned short availrows;  /* counter of available rows on display (used for /P) */
116
  unsigned short wcols = screen_getwidth() / WCOLWIDTH; /* number of columns in wide mode */
116
  unsigned short wcols = screen_getwidth() / WCOLWIDTH; /* number of columns in wide mode */
Line 148... Line 148...
148
    outputnl("    D by date                G group dirs first       - prefix to reverse order");
148
    outputnl("    D by date                G group dirs first       - prefix to reverse order");
149
    outputnl("");
149
    outputnl("");
150
    outputnl("/S Displays files in specified directory and all subdirectories");
150
    outputnl("/S Displays files in specified directory and all subdirectories");
151
    outputnl("/B Uses bare format (no heading information or summary)");
151
    outputnl("/B Uses bare format (no heading information or summary)");
152
    outputnl("/L Uses lowercases");
152
    outputnl("/L Uses lowercases");
153
    return(-1);
153
    return(CMD_OK);
154
  }
154
  }
155
 
155
 
156
  i = nls_getpatterns(nls);
156
  i = nls_getpatterns(nls);
157
  if (i != 0) outputnl(doserr(i));
157
  if (i != 0) outputnl(doserr(i));
158
 
158
 
Line 168... Line 168...
168
      switch (arg) {
168
      switch (arg) {
169
        case 'a':
169
        case 'a':
170
        case 'A':
170
        case 'A':
171
          /* TODO */
171
          /* TODO */
172
          outputnl("/A NOT IMPLEMENTED YET");
172
          outputnl("/A NOT IMPLEMENTED YET");
173
          return(-1);
173
          return(CMD_FAIL);
174
          break;
174
          break;
175
        case 'b':
175
        case 'b':
176
        case 'B':
176
        case 'B':
177
          format = DIR_OUTPUT_BARE;
177
          format = DIR_OUTPUT_BARE;
178
          break;
178
          break;
Line 182... Line 182...
182
          break;
182
          break;
183
        case 'o':
183
        case 'o':
184
        case 'O':
184
        case 'O':
185
          /* TODO */
185
          /* TODO */
186
          outputnl("/O NOT IMPLEMENTED YET");
186
          outputnl("/O NOT IMPLEMENTED YET");
187
          return(-1);
187
          return(CMD_FAIL);
188
          break;
188
          break;
189
        case 'p':
189
        case 'p':
190
        case 'P':
190
        case 'P':
191
          flags |= DIR_FLAG_PAUSE;
191
          flags |= DIR_FLAG_PAUSE;
192
          if (neg) flags &= (0xff ^ DIR_FLAG_PAUSE);
192
          if (neg) flags &= (0xff ^ DIR_FLAG_PAUSE);
193
          break;
193
          break;
194
        case 's':
194
        case 's':
195
        case 'S':
195
        case 'S':
196
          /* TODO */
196
          /* TODO */
197
          outputnl("/S NOT IMPLEMENTED YET");
197
          outputnl("/S NOT IMPLEMENTED YET");
198
          return(-1);
198
          return(CMD_FAIL);
199
          break;
199
          break;
200
        case 'w':
200
        case 'w':
201
        case 'W':
201
        case 'W':
202
          format = DIR_OUTPUT_WIDE;
202
          format = DIR_OUTPUT_WIDE;
203
          break;
203
          break;
204
        default:
204
        default:
205
          outputnl("Invalid switch");
205
          outputnl("Invalid switch");
206
          return(-1);
206
          return(CMD_FAIL);
207
      }
207
      }
208
    } else {  /* filespec */
208
    } else {  /* filespec */
209
      if (filespecptr != NULL) {
209
      if (filespecptr != NULL) {
210
        outputnl("Too many parameters");
210
        outputnl("Too many parameters");
211
        return(-1);
211
        return(CMD_FAIL);
212
      }
212
      }
213
      filespecptr = p->argv[i];
213
      filespecptr = p->argv[i];
214
    }
214
    }
215
  }
215
  }
216
 
216
 
Line 229... Line 229...
229
  } else {
229
  } else {
230
    i = file_truename(filespecptr, p->BUFFER);
230
    i = file_truename(filespecptr, p->BUFFER);
231
  }
231
  }
232
  if (i != 0) {
232
  if (i != 0) {
233
    outputnl(doserr(i));
233
    outputnl(doserr(i));
234
    return(-1);
234
    return(CMD_FAIL);
235
  }
235
  }
236
 
236
 
237
  if (format != DIR_OUTPUT_BARE) {
237
  if (format != DIR_OUTPUT_BARE) {
238
    drv = p->BUFFER[0];
238
    drv = p->BUFFER[0];
239
    if (drv >= 'a') {
239
    if (drv >= 'a') {
Line 257... Line 257...
257
  if (p->BUFFER[i - 1] == '\\') strcat(p->BUFFER, "????????.???");
257
  if (p->BUFFER[i - 1] == '\\') strcat(p->BUFFER, "????????.???");
258
 
258
 
259
  i = findfirst(dta, p->BUFFER, DOS_ATTR_RO | DOS_ATTR_HID | DOS_ATTR_SYS | DOS_ATTR_DIR | DOS_ATTR_ARC);
259
  i = findfirst(dta, p->BUFFER, DOS_ATTR_RO | DOS_ATTR_HID | DOS_ATTR_SYS | DOS_ATTR_DIR | DOS_ATTR_ARC);
260
  if (i != 0) {
260
  if (i != 0) {
261
    outputnl(doserr(i));
261
    outputnl(doserr(i));
262
    return(-1);
262
    return(CMD_FAIL);
263
  }
263
  }
264
 
264
 
265
  wcolcount = 0; /* may be used for columns counting with wide mode */
265
  wcolcount = 0; /* may be used for columns counting with wide mode */
266
 
266
 
267
  do {
267
  do {
Line 360... Line 360...
360
    output(" ");
360
    output(" ");
361
    outputnl("bytes free");
361
    outputnl("bytes free");
362
    if (flags & DIR_FLAG_PAUSE) dir_pagination(&availrows);
362
    if (flags & DIR_FLAG_PAUSE) dir_pagination(&availrows);
363
  }
363
  }
364
 
364
 
365
  return(-1);
365
  return(CMD_OK);
366
}
366
}