Subversion Repositories SvarDOS

Rev

Rev 389 | Rev 393 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 389 Rev 390
1
/*
1
/*
2
 * dir
2
 * dir
3
 *
3
 *
4
 * Displays a list of files and subdirectories in a directory.
4
 * Displays a list of files and subdirectories in a directory.
5
 *
5
 *
6
 * DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]
6
 * DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]
7
 *
7
 *
8
 * /P Pauses after each screenful of information.
8
 * /P Pauses after each screenful of information.
9
 * /W Uses wide list format.
9
 * /W Uses wide list format.
10
 *
10
 *
11
 * /A Displays file with specified attributes:
11
 * /A Displays file with specified attributes:
12
 *     D Directories           R Read-only files     H Hidden files
12
 *     D Directories           R Read-only files     H Hidden files
13
 *     A Ready for archiving   S System files        - prefix meaning "not"
13
 *     A Ready for archiving   S System files        - prefix meaning "not"
14
 *
14
 *
15
 * /O List files in sorted order:
15
 * /O List files in sorted order:
16
 *     N by name            S by size              E by extension
16
 *     N by name            S by size              E by extension
17
 *     D by date            G group dirs first     - prefix to reverse order
17
 *     D by date            G group dirs first     - prefix to reverse order
18
 *
18
 *
19
 * /S Displays files in specified directory and all subdirectories.
19
 * /S Displays files in specified directory and all subdirectories.
20
 * /B Uses bare format (no heading information or summary)
20
 * /B Uses bare format (no heading information or summary)
21
 * /L Uses lowercases
21
 * /L Uses lowercases
22
 */
22
 */
23
 
23
 
24
static int cmd_dir(struct cmd_funcparam *p) {
24
static int cmd_dir(struct cmd_funcparam *p) {
25
  const char *filespecptr = "*.*";
25
  const char *filespecptr = "*.*";
26
  struct DTA *dta = (void *)0x80; /* set DTA to its default location at 80h in PSP */
26
  struct DTA *dta = (void *)0x80; /* set DTA to its default location at 80h in PSP */
27
 
27
 
-
 
28
  if (cmd_ishlp(p)) {
-
 
29
    outputnl("Displays a list of files and subdirectories in a directory.");
-
 
30
    outputnl("\r\nTHIS COMMAND IS NOT FULLY IMPLEMENTED YET");
-
 
31
    return(-1);
-
 
32
  }
-
 
33
 
28
  if (findfirst(dta, filespecptr, DOS_ATTR_RO | DOS_ATTR_HID | DOS_ATTR_SYS | DOS_ATTR_DIR | DOS_ATTR_ARC) != 0) return(-1);
34
  if (findfirst(dta, filespecptr, DOS_ATTR_RO | DOS_ATTR_HID | DOS_ATTR_SYS | DOS_ATTR_DIR | DOS_ATTR_ARC) != 0) return(-1);
29
 
35
 
30
  outputnl(dta->fname);
36
  outputnl(dta->fname);
31
 
37
 
32
  while (findnext(dta) == 0) outputnl(dta->fname);
38
  while (findnext(dta) == 0) outputnl(dta->fname);
33
 
39
 
34
  return(-1);
40
  return(-1);
35
}
41
}
36
 
42