C/C++ÖÐʹÓÃÕýÔò±í´ïʽ
Í·Îļþregex.hÖж¨ÒåÁËc/c++ʹÓÃÕýÔò±í´ïʽµÄº¯Êý£º regcomp(), regexec(), regerror(), and regfree() ¡£regcomp()±àÒëÕýÔò±í´ïʽ£¬regexec()Æ¥ÅäÕýÔò±í´ïʽ£¬ regfree()ÊÍ·ÅÕýÔò±í´ïʽ£¬regerror()±¨¸æÕýÔò±í´ïʽ´íÎóÐÅÏ¢¡£Ê¹Ó÷½·¨ÈçÏ´úÂëËùʾ£º
static string merge_path(const string base, const string path)
{
static regex_t re;
static int initialized = 0;
regmatch_t pm[1];
string p, s;
size_t len;
assert(*path != '/');
if (base && (p = strrchr(base, '/'))) {
newarray(s, (p - base) + strlen(path) + 2);
strncpy(s, base, (p - base) + 1);
strcpy(s + ((p - base) + 1), path);
} else {
newarray(s, strlen(path) + 2);
#if 0
s[0] = '/';
strcpy(s + 1, path);
#else
strcpy(s, path);
#endif
}
/* Replace all substrings of form "/xxx/../" with "/" */
if (! initialized) {
assert(regcomp(&re, "/[^/]+/\\.\\./", REG_EXTENDED) == 0);
initialized = 1;
}
len = strlen(s);
while (regexec(&re, s, 1, pm, 0) == 0) {
memmove(s + pm[0].rm_so, s + (pm[0].rm_eo - 1), len - pm[0].rm_eo + 2);
len -= pm[0].rm_eo - pm[0].rm_so - 1;
}
/* Replace all substrings of the form "/./" with "/" */
/*len = strlen(s);*/
for (p = s; (p = strstr(p, "/./")); ) {
memmove(p, p + 2, len - (p - s) - 1);
len -= 2;
}
return s;
}
¹ØÓÚC/C++ÖÐÕýÔò±í´ïʽµÄ¹æÔò£¬ÏÖ½«opengroup.orgµÄ½Ì³ÌÕª³ÈçÏ£º£¨ÔÎÄÁ´½Óhttp://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_06£©
<<< Previous
Home
Next >>>
The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008
Copyright © 2001-2008 The IEEE and The Open Group
9. Regular Expressions
Regular Expressions (REs) provide a mechanism to select specific strings from a set of character strings.
Regular expressions are a context-independent syntax that can represent a wide variety of character sets and character set orderings, where these character sets
Ïà¹ØÎĵµ£º
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include<linux/config.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/errno.h>
#include<linux/sche ......
Ò»:Ç°ÑÔ
I2cÊÇphilipsÌá³öµÄÍâÉè×ÜÏß.I2CÖ»ÓÐÁ½ÌõÏß,Ò»Ìõ´®ÐÐÊý¾ÝÏß:SDA,Ò»ÌõÊÇʱÖÓÏßSCL.ÕýÒòΪÕâÑù,Ëü·½±ãÁ˹¤³ÌÈËÔ±
µÄ²¼Ïß.ÁíÍâ,I2CÊÇÒ»ÖÖ¶àÖ÷»ú¿ØÖÆ×ÜÏß.ËüºÍUSB×ÜÏß²»Í¬,USBÊÇ»ùÓÚmaster-slave»úÖÆ,ÈκÎÉ豸µÄͨÐűØÐëÓÉÖ÷»ú·¢Æð²Å¿ÉÒÔ.¶ø
I2C ÊÇ»ùÓÚmulti master»úÖÆ.һͬ×ÜÏßÉÏ¿ÉÔÊÐí¶à¸ömaster.¹ØÓÚI2CÐÒéµÄÖª ......
µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØϵÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëÑ°ÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓ⻶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ²¿ÊðÔÚÐí¶à¹Ø¼ ......
תÌû£ºÒ»»ÔµÄÎÄÕÂ
ÔÚLinuxÏÂ×ö¿ª·¢ÄÑÃâÒª½Ó´¥makefile£¬Õû¸öÏîÄ¿µÄ¹¹½¨¶¼ÒÀÀµÓÚËü¡£100¸ödeveloperÓÐ100ÖÖmakefileµÄд·¨£¬ÔÚÒ»¸ö½Ï´óµÄÏîÄ¿ÖУ¬¸÷ÖÖ¸÷ÑùµÄmakefileÎÞÂÛÔÚ¿ª·¢¡¢ºóÆÚά»¤»¹ÊÇÕû¸öϵͳµÄ³ÖÐø¼¯³É¶¼ÊÇÒ»¸ö¸ºµ£¡£
ÓÐÐÒ²ÎÓëÖع¹Ò»¸öÒÅÁôϵͳµÄmakefile£¬ÒÔÏÂÊÇһЩÐĵúÍÒ»¸ömakefileÄ£°å¡£
Öع¹Ä¿µÄ£º
1.Çå ......