mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* chmod.c: Remove OS/2 specific code.
* config.h: Likewise.
This commit is contained in:
parent
50e3625d7d
commit
3249e26bd5
@ -1,3 +1,8 @@
|
||||
2002-01-17 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* chmod.c: Remove OS/2 specific code.
|
||||
* config.h: Likewise.
|
||||
|
||||
2002-01-03 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* BUGS: Remove obsolete and OS/2 specific parts.
|
||||
|
79
pc/chmod.c
79
pc/chmod.c
@ -18,14 +18,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __os2__
|
||||
#define INCL_DOSFILEMGR
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#ifdef _OS_NT
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -50,14 +43,12 @@
|
||||
#include "../src/achown.h"
|
||||
#include "../src/chown.h"
|
||||
|
||||
#ifdef _OS_NT
|
||||
#define FILE_ARCHIVED FILE_ATTRIBUTE_ARCHIVE
|
||||
#define FILE_DIRECTORY FILE_ATTRIBUTE_DIRECTORY
|
||||
#define FILE_HIDDEN FILE_ATTRIBUTE_HIDDEN
|
||||
#define FILE_READONLY FILE_ATTRIBUTE_READONLY
|
||||
#define FILE_SYSTEM FILE_ATTRIBUTE_SYSTEM
|
||||
#define mk_chmod(fname,st) SetFileAttributes(fname,st)
|
||||
#endif
|
||||
|
||||
static int single_set;
|
||||
struct Dlg_head *ch_dlg;
|
||||
@ -269,40 +260,7 @@ int pc_stat_file (char *filename)
|
||||
{
|
||||
mode_t st;
|
||||
|
||||
#ifdef _OS_NT
|
||||
st = GetFileAttributes (filename);
|
||||
#endif /* _OS_NT */
|
||||
|
||||
#ifdef __os2__
|
||||
HFILE fHandle = 0L;
|
||||
ULONG fInfoLevel = 1; /* 1st Level Info: Standard attributs */
|
||||
FILESTATUS3 fInfoBuf;
|
||||
ULONG fInfoBufSize;
|
||||
ULONG fAction = 0;
|
||||
APIRET rc;
|
||||
|
||||
fInfoBufSize = sizeof(FILESTATUS3);
|
||||
rc = DosOpen((PSZ) filename,
|
||||
&fHandle,
|
||||
&fAction,
|
||||
(ULONG) 0,
|
||||
FILE_NORMAL,
|
||||
OPEN_ACTION_OPEN_IF_EXISTS,
|
||||
(OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE),
|
||||
(PEAOP2) NULL);
|
||||
if (rc != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = DosQueryFileInfo(fHandle, fInfoLevel, &fInfoBuf, fInfoBufSize);
|
||||
DosClose(fHandle);
|
||||
if (rc != 0) {
|
||||
return -1; /* error ! */
|
||||
} else {
|
||||
st = fInfoBuf.attrFile;
|
||||
}
|
||||
#endif /* __os2__ */
|
||||
|
||||
if (st & FILE_DIRECTORY)
|
||||
st = -1;
|
||||
return st;
|
||||
@ -323,43 +281,6 @@ char *next_file (void)
|
||||
return cpanel->dir.list[c_file].fname;
|
||||
}
|
||||
|
||||
#ifdef __os2__
|
||||
static int mk_chmod (char *filename, ULONG st)
|
||||
{
|
||||
HFILE fHandle = 0L;
|
||||
ULONG fInfoLevel = 1; /* 1st Level Info: Standard attributs */
|
||||
FILESTATUS3 fInfoBuf;
|
||||
ULONG fInfoBufSize;
|
||||
ULONG fAction = 0L;
|
||||
APIRET rc;
|
||||
|
||||
if (!(st & FILE_READONLY))
|
||||
chmod(filename, (S_IWRITE | S_IREAD));
|
||||
fInfoBufSize = sizeof(FILESTATUS3);
|
||||
rc = DosOpen((PSZ) filename,
|
||||
&fHandle,
|
||||
&fAction,
|
||||
(ULONG) 0,
|
||||
FILE_NORMAL,
|
||||
OPEN_ACTION_OPEN_IF_EXISTS,
|
||||
(OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE),
|
||||
0L);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = DosQueryFileInfo(fHandle, fInfoLevel, &fInfoBuf, fInfoBufSize);
|
||||
if (rc!=0) {
|
||||
DosClose(fHandle);
|
||||
return rc;
|
||||
}
|
||||
fInfoBuf.attrFile = st;
|
||||
rc = DosSetFileInfo(fHandle, fInfoLevel, &fInfoBuf, fInfoBufSize);
|
||||
rc = DosClose(fHandle);
|
||||
return rc;
|
||||
}
|
||||
#endif /* __os2__ */
|
||||
|
||||
static void do_chmod (mode_t sf)
|
||||
{
|
||||
sf &= and_mask;
|
||||
|
15
pc/config.h
15
pc/config.h
@ -61,16 +61,6 @@
|
||||
# endif
|
||||
#endif /* MC_NT */
|
||||
|
||||
#ifdef MC_OS2
|
||||
# ifndef OS2
|
||||
# define OS2
|
||||
# endif
|
||||
# ifndef __os2__
|
||||
# define __os2__
|
||||
# define NEEDS_LOCAL_DIRENT_H
|
||||
# endif
|
||||
#endif /* MC_OS2 */
|
||||
|
||||
#include "VERSION"
|
||||
|
||||
#ifndef pc_system
|
||||
@ -93,11 +83,6 @@
|
||||
#define HAVE_STDLIB_H
|
||||
#define HAVE_STRING_H
|
||||
|
||||
#ifndef MC_NT
|
||||
/* glib for Win32 provides its own dirent */
|
||||
#define HAVE_DIRENT_H
|
||||
#endif
|
||||
|
||||
#define HAVE_LIMITS_H
|
||||
|
||||
#if defined (__MINGW32__) || defined (_MSC_VER)
|
||||
|
Loading…
Reference in New Issue
Block a user