View file/dir attribute
This commit is contained in:
parent
f413e0216e
commit
ec859e8403
1 changed files with 23 additions and 0 deletions
23
ccc.c
23
ccc.c
|
@ -70,6 +70,7 @@ void create_file(void);
|
|||
void delete_files(void);
|
||||
void start_shell(void);
|
||||
void yank_clipboard(void);
|
||||
void view_file_attr(void);
|
||||
void wpprintw(const char *fmt, ...);
|
||||
void move_cursor(int row, int col);
|
||||
int readch(void);
|
||||
|
@ -367,6 +368,9 @@ int main(int argc, char **argv)
|
|||
|
||||
case 'o':
|
||||
case 'O':
|
||||
case 'x':
|
||||
view_file_attr();
|
||||
break;
|
||||
|
||||
/* mark one file */
|
||||
case SPACE:
|
||||
|
@ -1269,6 +1273,25 @@ void yank_clipboard(void)
|
|||
}
|
||||
}
|
||||
|
||||
void view_file_attr(void)
|
||||
{
|
||||
bprintf("\033[2J");
|
||||
move_cursor(1, 1);
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
/* Child process */
|
||||
execlp("stat", "stat", files->items[sel_file].name, NULL);
|
||||
_exit(1); /* Exit if exec fails */
|
||||
} else if (pid > 0) {
|
||||
/* Parent process */
|
||||
waitpid(pid, NULL, 0);
|
||||
} else {
|
||||
/* Fork failed */
|
||||
wpprintw("fork failed: %s", strerror(errno));
|
||||
}
|
||||
readch();
|
||||
}
|
||||
|
||||
/*
|
||||
* Print line to the panel
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue