Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/coreutils/stat.c


Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/coreutils/stat.c

    r2725 r3232  
    1313 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    1414 */
     15
     16//usage:#define stat_trivial_usage
     17//usage:       "[OPTIONS] FILE..."
     18//usage:#define stat_full_usage "\n\n"
     19//usage:       "Display file (default) or filesystem status\n"
     20//usage:    IF_FEATURE_STAT_FORMAT(
     21//usage:     "\n    -c fmt  Use the specified format"
     22//usage:    )
     23//usage:     "\n    -f  Display filesystem status"
     24//usage:     "\n    -L  Follow links"
     25//usage:     "\n    -t  Display info in terse form"
     26//usage:    IF_SELINUX(
     27//usage:     "\n    -Z  Print security context"
     28//usage:    )
     29//usage:    IF_FEATURE_STAT_FORMAT(
     30//usage:       "\n\nValid format sequences for files:\n"
     31//usage:       " %a Access rights in octal\n"
     32//usage:       " %A Access rights in human readable form\n"
     33//usage:       " %b Number of blocks allocated (see %B)\n"
     34//usage:       " %B The size in bytes of each block reported by %b\n"
     35//usage:       " %d Device number in decimal\n"
     36//usage:       " %D Device number in hex\n"
     37//usage:       " %f Raw mode in hex\n"
     38//usage:       " %F File type\n"
     39//usage:       " %g Group ID of owner\n"
     40//usage:       " %G Group name of owner\n"
     41//usage:       " %h Number of hard links\n"
     42//usage:       " %i Inode number\n"
     43//usage:       " %n File name\n"
     44//usage:       " %N File name, with -> TARGET if symlink\n"
     45//usage:       " %o I/O block size\n"
     46//usage:       " %s Total size, in bytes\n"
     47//usage:       " %t Major device type in hex\n"
     48//usage:       " %T Minor device type in hex\n"
     49//usage:       " %u User ID of owner\n"
     50//usage:       " %U User name of owner\n"
     51//usage:       " %x Time of last access\n"
     52//usage:       " %X Time of last access as seconds since Epoch\n"
     53//usage:       " %y Time of last modification\n"
     54//usage:       " %Y Time of last modification as seconds since Epoch\n"
     55//usage:       " %z Time of last change\n"
     56//usage:       " %Z Time of last change as seconds since Epoch\n"
     57//usage:       "\nValid format sequences for file systems:\n"
     58//usage:       " %a Free blocks available to non-superuser\n"
     59//usage:       " %b Total data blocks in file system\n"
     60//usage:       " %c Total file nodes in file system\n"
     61//usage:       " %d Free file nodes in file system\n"
     62//usage:       " %f Free blocks in file system\n"
     63//usage:    IF_SELINUX(
     64//usage:       " %C Security context in selinux\n"
     65//usage:    )
     66//usage:       " %i File System ID in hex\n"
     67//usage:       " %l Maximum length of filenames\n"
     68//usage:       " %n File name\n"
     69//usage:       " %s Block size (for faster transfer)\n"
     70//usage:       " %S Fundamental block size (for block counts)\n"
     71//usage:       " %t Type in hex\n"
     72//usage:       " %T Type in human readable form"
     73//usage:    )
     74
    1575#include "libbb.h"
    1676
     
    40100    if (S_ISLNK(st->st_mode))  return "symbolic link";
    41101    if (S_ISSOCK(st->st_mode)) return "socket";
     102#ifdef S_TYPEISMQ
    42103    if (S_TYPEISMQ(st))        return "message queue";
     104#endif
     105#ifdef S_TYPEISSEM
    43106    if (S_TYPEISSEM(st))       return "semaphore";
     107#endif
     108#ifdef S_TYPEISSHM
    44109    if (S_TYPEISSHM(st))       return "shared memory object";
     110#endif
    45111#ifdef S_TYPEISTMO
    46112    if (S_TYPEISTMO(st))       return "typed memory object";
     
    377443            ) < 0
    378444        ) {
    379             bb_perror_msg(filename);
     445            bb_simple_perror_msg(filename);
    380446            return 0;
    381447        }
     
    490556            ) < 0
    491557        ) {
    492             bb_perror_msg(filename);
     558            bb_simple_perror_msg(filename);
    493559            return 0;
    494560        }
     
    526592        if (option_mask32 & OPT_TERSE) {
    527593            format = (option_mask32 & OPT_SELINUX ?
    528                   "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n":
    529                   "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n");
     594                "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n"
     595                :
     596                "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n"
     597                );
    530598        } else {
    531599            if (S_ISBLK(statbuf.st_mode) || S_ISCHR(statbuf.st_mode)) {
    532600                format = (option_mask32 & OPT_SELINUX ?
    533                       "  File: %N\n"
    534                       "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
    535                       "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
    536                       " Device type: %t,%T\n"
    537                       "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
    538                       "   S_Context: %C\n"
    539                       "Access: %x\n" "Modify: %y\n" "Change: %z\n":
    540                       "  File: %N\n"
    541                       "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
    542                       "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
    543                       " Device type: %t,%T\n"
    544                       "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
    545                       "Access: %x\n" "Modify: %y\n" "Change: %z\n");
     601                    "  File: %N\n"
     602                    "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
     603                    "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
     604                    " Device type: %t,%T\n"
     605                    "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
     606                    "   S_Context: %C\n"
     607                    "Access: %x\n" "Modify: %y\n" "Change: %z\n"
     608                    :
     609                    "  File: %N\n"
     610                    "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
     611                    "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
     612                    " Device type: %t,%T\n"
     613                    "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
     614                    "Access: %x\n" "Modify: %y\n" "Change: %z\n"
     615                    );
    546616            } else {
    547617                format = (option_mask32 & OPT_SELINUX ?
    548                       "  File: %N\n"
    549                       "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
    550                       "Device: %Dh/%dd\tInode: %-10i  Links: %h\n"
    551                       "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
    552                       "S_Context: %C\n"
    553                       "Access: %x\n" "Modify: %y\n" "Change: %z\n":
    554                       "  File: %N\n"
    555                       "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
    556                       "Device: %Dh/%dd\tInode: %-10i  Links: %h\n"
    557                       "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
    558                       "Access: %x\n" "Modify: %y\n" "Change: %z\n");
     618                    "  File: %N\n"
     619                    "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
     620                    "Device: %Dh/%dd\tInode: %-10i  Links: %h\n"
     621                    "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
     622                    "S_Context: %C\n"
     623                    "Access: %x\n" "Modify: %y\n" "Change: %z\n"
     624                    :
     625                    "  File: %N\n"
     626                    "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
     627                    "Device: %Dh/%dd\tInode: %-10i  Links: %h\n"
     628                    "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
     629                    "Access: %x\n" "Modify: %y\n" "Change: %z\n"
     630                    );
    559631            }
    560632        }
Note: See TracChangeset for help on using the changeset viewer.