Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

62 63 char uid_to_name(), *ctime(), gid_to_name), *filemode (; void mode_to_letters) char modestr[11]i 67 mode_ to_letters( info_p->st mode, modestr) printf( printf( printf( printf( printf( printf( printf(

image text in transcribedimage text in transcribed

image text in transcribed image text in transcribedimage text in transcribed

62 63 char uid_to_name(), *ctime(), gid_to_name), *filemode (; void mode_to_letters) char modestr[11]i 67 mode_ to_letters( info_p->st mode, modestr) printf( printf( printf( printf( printf( printf( printf( "%s" "%4d " ' "%-8s " ' "%-8s " ' "%81d " ' "%.12s "' "%s " ' , modestr 69 70 71 72 73 74 75 76 (int) info-p-st-nlink); uid-to-name (info-p->st-uid) ); gid-to-name ( info-p-> st-gid) ); (long )info-p->st_size); 4+ctime (&info-p->st_mtine)); filename ); 78 80 utility functions 84 This function takes a mode value and a char array 85 and puts into the char array the file type and the 86 nine letters that correspond to the bits in mode 87 NOTE: It does not code setuid, setgid, and sticky 88 codes 89 / 90 void mode to_letters( int mode, char str[]) 91 92 93 94 95 strcpy str," /* default-no perms */ if S ISDIR (mode)) str[0] 'd'i/directory? if S_ISCHR (mode) str[0]'C'i/* char devices if S_ISBLK (mode) str[0] 'b'iblock device 97 98 if mode &S_IRUSR str[1] 'r'; 3 bits for user if ( mode & S-IWUSR ) str[2] 'w'; if mode & S_IXUSR) str[3]'x' 100 if (mode & S_IRGRP str[4] 'r' /* 3 bits for group / if (mode & S_IWGRP str[5] 'w' if ( mode & s_1XGRP ) str[6] 'x'; 102 103 104 105 106 107 108 109 if (mode &S_IROTH str[7] 'r'; 3 bits for other if mode &S_IWOTH str[8] 'w' if mode &S_IXOTH str[9]'x' 111 #include 112 113 char uid_to_name( uid t uid) 114 /* 115 returns pointer to username associated with uid, uses getpw() 116 pwd.h> struct passwd *xgetpwuid), *pw_ptr; static char numstr[10] 118 120 if pw_ptr- getpwuid( uid NULL 62 63 char uid_to_name(), *ctime(), gid_to_name), *filemode (; void mode_to_letters) char modestr[11]i 67 mode_ to_letters( info_p->st mode, modestr) printf( printf( printf( printf( printf( printf( printf( "%s" "%4d " ' "%-8s " ' "%-8s " ' "%81d " ' "%.12s "' "%s " ' , modestr 69 70 71 72 73 74 75 76 (int) info-p-st-nlink); uid-to-name (info-p->st-uid) ); gid-to-name ( info-p-> st-gid) ); (long )info-p->st_size); 4+ctime (&info-p->st_mtine)); filename ); 78 80 utility functions 84 This function takes a mode value and a char array 85 and puts into the char array the file type and the 86 nine letters that correspond to the bits in mode 87 NOTE: It does not code setuid, setgid, and sticky 88 codes 89 / 90 void mode to_letters( int mode, char str[]) 91 92 93 94 95 strcpy str," /* default-no perms */ if S ISDIR (mode)) str[0] 'd'i/directory? if S_ISCHR (mode) str[0]'C'i/* char devices if S_ISBLK (mode) str[0] 'b'iblock device 97 98 if mode &S_IRUSR str[1] 'r'; 3 bits for user if ( mode & S-IWUSR ) str[2] 'w'; if mode & S_IXUSR) str[3]'x' 100 if (mode & S_IRGRP str[4] 'r' /* 3 bits for group / if (mode & S_IWGRP str[5] 'w' if ( mode & s_1XGRP ) str[6] 'x'; 102 103 104 105 106 107 108 109 if (mode &S_IROTH str[7] 'r'; 3 bits for other if mode &S_IWOTH str[8] 'w' if mode &S_IXOTH str[9]'x' 111 #include 112 113 char uid_to_name( uid t uid) 114 /* 115 returns pointer to username associated with uid, uses getpw() 116 pwd.h> struct passwd *xgetpwuid), *pw_ptr; static char numstr[10] 118 120 if pw_ptr- getpwuid( uid NULL

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Did you write a special beginning that makes the reader want more?

Answered: 1 week ago