who3top.c
来自「unix linux 编程实践源代码」· C语言 代码 · 共 34 行
C
34 行
/* who3.c - who with buffered reads * - surpresses empty records * - formats time nicely * - buffers input (using utmplib) */#include <stdio.h>#include <sys/types.h>#include <utmp.h>#include <fcntl.h>#include <time.h>#define SHOWHOSTvoid show_info(struct utmp *);void showtime(time_t);int main(){ struct utmp *utbufp, /* holds pointer to next rec */ *utmp_next(); /* returns pointer to next */ if ( utmp_open( UTMP_FILE ) == -1 ){ perror(UTMP_FILE); exit(1); } while ( ( utbufp = utmp_next() ) != ((struct utmp *) NULL) ) show_info( utbufp ); utmp_close( ); return 0;}/* * show info() ...
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?