diff -Nur -Xcvs/diff_ignore cvs/client/civclient.c test-wish/client/civclient.c --- cvs/client/civclient.c 2004-09-06 13:20:47.000000000 -0500 +++ test-wish/client/civclient.c 2004-09-07 21:18:47.456968386 -0500 @@ -70,6 +70,7 @@ char *logfile = NULL; char *scriptfile = NULL; +char *execfile = NULL; static char tileset_name[512] = "\0"; char sound_plugin_name[512] = "\0"; char sound_set_name[512] = "\0"; @@ -181,6 +182,7 @@ #else fprintf(stderr, _(" -d, --debug NUM\tSet debug log level (0 to 3)\n")); #endif + fprintf(stderr, _(" -e, --exec FILE\tExecute this file on new turn\n")); fprintf(stderr, _(" -h, --help\t\tPrint a summary of the options\n")); fprintf(stderr, _(" -l, --log FILE\tUse FILE as logfile " "(spawned server also uses this)\n")); @@ -206,9 +208,11 @@ exit(EXIT_SUCCESS); } else if ((option = get_option("--log",argv,&i,argc))) { logfile = mystrdup(option); /* never free()d */ - } else if ((option = get_option("--read", argv, &i, argc))) + } else if ((option = get_option("--read", argv, &i, argc))) { scriptfile = mystrdup(option); /* never free()d */ - else if ((option = get_option("--name",argv,&i,argc))) + } else if ((option = get_option("--exec", argv, &i, argc))) { + execfile = mystrdup(option); /* never free()d */ + } else if ((option = get_option("--name",argv,&i,argc))) sz_strlcpy(user_name, option); else if ((option = get_option("--meta",argv,&i,argc))) sz_strlcpy(metaserver, option); diff -Nur -Xcvs/diff_ignore cvs/client/civclient.h test-wish/client/civclient.h --- cvs/client/civclient.h 2004-04-09 22:43:58.000000000 -0500 +++ test-wish/client/civclient.h 2004-09-07 21:13:10.409806023 -0500 @@ -41,6 +41,7 @@ extern char *logfile; extern char *scriptfile; +extern char *execfile; extern char sound_plugin_name[512]; extern char sound_set_name[512]; extern char server_host[512]; diff -Nur -Xcvs/diff_ignore cvs/client/packhand.c test-wish/client/packhand.c --- cvs/client/packhand.c 2004-09-06 09:58:48.000000000 -0500 +++ test-wish/client/packhand.c 2004-09-07 21:16:36.425392475 -0500 @@ -826,6 +826,11 @@ **************************************************************************/ void handle_start_turn(void) { + /* execute the new turn command: watch out! this better return. */ + if (execfile && system(execfile) == -1) { + freelog(LOG_ERROR, "Couldn't execute file: %s", execfile); + } + agents_start_turn(); non_ai_unit_focus = FALSE;