OSDN Git Service

table.c の整理。
[hengband/hengband.git] / src / main.c
index c9bf698..028506a 100644 (file)
@@ -29,6 +29,9 @@ static void quit_hook(cptr s)
 {
        int j;
 
+       /* Unused */
+       (void)s;
+
        /* Scan windows */
        for (j = 8 - 1; j >= 0; j--)
        {
@@ -73,9 +76,6 @@ static void create_user_dir(void)
        char dirpath[1024];
        char subdirpath[1024];
 
-       /* Drop privs */
-       safe_setuid_drop();
-
        /* Get an absolute path from the filename */
        path_parse(dirpath, 1024, PRIVATE_USER_PATH);
 
@@ -87,9 +87,6 @@ static void create_user_dir(void)
 
        /* Create the directory */
        mkdir(subdirpath, 0700);
-
-       /* Grab privs */
-       safe_setuid_grab();
 }
 
 #endif /* PRIVATE_USER_PATH */
@@ -164,7 +161,7 @@ static void change_path(cptr info)
        cptr s;
 
        /* Find equal sign */
-       s = strchr(info, '=');
+       s = my_strchr(info, '=');
 
        /* Verify equal sign */
        if (!s) quit_fmt("Try '-d<what>=<path>' not '-d%s'", info);
@@ -364,6 +361,10 @@ int main(int argc, char *argv[])
 #endif
 
 
+       /* Drop permissions */
+       safe_setuid_drop();
+
+
 #ifdef SET_UID
 
        /* Initialize the "time" checker */
@@ -520,6 +521,13 @@ int main(int argc, char *argv[])
                        }
 #endif
 
+                       case 'x':
+                       {
+                               if (!argv[i][2]) goto usage;
+                               prepare_browse_movie(&argv[i][2]);
+                               break;
+                       }                       
+
                        case '-':
                        {
                                argv[i] = argv[0];
@@ -615,9 +623,6 @@ int main(int argc, char *argv[])
        quit_aux = quit_hook;
 
 
-       /* Drop privs (so X11 will work correctly) */
-       safe_setuid_drop();
-
 
 #ifdef USE_XAW
        /* Attempt to use the "main-xaw.c" support */
@@ -769,10 +774,6 @@ int main(int argc, char *argv[])
 #endif
 
 
-       /* Grab privs (dropped above for X11) */
-       safe_setuid_grab();
-
-
        /* Make sure we have a display! */
        if (!done) quit("Unable to prepare any 'display module'!");