void load_reboot_db(void);
static bool in_suid_root_mode = 0;
static char *pidfile = NULL;
+static char *console_user = NULL; /* For defining a user to autmatically log into with console */
static char **saved_argv = NULL;
int file_watch_init(void);
FILE *id;
#endif
FILE *newerr;
+ char *eq;
bool detach_session = 1;
struct module_entry_t *m;
void (*handle)();
detach_session = 0;
console_input = dup(STDIN_FILENO);
console_output = dup(STDOUT_FILENO);
- } else if (strncmp(argv[n], "--pid-file", 10) == 0) {
- char *eq;
+ } else if(strncmp(argv[n], "--user",6) == 0) {
+ fprintf(stderr, "USING USER OPTION\n");
+ if ((eq = strchr(argv[n], '='))) {
+ console_user = eq + 1;
+ console_mode = 1;
+ detach_session = 0;
+ console_input = dup(STDIN_FILENO);
+ console_output = dup(STDOUT_FILENO);
+ } else {
+ if (n + 1 >= argc) {
+ fprintf(stderr, "%s: --user needs a user to log into.\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+ console_user = argv[n + 1];
+ n++;
+ /* Assume console mode & non-session */
+ console_mode = 1;
+ detach_session = 0;
+ console_input = dup(STDIN_FILENO);
+ console_output = dup(STDOUT_FILENO);
+ }
+ } else if (strncmp(argv[n], "--pid-file", 10) == 0) {
if ((eq = strchr(argv[n], '=')))
pidfile = eq + 1;
else {
__attribute__ ((__unused__)))
{
DESC *d;
+ dbref console_player;
int n;
d = (DESC *) mush_malloc(sizeof(DESC), "descriptor");
}
#endif
test_telnet(d);
- welcome_user(d);
+ if(console_user) {
+ console_player = lookup_player(console_user);
+ if(console_player != NOTHING) {
+ d->player = console_player;
+ d->connected = 2;
+ d->doing[0] = '\0';
+ d->connected_at = mudtime;
+ ModTime(console_player) = (time_t) 0;
+ set_flag_internal(console_player, "CONNECTED");
+ orator = console_player;
+ check_last(console_player, d->addr, d->ip); /* set Last, Lastsite, give paycheck */
+ strcpy(global_eval_context.ccom, "");
+ } else
+ fprintf(stderr, "No such player");
+ }
+ if(d->player == 0)
+ welcome_user(d);
+
for(n = 0; n < MAX_SNOOPS; n++)
d->snooper[n] = -1;
return d;