
Linux
文章平均质量分 83
路飞大大
Stay Hungry, Stay Foolish
Stay Focused, Keep Shipping
展开
-
关于Makefile,Makefile.in,Makefile.am,Configure功能及相互关系的问题
最近在研究开源的东西,发现有很多makefile.am,makefile.in,makefile文件,它们之间究竟是什么关系呢?能可以用什么工具生成吗? 无论对于一个初学者还是一个资深的Linux程序员,编写Makefile文件都是一件很麻烦的事;再者,开发人员应该把主要的精力放在程序代码的编写上,而在Makefile文件花费太多的精力显然是不明智的;还有,对于不同的处理器架构,往往转载 2012-02-08 13:29:21 · 1754 阅读 · 2 评论 -
Unix Programming Frequently Asked Questions - Part II
Unix Programming Frequently Asked Questions - Part IIhttp://www.steve.org.uk/Reference/Unix/faq_toc.html2. General File handling (including pipes and sockets)See also the Sockets FAQ, availa原创 2012-04-26 23:59:33 · 727 阅读 · 0 评论 -
Unix Programming Frequently Asked Questions - Part IV
Unix Programming Frequently Asked Questions - Part IV4. System Information4.1 How can I tell how much memory my system has?This is another `Frequently Unanswered Question'. In most cases原创 2012-04-27 00:04:33 · 727 阅读 · 0 评论 -
Unix Programming Frequently Asked Questions - Part V
Unix Programming Frequently Asked Questions - Part V5. Miscellaneous programming5.1 How do I compare strings using wildcards?The answer to that depends on what exactly you mean by`wildcards'.原创 2012-04-27 00:05:54 · 532 阅读 · 0 评论 -
Unix Programming Frequently Asked Questions - Part VII (over)
Unix Programming Frequently Asked Questions - Part VIIExamplesCatching SIGCHLD#include /* include this before any other sys headers */#include /* header for waitpid() and various macros原创 2012-04-27 00:10:15 · 638 阅读 · 0 评论 -
基于管道的popen和pclose函数
基于管道的popen和pclose函数标准I/O函数库提供了popen函数,它启动另外一个进程去执行一个shell命令行。这里我们称调用popen的进程为父进程,由popen启动的进程称为子进程。popen函数还创建一个管道用于父子进程间通信。子进程要么从管道读信息,要么向管道写信息,至于是读还是写取决于父进程调用popen时传递的参数。下在给出popen、pclose的定义:#i转载 2012-04-26 13:47:01 · 3936 阅读 · 0 评论 -
Unix Programming Frequently Asked Questions - Part III
Unix Programming Frequently Asked Questions - Part III点击打开链接3. Terminal I/O3.1 How can I make my program not echo input?How can I make my program not echo input, like login does when ask原创 2012-04-27 00:01:33 · 706 阅读 · 0 评论 -
Suppress output from popen()
Suppress output from popen()from stackoverflow病例样本:Is there a way to suppress the output from popen() without losing the Wait().Test 1:FILE * stream = NULL;char buffer [120];stream原创 2012-04-27 01:45:09 · 990 阅读 · 0 评论 -
popen(3) - Linux man page
popen(3) - Linux man page点击打开链接Namepopen, pclose - pipe stream to or from a processSynopsis#include stdio.h>FILE *popen(const char *command, const char *type);int pclose(FI原创 2012-04-28 22:48:11 · 907 阅读 · 0 评论 -
Unix Programming Frequently Asked Questions - Part I
Unix Programming Frequently Asked Questionshttp://www.steve.org.uk/Reference/Unix/faq_toc.htmlAbout this FAQ$Id: rawfaq.texi,v 1.37 2000/09/01 06:34:57 andrew Exp $This FAQ was originally be原创 2012-04-26 23:57:24 · 1135 阅读 · 0 评论 -
unp pipe popen函数
unp pipe popen函数在unix中pipe是一种很早的进程间通讯的手段,主要用于有血缘关系的进程(例如父子进程等)。pipe是半双工的,即数据流的方向是单向的。关于pipe的内容在unp的pipe和fifo章节进行总结吧,本文主要分析popen函数。标准I/O库提供了popen函数,原型如下:FILE *popen(const char *cmd, const ch转载 2012-04-27 00:56:05 · 781 阅读 · 0 评论 -
Linux下使用system()函数一定要谨慎
Linux下使用system()函数一定要谨慎曾经的曾经,被system()函数折磨过,之所以这样,是因为对system()函数了解不够深入。只是简单的知道用这个函数执行一个系统命令,这远远不够,它的返回值、它所执行命令的返回值以及命令执行失败原因如何定位,这才是重点。当初因为这个函数风险较多,故抛弃不用,改用其他的方法。这里先不说我用了什么方法,这里必须要搞懂system()函数,因为还转载 2012-04-26 13:37:17 · 988 阅读 · 0 评论 -
Linux中errno使用
<!--@page {margin:2cm}p {margin-bottom:0.21cm}h2 {margin-bottom:0.21cm}h2.western {font-family:"DejaVu Serif Condensed",serif}h2.cjk {font-family:"DejaVu Sans Condensed"; font-st原创 2012-04-26 13:52:21 · 785 阅读 · 0 评论 -
SVN代码回滚命令之---merge的使用
一、改动还没被提交的情况(未commit)这种情况下,见有的人的做法是删除work copy中文件,然后重新update,恩,这种做法达到了目的,但不优雅,因为这种事没必要麻烦服务端。其实一个命令就可以搞定:# svn revert [-R] PATHPATH可以是准备回滚的文件、目录,如果想把某个目录下的所有文件包括子目录都回滚,加上-R选项。二、改动已经提交(已comm原创 2012-04-26 13:59:50 · 837 阅读 · 0 评论 -
知其然且知所以然之grep命令
知其然且知所以然之grep命令最近听一新手朋友讲刚进公司的感受,其中一点就是Linux下的命令用得不熟,一大堆参数完全记不住,对一些老鸟的指法无比羡慕嫉妒恨。 刚开始使用命令谁都不熟,而且不经常使用还会忘记。刚敲入一个命令却忘记了参数是非常恼人的,尤其是遇到一个棘手的问题亟待解决时。这时你会怎么办呢?打开浏览器查一下?还是问下旁边的同事?前者有点慢,毕竟你需要从大量的信息中搜索,如碰转载 2012-04-26 14:27:50 · 1451 阅读 · 0 评论 -
Linux下system()函数引发的错误
Linux下system()函数引发的错误今天,一个运行了近一年的程序突然挂掉了,问题定位到是system()函数出的问题,关于该函数的简单使用在我上篇文章做过介绍: http://my.oschina.net/renhc/blog/53580先看一下问题简单封装了一下system()函数:int pox_system(const char *cmd_line){转载 2012-04-26 13:41:29 · 2923 阅读 · 0 评论 -
shell重定向
shell重定向 a.out >output 2>&1 VS a.out 2>&1 >output1、对于a.out >output 2>&1来说,它的意思是首先将标准输出描述符设置到output文件上,即后面的标准输出都后指定到output文件;然后将标准错误描述符指向标准输出(此时的标准输出已经是output文件了)。这条脚本执行后的结果是将原创 2012-04-27 00:59:13 · 587 阅读 · 0 评论 -
[1003.1(2008)/Issue 7 0000411]: adding atomic FD_CLOEXEC support
[1003.1(2008)/Issue 7 0000411]: adding atomic FD_CLOEXEC supportAustin Group Bug Tracker (noreply-Us27lTmNgZAcWVvVuXF20w@xxxxx.org)2011-08-04 00:54原始链接A NOTE has been added to this issue.转载 2012-04-27 01:08:51 · 654 阅读 · 0 评论 -
Unix Programming Frequently Asked Questions - Part VI
Unix Programming Frequently Asked Questions - Part VI6. Use of tools6.1 How can I debug the children after a fork?Depending on the tools available there are various ways:Your debugger may原创 2012-04-27 00:08:16 · 539 阅读 · 0 评论 -
popen函数及输出错误信息
#include // popen, printf, snprintf#include // WIFEXITED() WEXITSTATUS()#include // extern int errno;#include #include #include #include #define MAX_SIZE (1024)bool exec_cmd(原创 2012-04-28 22:52:06 · 6522 阅读 · 0 评论