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
a password field.
>>>>>>> 1.105
1998-05-26 Marc Ewing <marc@redhat.com>
* 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 "win.h"
#include "cons.saver.h"
#include "main.h"
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)
{
char *tty_name;
char *mc_conssaver;
int status;
switch (action){
@ -145,7 +147,8 @@ void handle_console (unsigned char action)
close (2);
open ("/dev/null", O_WRONLY);
/* 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 */
console_flag = 0;
write (1, &console_flag, 1);

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

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

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

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

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

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

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

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

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

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