1
1

Make program relocatable trough MCHOME variable, patch from Ludovic Drolez

Этот коммит содержится в:
Miguel de Icaza 1998-08-26 20:23:10 +00:00
родитель 3d0a91d4a8
Коммит 77c27f6130
8 изменённых файлов: 2272 добавлений и 2215 удалений

Просмотреть файл

@ -53,7 +53,6 @@ Sun May 31 13:19:59 1998 Norbert Warmuth <k3190@fh-sw.de>
* gwidget.c (x_create_input): Set the entry's visibility if it is * gwidget.c (x_create_input): Set the entry's visibility if it is
a password field. a password field.
>>>>>>> 1.105
1998-05-26 Marc Ewing <marc@redhat.com> 1998-05-26 Marc Ewing <marc@redhat.com>
* Makefile.in: use @LIBVFS@ when referring to libvfs-mc.a * Makefile.in: use @LIBVFS@ when referring to libvfs-mc.a

4423
po/mc.pot

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -38,6 +38,7 @@ signed char console_flag = 0;
#include "util.h" #include "util.h"
#include "win.h" #include "win.h"
#include "cons.saver.h" #include "cons.saver.h"
#include "main.h"
static int pipefd1 [2] = {-1, -1}, pipefd2 [2] = {-1, -1}; static int pipefd1 [2] = {-1, -1}, pipefd2 [2] = {-1, -1};
@ -93,6 +94,7 @@ void show_console_contents (int starty, unsigned char begin_line, unsigned char
void handle_console (unsigned char action) void handle_console (unsigned char action)
{ {
char *tty_name; char *tty_name;
char *mc_conssaver;
int status; int status;
switch (action){ switch (action){
@ -145,7 +147,8 @@ void handle_console (unsigned char action)
close (2); close (2);
open ("/dev/null", O_WRONLY); open ("/dev/null", O_WRONLY);
/* Exec the console save/restore handler */ /* Exec the console save/restore handler */
execl (LIBDIR "bin/cons.saver", "cons.saver", tty_name, NULL); mc_conssaver = concat_dir_and_file (mc_home, "bin/cons.saver");
execl (mc_conssaver, "cons.saver", tty_name, NULL);
/* Exec failed */ /* Exec failed */
console_flag = 0; console_flag = 0;
write (1, &console_flag, 1); write (1, &console_flag, 1);

Просмотреть файл

@ -42,7 +42,6 @@
#include "key.h" #include "key.h"
#include "tty.h" #include "tty.h"
#ifdef __QNX__ #ifdef __QNX__
/* select implementation: use QNX/term interface */ /* select implementation: use QNX/term interface */

Просмотреть файл

@ -2351,6 +2351,8 @@ void
OS_Setup () OS_Setup ()
{ {
char *termvalue; char *termvalue;
char *mc_libdir;
termvalue = getenv ("TERM"); termvalue = getenv ("TERM");
if (!termvalue){ if (!termvalue){
fprintf (stderr, _("The TERM environment variable is unset!\n")); fprintf (stderr, _("The TERM environment variable is unset!\n"));
@ -2374,9 +2376,14 @@ OS_Setup ()
sprintf (control_file, CONTROL_FILE, getpid ()); sprintf (control_file, CONTROL_FILE, getpid ());
my_putenv ("MC_CONTROL_FILE", control_file); my_putenv ("MC_CONTROL_FILE", control_file);
/* This is the directory, where MC was installed, on Unix this always is LIBDIR */ /* This is the directory, where MC was installed, on Unix this is LIBDIR */
/* and can be overriden by the MC_LIBDIR environment variable */
if ((mc_libdir = getenv ("MC_LIBDIR")) != NULL) {
mc_home = strdup(mc_libdir);
} else {
mc_home = strdup(LIBDIR); mc_home = strdup(LIBDIR);
} }
}
static void static void
sigchld_handler_no_subshell (int sig) sigchld_handler_no_subshell (int sig)
@ -2972,13 +2979,13 @@ int main (int argc, char *argv [])
bindtextdomain ("mc", LOCALEDIR); bindtextdomain ("mc", LOCALEDIR);
textdomain ("mc"); textdomain ("mc");
vfs_init ();
/* Initialize list of all user group for timur_clr_mode */ /* Initialize list of all user group for timur_clr_mode */
init_groups (); init_groups ();
OS_Setup (); OS_Setup ();
vfs_init ();
#ifdef HAVE_X #ifdef HAVE_X
/* NOTE: This call has to be before any our argument handling :) */ /* NOTE: This call has to be before any our argument handling :) */

Просмотреть файл

@ -1622,7 +1622,7 @@ do_move_up (WPanel *panel)
select_item (panel); select_item (panel);
} }
static int static void
move_rel (WPanel *panel, int rel) move_rel (WPanel *panel, int rel)
{ {
unselect_item (panel); unselect_item (panel);

Просмотреть файл

@ -181,6 +181,7 @@ static FILE *open_extfs_archive (int fstype, char *name, struct extfs_archive **
FILE *result; FILE *result;
mode_t mode; mode_t mode;
char *cmd; char *cmd;
char *mc_extfsdir;
struct stat mystat; struct stat mystat;
struct extfs_archive *current_archive; struct extfs_archive *current_archive;
struct extfs_entry *root_entry; struct extfs_entry *root_entry;
@ -206,12 +207,14 @@ static FILE *open_extfs_archive (int fstype, char *name, struct extfs_archive **
} }
#endif #endif
cmd = copy_strings (LIBDIR "extfs/", extfs_prefixes [fstype], mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
cmd = copy_strings (mc_extfsdir, extfs_prefixes [fstype],
" list ", local_name ? local_name : tmp, 0); " list ", local_name ? local_name : tmp, 0);
if (tmp) if (tmp)
free (tmp); free (tmp);
result = popen (cmd, "r"); result = popen (cmd, "r");
free (cmd); free (cmd);
free (mc_extfsdir);
if (result == NULL) { if (result == NULL) {
if (local_name != NULL && uses_archive) if (local_name != NULL && uses_archive)
mc_ungetlocalcopy (name, local_name, 0); mc_ungetlocalcopy (name, local_name, 0);
@ -555,15 +558,17 @@ static char *get_archive_name (struct extfs_archive *archive)
void extfs_run (char *file) void extfs_run (char *file)
{ {
struct extfs_archive *archive; struct extfs_archive *archive;
char *p, *q, *cmd, *archive_name; char *p, *q, *cmd, *archive_name, *mc_extfsdir;
if ((p = extfs_get_path (file, &archive, 0, 0)) == NULL) if ((p = extfs_get_path (file, &archive, 0, 0)) == NULL)
return; return;
q = name_quote (p, 0); q = name_quote (p, 0);
archive_name = name_quote (get_archive_name(archive), 0); archive_name = name_quote (get_archive_name(archive), 0);
cmd = copy_strings (LIBDIR "extfs/", extfs_prefixes [archive->fstype], mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
cmd = copy_strings (mc_extfsdir, extfs_prefixes [archive->fstype],
" run ", archive_name, " ", q, 0); " run ", archive_name, " ", q, 0);
free (mc_extfsdir);
free (archive_name); free (archive_name);
free (q); free (q);
#ifndef VFS_STANDALONE #ifndef VFS_STANDALONE
@ -603,7 +608,9 @@ static void *extfs_open (char *file, int flags, int mode)
q = name_quote (p, 0); q = name_quote (p, 0);
free (p); free (p);
archive_name = name_quote (get_archive_name (archive), 0); archive_name = name_quote (get_archive_name (archive), 0);
cmd = copy_strings (LIBDIR "extfs/", extfs_prefixes [archive->fstype],
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
cmd = copy_strings (mc_extfsdir, extfs_prefixes [archive->fstype],
" copyout ", " copyout ",
archive_name, archive_name,
" ", q, " ", entry->inode->local_filename, 0); " ", q, " ", entry->inode->local_filename, 0);
@ -613,10 +620,12 @@ static void *extfs_open (char *file, int flags, int mode)
free (entry->inode->local_filename); free (entry->inode->local_filename);
entry->inode->local_filename = NULL; entry->inode->local_filename = NULL;
free (cmd); free (cmd);
free (mc_extfsdir);
extfserrno = EIO; extfserrno = EIO;
return NULL; return NULL;
} }
free (cmd); free (cmd);
free (mc_extfsdir);
} }
local_handle = open (entry->inode->local_filename, flags, mode); local_handle = open (entry->inode->local_filename, flags, mode);
@ -657,6 +666,7 @@ static int extfs_close (void *data)
struct extfs_archive *archive; struct extfs_archive *archive;
char *archive_name, *file_name; char *archive_name, *file_name;
char *cmd; char *cmd;
char *mc_extfsdir;
char *p; char *p;
archive = file->archive; archive = file->archive;
@ -665,7 +675,8 @@ static int extfs_close (void *data)
file_name = name_quote (p, 0); file_name = name_quote (p, 0);
free (p); free (p);
cmd = copy_strings (LIBDIR "extfs/", mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
cmd = copy_strings (mc_extfsdir,
extfs_prefixes [archive->fstype], extfs_prefixes [archive->fstype],
" copyin ", archive_name, " ", " copyin ", archive_name, " ",
file_name, " ", file_name, " ",
@ -675,6 +686,7 @@ static int extfs_close (void *data)
if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID, shell, cmd)) if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID, shell, cmd))
errno_code = EIO; errno_code = EIO;
free (cmd); free (cmd);
free (mc_extfsdir);
{ {
struct stat file_status; struct stat file_status;
if( stat(file->entry->inode->local_filename,&file_status) != 0 ) if( stat(file->entry->inode->local_filename,&file_status) != 0 )
@ -993,7 +1005,13 @@ vfs extfs_vfs_ops =
#include "../src/profile.h" #include "../src/profile.h"
void extfs_init (void) void extfs_init (void)
{ {
FILE *cfg = fopen( LIBDIR "extfs/extfs.ini", "r" ); FILE *cfg;
char *mc_extfsini;
mc_extfsini = concat_dir_and_file (mc_home, "extfs/extfs.ini");
cfg = fopen (mc_extfsini, "r");
free (mc_extfsini);
if (!cfg) { if (!cfg) {
fprintf( stderr, "Warning: " LIBDIR "extfs/extfs.ini not found\n" ); fprintf( stderr, "Warning: " LIBDIR "extfs/extfs.ini not found\n" );
return; return;

Просмотреть файл

@ -57,6 +57,7 @@
#include "../src/mad.h" #include "../src/mad.h"
#include "../src/setup.h" #include "../src/setup.h"
#include "../src/tty.h" /* enable/disable interrupt key */ #include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/main.h"
#include <netdb.h> /* struct hostent */ #include <netdb.h> /* struct hostent */
#include <sys/socket.h> /* AF_INET */ #include <sys/socket.h> /* AF_INET */
#include <netinet/in.h> /* struct in_addr */ #include <netinet/in.h> /* struct in_addr */
@ -619,13 +620,15 @@ load_no_proxy_list ()
FILE *npf; FILE *npf;
int c; int c;
char *p; char *p;
char *mc_file;
static int loaded; static int loaded;
if (loaded) if (loaded)
return; return;
if (exist_file (LIBDIR "mc.no_proxy") && mc_file = concat_dir_and_file (mc_home, "mc.no_proxy");
(npf = fopen (LIBDIR "mc.no_proxy", "r"))) { if (exist_file (mc_file) &&
(npf = fopen (mc_file, "r"))) {
while (fgets (s, 258, npf) || !(feof (npf) || ferror (npf))) { while (fgets (s, 258, npf) || !(feof (npf) || ferror (npf))) {
if (!(p = strchr (s, '\n'))) { /* skip bogus entries */ if (!(p = strchr (s, '\n'))) { /* skip bogus entries */
while ((c = getc (npf)) != EOF && c != '\n') while ((c = getc (npf)) != EOF && c != '\n')
@ -652,6 +655,7 @@ load_no_proxy_list ()
fclose (npf); fclose (npf);
loaded = 1; loaded = 1;
} }
free (mc_file);
} }
static int static int