嗯,装了 cgywin 就可以把 windows 伪装成 unix 的样子了。不只有编辑器,编译器。很多其它强大而灵活的工具也是 unix 的重要的组成部分。
用的人肯定是非常多了,不过你要问价值怎么样,那应该是因人而异,不同的人价值观不一样嘛。
工具大约可以分成两类:
一类是操作简单,上手容易的。但伴随的缺点是功能强大程度有限,灵活性差。使用上操作速度不快,不能自动化或自动化能力差。
另一类则功能强大,灵活性极高。操作快捷,并拥有很强的自动化能力和脚本化能力。但有一个致命缺点,就是有一定的门槛,容易使初学者望而生畏。
unix 强调强大的功能和高度的灵活性,所以旗下的工具都青睐于后者。而且认为,即使工具入手困难,一次性学习的投入,如果可以在以后的使用中产生高效的回报,就完全值得。
其实 unix 下的工具大多都有高度的一致性,如果有一定的使用基础,学习使用新工具的门槛就会大大降低。并且 unix 的工具都有齐全的文档,查阅和使用都非常方便。
你既然有 cgywin 了,那么我说一个在 windows 下也可能会有点用的东西吧。
你可以试试
man strcpy (就是打这些字,然后按一下回车)
就会出来 srtcpy 这个库函数的说明,里面介绍的东西相当丰富。你换成别的函数名也可以。
看的时候用空格是往后翻页,b 是往前翻,q 是退出。h 会显示帮助,一般会我说的那三个就足够用了。
如果出的提示是“没有相关的说明”之类的,那就是你的 cgywin 安装的不全,你可以在安装时选上安装 doc 或者 document 之类的。就会有了。
在我这执行 man strcpy 出来的是以下这样的:
STRCPY(3) Linux Programmer's Manual STRCPY(3)
NAME
strcpy, strncpy - copy a string
SYNOPSIS
#include <string.h>
char *strcpy(char *dest, const char *src);
char *strncpy(char *dest, const char *src, size_t n);
DESCRIPTION
The strcpy() function copies the string pointed to by src, including
the terminating null byte ('\0'), to the buffer pointed to by dest.
The strings may not overlap, and the destination string dest must be
large enough to receive the copy.
The strncpy() function is similar, except that at most n bytes of src
are copied. Warning: If there is no null byte among the first n bytes
of src, the string placed in dest will not be null terminated.
If the length of src is less than n, strncpy() pads the remainder of
dest with null bytes.
A simple implementation of strncpy() might be:
char*
strncpy(char *dest, const char *src, size_t n){
size_t i;
for (i = 0 ; i < n && src[i] != '\0' ; i++)
dest[i] = src[i];
for ( ; i < n ; i++)
dest[i] = '\0';
return dest;
}
RETURN VALUE
The strcpy() and strncpy() functions return a pointer to the destina‐
tion string dest.
CONFORMING TO
SVr4, 4.3BSD, C89, C99.
NOTES
Some programmers consider strncpy() to be inefficient and error prone.
If the programmer knows (i.e., includes code to test!) that the size
of dest is greater than the length of src, then strcpy() can be used.
If there is no terminating null byte in the first n characters of src,
strncpy() produces an unterminated string in dest. Programmers often
prevent this mistake by forcing termination as follows:
strncpy(buf, str, n);
if (n > 0)
buf[n - 1]= '\0';
BUGS
If the destination string of a strcpy() is not large enough, then any‐
thing might happen. Overflowing fixed-length string buffers is a
favorite cracker technique for taking complete control of the machine.
Any time a program reads or copies data into a buffer, the program
first needs to check that there's enough space. This may be unneces‐
sary if you can show that overflow is impossible, but be careful: pro‐
grams can get changed over time, in ways that may make the impossible
possible.
SEE ALSO
bcopy(3), memccpy(3), memcpy(3), memmove(3), strdup(3), strpcpy(3),
wcscpy(3), wcsncpy(3)
COLOPHON
This page is part of release 3.23 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.
GNU 2009-06-01 STRCPY(3)