OSDN Git Service

Checked in changes from ext2ed version 0.2.
authorTheodore Ts'o <tytso@mit.edu>
Sat, 11 May 2002 17:03:25 +0000 (13:03 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 May 2002 17:03:25 +0000 (13:03 -0400)
ext2ed/Makefile
ext2ed/README
ext2ed/dir_com.c
ext2ed/ext2ed.h
ext2ed/general_com.c
ext2ed/init.c
ext2ed/inode_com.c
ext2ed/main.c
ext2ed/win.c

index ec5a86f..1df6fe2 100644 (file)
@@ -24,9 +24,9 @@
 # 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
 
 # ------------------------------------------------------------------------
@@ -65,11 +65,12 @@ clean:
 
 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)
index 7d187f2..2c64526 100644 (file)
@@ -1,7 +1,23 @@
-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
 -------------
@@ -98,4 +114,5 @@ Feel free to send me feedback with anything regarding to ext2ed.
 Enjoy,
 
 Gadi Oxman <tgud@tochnapc2.technion.ac.il>
-Haifa, August 23 1995
\ No newline at end of file
+Haifa, August 23 1995
+
index e1471fb..74557b7 100644 (file)
@@ -98,13 +98,13 @@ struct struct_file_info search_dir_entries (int (*action) (struct struct_file_in
 
 {
        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 */
                
@@ -115,7 +115,7 @@ struct struct_file_info search_dir_entries (int (*action) (struct struct_file_in
 
                                                                                /* 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;
@@ -133,7 +133,7 @@ struct struct_file_info search_dir_entries (int (*action) (struct struct_file_in
                                                                                /* 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);
                        
                }
                
@@ -216,9 +216,9 @@ void type_dir___cd (char *command_line)
        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);
        
@@ -317,9 +317,9 @@ Returns FOUND if found, or CONTINUE if not found.
 */
 
 {
-       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);
@@ -395,10 +395,10 @@ It involves computing the device offset of the inode and using directly the seto
        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 */
@@ -449,9 +449,9 @@ Show the current search entry (info) in one line. If the entry happens to be the
 
 {
        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);
@@ -591,9 +591,9 @@ because it is of variable length.
 {
        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) {
index 34d836f..65402e2 100644 (file)
@@ -35,7 +35,7 @@ Copyright (C) 1995 Gadi Oxman
 #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>
@@ -435,4 +435,4 @@ extern void show_info (void);
 extern void redraw_all (void);
 extern void close_windows (void);
 
-#endif /* EXT2ED_EDITOR_H */
\ No newline at end of file
+#endif /* EXT2ED_EDITOR_H */
index a8ebdc3..21fd30b 100644 (file)
@@ -87,6 +87,7 @@ void help (char *command_line)
        
        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");
index ef59b27..7f90a57 100644 (file)
@@ -20,7 +20,7 @@ Copyright (C) 1995 Gadi Oxman
 #include <readline.h>
 #include <signal.h>
 #include <unistd.h>
-#include <sys/ioctl.h>
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -427,9 +427,9 @@ void init_readline (void)
 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);
        
 }
 
@@ -604,4 +604,4 @@ void check_mounted (char *name)
        fclose (fp);
        
        return; 
-}
\ No newline at end of file
+}
index d2c0638..0f14d11 100644 (file)
@@ -214,7 +214,7 @@ void type_ext2_inode___show (char *command_line)
        
        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 - ");
index 43130c9..367c4ea 100644 (file)
@@ -77,8 +77,8 @@ 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 */
                                                                /* 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)
@@ -128,9 +128,9 @@ only the enter key is needed to retype it.
                                                                /* 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 */
@@ -371,4 +371,4 @@ We just report the error, and try to continue ...
        refresh_command_win ();getch ();werase (command_win);
 }
 
-#endif
\ No newline at end of file
+#endif
index 09ee22d..76ba197 100644 (file)
@@ -9,6 +9,9 @@ Window management - Interfacing with the ncurses library
 --------------------------------------------------------
 
 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
 
@@ -17,18 +20,29 @@ 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");
@@ -128,7 +142,8 @@ void refresh_command_win (void)
 void close_windows (void)
 
 {
-       echo ();
+//     echo ();
+       tcsetattr(0,TCSANOW,&termioInit);
        
        delwin (title_win);
        delwin (command_win);
@@ -166,4 +181,4 @@ void redraw_all (void)
        wmove (command_win,0,0);
        mvcur (-1,-1,LINES-COMMAND_WIN_LINES,0);
        
-}
\ No newline at end of file
+}