From abb4bd4b3a8838bdca16cd849a4cf0640c6b96db Mon Sep 17 00:00:00 2001 From: enselic Date: Tue, 16 Sep 2008 19:45:26 +0000 Subject: src/rmd_types.h: Add a rescue_path member to ProgArgs. src/rmd_initialize_data.c: Initialize rescue_path. src/rmd_parseargs.c: Don't rmdRescue() in ParseArgs(). We want the parse args functionality to be free from depdenencies. ParseArgs() should only parse args. Instead set the new rescue_path ProgArgs member. src/rmd.c: If a rescue_path was given, call rmdRescue() with that path. By doing this rmd_parseargs.c becomes more self-contained. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@553 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/rmd.c | 10 +++++++--- recordmydesktop/src/rmd_initialize_data.c | 1 + recordmydesktop/src/rmd_parseargs.c | 4 +--- recordmydesktop/src/rmd_types.h | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/recordmydesktop/src/rmd.c b/recordmydesktop/src/rmd.c index bb513a2..98b3862 100644 --- a/recordmydesktop/src/rmd.c +++ b/recordmydesktop/src/rmd.c @@ -28,15 +28,16 @@ #include "rmd_types.h" +#include "rmd_cache.h" #include "rmd_encode_cache.h" +#include "rmd_error.h" #include "rmd_initialize_data.h" #include "rmd_parseargs.h" #include "rmd_queryextensions.h" -#include "rmd_cache.h" -#include "rmd_error.h" -#include "rmd_threads.h" +#include "rmd_rescue.h" #include "rmd_setbrwindow.h" #include "rmd_shortcuts.h" +#include "rmd_threads.h" #include "rmd_wm_check.h" @@ -49,6 +50,9 @@ int main(int argc,char **argv){ if (!ParseArgs(argc, argv, &pdata.args)) { exit(1); } + if (pdata.args.rescue_path != NULL) { + exit(rmdRescue(pdata.args.rescue_path)); + } if(XInitThreads ()==0){ fprintf(stderr,"Couldn't initialize thread support!\n"); exit(7); diff --git a/recordmydesktop/src/rmd_initialize_data.c b/recordmydesktop/src/rmd_initialize_data.c index 631e725..5ec8bc3 100644 --- a/recordmydesktop/src/rmd_initialize_data.c +++ b/recordmydesktop/src/rmd_initialize_data.c @@ -199,6 +199,7 @@ void SetupDefaultArgs(ProgArgs *args) { args->y = 0; args->width = 0; args->height = 0; + args->rescue_path = NULL; args->nosound = 0; args->full_shots = 0; args->follow_mouse = 0; diff --git a/recordmydesktop/src/rmd_parseargs.c b/recordmydesktop/src/rmd_parseargs.c index 4fa1eac..ab1f4f7 100644 --- a/recordmydesktop/src/rmd_parseargs.c +++ b/recordmydesktop/src/rmd_parseargs.c @@ -29,7 +29,6 @@ #include "rmd_types.h" #include "rmd_macro.h" -#include "rmd_rescue.h" static void PrintConfig(void) { @@ -524,8 +523,7 @@ boolean ParseArgs(int argc, char **argv, ProgArgs *arg_return) { } else if(!strcmp(argv[i],"-rescue")){ if(i+1rescue_path = argv[i + 1]; } else{ fprintf(stderr,"Argument Usage: -rescue path_to_data\n"); diff --git a/recordmydesktop/src/rmd_types.h b/recordmydesktop/src/rmd_types.h index 4cd9548..c93b8b7 100644 --- a/recordmydesktop/src/rmd_types.h +++ b/recordmydesktop/src/rmd_types.h @@ -129,6 +129,7 @@ typedef struct _ProgArgs{ #else u_int32_t buffsize; #endif + const char* rescue_path; int nosound; //do not record sound(default 0) int noshared; //do not use shared memory extension(default 0) int nowmcheck; //do not check if there's a 3d comp window manager -- cgit v1.2.3