mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-13 11:54:31 +08:00
d1154eb460
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and this was starting to cause some tools heartburn. It also made "make V=1" almost useless, since trying to following the individual commands run by make was lost in the noise of all of the defines. So fix this by putting the configure-generated defines in lib/config.h and the directory pathnames to lib/dirpaths.h. In addition, clean up some vestigal defines in configure.in and in the Makefiles to further shorten the cc command lines. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
99 lines
2.2 KiB
C
99 lines
2.2 KiB
C
/*
|
|
|
|
/usr/src/ext2ed/ext2_com.c
|
|
|
|
A part of the extended file system 2 disk editor.
|
|
|
|
--------------------------------------
|
|
Extended-2 filesystem General commands
|
|
--------------------------------------
|
|
|
|
The commands here will be registered when we are editing an ext2 filesystem
|
|
|
|
First written on: July 28 1995
|
|
|
|
Copyright (C) 1995 Gadi Oxman
|
|
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "ext2ed.h"
|
|
|
|
void type_ext2___super (char *command_line)
|
|
|
|
/*
|
|
|
|
We are moving to the superblock - Just use setoffset and settype. The offset was gathered in the
|
|
initialization phase (but is constant - 1024).
|
|
|
|
*/
|
|
|
|
{
|
|
char buffer [80];
|
|
|
|
super_info.copy_num=0;
|
|
sprintf (buffer,"setoffset %ld",file_system_info.super_block_offset);dispatch (buffer);
|
|
sprintf (buffer,"settype ext2_super_block");dispatch (buffer);
|
|
}
|
|
|
|
void type_ext2___cd (char *command_line)
|
|
|
|
/*
|
|
|
|
A global cd command - The path should start with /.
|
|
|
|
We implement it through dispatching to our primitive functions.
|
|
|
|
*/
|
|
|
|
{
|
|
char temp [80],buffer [80],*ptr;
|
|
|
|
ptr=parse_word (command_line,buffer);
|
|
if (*ptr==0) {
|
|
wprintw (command_win,"Error - No argument specified\n");refresh_command_win ();return;
|
|
}
|
|
ptr=parse_word (ptr,buffer);
|
|
|
|
if (buffer [0] != '/') {
|
|
wprintw (command_win,"Error - Use a full pathname (begin with '/')\n");refresh_command_win ();return;
|
|
}
|
|
|
|
/* Note the various dispatches below - They should be intuitive if you know the ext2 filesystem structure */
|
|
|
|
dispatch ("super");dispatch ("group");dispatch ("inode");dispatch ("next");dispatch ("dir");
|
|
if (buffer [1] != 0) {
|
|
sprintf (temp,"cd %s",buffer+1);dispatch (temp);
|
|
}
|
|
}
|
|
|
|
void type_ext2___group (char *command_line)
|
|
|
|
/*
|
|
|
|
We go to the group descriptors.
|
|
First, we go to the first group descriptor in the main copy.
|
|
Then, we use the group's entry command to pass to another group.
|
|
|
|
*/
|
|
|
|
{
|
|
long group_num=0;
|
|
char *ptr,buffer [80];
|
|
|
|
ptr=parse_word (command_line,buffer);
|
|
if (*ptr!=0) {
|
|
ptr=parse_word (ptr,buffer);
|
|
group_num=atol (buffer);
|
|
}
|
|
|
|
group_info.copy_num=0;group_info.group_num=0;
|
|
sprintf (buffer,"setoffset %ld",file_system_info.first_group_desc_offset);dispatch (buffer);
|
|
sprintf (buffer,"settype ext2_group_desc");dispatch (buffer);
|
|
sprintf (buffer,"entry %ld",group_num);dispatch (buffer);
|
|
}
|