static qboolean OnChange_movie_dir(cvar_t *var, char *string) { if (Movie_IsCapturing()) { Com_Printf("Cannot change demo_capture_dir whilst capturing. Use 'demo_capture stop' to cease capturing first.\n"); return true; } else if (strlen(string) > 31) { Com_Printf("demo_capture_dir can only contain a maximum of 31 characters\n"); return true; } Util_Process_Filename(string); if (!(Util_Is_Valid_Filename(string))) { Com_Printf(Util_Invalid_Filename_Msg("demo_capture_dir")); return true; } return false; }
static void Log_log_f(void) { char *fulllogname; FILE *templog; switch (Cmd_Argc()) { case 1: if (autologging) Com_Printf("Auto console logging is in progress\n"); else if (Log_IsLogging()) Com_Printf("Logging to %s\n", logfilename); else Com_Printf("Not logging\n"); return; case 2: if (!strcasecmp(Cmd_Argv(1), "stop")) { if (autologging) { Log_AutoLogging_StopMatch(); } else { if (Log_IsLogging()) { Log_Stop(); Com_Printf("Stopped logging to %s\n", logfilename); } else { Com_Printf("Not logging\n"); } } return; } if (autologging) { Com_Printf("Auto console logging must be stopped first!\n"); return; } if (Log_IsLogging()) { Log_Stop(); Com_Printf("Stopped logging to %s\n", logfilename); } strlcpy(logfilename, Cmd_Argv(1), sizeof(logfilename) - 4); Util_Process_Filename(logfilename); if (!Util_Is_Valid_Filename(logfilename)) { Com_Printf(Util_Invalid_Filename_Msg("filename")); return; } COM_ForceExtensionEx (logfilename, ".log", sizeof (logfilename)); fulllogname = va("%s/%s", Log_LogDirectory(), logfilename); if (!(templog = fopen (fulllogname, log_readable.value ? "w" : "wb"))) { FS_CreatePath(fulllogname); if (!(templog = fopen (fulllogname, log_readable.value ? "w" : "wb"))) { Com_Printf("Error: Couldn't open %s\n", logfilename); return; } } Com_Printf("Logging to %s\n", logfilename); logfile = templog; break; default: Com_Printf("Usage: %s [filename | stop]\n", Cmd_Argv(0)); return; } }