跟我一起写操作系统

    返回首页    发表留言
本文作者:李德强
          第一节 pwd命令
 
 

         pwd为print name of current/working directory的简写。顾名思义,就是显示当前的工作目录。pwd的实现代码如下:

char *current_path = malloc(SHELL_CMD_LEN);
int params[2];
params[0] = 6;
params[1] = (int) current_path;
__asm__ volatile("int $0x80" :: "a"(params));
printf("%s\n", current_path);
free(current_path);

        运行结果如下:



 

        源代码的下载地址为:

https            https://github.com/magicworldos/lidqos.git 
git              git@github.com:magicworldos/lidqos.git 
subverion        https://github.com/magicworldos/lidqos 
branch           v0.30

    返回首页    返回顶部
  看不清?点击刷新

 

  Copyright © 2015-2023 问渠网 辽ICP备15013245号