mirror of https://github.com/vitalif/e2fsprogs
Update ext2ed with newer superblock descriptions, and add directory indexing
structure. Add support for displaying and setting character fields. Add make depend logic and use e2fsprogs version strings.bitmap-optimize
parent
b38cd28363
commit
7c36779aeb
|
@ -1,4 +1,17 @@
|
||||||
2002-05-11 <tytso@snap.thunk.org>
|
2002-05-11 <tytso@mit.edu>
|
||||||
|
|
||||||
|
* win.c, main.c, general_com.c: Use e2fsprogs's version
|
||||||
|
information for the program banner.
|
||||||
|
|
||||||
|
* ext2ed.h, init.c, general_com.c: Add a field_type parameter, and
|
||||||
|
use specialized routines for showing and setting ints, uints,
|
||||||
|
and characeter strings.
|
||||||
|
|
||||||
|
* ext2.descriptors: Updated with newer superblock descriptor; use
|
||||||
|
__u32 and __u16 instead of unsigned long and unsigned
|
||||||
|
short. Add data structures for direcctory indexing code.
|
||||||
|
|
||||||
|
2002-05-11 <tytso@mit.edu>
|
||||||
|
|
||||||
* ext2ed.h: Remove VAR_DIR, and replace it with ETC_DIR.
|
* ext2ed.h: Remove VAR_DIR, and replace it with ETC_DIR.
|
||||||
(/var/lib is no longer a politically correct location for
|
(/var/lib is no longer a politically correct location for
|
||||||
|
|
|
@ -19,6 +19,12 @@ DOC_DIR = $datadir/doc/ext2ed
|
||||||
XTRA_CFLAGS = $(FLAGS) -DETC_DIR=\"$(root_sysconfdir)\" -I/usr/include/readline
|
XTRA_CFLAGS = $(FLAGS) -DETC_DIR=\"$(root_sysconfdir)\" -I/usr/include/readline
|
||||||
LIBS = -lreadline -lncurses
|
LIBS = -lreadline -lncurses
|
||||||
|
|
||||||
|
SRCS= $(srcdir)/main.c $(srcdir)/init.c $(srcdir)/general_com.c \
|
||||||
|
$(srcdir)/inode_com.c $(srcdir)/dir_com.c $(srcdir)/super_com.c \
|
||||||
|
$(srcdir)/disk.c $(srcdir)/win.c $(srcdir)/group_com.c \
|
||||||
|
$(srcdir)/file_com.c $(srcdir)/blockbitmap_com.c \
|
||||||
|
$(srcdir)/ext2_com.c $(srcdir)/inodebitmap_com.c
|
||||||
|
|
||||||
OBJS= main.o init.o general_com.o inode_com.o dir_com.o super_com.o \
|
OBJS= main.o init.o general_com.o inode_com.o dir_com.o super_com.o \
|
||||||
disk.o win.o group_com.o file_com.o blockbitmap_com.o ext2_com.o \
|
disk.o win.o group_com.o file_com.o blockbitmap_com.o ext2_com.o \
|
||||||
inodebitmap_com.o
|
inodebitmap_com.o
|
||||||
|
@ -75,3 +81,15 @@ install: ext2ed
|
||||||
# Makefile dependencies follow. This must be the last section in
|
# Makefile dependencies follow. This must be the last section in
|
||||||
# the Makefile.in file
|
# the Makefile.in file
|
||||||
#
|
#
|
||||||
|
main.o: $(srcdir)/main.c $(srcdir)/ext2ed.h
|
||||||
|
general_com.o: $(srcdir)/general_com.c $(srcdir)/ext2ed.h
|
||||||
|
inode_com.o: $(srcdir)/inode_com.c $(srcdir)/ext2ed.h
|
||||||
|
dir_com.o: $(srcdir)/dir_com.c $(srcdir)/ext2ed.h
|
||||||
|
super_com.o: $(srcdir)/super_com.c $(srcdir)/ext2ed.h
|
||||||
|
disk.o: $(srcdir)/disk.c $(srcdir)/ext2ed.h
|
||||||
|
win.o: $(srcdir)/win.c $(srcdir)/ext2ed.h
|
||||||
|
group_com.o: $(srcdir)/group_com.c $(srcdir)/ext2ed.h
|
||||||
|
file_com.o: $(srcdir)/file_com.c $(srcdir)/ext2ed.h
|
||||||
|
blockbitmap_com.o: $(srcdir)/blockbitmap_com.c $(srcdir)/ext2ed.h
|
||||||
|
ext2_com.o: $(srcdir)/ext2_com.c $(srcdir)/ext2ed.h
|
||||||
|
inodebitmap_com.o: $(srcdir)/inodebitmap_com.c $(srcdir)/ext2ed.h
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -93,12 +93,17 @@ struct struct_descriptor { /* Describes an object */
|
||||||
unsigned char name [60];
|
unsigned char name [60];
|
||||||
unsigned short fields_num;
|
unsigned short fields_num;
|
||||||
unsigned char field_names [MAX_FIELDS][80];
|
unsigned char field_names [MAX_FIELDS][80];
|
||||||
|
unsigned char field_types [MAX_FIELDS];
|
||||||
unsigned short field_lengths [MAX_FIELDS];
|
unsigned short field_lengths [MAX_FIELDS];
|
||||||
unsigned short field_positions [MAX_FIELDS];
|
unsigned short field_positions [MAX_FIELDS];
|
||||||
struct struct_commands type_commands;
|
struct struct_commands type_commands;
|
||||||
struct struct_descriptor *prev,*next;
|
struct struct_descriptor *prev,*next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FIELD_TYPE_INT 1
|
||||||
|
#define FIELD_TYPE_UINT 2
|
||||||
|
#define FIELD_TYPE_CHAR 3
|
||||||
|
|
||||||
struct struct_type_data { /* The object's data is usually here */
|
struct struct_type_data { /* The object's data is usually here */
|
||||||
long offset_in_block;
|
long offset_in_block;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ Copyright (C) 1995 Gadi Oxman
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ext2ed.h"
|
#include "ext2ed.h"
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
void help (char *command_line)
|
void help (char *command_line)
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ void help (char *command_line)
|
||||||
|
|
||||||
wprintw (show_pad,"\n\n");max_line+=2;
|
wprintw (show_pad,"\n\n");max_line+=2;
|
||||||
|
|
||||||
wprintw (show_pad,"EXT2ED ver %d.%d (%s)\n",version_major,version_minor,revision_date);
|
wprintw (show_pad,"EXT2ED ver %s (%s)\n",E2FSPROGS_VERSION, E2FSPROGS_DATE);
|
||||||
wprintw (show_pad,"Copyright (C) 1995 Gadi Oxman\n");
|
wprintw (show_pad,"Copyright (C) 1995 Gadi Oxman\n");
|
||||||
wprintw (show_pad,"Reviewed 2001 Christian Bac\n");
|
wprintw (show_pad,"Reviewed 2001 Christian Bac\n");
|
||||||
wprintw (show_pad,"EXT2ED is hereby placed under the terms of the GNU General Public License.\n\n");
|
wprintw (show_pad,"EXT2ED is hereby placed under the terms of the GNU General Public License.\n\n");
|
||||||
|
@ -275,13 +276,97 @@ void set_offset (char *command_line)
|
||||||
type_data.offset_in_block=0;
|
type_data.offset_in_block=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_int(short len, void *ptr, char *name, char *value)
|
||||||
|
{
|
||||||
|
char *char_ptr;
|
||||||
|
short *short_ptr;
|
||||||
|
long *long_ptr;
|
||||||
|
long v;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
v = strtol(value, &tmp, 0);
|
||||||
|
if (*tmp) {
|
||||||
|
wprintw( command_win, "Bad value - %s\n", value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (len) {
|
||||||
|
case 1:
|
||||||
|
char_ptr = (char *) ptr;
|
||||||
|
*char_ptr = v;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
short_ptr = (short *) ptr;
|
||||||
|
*short_ptr = v;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
long_ptr = (long *) ptr;
|
||||||
|
*long_ptr = v;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wprintw (command_win,
|
||||||
|
"set_int: unsupported length: %d\n", len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wprintw (command_win, "Variable %s set to %s\n",
|
||||||
|
name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_uint(short len, void *ptr, char *name, char *value)
|
||||||
|
{
|
||||||
|
unsigned char *char_ptr;
|
||||||
|
unsigned short *short_ptr;
|
||||||
|
unsigned long *long_ptr;
|
||||||
|
unsigned long v;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
v = strtoul(value, &tmp, 0);
|
||||||
|
if (*tmp) {
|
||||||
|
wprintw( command_win, "Bad value - %s\n", value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (len) {
|
||||||
|
case 1:
|
||||||
|
char_ptr = (unsigned char *) ptr;
|
||||||
|
*char_ptr = v;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
short_ptr = (unsigned short *) ptr;
|
||||||
|
*short_ptr = v;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
long_ptr = (unsigned long *) ptr;
|
||||||
|
*long_ptr = v;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wprintw (command_win,
|
||||||
|
"set_uint: unsupported length: %d\n", len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wprintw (command_win, "Variable %s set to %s\n",
|
||||||
|
name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_char(short len, void *ptr, char *name, char *value)
|
||||||
|
{
|
||||||
|
if (strlen(value)+1 > len) {
|
||||||
|
wprintw( command_win, "Value %s too big for field\n",
|
||||||
|
name, len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset(ptr, 0, len);
|
||||||
|
strcpy((char *) ptr, value);
|
||||||
|
wprintw (command_win, "Variable %s set to %s\n",
|
||||||
|
name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void set (char *command_line)
|
void set (char *command_line)
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned short *int_ptr;
|
unsigned short *int_ptr;
|
||||||
unsigned char *char_ptr;
|
unsigned char *char_ptr;
|
||||||
unsigned long *long_ptr,offset=0;
|
unsigned long *long_ptr,offset=0;
|
||||||
int i,found=0;
|
int i,len, found=0;
|
||||||
char *ptr,buffer [80],variable [80],value [80];
|
char *ptr,buffer [80],variable [80],value [80];
|
||||||
|
|
||||||
if (device_handle==NULL) {
|
if (device_handle==NULL) {
|
||||||
|
@ -315,24 +400,24 @@ void set (char *command_line)
|
||||||
if (strcmp (current_type->field_names [i],variable)==0) {
|
if (strcmp (current_type->field_names [i],variable)==0) {
|
||||||
found=1;
|
found=1;
|
||||||
ptr=type_data.u.buffer+offset;
|
ptr=type_data.u.buffer+offset;
|
||||||
switch (current_type->field_lengths [i]) {
|
len = current_type->field_lengths [i];
|
||||||
case 1:
|
switch (current_type->field_types [i]) {
|
||||||
char_ptr=(unsigned char *) ptr;
|
case FIELD_TYPE_INT:
|
||||||
*char_ptr=(char) atoi (value);
|
set_int(len, ptr, variable, value);
|
||||||
wprintw (command_win,"Variable %s set to %u\n",variable,*char_ptr);refresh_command_win ();
|
break;
|
||||||
break;
|
case FIELD_TYPE_UINT:
|
||||||
case 2:
|
set_uint(len, ptr, variable, value);
|
||||||
int_ptr=(unsigned short *) ptr;
|
break;
|
||||||
*int_ptr=atoi (value);
|
case FIELD_TYPE_CHAR:
|
||||||
wprintw (command_win,"Variable %s set to %u\n",variable,*int_ptr);refresh_command_win ();
|
set_char(len, ptr, variable, value);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
case 4:
|
wprintw (command_win,
|
||||||
long_ptr=(unsigned long *) ptr;
|
"set: unhandled type %d\n",
|
||||||
*long_ptr=atol (value);
|
current_type->field_types [i]);
|
||||||
wprintw (command_win,"Variable %s set to %lu\n",variable,*long_ptr);refresh_command_win ();
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
refresh_command_win ();
|
||||||
}
|
}
|
||||||
offset+=current_type->field_lengths [i];
|
offset+=current_type->field_lengths [i];
|
||||||
}
|
}
|
||||||
|
@ -446,11 +531,95 @@ void set_type (char *command_line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void show_int(short len, void *ptr)
|
||||||
|
{
|
||||||
|
long temp;
|
||||||
|
char *format;
|
||||||
|
|
||||||
|
switch (len) {
|
||||||
|
case 1:
|
||||||
|
temp = *((char *) ptr);
|
||||||
|
format = "%3d (0x%02x)\n";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
temp = *((short *) ptr);
|
||||||
|
format = "%d (0x%x)\n";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
temp = *((long *) ptr);
|
||||||
|
format = "%d\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wprintw (show_pad, "unimplemented\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wprintw(show_pad, format, temp, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_uint(short len, void *ptr)
|
||||||
|
{
|
||||||
|
unsigned long temp;
|
||||||
|
char *format;
|
||||||
|
|
||||||
|
switch (len) {
|
||||||
|
case 1:
|
||||||
|
temp = *((unsigned char *) ptr);
|
||||||
|
temp = temp & 0xFF;
|
||||||
|
format = "%3u (0x%02x)\n";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
temp = *((unsigned short *) ptr);
|
||||||
|
temp = temp & 0xFFFF;
|
||||||
|
format = "%u (0x%x)\n";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
temp = (unsigned long) *((unsigned long *) ptr);
|
||||||
|
format = "%u\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wprintw (show_pad, "unimplemented\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wprintw(show_pad, format, temp, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_char(short len, void *ptr)
|
||||||
|
{
|
||||||
|
unsigned char *cp = (unsigned char *) ptr;
|
||||||
|
unsigned char ch;
|
||||||
|
int i,j;
|
||||||
|
|
||||||
|
wprintw(show_pad, "\"");
|
||||||
|
|
||||||
|
for (i=0; i < len; i++) {
|
||||||
|
ch = *cp++;
|
||||||
|
if (ch == 0) {
|
||||||
|
for (j=i+1; j < len; j++)
|
||||||
|
if (cp[j-i])
|
||||||
|
break;
|
||||||
|
if (j == len)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ch > 128) {
|
||||||
|
wprintw(show_pad, "M-");
|
||||||
|
ch -= 128;
|
||||||
|
}
|
||||||
|
if ((ch < 32) || (ch == 0x7f)) {
|
||||||
|
wprintw(show_pad, "^");
|
||||||
|
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
|
||||||
|
}
|
||||||
|
wprintw(show_pad, "%c", ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
wprintw(show_pad, "\"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void show (char *command_line)
|
void show (char *command_line)
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned int i,l,temp_int;
|
unsigned int i,l,len,temp_int;
|
||||||
unsigned long offset=0,temp_long;
|
unsigned long offset=0,temp_long;
|
||||||
unsigned char temp_char,*ch_ptr;
|
unsigned char temp_char,*ch_ptr;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
@ -502,29 +671,23 @@ void show (char *command_line)
|
||||||
for (i=0;i<current_type->fields_num;i++) {
|
for (i=0;i<current_type->fields_num;i++) {
|
||||||
wprintw (show_pad,"%-20s = ",current_type->field_names [i]);
|
wprintw (show_pad,"%-20s = ",current_type->field_names [i]);
|
||||||
ptr=type_data.u.buffer+offset;
|
ptr=type_data.u.buffer+offset;
|
||||||
switch (current_type->field_lengths [i]) {
|
len = current_type->field_lengths[i];
|
||||||
case 1:
|
switch (current_type->field_types[i]) {
|
||||||
temp_char=*((unsigned char *) ptr);
|
case FIELD_TYPE_INT:
|
||||||
wprintw (show_pad,"%3u (0x%02x",temp_char,temp_char);
|
show_int(len, ptr);
|
||||||
if (temp_char>=' ' && temp_char<='z')
|
break;
|
||||||
wprintw (show_pad," , %c)\n",temp_char);
|
case FIELD_TYPE_UINT:
|
||||||
else
|
show_uint(len, ptr);
|
||||||
wprintw (show_pad,")\n");
|
break;
|
||||||
|
case FIELD_TYPE_CHAR:
|
||||||
offset ++;l++;
|
show_char(len, ptr);
|
||||||
break;
|
break;
|
||||||
case 2:
|
default:
|
||||||
temp_int=*((unsigned short *) ptr);
|
wprintw (show_pad, "unimplemented\n");
|
||||||
wprintw (show_pad,"%u (0x%x)\n",temp_int,temp_int);
|
break;
|
||||||
offset +=2;l++;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
temp_long=*((unsigned long *) ptr);
|
|
||||||
wprintw (show_pad,"%lu\n",temp_long);
|
|
||||||
offset +=4;l++;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/* offset+=current_type->field_lengths [i]; */
|
offset+=len;
|
||||||
|
l++;
|
||||||
}
|
}
|
||||||
current_type->length=offset;
|
current_type->length=offset;
|
||||||
show_pad_info.max_line=l-1;
|
show_pad_info.max_line=l-1;
|
||||||
|
|
|
@ -185,57 +185,74 @@ struct struct_descriptor *add_new_descriptor (char *name)
|
||||||
{
|
{
|
||||||
struct struct_descriptor *ptr;
|
struct struct_descriptor *ptr;
|
||||||
|
|
||||||
|
ptr = malloc (sizeof (struct struct_descriptor));
|
||||||
|
if (ptr == NULL) {
|
||||||
|
printf ("Error - Can not allocate memory - Quitting\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
memset(ptr, 0, sizeof(struct struct_descriptor));
|
||||||
|
ptr->prev = ptr->next = NULL;
|
||||||
|
strcpy (ptr->name,name);
|
||||||
|
ptr->length=0;
|
||||||
|
ptr->fields_num=0;
|
||||||
if (first_type==NULL) {
|
if (first_type==NULL) {
|
||||||
first_type=last_type=ptr=(struct struct_descriptor *) malloc (sizeof (struct struct_descriptor));
|
first_type = last_type = ptr;
|
||||||
if (ptr==NULL) {
|
} else {
|
||||||
printf ("Error - Can not allocate memory - Quitting\n");
|
ptr->prev = last_type; last_type->next = ptr; last_type=ptr;
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
ptr->prev=ptr->next=NULL;
|
|
||||||
strcpy (ptr->name,name);
|
|
||||||
ptr->length=0;
|
|
||||||
ptr->fields_num=0;
|
|
||||||
ptr->type_commands.last_command=-1;
|
|
||||||
fill_type_commands (ptr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ptr=(struct struct_descriptor *) malloc (sizeof (struct struct_descriptor));
|
|
||||||
if (ptr==NULL) {
|
|
||||||
printf ("Error - Can not allocate memory - Quitting\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
ptr->prev=last_type;last_type->next=ptr;last_type=ptr;
|
|
||||||
strcpy (ptr->name,name);
|
|
||||||
ptr->length=0;
|
|
||||||
ptr->fields_num=0;
|
|
||||||
ptr->type_commands.last_command=-1;
|
|
||||||
fill_type_commands (ptr);
|
|
||||||
}
|
}
|
||||||
|
ptr->type_commands.last_command=-1;
|
||||||
|
fill_type_commands (ptr);
|
||||||
return (ptr);
|
return (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct type_table {
|
||||||
|
char *name;
|
||||||
|
int field_type;
|
||||||
|
int len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct type_table type_table[] = {
|
||||||
|
{ "long", FIELD_TYPE_INT, 4 },
|
||||||
|
{ "short", FIELD_TYPE_INT, 2 },
|
||||||
|
{ "char", FIELD_TYPE_CHAR, 1 },
|
||||||
|
{ "__u32", FIELD_TYPE_UINT, 4 },
|
||||||
|
{ "__s32", FIELD_TYPE_INT, 4 },
|
||||||
|
{ "__u16", FIELD_TYPE_UINT, 2 },
|
||||||
|
{ "__s16", FIELD_TYPE_INT, 2 },
|
||||||
|
{ "__u8", FIELD_TYPE_UINT, 1 },
|
||||||
|
{ "__s8", FIELD_TYPE_INT, 1 },
|
||||||
|
{ 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
void add_new_variable (struct struct_descriptor *ptr,char *v_type,char *v_name)
|
void add_new_variable (struct struct_descriptor *ptr,char *v_type,char *v_name)
|
||||||
|
|
||||||
{
|
{
|
||||||
short len=1;
|
short len=1;
|
||||||
|
char field_type=FIELD_TYPE_INT;
|
||||||
|
struct type_table *p;
|
||||||
|
|
||||||
strcpy (ptr->field_names [ptr->fields_num],v_name);
|
strcpy (ptr->field_names [ptr->fields_num],v_name);
|
||||||
ptr->field_positions [ptr->fields_num]=ptr->length;
|
ptr->field_positions [ptr->fields_num]=ptr->length;
|
||||||
|
|
||||||
if (strcasecmp (v_type,"long")==0) len=4;
|
|
||||||
if (strcasecmp (v_type,"__u32")==0) len=4;
|
|
||||||
if (strcasecmp (v_type,"__s32")==0) len=4;
|
|
||||||
|
|
||||||
if (strcasecmp (v_type,"__u16")==0) len=2;
|
for (p = type_table; p->name; p++) {
|
||||||
if (strcasecmp (v_type,"__s16")==0) len=2;
|
if (strcmp(v_type, p->name) == 0) {
|
||||||
if (strcasecmp (v_type,"short")==0) len=2;
|
len = p->len;
|
||||||
if (strcasecmp (v_type,"int")==0) len=2;
|
field_type = p->field_type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (p->name == 0) {
|
||||||
|
if (strncmp(v_type, "char[", 5) == 0) {
|
||||||
|
len = atoi(v_type+5);
|
||||||
|
field_type = FIELD_TYPE_CHAR;
|
||||||
|
} else {
|
||||||
|
printf("Unknown type %s for field %s\n", v_type, v_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strcasecmp (v_type,"__u8")==0) len=1;
|
ptr->field_lengths [ptr->fields_num] = len;
|
||||||
if (strcasecmp (v_type,"__s8")==0) len=1;
|
ptr->field_types [ptr->fields_num] = field_type;
|
||||||
if (strcasecmp (v_type,"char")==0) len=1;
|
|
||||||
|
|
||||||
ptr->field_lengths [ptr->fields_num]=len;
|
|
||||||
|
|
||||||
ptr->length+=len;
|
ptr->length+=len;
|
||||||
ptr->fields_num++;
|
ptr->fields_num++;
|
||||||
|
|
|
@ -77,8 +77,6 @@ struct struct_inode_bitmap_info inode_bitmap_info; /* Used by inodebitmap_com.c
|
||||||
|
|
||||||
int redraw_request=0; /* Is set by a signal handler to handle terminal */
|
int redraw_request=0; /* Is set by a signal handler to handle terminal */
|
||||||
/* screen size change. */
|
/* screen size change. */
|
||||||
int version_major=0,version_minor=2;
|
|
||||||
char revision_date [80]="April 5 2001";
|
|
||||||
char email_address [80]="tgud@tochnapc2.technion.ac.il";
|
char email_address [80]="tgud@tochnapc2.technion.ac.il";
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
|
|
|
@ -24,6 +24,7 @@ Copyright (C) 1995 Gadi Oxman
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "ext2ed.h"
|
#include "ext2ed.h"
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
struct struct_pad_info show_pad_info;
|
struct struct_pad_info show_pad_info;
|
||||||
WINDOW *title_win,*show_win,*command_win,*show_pad;
|
WINDOW *title_win,*show_win,*command_win,*show_pad;
|
||||||
|
@ -60,7 +61,7 @@ void init_windows (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
box (title_win,0,0);
|
box (title_win,0,0);
|
||||||
sprintf (title_string,"EXT2ED - Extended-2 File System editor ver %d.%d (%s)",version_major,version_minor,revision_date);
|
sprintf (title_string,"EXT2ED - Extended-2 File System editor ver %s (%s)", E2FSPROGS_VERSION, E2FSPROGS_DATE);
|
||||||
wmove (title_win,TITLE_WIN_LINES/2,(COLS-strlen (title_string))/2);
|
wmove (title_win,TITLE_WIN_LINES/2,(COLS-strlen (title_string))/2);
|
||||||
wprintw (title_win,title_string);
|
wprintw (title_win,title_string);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue