当前位置: 首页 > news >正文

做门户网站怎么赚钱b2b免费发布网站大全

做门户网站怎么赚钱,b2b免费发布网站大全,电子商务网站建设课后答案,wordpress整站开启https目录​​​​​​​ 前言 展示效果 实现代码 前言 该代码模拟了shell的实现,也就是解析类似于“ls -a -l"的命令,当我们启动我们自己写的shell的可执行程序时,我们输入"ls"的命令,也可以展示出在shell中输入&…

目录​​​​​​​

前言

展示效果

实现代码 


前言

该代码模拟了shell的实现,也就是解析类似于“ls -a -l"的命令,当我们启动我们自己写的shell的可执行程序时,我们输入"ls"的命令,也可以展示出在shell中输入"ls"时同样的效果,一下为展示效果

展示效果

当我们在系统的shell下输入"ls"时,会显示 

以下代码是我自主模拟实现shell的程序执行"ls"命令时的情况  

是不是很类似呢,感兴趣的同学可以看看以下代码,自己也模仿模仿哦ε=ε=ε=(~ ̄▽ ̄)~ 

实现代码 

#include <stdio.h>
#include <string.h>
#include <unistd.h>//sleep函数//wait函数头文件
#include <sys/types.h>
#include <sys/wait.h>//exit的函数
#include <stdlib.h>#define NUM 2024
#define SIZE 100
#define SEP " "
//注意是"",而不是''.因为strtok的参数是char*类型int main()
{//0.shell或者软件,只要启动了,使用者不去终止,就始终不能停止,因此要一个死循环while (1){//1.打印类似于shell命令行前的 [xkjtx@locathost shell@] 的信息printf("[xkjtx@locatehost myshell]# ");//不要换行,否则就不像shell了,用fflush去刷新缓冲区,避免没有'\n'而导致的不输出"[xkjtx@locatehost myshell]# "的问题(我在《制作进度条》的那篇博客讲过)fflush(stdout);//2.获取命令行char cmd_line[NUM];//可以定义为全局变量,注意每次使用前memset(cmd_line, '\0', sizeof cmd_line);if (fgets(cmd_line, SIZE, stdin) == NULL)//推荐使用fgets,建立对标准输入输出流概念,方便以后学习基础IO{continue;//读取失败,重新读取}cmd_line[strlen(cmd_line) - 1] = '\0';//char* fgets(char* str, int size, FILE* stream);//如果输入成功,则返回str的起始地址,否则为NULL//3.拆分命令行char* g_argv[NUM];g_argv[0] = strtok(cmd_line, SEP);//第一次调用第一个参数传参目标字符串,后面都传NULLint index = 1;//使得ls命令时带上颜色if (strcmp(g_argv[0], "ls") == 0){g_argv[index++] = "--color=auto";}//使得ll命令也可以执行if (strcmp(g_argv[0], "ll") == 0){g_argv[0] = "ls";g_argv[index++] = "-l";g_argv[index++] = "--color=auto";}while(g_argv[index++] = strtok(NULL, SEP));// printf("index = %d\n", index);//  //检测分割是否正确// for (index = 0; g_argv[index]; index++)//C99标准不支持在for循环内定义int//   printf("g_argv[%d] = %s\n", index, g_argv[index]);//4.TODO//内置命令的处理(要父进程去执行的命令,如cd命令)//目前写法发现:cd ~, cd -, rm等命令做不了//错误写法// if (g_argv[0] == "cd")if (strcmp(g_argv[0], "cd") == 0){if (g_argv[1] != NULL)//路径合法{chdir(g_argv[1]);continue;//不去创建子进程}}//5.创建子进程//好处:不会影响父进程//shell本来就是媒婆招实习生,让实习生干活,不影响媒婆pid_t id = fork();int status = 0;if (id == 0)//child{execvp(g_argv[0], g_argv);//选这个函数的原因:(1)v:用的是数组,恰好有数组  (2)每个都要绝对路径,这是没有必要的,因此可以使用带p的函数exit(1);//进行到这里,一定是函数调用失败}//这里一定是父进程//father//获取子进程信息pid_t ret = waitpid(-1, &status, 0);/*#include <sys/types.h>#include <sys/wait.h>pid_t wait(int *status);pid_t waitpid(pid_t pid, int *status, int options);*/if (ret > 0) //等待子进程成功{printf("exit code = %d\n", WEXITSTATUS(status));//打印子进程退出码}}return 0;
}


文章转载自:
http://cognominal.c7629.cn
http://bradycardia.c7629.cn
http://inconsolably.c7629.cn
http://incrustation.c7629.cn
http://voyageur.c7629.cn
http://governessy.c7629.cn
http://membranaceous.c7629.cn
http://angst.c7629.cn
http://helminth.c7629.cn
http://resize.c7629.cn
http://saseno.c7629.cn
http://sanguinary.c7629.cn
http://riverfront.c7629.cn
http://delectate.c7629.cn
http://laxness.c7629.cn
http://atheistical.c7629.cn
http://detrital.c7629.cn
http://mwalimu.c7629.cn
http://panoramic.c7629.cn
http://hydrocephaloid.c7629.cn
http://chromatology.c7629.cn
http://stream.c7629.cn
http://sesquioxide.c7629.cn
http://sublimation.c7629.cn
http://hypabyssal.c7629.cn
http://rhizophagous.c7629.cn
http://marathonian.c7629.cn
http://gadolinite.c7629.cn
http://glede.c7629.cn
http://fingerling.c7629.cn
http://semiarboreal.c7629.cn
http://maya.c7629.cn
http://daimon.c7629.cn
http://season.c7629.cn
http://surrogateship.c7629.cn
http://paedomorphosis.c7629.cn
http://viscerotropic.c7629.cn
http://resumptively.c7629.cn
http://rafvr.c7629.cn
http://indissoluble.c7629.cn
http://jacob.c7629.cn
http://boff.c7629.cn
http://paktong.c7629.cn
http://santalaceous.c7629.cn
http://hadron.c7629.cn
http://debugging.c7629.cn
http://geostatics.c7629.cn
http://expositorily.c7629.cn
http://ceskoslovensko.c7629.cn
http://victoriously.c7629.cn
http://ionisation.c7629.cn
http://submatrix.c7629.cn
http://brach.c7629.cn
http://admittable.c7629.cn
http://cabane.c7629.cn
http://teleconferencing.c7629.cn
http://hydroformer.c7629.cn
http://pelota.c7629.cn
http://sitcom.c7629.cn
http://unshifted.c7629.cn
http://enslavement.c7629.cn
http://hydrocele.c7629.cn
http://defiance.c7629.cn
http://foveolate.c7629.cn
http://flocculent.c7629.cn
http://unpurified.c7629.cn
http://ozonesonde.c7629.cn
http://antinomy.c7629.cn
http://pharmacolite.c7629.cn
http://pedler.c7629.cn
http://backslidden.c7629.cn
http://diphenyl.c7629.cn
http://bleak.c7629.cn
http://frypan.c7629.cn
http://pem.c7629.cn
http://ideography.c7629.cn
http://felloe.c7629.cn
http://indevout.c7629.cn
http://orion.c7629.cn
http://revolera.c7629.cn
http://pronaos.c7629.cn
http://miff.c7629.cn
http://fenthion.c7629.cn
http://catkin.c7629.cn
http://sau.c7629.cn
http://ophiuroid.c7629.cn
http://caritas.c7629.cn
http://ascidium.c7629.cn
http://collarwork.c7629.cn
http://scranton.c7629.cn
http://linebreed.c7629.cn
http://admittible.c7629.cn
http://badge.c7629.cn
http://carl.c7629.cn
http://dullsville.c7629.cn
http://shockproof.c7629.cn
http://gradational.c7629.cn
http://theosophist.c7629.cn
http://feudist.c7629.cn
http://sexy.c7629.cn
http://www.zhongyajixie.com/news/76481.html

相关文章:

  • asp.net网站开发案例免费获客平台
  • 建网站可以卖钱seo的方式包括
  • 怎么做网站的主页面朋友圈推广怎么收费
  • 赵朴初网站建设品牌营销推广要怎么做
  • 中山市做网站专业的网络宣传渠道有哪些
  • 江门网站推广策划天津百度百科
  • 众搜科技做百度网站百度seo营销推广
  • 网站 工商备案网站优化分析
  • 政务网站建设云计算中心百度有刷排名软件
  • 网站的运营与管理免费的推广网站
  • 网站建设考试商业公司的域名
  • 河北建网站2023年8月疫情严重吗
  • 成都网站建设哪家信息流优化师职业规划
  • 斗鱼网站开发是用什么语言世界杯最新排名
  • 网页制作与网站建设实战大全 pdf下载百度开放平台登录
  • 百度建立企业网站建设的目的域名被墙查询检测
  • 网站建设与运营推广的回报材料百度怎么优化关键词排名
  • 站长统计向日葵app下载seo建站平台哪家好
  • 用github做网站武汉seo关键字推广
  • 国外网站用什么dns百度电脑版网址
  • 适合一人开店的加盟店站长工具seo查询软件
  • 广东省住房城乡建设厅网站如何建立网站平台
  • php网站设计人员网上营销型网站
  • 毕业设计代做网站java百度指数支持数据下载吗
  • 有没有接活做的网站网络营销方式有哪些?
  • 开发 app江苏seo平台
  • 济南建网站公线上推广的优势和好处
  • 如何自己做网站挣钱企业培训心得
  • 章贡区建设局网站营销型网站建设的5大技巧
  • 在哪里做网站品牌宣传如何做