bsd

What's the Solaris equivalent to the BSD's 'tail -n100'?

前提是你 提交于 2019-12-06 21:08:24
问题 I've looked this up a thousand times, and I always forget it, so, here for eternity: Solaris has a bit of an awkward syntax for tail . How do I do the equivalent of BSD's tail -n N ? What I want are the last N lines from tail's input. 回答1: Just remove the "n" tail -100 回答2: Or you can use: /usr/xpg4/bin/tail which does behave like you want ( tail -n N ). xpg4 = Xopen Portability Guide Issue 4, contains binaries strictly compliant with several POSIX and other standards. The differences with

Failed to execute script.sh: unknown error

故事扮演 提交于 2019-12-06 07:52:42
I wanted to use DTrace to see "what syscalls are made by my shell script". I made a very simple shell script, shell.sh , and gave it execute privileges: #!/bin/bash grep 1 <<< 123 I cd 'd into its directory, and ran this simple DTrace script: sudo dtrace -n 'syscall:::entry /pid == $target/ { @[probefunc] = count(); }' -c ./trace-me.sh I get this error output: dtrace: failed to execute ./trace-me.sh: unknown error What happened here? I've run csrutil enable --without dtrace . The DTrace script runs fine if I remove the -c arg (and replace $target with a pid). Is this just another Mac gotcha? I

What does -D_DEFAULT_SOURCE do?

强颜欢笑 提交于 2019-12-05 09:46:54
问题 Previously I was receiving warnings from gcc -std=c99 that usleep() was implicitly declared. Then I stumbled across this stackoverflow post, which led me to use -D_BSD_SOURCE . However, now gcc tells me that -D_BSD_SOURCE has been deprecated and I should use -D_DEFAULT_SOURCE instead. #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" Why is -D_BSD_SOURCE deprecated? Why is -D_DEFAULT_SOURCE used instead? And what does it do? I did some googling, and the results are

Determine OS during runtime

半城伤御伤魂 提交于 2019-12-05 05:35:35
Neither ISO C nor POSIX offer functionality to determine the underlying OS during runtime. From a theoretical point of view, it doesn't matter since C offers wrappers for the most common system calls, and from a nit-picking point of view, there doesn't even have to be an underlying OS. However, in many real-world scenarios, it has proven helpful to know more about the host environment than C is willing to share, e.g. in order to find out where to store config files or how to call select() , so: Is there an idiomatic way for an application written in C to determine the underlying OS during

许可协议 :GPL、BSD、MIT、Mozilla、Apache和LGPL

六月ゝ 毕业季﹏ 提交于 2019-12-05 02:01:16
原文摘自:https://blog.csdn.net/testcs_dn/article/details/38496107 首先借用有心人士的一张相当直观清晰的图来划分各种协议:开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别 以下是上述协议的简单介绍: BSD开源协议 BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以”为所欲为”,可以自由的使用,修改源代码,也可以将修改后的代码作为开源或者专有软件再发布。 但”为所欲为”的前提当你发布使用了BSD协议的代码,或则以BSD协议代码为基础做二次开发自己的产品时,需要满足三个条件: 如果再发布的产品中包含源代码,则在源代码中必须带有原来代码中的BSD协议。 如果再发布的只是二进制类库/软件,则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。 不可以用开源代码的作者/机构名字和原来产品的名字做市场推广。 BSD 代码鼓励代码共享,但需要尊重代码作者的著作权。BSD由于允许使用者修改和重新发布代码,也允许使用或在BSD代码上开发商业软件发布和销售,因此是对商业集成很友好的协议。而很多的公司企业在选用开源产品的时候都首选BSD协议,因为可以完全控制这些第三方的代码,在必要的时候可以修改或者二次开发。 Apache Licence 2.0 Apache

Get Current User from root mode?

♀尐吖头ヾ 提交于 2019-12-04 17:04:47
I am writing a login item and I am trying to find if its possible to get the current user. Lets say, I have logged in with user "Test" and when I execute the exe with root privileges and if I use char *user = getenv("USER"); user is "root". My expected answer is "Test". How can I get it? I don't know if I can put objective c code in login item? Is it possible to NSUserName in login item. NSString *user = NSUserName(); You want the SCDynamicStoreCopyConsoleUser function . QA1133 gives some relevant details and caveats. Login items can be Cocoa applications, so you can use NSUserName() (which is

五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)

主宰稳场 提交于 2019-12-04 09:22:40
转载自: https://blog.csdn.net/yihui823/article/details/6779361 现今存在的开源协议很多,而经过Open Source Initiative组织通过批准的开源协议目前有58种( http://www.opensource.org/licenses/alphabetical )。我们在常见的开源协议如BSD, GPL, LGPL,MIT等都是OSI批准的协议。如果要开源自己的代码,最好也是选择这些被批准的开源协议。 这里我们来看五种最常用的开源协议及它们的适用范围,供那些准备开源或者使用开源产品的开发人员/厂家参考。 BSD开源协议 ( original BSD license 、 FreeBSD license 、 Original BSD license ) BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以”为所欲为”,可以自由的使用,修改源代码,也可以将修改后的代码作为开源或者专有软件再发布。 但”为所欲为”的前提当你发布使用了BSD协议的代码,或则以BSD协议代码为基础做二次开发自己的产品时,需要满足三个条件: 如果再发布的产品中包含源代码,则在源代码中必须带有原来代码中的BSD协议。 如果再发布的只是二进制类库/软件,则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。 不可以用开源代码的作者

Linux工作环境:CentOS7最小安装+Xfce桌面环境

冷暖自知 提交于 2019-12-04 05:51:08
打造基于CentOS7的xfce最简工作环境 打造基于CentOS7的xfce最简工作环境 引言 操作系统与桌面环境的抉择 1 操作系统 2 桌面环境 安装步骤 1 执行CentOS7 最小安装 2 安装X Window system 3 安装Xfce4 4 安装中文字体和中文输入法 5 安装firefox 6 安装开发环境 1 引言 之前我写过一篇名为“ 打造字符界面的多媒体Linux系统 ”的博文,详细描述了基于framebuffer多媒体Linux工作站安装步骤。然而,毕竟今天要完全离开窗口环境工作不太现实,最起码也要使用firefox之类的完整浏览器吧。而且有了窗口管理器也能更加方便地进行程序开发。 硬件环境:ThinkPad T410S 2 操作系统与桌面环境的抉择 2.1 操作系统 类Unix操作系统有很多,用户群较多的开放源代码而且免费的有:BSD系列(FreeBSD,NetBSD,OpenBSD),Linux系列(CentOS,Suse,Ubuntu,Debian)。BSD和Linux一直以来口水战不断,谁也看不上谁,但同时又相互学习。本文不想再次引发这种无聊的战争,仅从个人体验谈起。最开始我尝试了BSD中用户数量最多,支持硬件最多的FreeBSD,安装完成发现还是有很多硬件不被支持,而且pkg安装软件速度很慢(应该是服务器网络问题)。对于新硬件的支持

What does -D_DEFAULT_SOURCE do?

会有一股神秘感。 提交于 2019-12-03 22:26:56
Previously I was receiving warnings from gcc -std=c99 that usleep() was implicitly declared. Then I stumbled across this stackoverflow post , which led me to use -D_BSD_SOURCE . However, now gcc tells me that -D_BSD_SOURCE has been deprecated and I should use -D_DEFAULT_SOURCE instead. #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" Why is -D_BSD_SOURCE deprecated? Why is -D_DEFAULT_SOURCE used instead? And what does it do? I did some googling , and the results are just filled with people using it to shut gcc up. I couldn't find out why -D_BSD_SOURCE has been

Good collection of libraries for C? [closed]

﹥>﹥吖頭↗ 提交于 2019-12-03 05:46:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm looking for a good collection of libraries for ANSI-C, stuff for handling vectors, hash maps, binary tress, string processing, etc. 回答1: Try glib? It's used by GTK+, but it can also be used on other platforms. You can also try Apache APR, which is used by the Apache web server and some of their other C