1: #include "hd.h"
   2: #include "mydir.h"
   3: #include "command.h"
   4: 
   5: #define SHIFT1  13
   6: #define SHIFT2  6
   7: #define SHIFT3  3
   8: #define MASK    07
   9: 
  10: pfstatus (fname) char * fname; {
  11: 
  12: /* long listing of a file */
  13: static char *mchar [2] [8] = {
  14:     "---", "--x", "-w-", "-wx",
  15:     "r--", "r-x", "rw-", "rwx",
  16:     "--s", "--s", "-ws", "-ws",
  17:     "r-s", "r-s", "rws", "rws"
  18: };
  19: 
  20: static char fformat [8] = {' ', 'c', 'd', 'b', '-', '?', '?', '?'};
  21: 
  22: register mode;
  23: 
  24: if (stat (fname, &scr_stb)) {
  25:     printf ("Cannot Access");
  26:     return;
  27: }
  28: mode = scr_stb.st_mode;
  29: 
  30: printf ("%c%c%s%s%s%s%2d",
  31:     (mode & S_ISVTX) ? 't' : ' ',
  32:     fformat [(mode >> SHIFT1) & MASK],
  33:     mchar [(mode & S_ISUID) != 0] [(mode >> SHIFT2) & MASK],
  34:     mchar [(mode & S_ISGID) != 0] [(mode >> SHIFT3) & MASK],
  35:     mchar [0]             [mode & MASK],
  36:     scr_stb.st_nlink > 99 ? "" : " ",
  37:     scr_stb.st_nlink);
  38: if (mode & S_IFCHR)
  39:     printf ("%5d, %3d",
  40:     major (scr_stb.st_rdev), minor (scr_stb.st_rdev));
  41: else
  42:     printf ("%10D", scr_stb.st_size);
  43: printf (" %.24s", ctime (&scr_stb.st_mtime));
  44: }
  45: 
  46: /* This prints out the protection modes of the files on the current
  47:    page.  It knows the page from the global variable cpage.  The
  48:    value NOREPLOT is always returned, to make globalcmd happy.
  49: */
  50: longlist () {       /* long listing for entire page */
  51: 
  52:     register i;
  53:     bufout ();
  54:     for (i=0; i < pageend; i++) longfile (i);
  55:     unbufout ();
  56: 
  57:     return CMD_DATE;    /* Run date command */
  58: }
  59: 
  60: longfile (index) int index; {
  61: 
  62: atfile (index, 22); pfstatus (filename (index));
  63: }

Defined functions

longfile defined in line 60; used 2 times
longlist defined in line 50; used 3 times
pfstatus defined in line 10; used 1 times
  • in line 62

Defined macros

MASK defined in line 8; used 4 times
SHIFT1 defined in line 5; used 1 times
  • in line 32
SHIFT2 defined in line 6; used 1 times
  • in line 33
SHIFT3 defined in line 7; used 1 times
  • in line 34
Last modified: 1980-08-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 636
Valid CSS Valid XHTML 1.0 Strict