Imported from util-linux-2.11y tarball.

This commit is contained in:
Karel Zak 2006-12-07 00:26:08 +01:00
parent 95f1bdeee4
commit a5a16c6853
39 changed files with 9180 additions and 8071 deletions

29
HISTORY
View file

@ -1,9 +1,29 @@
util-linux 2.11y
* Danish messages (Claus Hindsgaul)
* Finnish messages (Lauri Nurmi)
* German messages (Michael Piefel)
* Spanish messages (Santiago Vila Doncel)
* Swedish messages (Christian Rose)
* cfdisk: improve escape seq recognition when compiled with slang
* fdisk: decimal units
* hwclock/rtc.c: minor cleanup (Joachim Henke)
* ipcs: compilation fix
* more: kill external help file (Joachim Henke)
* mount: fix LABEL= handling for user umount
* mount: don't abort on read error on photocds (Gyorgy Kovesdi)
* mount.8: add dmask and fmask vfat mount options
* pg: compilation fix (Joachim Henke)
* script: localized time strings (Goeran Uddeborg)
* setterm: accept devfs name (Joachim Henke)
* simpleinit: security: refuse initctl_fd if setting FD_CLOEXEC fails
* umount: allow user umount after mount by label or uuid
util-linux 2.11x
* Danish messages (Claus Hindsgaul)
* Dutch messages (Taco Witte)
* Finnish messages (Lauri Nurmi)
* No French messages with permission to distribute (Michel Robitaille)
* German messages (Michael Piefel)
* Swedish messages (Christian Rose)
* Turkish messages (Nilgün Belma Bugüner)
@ -36,7 +56,6 @@ util-linux 2.11v
* Catalan messages (Antoni Bella Perez)
* Finnish messages (Lauri Nurmi)
* No French messages with permission to distribute (Michel Robitaille)
* Very few Russian messages (panivan@yandex.ru)
* Slovenian messages (Primoz Peterlin)
* Spanish messages (Santiago Vila Doncel)
@ -89,7 +108,6 @@ util-linux 2.11s
* Estonian messages (Meelis Roos)
* French messages: some minor corrections
* No French messages with permission to distribute (Michel Robitaille)
* German messages (Michael Piefel)
* Spanish messages (Santiago Vila Doncel)
* Swedish messages (Christian Rose)
@ -116,7 +134,6 @@ util-linux 2.11s
util-linux 2.11r
* Estonian messages (Meelis Roos)
* No French messages with permission to distribute (Michel Robitaille)
* German messages (Michael Piefel)
* Spanish messages (Santiago Vila Doncel)
* Swedish messages (Christian Rose)
@ -139,7 +156,6 @@ util-linux 2.11q
util-linux 2.11p
* Danish messages (Claus Hindsgaul)
* No French messages with permission to distribute (Michel Robitaille)
* German messages (Karl Eichwalder)
* Spanish messages (Santiago Vila Doncel)
* Swedish messages (Christian Rose)
@ -157,7 +173,6 @@ util-linux 2.11p
util-linux 2.11o
* Estonian messages (Meelis Roos)
* No French messages with permission to distribute (Michel Robitaille)
* Japanese messages (Daisuke Yamashita)
* Spanish messages (Santiago Vila Doncel)
* cal: option -s: Sunday is first day of the week
@ -184,7 +199,6 @@ util-linux 2.11o
util-linux 2.11n
* Danish messages (Claus Hindsgaul)
* No French messages with permission to distribute (Michel Robitaille)
* German messages (Karl Eichwalder)
* Swedish messages (Christian Rose)
* Turkish messages now in UTF-8 (Nilgün Belma Bugüner)
@ -249,7 +263,6 @@ util-linux 2.11k
util-linux 2.11j
* No French messages with permission to distribute (Michel Robitaille)
* fdisk: fix for AIX label (Olaf Hering)
* fdisk: fix for creating DOS label when BSD label is present
* mount.8: added remark about blocksize to ext2 sb= mount option description.

View file

@ -80,6 +80,12 @@ Warnings like
from pointer target type
are caused by bad ncurses or glibc header files.
Warnings like
script.c: In function `dooutput':
script.c:254: warning: `%c' yields only last 2 digits of year in some locales
are caused by a broken gcc that warns about things that are not wrong,
where the warning is not easily avoided.
All such warnings are harmless.
There should be no compilation errors.

View file

@ -134,7 +134,6 @@ ERR_O=$(LIB)/err.o
# Set HAVE_SLANG to yes if you have slang (and prefer to use that for cfdisk)
# (If neither HAVE_NCURSES nor HAVE_SLANG is defined, cfdisk is not made.)
# HAVE_SLANG=yes
# There is a subdirectory /usr/include/slang containing slcurses.h
# SLANGFLAGS=-I/usr/include/slang
# No such subdirectory - slcurses.h lives in /usr/include
@ -159,9 +158,6 @@ LOG_DIR= /var/log
MAN_DIR= /usr/share/man
INFO_DIR= /usr/share/info
# Directory for help file for more. Used to be /usr/lib.
MOREHELP_DIR= $(USRSHAREMISC_DIR)
#
# Paths used for install
#
@ -188,9 +184,6 @@ INFODIR= $(DESTDIR)$(INFO_DIR)
# Directory for shutdown, halt, reboot, etc.
SHUTDOWNDIR= $(SBINDIR)
# Directory for help file for more. Used to be /usr/lib.
MOREHELPDIR= $(DESTDIR)$(MOREHELP_DIR)
# Modes
DIRMODE= 755
BINMODE= 755

View file

@ -1 +1 @@
2.11x
2.11y

View file

@ -28,7 +28,7 @@ endif
all: $(SBIN) $(NOTMADE)
cfdisk.o: cfdisk.c
cfdisk.o: cfdisk.c ../MCONFIG
ifeq "$(HAVE_SLANG)" "yes"
$(CC) -c $(CFLAGS) -DSLCURSES=1 $< -o $@
else

View file

@ -107,8 +107,6 @@ extern ext2_loff_t ext2_llseek(unsigned int fd, ext2_loff_t offset,
#define SECTOR_SIZE 512
#define MAX_CYLINDERS 65535 /* there is no maximum anymore */
/* the kernel max is 65535 */
#define MAX_HEADS 255
#define MAX_SECTORS 63
@ -1184,60 +1182,57 @@ menuUpdate( int y, int x, struct MenuItem *menuItems, int itemLength,
}
/* This function takes a list of menu items, lets the user choose one *
* and returns the value keyboard shortcut of the selected menu item */
* and returns the keyboard shortcut value of the selected menu item */
static int
menuSelect( int y, int x, struct MenuItem *menuItems, int itemLength,
char *available, int menuType, int menuDefault ) {
int i, ylast = y, key = 0, current = menuDefault;
if( !( menuType & ( MENU_HORIZ | MENU_VERT ) ) )
{
if( !( menuType & ( MENU_HORIZ | MENU_VERT ) ) ) {
print_warning(_("Menu without direction. Defaulting horizontal."));
menuType |= MENU_HORIZ;
}
/* Make sure that the current is one of the available items */
while( !strchr(available, menuItems[current].key) )
{
while( !strchr(available, menuItems[current].key) ) {
current ++ ;
if( !menuItems[current].key ) current = 0;
}
/* Repeat until allowable choice has been made */
while( !key )
{
/* Display the menu */
while( !key ) {
/* Display the menu and read a command */
ylast = menuUpdate( y, x, menuItems, itemLength, available,
menuType, current );
refresh();
key = getch();
/* Clear out all prompts and such */
clear_warning();
for( i = y; i < ylast; i ++ )
{
move( i, x );
for (i = y; i < ylast; i++) {
move(i, x);
clrtoeol();
}
move( WARNING_START + 1, 0 );
clrtoeol();
/* Cursor keys */
if( key == ESC )
{
/* Cursor keys - possibly split by slow connection */
if( key == ESC ) {
/* Check whether this is a real ESC or one of extended keys */
/*nodelay(stdscr, TRUE);*/
key = getch();
/*nodelay(stdscr, FALSE);*/
if( key == /*ERR*/ ESC )
{
if( key == /*ERR*/ ESC ) {
/* This is a real ESC */
key = ESC;
}
if( key == '[' )
{
if(key == '[' || key == 'O') {
/* This is one extended keys */
switch( getch() )
{
key = getch();
switch(key) {
case 'A': /* Up arrow */
key = MENU_UP;
break;
@ -1250,21 +1245,23 @@ menuSelect( int y, int x, struct MenuItem *menuItems, int itemLength,
case 'D': /* Left arrow */
key = MENU_LEFT;
break;
default:
key = 0;
}
}
}
/* Enter equals to the keyboard shortcut of current menu item */
if( key == CR)
/* Enter equals the keyboard shortcut of current menu item */
if (key == CR)
key = menuItems[current].key;
/* Give alternatives for arrow keys in case the window manager
swallows these */
if ( key == TAB )
if (key == TAB)
key = MENU_RIGHT;
if ( key == UPKEY ) /* ^P */
if (key == UPKEY) /* ^P */
key = MENU_UP;
if ( key == DOWNKEY ) /* ^N */
if (key == DOWNKEY) /* ^N */
key = MENU_DOWN;
if (key == MENU_UP) {
@ -1315,21 +1312,22 @@ menuSelect( int y, int x, struct MenuItem *menuItems, int itemLength,
/* Should all keys to be accepted? */
if( key && (menuType & MENU_ACCEPT_OTHERS) ) break;
/* Is pressed key among acceptable ones */
/* Is pressed key among acceptable ones? */
if( key && (strchr(available, tolower(key)) || strchr(available, key)))
break;
/* The key has not been accepted so far -> let's reject it */
if( key )
{
if (key) {
key = 0;
putchar( BELL );
print_warning(_("Illegal key"));
}
}
/* Clear out prompts and such */
clear_warning();
for( i = y; i <= ylast; i ++ )
{
for( i = y; i <= ylast; i ++ ) {
move( i, x );
clrtoeol();
}
@ -2820,7 +2818,7 @@ do_curses_fdisk(void) {
static void
copyright(void) {
fprintf(stderr, _("Copyright (C) 1994-2000 Kevin E. Martin & aeb\n"));
fprintf(stderr, _("Copyright (C) 1994-2002 Kevin E. Martin & aeb\n"));
}
static void

View file

@ -1081,11 +1081,14 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
continue;
if (*line_ptr == '+' || *line_ptr == '-') {
int minus = (*line_ptr == '-');
int absolute = 0;
i = atoi(line_ptr+1);
if (*line_ptr == '-')
i = -i;
while (isdigit(*++line_ptr))
use_default = 0;
switch (*line_ptr) {
case 'c':
case 'C':
@ -1094,25 +1097,31 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
break;
case 'k':
case 'K':
i *= 2;
i /= (sector_size / 512);
i /= units_per_sector;
absolute = 1000;
break;
case 'm':
case 'M':
i *= 2048;
i /= (sector_size / 512);
i /= units_per_sector;
absolute = 1000000;
break;
case 'g':
case 'G':
i *= 2048000;
i /= (sector_size / 512);
i /= units_per_sector;
absolute = 1000000000;
break;
default:
break;
}
if (absolute) {
unsigned long long bytes;
unsigned long unit;
bytes = (unsigned long long) i * absolute;
unit = sector_size * units_per_sector;
bytes += unit/2; /* round */
bytes /= unit;
i = bytes;
}
if (minus)
i = -i;
i += base;
} else {
i = atoi(line_ptr);
@ -1457,7 +1466,7 @@ static void check_consistency(struct partition *p, int partition) {
/* Ending on cylinder boundary? */
if (peh != (heads - 1) || pes != sectors) {
printf(_("Partition %i does not end on cylinder boundary:\n"),
printf(_("Partition %i does not end on cylinder boundary.\n"),
partition + 1);
#if 0
printf(_(" phys=(%d, %d, %d) "), pec, peh, pes);

View file

@ -89,20 +89,19 @@ struct linux_rtc_time {
#define RTC_DEVN "rtc"
#endif
static char rtc_dev_name[40];
static char *rtc_dev_name;
/* maybe we should not try /dev/misc/efirtc? */
static int
open_rtc(void) {
int rtc_fd;
sprintf(rtc_dev_name, "/dev/%s", RTC_DEVN);
rtc_dev_name = "/dev/" RTC_DEVN;
rtc_fd = open(rtc_dev_name, O_RDONLY);
if (rtc_fd < 0 && errno == ENOENT) {
sprintf(rtc_dev_name, "/dev/misc/%s", RTC_DEVN);
rtc_dev_name = "/dev/misc/" RTC_DEVN;
rtc_fd = open(rtc_dev_name, O_RDONLY);
if (rtc_fd < 0 && errno == ENOENT)
sprintf(rtc_dev_name, "/dev/%s", RTC_DEVN);
rtc_dev_name = "/dev/" RTC_DEVN;
}
return rtc_fd;
}

View file

@ -201,7 +201,6 @@ int kerror = KSUCCESS, notickets = 1;
#endif
#define TTYGRPNAME "tty" /* name of group to own ttys */
/**# define TTYGRPNAME "other" **/
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
@ -238,11 +237,6 @@ struct ltchars ltc = {
};
#endif
const char *months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
/* Nice and simple code provided by Linus Torvalds 16-Feb-93 */
/* Nonblocking stuff by Maciej W. Rozycki, macro@ds2.pg.gda.pl, 1999.
He writes: "Login performs open() on a tty in a blocking mode.

View file

@ -13,6 +13,8 @@
* - block signals in handlers, so that longjmp() doesn't kill context
* 2001-02-25 Richard Gooch <rgooch@atnf.csiro.au>
* - make default INIT_PATH the boot_prog (if it is a directory) - YECCH
* 2002-11-20 patch from SuSE
* - refuse initctl_fd if setting FD_CLOEXEC fails
*/
#include <sys/types.h>
@ -204,6 +206,19 @@ int main(int argc, char *argv[])
err ( _("error opening fifo\n") );
}
if (initctl_fd >= 0 && fcntl(initctl_fd, F_SETFD, FD_CLOEXEC) != 0) {
err ( _("error setting close-on-exec on /dev/initctl") );
/* Can the fcntl ever fail? If it does, and we leave
the descriptor open in child processes, then any
process on the system will be able to write to
/dev/initctl and have us execute arbitrary commands
as root. So let's refuse to use the fifo in this case. */
close(initctl_fd);
initctl_fd = -1;
}
if ( want_single || (access (_PATH_SINGLE, R_OK) == 0) ) do_single ();
/*If we get a SIGTSTP before multi-user mode, do nothing*/

View file

@ -238,6 +238,15 @@ resize(int dummy) {
kill(child, SIGWINCH);
}
/*
* Stop extremely silly gcc complaint on %c:
* warning: `%c' yields only last 2 digits of year in some locales
*/
static void
my_strftime(char *buf, size_t len, const char *fmt, const struct tm *tm) {
strftime(buf, len, fmt, tm);
}
void
dooutput() {
register int cc;
@ -251,7 +260,9 @@ dooutput() {
(void) close(slave);
#endif
tvec = time((time_t *)NULL);
fprintf(fscript, _("Script started on %s"), ctime(&tvec));
my_strftime(obuf, sizeof obuf, "%c\n", localtime(&tvec));
fprintf(fscript, _("Script started on %s"), obuf);
for (;;) {
if (tflg)
gettimeofday(&tv, NULL);
@ -259,9 +270,9 @@ dooutput() {
if (cc <= 0)
break;
if (tflg) {
newtime=tv.tv_sec + (double) tv.tv_usec / 1000000;
newtime = tv.tv_sec + (double) tv.tv_usec / 1000000;
fprintf(stderr, "%f %i\n", newtime - oldtime, cc);
oldtime=newtime;
oldtime = newtime;
}
(void) write(1, obuf, cc);
(void) fwrite(obuf, 1, cc, fscript);
@ -321,9 +332,10 @@ done() {
if (subchild) {
if (!qflg) {
char buf[BUFSIZ];
tvec = time((time_t *)NULL);
fprintf(fscript, _("\nScript done on %s"),
ctime(&tvec));
my_strftime(buf, sizeof buf, "%c\n", localtime(&tvec));
fprintf(fscript, _("\nScript done on %s"), buf);
}
(void) fclose(fscript);
(void) close(master);

View file

@ -107,6 +107,7 @@
#else
#include <curses.h>
#endif
#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/ioctl.h>
#include <sys/time.h>
#include "nls.h"
@ -184,7 +185,7 @@ int opt_cl_all; /* Clear all or rest. */
int opt_bl_min; /* Blank screen. */
int opt_blength_l;
int opt_bfreq_f;
int opt_sn_num = 0; /* Snap screen. */
int opt_sn_num; /* Snap screen. */
int opt_st_attr;
int opt_rt_len; /* regular tab length */
int opt_tb_array[161]; /* Array for tab list */
@ -1109,7 +1110,6 @@ perform_sequence(int vcterm) {
static void
screendump(int vcnum, FILE *F) {
#include <sys/param.h>
char infile[MAXPATHLEN];
unsigned char header[4];
unsigned int rows, cols;
@ -1117,8 +1117,23 @@ screendump(int vcnum, FILE *F) {
char *inbuf, *outbuf, *p, *q;
sprintf(infile, "/dev/vcsa%d", vcnum);
fd = open(infile, 0);
if (fd < 0 || read(fd, header, 4) != 4)
fd = open(infile, O_RDONLY);
if (fd < 0 && vcnum == 0) {
/* vcsa0 is often called vcsa */
sprintf(infile, "/dev/vcsa");
fd = open(infile, O_RDONLY);
}
if (fd < 0) {
/* try devfs name - for zero vcnum just /dev/vcc/a */
/* some gcc's warn for %.u - add 0 */
sprintf(infile, "/dev/vcc/a%.0u", vcnum);
fd = open(infile, O_RDONLY);
}
if (fd < 0) {
sprintf(infile, "/dev/vcsa%d", vcnum);
goto try_ioctl;
}
if (read(fd, header, 4) != 4)
goto try_ioctl;
rows = header[0];
cols = header[1];

View file

@ -43,12 +43,12 @@ install: $(PROGS)
$(COMPILE) $<
mount: mount.o fstab.o sundries.o realpath.o mntent.o version.o \
mount_guess_fstype.o mount_by_label.o getusername.o \
mount_guess_fstype.o get_label_uuid.o mount_by_label.o getusername.o \
$(LIB)/setproctitle.o $(LIB)/env.o $(NFS_OBJS) $(LO_OBJS)
$(LINK) $^ -o $@
umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
version.o $(LIB)/env.o $(LO_OBJS)
get_label_uuid.o version.o $(LIB)/env.o $(LO_OBJS)
$(LINK) $^ -o $@
swapon: swapon.o version.o

View file

@ -12,6 +12,7 @@
#include "mntent.h"
#include "fstab.h"
#include "sundries.h" /* for xmalloc() etc */
#include "get_label_uuid.h"
#include "nls.h"
#define streq(s, t) (strcmp ((s), (t)) == 0)
@ -223,22 +224,60 @@ getmntoptfile (const char *file) {
return NULL;
}
static int
has_label(const char *device, const char *label) {
char devuuid[16];
char *devlabel;
return !get_label_uuid(device, &devlabel, devuuid) &&
!strcmp(label, devlabel);
}
static int
has_uuid(const char *device, const char *uuid){
char devuuid[16];
char *devlabel;
return !get_label_uuid(device, &devlabel, devuuid) &&
!memcmp(uuid, devuuid, sizeof(devuuid));
}
/* Find the entry (SPEC,FILE) in fstab */
struct mntentchn *
getfsspecfile (const char *spec, const char *file) {
struct mntentchn *mc, *mc0;
mc0 = fstab_head();
/* first attempt: names occur precisely as given */
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
if (streq (mc->m.mnt_dir, file) &&
streq (mc->m.mnt_fsname, spec))
return mc;
/* second attempt: names found after symlink resolution */
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
if ((streq (mc->m.mnt_dir, file) ||
streq (canonicalize(mc->m.mnt_dir), file))
&& (streq (mc->m.mnt_fsname, spec) ||
streq (canonicalize(mc->m.mnt_fsname), spec)))
return mc;
/* third attempt: names found after LABEL= or UUID= resolution */
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
if (!strncmp (mc->m.mnt_fsname, "LABEL=", 6) &&
(streq (mc->m.mnt_dir, file) ||
streq (canonicalize(mc->m.mnt_dir), file))) {
if (has_label(spec, mc->m.mnt_fsname+6))
return mc;
}
if (!strncmp (mc->m.mnt_fsname, "UUID=", 5) &&
(streq (mc->m.mnt_dir, file) ||
streq (canonicalize(mc->m.mnt_dir), file))) {
if (has_uuid(spec, mc->m.mnt_fsname+5))
return mc;
}
}
return NULL;
}

118
mount/get_label_uuid.c Normal file
View file

@ -0,0 +1,118 @@
/*
* Get label. Used by both mount and umount.
*/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "linux_fs.h"
#include "get_label_uuid.h"
/*
* See whether this device has (the magic of) a RAID superblock at the end.
* If so, it probably is, or has been, part of a RAID array.
*
* For the moment this test is switched off - it causes problems.
* "Checking for a disk label should only be done on the full raid,
* not on the disks that form the raid array. This test causes a lot of
* problems when run on my striped promise fasttrak 100 array."
*/
static inline int
is_raid_partition(int fd) {
#if 0
struct mdp_super_block mdsb;
int n;
/* hardcode 4096 here in various places, because that's
what it's defined to be. Note that even if we used
the actual kernel headers, sizeof(mdp_super_t) is
slightly larger in the 2.2 kernel on 64-bit archs,
so using that wouldn't work. */
lseek(fd, -4096, SEEK_END); /* Ignore possible error
about return value overflow */
n = 4096;
if (sizeof(mdsb) < n)
n = sizeof(mdsb);
if (read(fd, &mdsb, n) != n)
return 1; /* error */
return (mdsbmagic(mdsb) == MD_SB_MAGIC);
#else
return 0;
#endif
}
/* for now, only ext2, ext3, xfs, ocfs are supported */
int
get_label_uuid(const char *device, char **label, char *uuid) {
int fd;
int rv = 1;
size_t namesize;
struct ext2_super_block e2sb;
struct xfs_super_block xfsb;
struct jfs_super_block jfssb;
struct ocfs_volume_header ovh; /* Oracle */
struct ocfs_volume_label olbl;
fd = open(device, O_RDONLY);
if (fd < 0)
return rv;
/* If there is a RAID partition, or an error, ignore this partition */
if (is_raid_partition(fd)) {
close(fd);
return rv;
}
if (lseek(fd, 1024, SEEK_SET) == 1024
&& read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb)
&& (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) {
memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid));
namesize = sizeof(e2sb.s_volume_name);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, e2sb.s_volume_name, namesize);
rv = 0;
}
else if (lseek(fd, 0, SEEK_SET) == 0
&& read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb)
&& (strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0)) {
memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid));
namesize = sizeof(xfsb.s_fname);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, xfsb.s_fname, namesize);
rv = 0;
}
else if (lseek(fd, 0, SEEK_SET) == 0
&& read(fd, (char *) &ovh, sizeof(ovh)) == sizeof(ovh)
&& (strncmp(ovh.signature, OCFS_MAGIC, sizeof(OCFS_MAGIC)) == 0)
&& (lseek(fd, 512, SEEK_SET) == 512)
&& read(fd, (char *) &olbl, sizeof(olbl)) == sizeof(olbl)) {
uuid[0] = '\0';
namesize = ocfslabellen(olbl);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, olbl.label, namesize);
rv = 0;
}
else if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) == JFS_SUPER1_OFF
&& read(fd, (char *) &jfssb, sizeof(jfssb)) == sizeof(jfssb)
&& (strncmp(jfssb.s_magic, JFS_MAGIC, 4) == 0)) {
if (assemble4le(jfssb.s_version) == 1) {
/* old (OS/2 compatible) jfs filesystems don't
have UUIDs and only have a very small label. */
memset(uuid, 0, 16);
namesize = sizeof(jfssb.s_fpack);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, jfssb.s_fpack, namesize);
} else {
memcpy(uuid, jfssb.s_uuid, sizeof(jfssb.s_uuid));
namesize = sizeof(jfssb.s_label);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, jfssb.s_label, namesize);
}
rv = 0;
}
close(fd);
return rv;
}

1
mount/get_label_uuid.h Normal file
View file

@ -0,0 +1 @@
int get_label_uuid(const char *device, char **label, char *uuid);

View file

@ -362,6 +362,7 @@ currently supported are:
.IR ntfs ,
.IR proc ,
.IR qnx4 ,
.IR ramfs ,
.IR reiserfs ,
.IR romfs ,
.IR smbfs ,
@ -894,6 +895,16 @@ Set the umask (the bitmask of the permissions that are
present). The default is the umask of the current process.
The value is given in octal.
.TP
.BI dmask= value
Set the umask applied to directories only.
The default is the umask of the current process.
The value is given in octal. Present since 2.5.43.
.TP
.BI fmask= value
Set the umask applied to regular files only.
The default is the umask of the current process.
The value is given in octal. Present since 2.5.43.
.TP
.BI check= value
Three different levels of pickyness can be chosen:
.RS
@ -1241,6 +1252,11 @@ By default, the files are owned by root and not readable by somebody else.
\fBuid=\fP\fIvalue\fP and \fBgid=\fP\fIvalue\fP
These options are recognized, but have no effect as far as I can see.
.SH "Mount options for ramfs"
Ramfs is a memory based filesystem. Mount it and you have it. Unmount it
and it is gone. Present since Linux 2.3.99pre4.
There are no mount options.
.SH "Mount options for reiserfs"
Reiserfs is a journaling filesystem.
The reiserfs mount options are more fully described at

View file

@ -29,6 +29,7 @@
#include <dirent.h>
#include "sundries.h" /* for xstrdup */
#include "linux_fs.h"
#include "get_label_uuid.h"
#include "mount_by_label.h"
#include "nls.h"
@ -45,113 +46,6 @@ static struct uuidCache_s {
char *device;
} *uuidCache = NULL;
/*
* See whether this device has (the magic of) a RAID superblock at the end.
* If so, it probably is, or has been, part of a RAID array.
*
* For the moment this test is switched off - it causes problems.
* "Checking for a disk label should only be done on the full raid,
* not on the disks that form the raid array. This test causes a lot of
* problems when run on my striped promise fasttrak 100 array."
*/
static int
is_raid_partition(int fd) {
#if 0
struct mdp_super_block mdsb;
int n;
/* hardcode 4096 here in various places, because that's
what it's defined to be. Note that even if we used
the actual kernel headers, sizeof(mdp_super_t) is
slightly larger in the 2.2 kernel on 64-bit archs,
so using that wouldn't work. */
lseek(fd, -4096, SEEK_END); /* Ignore possible error
about return value overflow */
n = 4096;
if (sizeof(mdsb) < n)
n = sizeof(mdsb);
if (read(fd, &mdsb, n) != n)
return 1; /* error */
return (mdsbmagic(mdsb) == MD_SB_MAGIC);
#else
return 0;
#endif
}
/* for now, only ext2, ext3, xfs, ocfs are supported */
static int
get_label_uuid(const char *device, char **label, char *uuid) {
int fd;
int rv = 1;
size_t namesize;
struct ext2_super_block e2sb;
struct xfs_super_block xfsb;
struct jfs_super_block jfssb;
struct ocfs_volume_header ovh; /* Oracle */
struct ocfs_volume_label olbl;
fd = open(device, O_RDONLY);
if (fd < 0)
return rv;
/* If there is a RAID partition, or an error, ignore this partition */
if (is_raid_partition(fd)) {
close(fd);
return rv;
}
if (lseek(fd, 1024, SEEK_SET) == 1024
&& read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb)
&& (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) {
memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid));
namesize = sizeof(e2sb.s_volume_name);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, e2sb.s_volume_name, namesize);
rv = 0;
}
else if (lseek(fd, 0, SEEK_SET) == 0
&& read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb)
&& (strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0)) {
memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid));
namesize = sizeof(xfsb.s_fname);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, xfsb.s_fname, namesize);
rv = 0;
}
else if (lseek(fd, 0, SEEK_SET) == 0
&& read(fd, (char *) &ovh, sizeof(ovh)) == sizeof(ovh)
&& (strncmp(ovh.signature, OCFS_MAGIC, sizeof(OCFS_MAGIC)) == 0)
&& (lseek(fd, 512, SEEK_SET) == 512)
&& read(fd, (char *) &olbl, sizeof(olbl)) == sizeof(olbl)) {
uuid[0] = '\0';
namesize = ocfslabellen(olbl);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, olbl.label, namesize);
rv = 0;
}
else if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) == JFS_SUPER1_OFF
&& read(fd, (char *) &jfssb, sizeof(jfssb)) == sizeof(jfssb)
&& (strncmp(jfssb.s_magic, JFS_MAGIC, 4) == 0)) {
if (assemble4le(jfssb.s_version) == 1) {
/* old (OS/2 compatible) jfs filesystems don't
have UUIDs and only have a very small label. */
memset(uuid, 0, 16);
namesize = sizeof(jfssb.s_fpack);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, jfssb.s_fpack, namesize);
} else {
memcpy(uuid, jfssb.s_uuid, sizeof(jfssb.s_uuid));
namesize = sizeof(jfssb.s_label);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, jfssb.s_label, namesize);
}
rv = 0;
}
close(fd);
return rv;
}
static void
uuidcache_addentry(char *device, char *label, char *uuid) {
struct uuidCache_s *last;

View file

@ -275,7 +275,8 @@ do_guess_fstype(const char *device) {
/* block 0 */
if (lseek(fd, 0, SEEK_SET) != 0
|| read(fd, (char *) &xsb, sizeof(xsb)) != sizeof(xsb))
goto io_error;
goto try_iso9660;
/* Gyorgy Kovesdi: none of my photocds has a readable block 0 */
if (xiafsmagic(xsb.xiasb) == _XIAFS_SUPER_MAGIC)
type = "xiafs";
@ -426,6 +427,7 @@ do_guess_fstype(const char *device) {
if (!type) {
/* block 32 */
try_iso9660:
if (lseek(fd, 0x8000, SEEK_SET) != 0x8000
|| read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb))
goto io_error;

914
po/ca.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

938
po/cs.po

File diff suppressed because it is too large Load diff

935
po/da.po

File diff suppressed because it is too large Load diff

1077
po/de.po

File diff suppressed because it is too large Load diff

2330
po/es.po

File diff suppressed because it is too large Load diff

929
po/et.po

File diff suppressed because it is too large Load diff

946
po/fi.po

File diff suppressed because it is too large Load diff

912
po/fr.po

File diff suppressed because it is too large Load diff

911
po/it.po

File diff suppressed because it is too large Load diff

934
po/ja.po

File diff suppressed because it is too large Load diff

929
po/nl.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

951
po/sl.po

File diff suppressed because it is too large Load diff

940
po/sv.po

File diff suppressed because it is too large Load diff

914
po/tr.po

File diff suppressed because it is too large Load diff

View file

@ -360,9 +360,12 @@ void do_shm (char format)
printf ("%-10d %-10.10s", shmid, pw->pw_name);
else
printf ("%-10d %-10d", shmid, ipcp->uid);
printf ("%-10o %-10d %-10ld %-6s %-6s\n",
printf ("%-10o %-10ld %-10ld %-6s %-6s\n",
ipcp->mode & 0777,
shmseg.shm_segsz,
/*
* earlier: int, Austin has size_t
*/
(long) shmseg.shm_segsz,
/*
* glibc-2.1.3 and earlier has unsigned short;
* Austin has shmatt_t
@ -606,8 +609,8 @@ void print_shm (int shmid)
ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid);
printf (_("mode=%#o\taccess_perms=%#o\n"),
ipcp->mode, ipcp->mode & 0777);
printf (_("bytes=%d\tlpid=%d\tcpid=%d\tnattch=%ld\n"),
shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid,
printf (_("bytes=%ld\tlpid=%d\tcpid=%d\tnattch=%ld\n"),
(long) shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid,
(long) shmds.shm_nattch);
printf (_("att_time=%-26.24s\n"),
shmds.shm_atime ? ctime (&shmds.shm_atime) : _("Not set"));

View file

@ -12,7 +12,7 @@ USRBIN= col colcrt colrm column hexdump rev line
BIN=
MAYBE= more ul
MAYBE= more pg ul
ifeq "$(HAVE_NCURSES)" "yes"
BIN:=$(BIN) more
@ -25,12 +25,6 @@ MAN1:=$(MAN1) more.1
endif
endif
# Where to put database files?
MOREHELP= more.help
MOREHELPFILE=$(MOREHELP_DIR)/$(MOREHELP)
# MOREHELP_DIR and MOREHELPDIR set in ../MCONFIG
CFLAGS:=$(CFLAGS) -DMOREHELPFILE=\"$(MOREHELPFILE)\"
# Is pg silent?
ifeq "$(SILENT_PG)" "yes"
CFLAGS:=$(CFLAGS) -DPGNOBELL
@ -82,12 +76,11 @@ line: line.o
colcrt.o colrm.o column.o rev.o ul.o: $(LIB)/widechar.h
install install.shadow install.text-utils: all
$(INSTALLDIR) $(BINDIR) $(USRBINDIR) $(MOREHELPDIR) $(MAN1DIR)
$(INSTALLDIR) $(BINDIR) $(USRBINDIR) $(MAN1DIR)
ifneq "$(BIN)" ""
$(INSTALLBIN) $(BIN) $(BINDIR)
endif
$(INSTALLBIN) $(USRBIN) $(USRBINDIR)
$(INSTALLDAT) $(MOREHELP) $(MOREHELPDIR)
$(INSTALLMAN) $(MAN1) $(MAN1DIR)
.PHONY: clean distclean

View file

@ -63,7 +63,6 @@
#include <regex.h>
#undef _REGEX_RE_COMP
/* #define MOREHELPFILE "/usr/lib/more.help" */
#define VI "vi" /* found on the user's path */
#define Fopen(s,m) (Currline = 0,file_pos=0,fopen(s,m))
@ -1216,7 +1215,6 @@ int command (char *filename, register FILE *f)
register int retval = 0;
register int c;
char colonch;
FILE *helpf;
int done;
char comchar, cmdbuf[80];
@ -1388,31 +1386,37 @@ int command (char *filename, register FILE *f)
break;
case '?':
case 'h':
helpf = NULL;
{
char *lang;
char hlpfile[sizeof(MOREHELPFILE)+4];
lang = getenv("LANGUAGE");
if (!lang || *lang == '\0')
lang = setlocale(LC_MESSAGES, "");
if (!lang || *lang == '\0')
lang = getenv("LANG");
if (lang && strlen(lang) > 1) {
strcpy(hlpfile, MOREHELPFILE);
strcat(hlpfile, ".");
strncat(hlpfile, lang, 2);
helpf = fopen (hlpfile, "r");
}
}
if (helpf == NULL)
helpf = fopen (MOREHELPFILE, "r");
if (helpf == NULL)
error (_("Can't open help file"));
if (noscroll) doclear ();
copy_file (helpf);
fclose (helpf);
prompt (filename);
if (noscroll) doclear();
xprintf(_("\nMost commands optionally preceded by integer argument"
" k. Defaults in brackets.\n"
"Star (*) indicates argument becomes new default.\n"));
xprintf("---------------------------------------"
"----------------------------------------\n");
xprintf(_("<space>\t\t\t"
"Display next k lines of text [current screen size]\n"
"z\t\t\tDisplay next k lines of text [current screen size]*\n"
"<return>\t\tDisplay next k lines of text [1]*\n"
"d or ctrl-D\t\t"
"Scroll k lines [current scroll size, initially 11]*\n"
"q or Q or <interrupt>\tExit from more\n"
"s\t\t\tSkip forward k lines of text [1]\n"
"f\t\t\tSkip forward k screenfuls of text [1]\n"
"b or ctrl-B\t\tSkip backwards k screenfuls of text [1]\n"
"'\t\t\tGo to place where previous search started\n"
"=\t\t\tDisplay current line number\n"
"/<regular expression>\t"
"Search for kth occurrence of regular expression [1]\n"
"n\t\t\tSearch for kth occurrence of last r.e [1]\n"
"!<cmd> or :!<cmd>\tExecute <cmd> in a subshell\n"
"v\t\t\tStart up /usr/bin/vi at current line\n"
"ctrl-L\t\t\tRedraw screen\n"
":n\t\t\tGo to kth next file [1]\n"
":p\t\t\tGo to kth previous file [1]\n"
":f\t\t\tDisplay current file name and line number\n"
".\t\t\tRepeat previous command\n"));
xprintf("---------------------------------------"
"----------------------------------------\n");
prompt(filename);
break;
case 'v': /* This case should go right before default */
if (!no_intty) {

View file

@ -61,7 +61,11 @@
#include <locale.h>
#include <nl_types.h>
#include <libgen.h>
#if NCH
#include <ncurses.h>
#else
#include <curses.h>
#endif
#include <term.h>
#include "nls.h"