通过函数指针定义,调用时加上参数

struct Command {
const char *name;
const char *desc;
// return -1 to force monitor to exit
int (*func)(int argc, char** argv, struct Trapframe* tf);
};

static struct Command commands[] = {
{ "help", "Display this list of commands", mon_help },
{ "kerninfo", "Display information about the kernel", mon_kerninfo },
{ "backtrace", "Display the current stack trace", mon_backtrace },
};

if (strcmp(argv[0], commands[i].name) == 0)
return commands[i].func(argc, argv, tf);

最新文章

  1. 关于ScrollView嵌套ListView问题
  2. SQL Cumulative Sum累积求和
  3. HTML、CSS和JS
  4. 读写文本(.txt)文件 .NET
  5. mysql:批量更新
  6. HDU 4122
  7. OpenGL学习笔记之了解OpenGL
  8. 01---HTML整理
  9. Swift的闭包(一):闭包简介、闭包表达式的优化
  10. 大数据笔记01:大数据之Hadoop简介
  11. dubbo 服务化
  12. 关于LIST.Select().ToList()慢的问题
  13. 详细分析Java中断机制(转)
  14. Ubuntu 创建启动器
  15. LeetCode OJ 219.Contains Duplicate 2
  16. linux中grep命令的用法
  17. c++(选择排序)
  18. SpaceNet数据集
  19. springmvc 项目单元测试
  20. 建一个网站python

热门文章

  1. Adobe Acrobat Pro 9破解
  2. ffmpeg编译
  3. PHP关于数组缓存JSON、serialize、var_export的说明
  4. 简单学习JavaScript面向对象编程
  5. erlang 常用的计算长度函数
  6. 关于解决“No matching provisioning profiles found”问题-ios
  7. PHP验证码类
  8. getScrollX()理解
  9. sqlDeveloper连接oracle
  10. c语言-猜数字游戏