static BOOL WINAPI ws_handler (DWORD dwEvent) { switch (dwEvent) { #ifdef CTRLC_BACKGND case CTRL_C_EVENT: ws_hangup ("CTRL+C"); return TRUE; #endif #ifdef CTRLBREAK_BACKGND case CTRL_BREAK_EVENT: ws_hangup ("CTRL+Break"); return TRUE; #endif default: return FALSE; } }
void fork_to_background (void) { /* Whether we arrange our own version of opt.lfilename here. */ int changedp = 0; if (!opt.lfilename) { opt.lfilename = unique_name (DEFAULT_LOGFILE); changedp = 1; } printf (_("Continuing in background.\n")); if (changedp) printf (_("Output will be written to `%s'.\n"), opt.lfilename); ws_hangup (); if (!windows_nt_p) FreeConsole (); }
void fork_to_background (void) { /* Whether we arrange our own version of opt.lfilename here. */ int changedp = 0; //z l 表示日志文件,filename 表示文件名称 if (!opt.lfilename) { //z 根据文件前缀生成一个文件名,前缀+数字(数字增大,直到找到一个不存在的文件为止) opt.lfilename = unique_name (DEFAULT_LOGFILE); changedp = 1; } printf (_("Continuing in background.\n")); //z 成功生成日志记录文件,输出信息 if (changedp) printf (_("Output will be written to `%s'.\n"), opt.lfilename); ws_hangup (); if (!windows_nt_p) FreeConsole (); }