linux系统编程
景天的天
我害怕你心碎没人帮你擦眼泪
展开
-
Unix-Linux编程实践教程——pipe
这个demo还是很有意思的,关于重定向和管道结合的很好,也很清晰的展示了进程之间通过管道去通信的原理。//// Created by Jimmy on 3/31/20.//#include <stdio.h>#include <unistd.h>#include <cstdlib>#define oops(m,x) {perror(m);exi...原创 2020-04-01 09:16:39 · 243 阅读 · 0 评论 -
Unix-Linux编程实践教程——shell(3)
相较前一个版本,主要是把main.cpp中的对命令直接执行换成了对命令进行处理,加了逻辑的判断。头文件controlflow.h//// Created by Jimmy on 3/25/20.//#ifndef WHO_CONTROLFLOW_H#define WHO_CONTROLFLOW_H#include <stdio.h>#include "smsh....原创 2020-03-25 15:45:45 · 192 阅读 · 0 评论 -
Unix-Linux编程实践教程——shell(2)
头文件smsh.h//// Created by Jimmy on 3/23/20.//#ifndef WHO_SMSH_H#define WHO_SMSH_H#include <stdio.h>#include <stdlib.h>#include <string.h>#include <signal.h>#include ...原创 2020-03-23 16:51:41 · 264 阅读 · 0 评论 -
Unix-Linux编程实践教程——shell(1)
//// Created by Jimmy on 3/19/20.//#include <stdio.h>#include <signal.h>#include <string.h>#include <stdlib.h>#include <zconf.h>#define MAXARGS 20#define ARGLEN...原创 2020-03-20 10:59:08 · 195 阅读 · 0 评论 -
Unix-Linux编程实践教程——pwd
//// Created by Eddie on 2020/3/16.//#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <dirent.h>#include <cstdlib>#include <cstring>#...原创 2020-03-16 21:47:29 · 171 阅读 · 0 评论 -
Unix-Linux编程实践教程——ls
//// Created by Eddie on 2020/3/15.//#include <stdio.h>#include <sys/types.h>#include <dirent.h>void do_ls(char[]);int main(int ac, char *av[]){ if(ac == 1) do_...原创 2020-03-15 22:09:33 · 201 阅读 · 0 评论 -
Unix-Linux编程实践教程——utmplib.c
//// Created by Eddie on 2020/3/14.//#include <stdio.h>#include <fcntl.h>#include <sys/types.h>#include <utmp.h>#include <zconf.h>#define NRECS 16#define NULLU...原创 2020-03-15 09:03:59 · 279 阅读 · 0 评论 -
Unix-Linux编程实践教程——cp
/*--version 1.0--*/#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <cstdlib>#define BUFFERSIZE 4096#define COPYMODE 0644void oops(const char *, const c...原创 2020-03-13 17:05:39 · 229 阅读 · 0 评论 -
Unix-Linux编程实践教程——who
/*--version 1.0--*/#include <stdio.h>#include <utmp.h>#include <fcntl.h>#include <unistd.h>#include <cstdlib>#define SHOWHOSTvoid show_info(utmp *);int main(){...原创 2020-03-12 20:25:14 · 164 阅读 · 0 评论 -
Unix-Linux编程实践教程——more
/*--version 1.0--*/#include <stdio.h>#include <cstdlib>#define PAGELEN 24#define LINELEN 512void do_more(FILE *);int see_more();int main(int ac, char * av[]){ FILE *fp; ...原创 2020-03-12 10:43:43 · 184 阅读 · 0 评论