- 论坛徽章:
- 0
|
最近阅读nano源码,看到这么一个函数- void die(const char *msg, ...)
- {
- va_list ap; /*声明一个va_list类型变量*/
- endwin();
- /* Restore the old terminal settings. */
- tcsetattr(0, TCSANOW, &oldterm);
- va_start(ap, msg); /*初始化ap*/
- vfprintf(stderr, msg, ap); /* 和fprintf()函数功能相同,只不过是...变成了ap,这里不是直接来遍历未知变量,而是使用了vfprintf()函数来遍历*/
- va_end(ap); /*完成,ap变成未定义的了*/
- /* Save the current file buffer if it's been modified. */
- if (openfile && openfile->modified) {
- /* If we've partitioned the filestruct, unpartition it now. */
- if (filepart != NULL)
- unpartition_filestruct(&filepart);
- die_save_file(openfile->filename
- #ifndef NANO_TINY
- , openfile->current_stat
- #endif
- );
- }
- #ifdef ENABLE_MULTIBUFFER
- /* Save all of the other modified file buffers, if any. */
- if (openfile != NULL) {
- openfilestruct *tmp = openfile;
- while (tmp != openfile->next) {
- openfile = openfile->next;
- /* Save the current file buffer if it's been modified. */
- if (openfile->modified)
- die_save_file(openfile->filename
- #ifndef NANO_TINY
- , openfile->current_stat
- #endif
- );
- }
- }
- #endif
- /* Get out. */
- exit(1);
- }
复制代码 看到在其他函数里调用这个函数的时候,这么调用的:- die(_("Window size is too small for nano...\n"));
复制代码 这个是什么意思?
funName(_(" "))这个怎么理解阿?撇开函数的具体功能,对这个函数调用的方式很是不解。 |
|