拆分命令行中的" '"是什么意思?

  • 本文关键字:是什么 命令行 拆分 c
  • 更新时间 :
  • 英文 :

int parseline(const char *cmdline, char **argv)
{
static char array[MAXLINE]; /* holds local copy of command line */
char *buf = array;          /* ptr that traverses command line */
char *delim;                /* points to first space delimiter */
int argc;                   /* number of args */
int bg;                     /* background job? */
strcpy(buf, cmdline);
buf[strlen(buf)-1] = ' ';  /* replace trailing 'n' with space */
while (*buf && (*buf == ' ')) /* ignore leading spaces */
buf++;
/* Build the argv list */
argc = 0;
if (*buf == ''') {
buf++;
delim = strchr(buf, ''');
}
else {
delim = strchr(buf, ' ');
}
//...
}

我不明白的部分是if (*buf == ''')

关于这一部分,我所知道的是用分隔符分割命令行,后一个是空格,那么'是什么意思?

'''是转义的单引号

请参阅此处了解更多转义序列

最新更新