# required ncurses and readline include files / libraries. Be sure that you
# don't mix two two versions of ncurses.
-# NCURSES_INCLUDE = -I/usr/local/include -I/usr/local/include/ncurses
-# NCURSES_LIB = -L/usr/local/lib
-# READLINE_INCLUDE = -I/usr/include -I/usr/include/readline
+NCURSES_INCLUDE = -I/usr/include/ncurses
+# NCURSES_LIB = -L/usr//lib
+READLINE_INCLUDE = -I/usr/include/readline
# READLINE_LIB = -L/usr/lib
# ------------------------------------------------------------------------
install: ext2ed
install -d $(VAR_DIR)
- install -d $(DOC_DIR)
install -m 755 ext2ed $(BIN_DIR)
install -m 644 ext2.descriptors $(VAR_DIR)
install -m 644 ext2ed.conf $(VAR_DIR)
install -m 644 doc/ext2ed.8 $(MAN_DIR)
+
+install.doc:
install -m 644 doc/user-guide-0.1.sgml $(DOC_DIR)
install -m 644 doc/user-guide-0.1.ps $(DOC_DIR)
install -m 644 doc/Ext2fs-overview-0.1.sgml $(DOC_DIR)
-ext2ed - The extended-2 filesystem editor, version 0.1
+ext2ed - The extended-2 filesystem editor, version 0.2
------------------------------------------------------
-This is version 0.1 of ext2ed - The extended-2 filesystem editor.
+This is version 0.2 of ext2ed - The extended-2 filesystem editor.
+
+Modifications on Apr 5 2001
+This is minor bug fixes to ext2ed, as of April 2001.
+It supports modern ext2 version that has file type in directory structure
+and fixes the missunderstanding between ncurses and
+readline.
+
+I first applied patches from Redhat except the one for readline that
+rewrote a readline behavior.
+
+Globals diffs between version 0.1 and 0.2 is stored in file :
+ diff-ext2ed.1.2
+
+Christian Bac <Christian.Bac@nt-evry.fr>
+
+----------------------------------------------------------------------------
Documentation
-------------
Enjoy,
Gadi Oxman <tgud@tochnapc2.technion.ac.il>
-Haifa, August 23 1995
\ No newline at end of file
+Haifa, August 23 1995
+
{
struct struct_file_info info; /* Temporary variables used to */
- struct ext2_dir_entry *dir_entry_ptr; /* contain the current search entries */
+ struct ext2_dir_entry_2 *dir_entry_ptr; /* contain the current search entries */
int return_code;
info=first_file_info; /* Start from the first entry - Read it */
low_read (info.buffer,file_system_info.block_size,info.global_block_offset);
- dir_entry_ptr=(struct ext2_dir_entry *) (info.buffer+info.dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (info.buffer+info.dir_entry_offset);
while (info.file_offset < info.file_length) { /* While we haven't reached the end */
/* Pass to the next entry */
- dir_entry_ptr=(struct ext2_dir_entry *) (info.buffer+info.dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (info.buffer+info.dir_entry_offset);
info.dir_entry_num++;
info.dir_entry_offset+=dir_entry_ptr->rec_len;
/* read it and update the pointer */
low_read (info.buffer,file_system_info.block_size,info.global_block_offset);
- dir_entry_ptr=(struct ext2_dir_entry *) (info.buffer+info.dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (info.buffer+info.dir_entry_offset);
}
int status;
char *ptr,full_dir_name [500],dir_name [500],temp [500],temp2 [500];
struct struct_file_info info;
- struct ext2_dir_entry *dir_entry_ptr;
+ struct ext2_dir_entry_2 *dir_entry_ptr;
- dir_entry_ptr=(struct ext2_dir_entry *) (file_info.buffer+file_info.dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (file_info.buffer+file_info.dir_entry_offset);
ptr=parse_word (command_line,dir_name);
*/
{
- struct ext2_dir_entry *dir_entry_ptr;
+ struct ext2_dir_entry_2 *dir_entry_ptr;
- dir_entry_ptr=(struct ext2_dir_entry *) (info->buffer+info->dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (info->buffer+info->dir_entry_offset);
if (dir_entry_ptr->name_len != strlen (name_search))
return (CONTINUE);
long inode_offset;
char buffer [80];
- struct ext2_dir_entry *dir_entry_ptr;
+ struct ext2_dir_entry_2 *dir_entry_ptr;
low_read (file_info.buffer,file_system_info.block_size,file_info.global_block_offset);
- dir_entry_ptr=(struct ext2_dir_entry *) (file_info.buffer+file_info.dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (file_info.buffer+file_info.dir_entry_offset);
inode_offset=inode_num_to_inode_offset (dir_entry_ptr->inode); /* Compute the inode's offset */
sprintf (buffer,"setoffset %ld",inode_offset);dispatch (buffer); /* Move to it */
{
unsigned char temp [80];
- struct ext2_dir_entry *dir_entry_ptr;
+ struct ext2_dir_entry_2 *dir_entry_ptr;
- dir_entry_ptr=(struct ext2_dir_entry *) (info->buffer+info->dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (info->buffer+info->dir_entry_offset);
if (info->dir_entry_num == file_info.dir_entry_num) /* Highlight the current entry */
wattrset (show_pad,A_REVERSE);
{
int found=0;
unsigned char *ptr,buffer [80],variable [80],value [80],temp [80];
- struct ext2_dir_entry *dir_entry_ptr;
+ struct ext2_dir_entry_2 *dir_entry_ptr;
- dir_entry_ptr=(struct ext2_dir_entry *) (file_info.buffer+file_info.dir_entry_offset);
+ dir_entry_ptr=(struct ext2_dir_entry_2 *) (file_info.buffer+file_info.dir_entry_offset);
ptr=parse_word (command_line,buffer);
if (*ptr==0) {
#define DEBUG /* Activate self-sanity checks */
#include <linux/ext2_fs.h> /* Main kernel ext2 include file */
-#include <linux/stat.h>
+#include <sys/stat.h>
#ifdef OLD_NCURSES /* The ncurses interface */
#include <ncurses/ncurses.h>
extern void redraw_all (void);
extern void close_windows (void);
-#endif /* EXT2ED_EDITOR_H */
\ No newline at end of file
+#endif /* EXT2ED_EDITOR_H */
wprintw (show_pad,"EXT2ED ver %d.%d (%s)\n",version_major,version_minor,revision_date);
wprintw (show_pad,"Copyright (C) 1995 Gadi Oxman\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 was programmed as a student project in the software laboratory\n");
wprintw (show_pad,"of the faculty of electrical engineering in the\n");
#include <readline.h>
#include <signal.h>
#include <unistd.h>
-#include <sys/ioctl.h>
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
void init_signals (void)
{
- signal (SIGWINCH,(SignalHandler) signal_SIGWINCH_handler); /* Catch SIGWINCH */
- signal (SIGTERM,(SignalHandler) signal_SIGTERM_handler);
- signal (SIGSEGV,(SignalHandler) signal_SIGSEGV_handler);
+ signal (SIGWINCH, signal_SIGWINCH_handler); /* Catch SIGWINCH */
+ signal (SIGTERM, signal_SIGTERM_handler);
+ signal (SIGSEGV, signal_SIGSEGV_handler);
}
fclose (fp);
return;
-}
\ No newline at end of file
+}
wprintw (show_win,"Inode type: ");
- if (inode_num < EXT2_FIRST_INO) {
+ if (inode_num < EXT2_GOOD_OLD_FIRST_INO) {
switch (inode_num) {
case EXT2_BAD_INO:
wprintw (show_win,"Bad blocks inode - ");
int redraw_request=0; /* Is set by a signal handler to handle terminal */
/* screen size change. */
-int version_major=0,version_minor=1;
-char revision_date [80]="August 22 1995";
+int version_major=0,version_minor=2;
+char revision_date [80]="April 5 2001";
char email_address [80]="tgud@tochnapc2.technion.ac.il";
int main (void)
/* using the readline library I'm breaking its */
/* assumptions. The double -1 arguments tell ncurses */
/* to disable cursor movement optimization this time. */
- echo ();
+ //echo ();
ptr=readline ("ext2ed > "); /* Read the user's command line. */
- noecho ();
+ //noecho ();
strcpy (command_line,ptr); /* Readline allocated the buffer - Copy the string */
free (ptr); /* and free the allocated buffer */
refresh_command_win ();getch ();werase (command_win);
}
-#endif
\ No newline at end of file
+#endif
--------------------------------------------------------
First written on: April 17 1995
+Modified on : April 05 2001 Christian.Bac@int-evry.fr
+it looks like readline does not like that initscr decides to set the tty to
+noecho.
Copyright (C) 1995 Gadi Oxman
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <termios.h>
+#include <unistd.h>
#include "ext2ed.h"
struct struct_pad_info show_pad_info;
WINDOW *title_win,*show_win,*command_win,*show_pad;
+/* to remember configuration after initscr
+ * and modify it
+ */
+struct termios termioInit, termioCurrent;
+
void init_windows (void)
{
char title_string [80];
initscr ();
+ tcgetattr(0,&termioInit); /* save initial config */
+ termioCurrent = termioInit;
+ termioCurrent.c_lflag |= ECHO; /* set echo on */
+ tcsetattr(0,TCSANOW,&termioCurrent);
if (LINES<TITLE_WIN_LINES+SHOW_WIN_LINES+COMMAND_WIN_LINES+3) {
printf ("Sorry, your terminal screen is too small\n");
void close_windows (void)
{
- echo ();
+// echo ();
+ tcsetattr(0,TCSANOW,&termioInit);
delwin (title_win);
delwin (command_win);
wmove (command_win,0,0);
mvcur (-1,-1,LINES-COMMAND_WIN_LINES,0);
-}
\ No newline at end of file
+}