⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nixmode.i

📁 这是资料最全的有关汇编语言的示例源代码
💻 I
字号:
#ifndef LINT
/* @(#) nixmode.i 1.2 88/01/24 12:48:57 */
static char modeid[]="@(#) nixmode.i 1.2 88/01/24 12:48:57";
#endif

/*
(C) Copyright 1988 Rahul Dhesi -- All rights reserved

UNIX-specific routines to get and set file attribute.  These might be 
usable on other systems that have the following identical things:
fileno(), fstat(), chmod(), sys/types.h and sys/stat.h.
*/

/*
Get file attributes.  Currently only the lowest nine of the
**IX mode bits are used.  Also we return bit 23=0 and bit 22=1,
which means use portable attribute format, and use attribute
value instead of using default at extraction time.
*/

unsigned long getfattr (f)
ZOOFILE f;
{
	int fd;
   struct stat buf;           /* buffer to hold file information */
	fd = fileno(f);
   if (fstat (fd, &buf) == -1)
      return (NO_FATTR);      /* inaccessible -- no attributes */
	else
		return (unsigned long) (buf.st_mode & 0x1ffL) | (1L << 22);
}

/*
Set file attributes.  Only the lowest nine bits are used.
*/

int setfattr (f, a)
char *f;							/* filename */
unsigned long a;				/* atributes to set */
{
	return (chmod (f, (int) (a & 0x1ff)));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -