[Ocfs2-tools-commits] smushran commits r973 - in
trunk/debugfs.ocfs2: . include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jun 22 18:16:41 CDT 2005
Author: smushran
Signed-off-by: mfasheh
Date: 2005-06-22 18:16:38 -0500 (Wed, 22 Jun 2005)
New Revision: 973
Modified:
trunk/debugfs.ocfs2/include/main.h
trunk/debugfs.ocfs2/main.c
Log:
fixes the annoying prompt-dissapears-on-backspace issue in debugfs
Signed-off-by: mfasheh
Modified: trunk/debugfs.ocfs2/include/main.h
===================================================================
--- trunk/debugfs.ocfs2/include/main.h 2005-06-22 00:20:56 UTC (rev 972)
+++ trunk/debugfs.ocfs2/include/main.h 2005-06-22 23:16:38 UTC (rev 973)
@@ -86,6 +86,7 @@
typedef struct _dbgfs_opts {
int allow_write;
+ int no_prompt;
char *cmd_file;
char *device;
} dbgfs_opts;
Modified: trunk/debugfs.ocfs2/main.c
===================================================================
--- trunk/debugfs.ocfs2/main.c 2005-06-22 00:20:56 UTC (rev 972)
+++ trunk/debugfs.ocfs2/main.c 2005-06-22 23:16:38 UTC (rev 973)
@@ -42,11 +42,12 @@
*/
static void usage (char *progname)
{
- g_print ("usage: %s [-f cmdfile] [-V] [-w] [-?] [device]\n", progname);
g_print ("usage: %s -l [<logentry> ... [allow|off|deny]] ...\n", progname);
+ g_print ("usage: %s [-f cmdfile] [-V] [-w] [-n] [-?] [device]\n", progname);
g_print ("\t-f, --file <cmdfile>\tExecute commands in cmdfile\n");
g_print ("\t-w, --write\t\tOpen in read-write mode instead of the default of read-only\n");
g_print ("\t-V, --version\t\tShow version\n");
+ g_print ("\t-n, --noprompt\t\tHide prompt\n");
g_print ("\t-?, --help\t\tShow this help\n");
exit (0);
} /* usage */
@@ -118,12 +119,13 @@
{ "version", 0, 0, 'V' },
{ "help", 0, 0, '?' },
{ "write", 0, 0, '?' },
- { "log", 0, 0, 'l' },
+ { "log", 0, 0, 'l' },
+ { "noprompt", 0, 0, 'n' },
{ 0, 0, 0, 0}
};
while (1) {
- c = getopt_long(argc, argv, "lf:V?w", long_options, NULL);
+ c = getopt_long(argc, argv, "lf:V?wn", long_options, NULL);
if (c == -1)
break;
@@ -144,6 +146,10 @@
opts->allow_write = 1;
break;
+ case 'n':
+ opts->no_prompt = 1;
+ break;
+
case '?':
print_version(gbls.progname);
usage(gbls.progname);
@@ -175,7 +181,7 @@
* get_line()
*
*/
-static char * get_line (FILE *stream)
+static char * get_line (FILE *stream, int no_prompt)
{
char *line;
static char buf[1024];
@@ -194,8 +200,10 @@
break;
}
} else {
- fprintf(stderr, "%s", PROMPT);
- line = readline (NULL);
+ if (no_prompt)
+ line = readline(NULL);
+ else
+ line = readline(PROMPT);
if (line && *line) {
g_strchug(line);
@@ -299,11 +307,11 @@
}
while (1) {
- line = get_line(cmd);
+ line = get_line(cmd, opts.no_prompt);
if (line) {
- if (!gbls.interactive)
- fprintf (stderr, "%s%s\n", PROMPT, line);
+ if (!gbls.interactive && !opts.no_prompt)
+ fprintf (stdout, "%s%s\n", PROMPT, line);
do_command (line);
if (gbls.interactive)
free (line);
More information about the Ocfs2-tools-commits
mailing list