mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Add i18n through gettext, as well as a Swedish translation
darcs-hash:20060104125102-ac50b-5bf026578a69bd94f7a7a3c8dee0ebccd95e5c24.gz
This commit is contained in:
parent
26de6ba26b
commit
ec43c635cc
30 changed files with 1999 additions and 546 deletions
165
Makefile.in
165
Makefile.in
|
@ -38,6 +38,7 @@ INSTALL:=@INSTALL@
|
|||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = @datadir@
|
||||
bindir = @bindir@
|
||||
mandir = @mandir@
|
||||
sysconfdir = @sysconfdir@
|
||||
|
@ -46,13 +47,15 @@ fishfile = @fishfile@
|
|||
fishinputfile = @fishinputfile@
|
||||
docdir = @docdir@
|
||||
|
||||
HAVE_GETTEXT=@HAVE_GETTEXT@
|
||||
|
||||
# All objects used by fish, that are compiled from an ordinary .c file
|
||||
# using an ordinary .h file.
|
||||
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
|
||||
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
|
||||
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
|
||||
output.o intern.o env_universal.o env_universal_common.o \
|
||||
input_common.o event.o signal.o io.o
|
||||
input_common.o event.o signal.o io.o translate.o
|
||||
|
||||
# builtin_help.h exists, but builtin_help.c is autogenerated
|
||||
COMMON_OBJS_WITH_HEADER := builtin_help.o
|
||||
|
@ -154,8 +157,12 @@ MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \
|
|||
doc_src/builtin_doc/man/man1/tokenize.1 \
|
||||
doc_src/builtin_doc/man/man1/count.1
|
||||
|
||||
#All translation message catalogs
|
||||
TRANSLATIONS_SRC := $(wildcard po/*.po)
|
||||
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
|
||||
|
||||
#Make everything needed for installing fish
|
||||
all: $(PROGRAMS) user_doc
|
||||
all: $(PROGRAMS) user_doc
|
||||
|
||||
# User documentation, describing the features of the fish shell.
|
||||
user_doc: doc.h Doxyfile.user user_doc.head.html
|
||||
|
@ -205,6 +212,28 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
|
|||
cat $*.txt >>$@;
|
||||
echo "*/" >>$@
|
||||
|
||||
# Compile translation file
|
||||
%.gmo:%.po
|
||||
if test $(HAVE_GETTEXT) = 1; then \
|
||||
msgfmt $*.po -o $*.gmo; \
|
||||
fi
|
||||
|
||||
# Update existing po file or copy messages.pot
|
||||
%.po: messages.pot
|
||||
if test $(HAVE_GETTEXT) = 1;then \
|
||||
if test -f $*.po; then \
|
||||
msgmerge -U --backup=existing --no-wrap $*.po messages.pot;\
|
||||
else \
|
||||
cp messages.pot $*.po;\
|
||||
fi; \
|
||||
fi
|
||||
|
||||
# Create a template translation object
|
||||
messages.pot: *.c *.h
|
||||
if test $(HAVE_GETTEXT) = 1;then \
|
||||
xgettext -k_ -kN_ --no-wrap *.c *.h -o messages.pot; \
|
||||
fi
|
||||
|
||||
# Generate the internal help functions by making doxygen create
|
||||
# man-pages which are then converted into C code. The convertion path
|
||||
# looks like this:
|
||||
|
@ -266,7 +295,7 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui
|
|||
echo "}" >>$@
|
||||
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
|
||||
|
||||
install: all
|
||||
install: all install-translations
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
|
||||
for i in $(PROGRAMS); do\
|
||||
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
|
||||
|
@ -294,7 +323,7 @@ install: all
|
|||
@echo If you want to use fish as the default shell, remember to first
|
||||
@echo add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.
|
||||
|
||||
uninstall:
|
||||
uninstall: uninstall-translations
|
||||
for i in $(PROGRAMS); do \
|
||||
rm -f $(DESTDIR)$(bindir)/$$i; \
|
||||
done;
|
||||
|
@ -307,6 +336,21 @@ uninstall:
|
|||
rm $(DESTDIR)$(mandir)/man1/$$i; \
|
||||
done;
|
||||
|
||||
install-translations: all
|
||||
if test $(HAVE_GETTEXT) = 1; then \
|
||||
for i in $(TRANSLATIONS); do \
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES; \
|
||||
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES/fish.mo; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
uninstall-translations: all
|
||||
if test $(HAVE_GETTEXT) = 1; then \
|
||||
for i in $(TRANSLATIONS_SRC); do \
|
||||
rm -f $(DESTDIR)$(datadir)/locale/$$(basename $$i .po)/LC_MESSAGES/fish.mo; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# The fish shell
|
||||
fish: $(FISH_OBJS)
|
||||
$(CC) $(FISH_OBJS) $(LDFLAGS) -o $@
|
||||
|
@ -346,18 +390,20 @@ depend:
|
|||
#
|
||||
# Uses install instead of mkdir so build won't fail if the directory
|
||||
# exists
|
||||
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
|
||||
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog $(TRANSLATIONS_SRC)
|
||||
rm -rf fish-@PACKAGE_VERSION@
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
|
||||
$(INSTALL) -d fish-@PACKAGE_VERSION@/translations
|
||||
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
|
||||
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
|
||||
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
|
||||
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
|
||||
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
|
||||
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/translations/
|
||||
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
|
||||
rm -rf fish-@PACKAGE_VERSION@
|
||||
|
||||
|
@ -394,66 +440,85 @@ clean:
|
|||
rm -rf doc_src/builtin_doc
|
||||
rm -rf fish-@PACKAGE_VERSION@
|
||||
rm -rf xsel-0.9.6/
|
||||
rm $(TRANSLATIONS)
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h
|
||||
builtin.o: parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
|
||||
builtin.o: io.h parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
|
||||
builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h
|
||||
builtin.o: intern.h
|
||||
builtin_commandline.o: config.h util.h builtin.h common.h wgetopt.h reader.h
|
||||
builtin_commandline.o: proc.h parser.h tokenizer.h input_common.h input.h
|
||||
builtin.o: intern.h event.h signal.h
|
||||
builtin_commandline.o: signal.h config.h util.h builtin.h common.h wgetopt.h
|
||||
builtin_commandline.o: reader.h proc.h io.h parser.h tokenizer.h
|
||||
builtin_commandline.o: input_common.h input.h
|
||||
builtin_help.o: config.h util.h common.h builtin_help.h
|
||||
builtin_set.o: config.h util.h builtin.h env.h expand.h common.h wgetopt.h
|
||||
builtin_set.o: proc.h parser.h
|
||||
common.o: config.h util.h wutil.h common.h expand.h proc.h wildcard.h
|
||||
common.o: parser.h
|
||||
complete.o: config.h util.h tokenizer.h wildcard.h proc.h parser.h function.h
|
||||
complete.o: complete.h builtin.h env.h exec.h expand.h common.h reader.h
|
||||
complete.o: history.h intern.h wutil.h
|
||||
env.o: config.h util.h wutil.h proc.h common.h env.h sanity.h expand.h
|
||||
env.o: history.h reader.h parser.h env_universal.h env_universal_common.h
|
||||
env_universal.o: util.h common.h wutil.h env_universal_common.h
|
||||
env_universal.o: env_universal.h
|
||||
env_universal_common.o: util.h common.h wutil.h env_universal_common.h
|
||||
exec.o: config.h util.h common.h wutil.h proc.h exec.h parser.h builtin.h
|
||||
exec.o: function.h env.h wildcard.h sanity.h expand.h env_universal.h
|
||||
exec.o: env_universal_common.h
|
||||
expand.o: config.h util.h common.h wutil.h env.h proc.h parser.h expand.h
|
||||
expand.o: wildcard.h exec.h tokenizer.h complete.h
|
||||
fishd.o: util.h common.h wutil.h env_universal_common.h
|
||||
fish_pager.o: config.h util.h wutil.h common.h complete.h output.h
|
||||
builtin_set.o: signal.h config.h util.h builtin.h env.h expand.h common.h
|
||||
builtin_set.o: wgetopt.h proc.h io.h parser.h
|
||||
builtin_ulimit.o: config.h util.h builtin.h common.h wgetopt.h
|
||||
common.o: config.h signal.h util.h wutil.h common.h expand.h proc.h io.h
|
||||
common.o: wildcard.h parser.h
|
||||
complete.o: signal.h config.h util.h tokenizer.h wildcard.h proc.h io.h
|
||||
complete.o: parser.h function.h complete.h builtin.h env.h exec.h expand.h
|
||||
complete.o: common.h reader.h history.h intern.h wutil.h
|
||||
env.o: config.h signal.h util.h wutil.h proc.h io.h common.h env.h sanity.h
|
||||
env.o: expand.h history.h reader.h parser.h env_universal.h
|
||||
env.o: env_universal_common.h input_common.h event.h
|
||||
env_universal.o: config.h signal.h util.h common.h wutil.h
|
||||
env_universal.o: env_universal_common.h env_universal.h
|
||||
env_universal_common.o: signal.h util.h common.h wutil.h
|
||||
env_universal_common.o: env_universal_common.h
|
||||
event.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
|
||||
event.o: event.h
|
||||
exec.o: signal.h config.h util.h common.h wutil.h proc.h io.h exec.h parser.h
|
||||
exec.o: builtin.h function.h env.h wildcard.h sanity.h expand.h
|
||||
exec.o: env_universal.h env_universal_common.h
|
||||
expand.o: signal.h config.h util.h common.h wutil.h env.h proc.h io.h
|
||||
expand.o: parser.h expand.h wildcard.h exec.h tokenizer.h complete.h
|
||||
fishd.o: signal.h util.h common.h wutil.h env_universal_common.h
|
||||
fish_pager.o: config.h signal.h util.h wutil.h common.h complete.h output.h
|
||||
fish_pager.o: input_common.h env_universal.h env_universal_common.h
|
||||
fish_tests.o: config.h util.h common.h proc.h reader.h builtin.h function.h
|
||||
fish_tests.o: complete.h wutil.h env.h expand.h parser.h tokenizer.h
|
||||
function.o: config.h util.h function.h proc.h parser.h common.h intern.h
|
||||
highlight.o: config.h util.h wutil.h highlight.h tokenizer.h proc.h parser.h
|
||||
highlight.o: builtin.h function.h env.h expand.h sanity.h common.h complete.h
|
||||
highlight.o: output.h
|
||||
fish_tests.o: config.h signal.h util.h common.h proc.h io.h reader.h
|
||||
fish_tests.o: builtin.h function.h complete.h wutil.h env.h expand.h parser.h
|
||||
fish_tests.o: tokenizer.h output.h exec.h event.h
|
||||
function.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h
|
||||
function.o: intern.h event.h
|
||||
highlight.o: signal.h config.h util.h wutil.h highlight.h tokenizer.h proc.h
|
||||
highlight.o: io.h parser.h builtin.h function.h env.h expand.h sanity.h
|
||||
highlight.o: common.h complete.h output.h
|
||||
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
|
||||
input.o: config.h util.h wutil.h reader.h proc.h common.h sanity.h
|
||||
input.o: input_common.h input.h parser.h env.h expand.h
|
||||
input.o: config.h signal.h util.h wutil.h reader.h proc.h io.h common.h
|
||||
input.o: sanity.h input_common.h input.h parser.h env.h expand.h event.h
|
||||
input_common.o: config.h util.h common.h wutil.h input_common.h
|
||||
input_common.o: env_universal.h env_universal_common.h
|
||||
intern.o: config.h util.h common.h intern.h
|
||||
kill.o: config.h util.h wutil.h kill.h proc.h sanity.h common.h env.h
|
||||
kill.o: expand.h exec.h parser.h
|
||||
main.o: config.h util.h common.h reader.h builtin.h function.h complete.h
|
||||
main.o: wutil.h env.h sanity.h proc.h parser.h expand.h intern.h
|
||||
io.o: config.h util.h wutil.h exec.h proc.h io.h common.h
|
||||
key_reader.o: input_common.h
|
||||
kill.o: signal.h config.h util.h wutil.h kill.h proc.h io.h sanity.h common.h
|
||||
kill.o: env.h expand.h exec.h parser.h
|
||||
main.o: config.h signal.h util.h common.h reader.h builtin.h function.h
|
||||
main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h expand.h
|
||||
main.o: intern.h exec.h event.h output.h translate.h
|
||||
mimedb.o: config.h xdgmime.h util.h
|
||||
output.o: config.h util.h wutil.h expand.h common.h output.h highlight.h
|
||||
parser.o: config.h util.h common.h wutil.h proc.h parser.h tokenizer.h exec.h
|
||||
parser.o: wildcard.h function.h builtin.h builtin_help.h env.h expand.h
|
||||
parser.o: reader.h sanity.h env_universal.h env_universal_common.h
|
||||
proc.o: config.h util.h wutil.h proc.h common.h reader.h sanity.h env.h
|
||||
reader.o: config.h util.h wutil.h highlight.h reader.h proc.h parser.h
|
||||
reader.o: complete.h history.h common.h sanity.h env.h exec.h expand.h
|
||||
reader.o: tokenizer.h kill.h input_common.h input.h function.h output.h
|
||||
sanity.o: config.h util.h common.h sanity.h proc.h history.h reader.h kill.h
|
||||
sanity.o: wutil.h
|
||||
output.o: config.h signal.h util.h wutil.h expand.h common.h output.h
|
||||
output.o: highlight.h
|
||||
parser.o: signal.h config.h util.h common.h wutil.h proc.h io.h parser.h
|
||||
parser.o: tokenizer.h exec.h wildcard.h function.h builtin.h builtin_help.h
|
||||
parser.o: env.h expand.h reader.h sanity.h env_universal.h
|
||||
parser.o: env_universal_common.h event.h translate.h msgnrs.h
|
||||
proc.o: config.h signal.h util.h wutil.h proc.h io.h common.h reader.h
|
||||
proc.o: sanity.h env.h parser.h event.h
|
||||
reader.o: config.h signal.h util.h wutil.h highlight.h reader.h proc.h io.h
|
||||
reader.o: parser.h complete.h history.h common.h sanity.h env.h exec.h
|
||||
reader.o: expand.h tokenizer.h kill.h input_common.h input.h function.h
|
||||
reader.o: output.h
|
||||
sanity.o: signal.h config.h util.h common.h sanity.h proc.h io.h history.h
|
||||
sanity.o: reader.h kill.h wutil.h
|
||||
set_color.o: config.h
|
||||
signal.o: config.h signal.h common.h util.h wutil.h event.h reader.h proc.h
|
||||
signal.o: io.h
|
||||
tokenize.o: config.h
|
||||
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h
|
||||
translate.o: msgnrs.h common.h util.h
|
||||
util.o: config.h util.h common.h wutil.h
|
||||
wgetopt.o: config.h wgetopt.h wutil.h
|
||||
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
|
||||
|
|
398
builtin.c
398
builtin.c
|
@ -11,7 +11,7 @@
|
|||
|
||||
2). Add a line like hash_put( &builtin, L"NAME", &builtin_NAME ); to builtin_init. This will enable the parser to find the builtin function.
|
||||
|
||||
3). Add a line like hash_put( desc, L"NAME", L"Bla bla bla" ); to the proper part of builtin_get_desc, containing a short description of what the builtin does. This description is used by the completion system.
|
||||
3). Add a line like hash_put( desc, L"NAME", _(L"Bla bla bla") ); to the proper part of builtin_get_desc, containing a short description of what the builtin does. This description is used by the completion system.
|
||||
|
||||
4). Create a file doc_src/NAME.txt, containing the manual for the builtin in Doxygen-format. Check the other builtin manuals for proper syntax.
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
|||
#include "intern.h"
|
||||
#include "event.h"
|
||||
#include "signal.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
The default prompt for the read command
|
||||
|
@ -76,7 +77,7 @@
|
|||
/**
|
||||
The send stuff to foreground message
|
||||
*/
|
||||
#define FG_MSG L"Send job %d, '%ls' to foreground\n"
|
||||
#define FG_MSG _( L"Send job %d, '%ls' to foreground\n" )
|
||||
|
||||
/**
|
||||
Print modes for the jobs builtin
|
||||
|
@ -234,9 +235,8 @@ static int builtin_bind( wchar_t **argv )
|
|||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_printf( sb_err,
|
||||
L"%ls%ls %ls\n",
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
|
@ -331,13 +331,10 @@ static int builtin_block( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -370,13 +367,13 @@ static int builtin_block( wchar_t **argv )
|
|||
{
|
||||
if( scope != UNSET )
|
||||
{
|
||||
sb_printf( sb_err, L"%ls: Can not specify scope when removing block\n", argv[0] );
|
||||
sb_printf( sb_err, _( L"%ls: Can not specify scope when removing block\n" ), argv[0] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( !global_event_block )
|
||||
{
|
||||
sb_printf( sb_err, L"%ls: No blocks defined\n", argv[0] );
|
||||
sb_printf( sb_err, _( L"%ls: No blocks defined\n" ), argv[0] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -473,13 +470,10 @@ static int builtin_builtin( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
|
||||
|
@ -570,13 +564,10 @@ static int builtin_generic( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
||||
|
@ -633,13 +624,10 @@ static int builtin_exec( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
||||
|
@ -796,13 +784,10 @@ static int builtin_functions( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
|
||||
|
@ -840,10 +825,11 @@ static int builtin_functions( wchar_t **argv )
|
|||
*/
|
||||
if( (erase + (desc!=0) + list) > 1 )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Invalid combination of options\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Invalid combination of options\n" ),
|
||||
argv[0] );
|
||||
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -864,7 +850,7 @@ static int builtin_functions( wchar_t **argv )
|
|||
if( argc-woptind != 1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Expected exactly one function name\n",
|
||||
_( L"%ls: Expected exactly one function name\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
|
@ -874,7 +860,7 @@ static int builtin_functions( wchar_t **argv )
|
|||
if( !function_exists( func ) )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Function '%ls' does not exist\n",
|
||||
_( L"%ls: Function '%ls' does not exist\n" ),
|
||||
argv[0],
|
||||
func );
|
||||
|
||||
|
@ -913,7 +899,7 @@ static int builtin_functions( wchar_t **argv )
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
sb_append( sb_out, L"Current function definitions are:\n\n" );
|
||||
sb_append( sb_out, _( L"Current function definitions are:\n\n" ) );
|
||||
al_init( &names );
|
||||
function_get_names( &names, show_hidden );
|
||||
names_arr = list_to_char_arr( &names );
|
||||
|
@ -1049,13 +1035,10 @@ static int builtin_function( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
res = 1;
|
||||
|
@ -1078,7 +1061,7 @@ static int builtin_function( wchar_t **argv )
|
|||
if( sig < 0 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Unknown signal %ls\n",
|
||||
_( L"%ls: Unknown signal '%ls'\n" ),
|
||||
argv[0],
|
||||
woptarg );
|
||||
res=1;
|
||||
|
@ -1102,7 +1085,7 @@ static int builtin_function( wchar_t **argv )
|
|||
if( !wcsvarname( woptarg ) )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Invalid variable name %ls\n",
|
||||
_( L"%ls: Invalid variable name '%ls'\n" ),
|
||||
argv[0],
|
||||
woptarg );
|
||||
res=1;
|
||||
|
@ -1164,7 +1147,7 @@ static int builtin_function( wchar_t **argv )
|
|||
if( job_id == -1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Cannot find calling job for event handler\n",
|
||||
_( L"%ls: Cannot find calling job for event handler\n" ),
|
||||
argv[0] );
|
||||
res=1;
|
||||
}
|
||||
|
@ -1182,7 +1165,7 @@ static int builtin_function( wchar_t **argv )
|
|||
if( errno || !end || *end )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Invalid process id %ls\n",
|
||||
_( L"%ls: Invalid process id %ls\n" ),
|
||||
argv[0],
|
||||
woptarg );
|
||||
res=1;
|
||||
|
@ -1219,7 +1202,7 @@ static int builtin_function( wchar_t **argv )
|
|||
if( argc-woptind != 1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Expected one argument, got %d\n",
|
||||
_( L"%ls: Expected one argument, got %d\n" ),
|
||||
argv[0],
|
||||
argc-woptind );
|
||||
res=1;
|
||||
|
@ -1227,7 +1210,7 @@ static int builtin_function( wchar_t **argv )
|
|||
else if( !(is_binding?wcsbindingname( argv[woptind] ) : wcsvarname( argv[woptind] ) ))
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: illegal function name '%ls'\n",
|
||||
_( L"%ls: Illegal function name '%ls'\n" ),
|
||||
argv[0],
|
||||
argv[woptind] );
|
||||
|
||||
|
@ -1237,7 +1220,7 @@ static int builtin_function( wchar_t **argv )
|
|||
{
|
||||
|
||||
sb_printf( sb_err,
|
||||
L"%ls: the name '%ls' is reserved,\nand can not be used as a function name\n",
|
||||
_( L"%ls: The name '%ls' is reserved,\nand can not be used as a function name\n" ),
|
||||
argv[0],
|
||||
argv[woptind] );
|
||||
|
||||
|
@ -1253,9 +1236,10 @@ static int builtin_function( wchar_t **argv )
|
|||
int chars=0;
|
||||
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
||||
sb_append( sb_err, L"Current functions are: " );
|
||||
chars += wcslen( L"Current functions are: " );
|
||||
const wchar_t *cfa = _( L"Current functions are: " );
|
||||
sb_append( sb_err, cfa );
|
||||
chars += wcslen( cfa );
|
||||
|
||||
al_init( &names );
|
||||
function_get_names( &names, 0 );
|
||||
names_arr = list_to_char_arr( &names );
|
||||
|
@ -1350,13 +1334,10 @@ static int builtin_random( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -1398,7 +1379,7 @@ static int builtin_random( wchar_t **argv )
|
|||
if( errno || *end )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Seed value '%ls' is not a valid number\n",
|
||||
_( L"%ls: Seed value '%ls' is not a valid number\n" ),
|
||||
argv[0],
|
||||
argv[woptind] );
|
||||
|
||||
|
@ -1412,7 +1393,7 @@ static int builtin_random( wchar_t **argv )
|
|||
default:
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Expected zero or one argument, got %d\n",
|
||||
_( L"%ls: Expected zero or one argument, got %d\n" ),
|
||||
argv[0],
|
||||
argc-woptind );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
@ -1488,13 +1469,10 @@ static int builtin_read( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -1529,26 +1507,22 @@ static int builtin_read( wchar_t **argv )
|
|||
|
||||
if( ( place & ENV_UNEXPORT ) && ( place & ENV_EXPORT ) )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_EXPUNEXP,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_EXPUNEXP,
|
||||
argv[0],
|
||||
parser_current_line() );
|
||||
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (place&ENV_LOCAL) && (place & ENV_GLOBAL) )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_GLOCAL,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_GLOCAL,
|
||||
argv[0],
|
||||
parser_current_line() );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -1556,10 +1530,11 @@ static int builtin_read( wchar_t **argv )
|
|||
|
||||
if( woptind == argc )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_MISSING,
|
||||
argv[0] );
|
||||
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_MISSING,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
|
@ -1752,13 +1727,10 @@ static int builtin_status( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -1855,7 +1827,7 @@ static int builtin_exit( wchar_t **argv )
|
|||
if( errno || *end != 0)
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Argument must be an integer '%ls'\n",
|
||||
_( L"%ls: Argument must be an integer '%ls'\n" ),
|
||||
argv[0],
|
||||
argv[1] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
@ -1866,7 +1838,7 @@ static int builtin_exit( wchar_t **argv )
|
|||
|
||||
default:
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Too many arguments\n",
|
||||
_( L"%ls: Too many arguments\n" ),
|
||||
argv[0] );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
@ -1910,11 +1882,9 @@ static int builtin_cd( wchar_t **argv )
|
|||
dir_in = env_get( L"HOME" );
|
||||
if( !dir_in )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Could not find home directory\n",
|
||||
(void *)0 );
|
||||
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Could not find home directory\n" ),
|
||||
argv[0] );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1925,7 +1895,7 @@ static int builtin_cd( wchar_t **argv )
|
|||
if( !dir )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: is not a directory or you do not have permission to enter it\n",
|
||||
_( L"%ls: '%ls' is not a directory or you do not have permission to enter it\n" ),
|
||||
argv[0],
|
||||
dir_in );
|
||||
sb_append2( sb_err,
|
||||
|
@ -1937,7 +1907,7 @@ static int builtin_cd( wchar_t **argv )
|
|||
if( wchdir( dir ) != 0 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: '%ls' is not a directory\n",
|
||||
_( L"%ls: '%ls' is not a directory\n" ),
|
||||
argv[0],
|
||||
dir );
|
||||
sb_append2( sb_err,
|
||||
|
@ -1952,7 +1922,7 @@ static int builtin_cd( wchar_t **argv )
|
|||
if (!set_pwd(L"PWD"))
|
||||
{
|
||||
res=1;
|
||||
sb_printf( sb_err, L"%ls: Could not set PWD variable\n", argv[0] );
|
||||
sb_printf( sb_err, _( L"%ls: Could not set PWD variable\n" ), argv[0] );
|
||||
}
|
||||
|
||||
free( dir );
|
||||
|
@ -2061,12 +2031,10 @@ static int builtin_complete( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Unknown option ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
@ -2108,12 +2076,11 @@ static int builtin_complete( wchar_t **argv )
|
|||
case 's':
|
||||
if( wcslen( woptarg ) > 1 )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Parameter too long ",
|
||||
woptarg,
|
||||
L"\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Parameter '%ls' is too long\n" ),
|
||||
argv[0],
|
||||
woptarg );
|
||||
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
// builtin_print_help( argv[0], sb_err );
|
||||
|
@ -2164,7 +2131,7 @@ static int builtin_complete( wchar_t **argv )
|
|||
if( woptind != argc )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Too many arguments\n",
|
||||
_( L"%ls: Too many arguments\n" ),
|
||||
argv[0] );
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
|
@ -2231,7 +2198,7 @@ static int builtin_source( wchar_t ** argv )
|
|||
|
||||
if( argc != 2 )
|
||||
{
|
||||
sb_printf( sb_err, L"%ls: Expected exactly one argument, gor %d\n", argv[0], argc );
|
||||
sb_printf( sb_err, _( L"%ls: Expected exactly one argument, got %d\n" ), argv[0], argc );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
@ -2244,7 +2211,7 @@ static int builtin_source( wchar_t ** argv )
|
|||
|
||||
if( !S_ISREG(buf.st_mode) )
|
||||
{
|
||||
sb_printf( sb_err, L"%ls: '%ls' is not a file\n", argv[0], argv[1] );
|
||||
sb_printf( sb_err, _( L"%ls: '%ls' is not a file\n" ), argv[0], argv[1] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -2269,7 +2236,7 @@ static int builtin_source( wchar_t ** argv )
|
|||
if( res )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls : Error while reading file '%ls'\n",
|
||||
_( L"%ls: Error while reading file '%ls'\n" ),
|
||||
argv[0],
|
||||
argv[1]
|
||||
);
|
||||
|
@ -2341,18 +2308,16 @@ static int builtin_fg( wchar_t **argv )
|
|||
j = job_get_from_pid( pid );
|
||||
if( j != 0 )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Ambiguous job\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Ambiguous job\n" ),
|
||||
argv[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Not a job (",
|
||||
argv[1],
|
||||
L")\n", (void *)0 );
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: '%ls' is not a job\n" ),
|
||||
argv[0],
|
||||
argv[1] );
|
||||
}
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
|
@ -2366,10 +2331,9 @@ static int builtin_fg( wchar_t **argv )
|
|||
|
||||
if( j == 0 )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": No suitable job\n",
|
||||
(void *)0);
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: No suitable job\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
@ -2413,18 +2377,21 @@ static int builtin_fg( wchar_t **argv )
|
|||
/**
|
||||
Helper function for builtin_bg()
|
||||
*/
|
||||
static void send_to_bg( job_t *j, wchar_t *name )
|
||||
static void send_to_bg( job_t *j, const wchar_t *name )
|
||||
{
|
||||
if( j == 0 )
|
||||
{
|
||||
sb_append2( sb_err, L"bg", L": Unknown job ", name, L"\n", (void *)0 );
|
||||
sb_printf( sb_err,
|
||||
_( L"%ls: Unknown job '%ls'\n" ),
|
||||
L"bg",
|
||||
name );
|
||||
builtin_print_help( L"bg", sb_err );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"Send job %d '%ls' to background\n",
|
||||
_(L"Send job %d '%ls' to background\n"),
|
||||
j->job_id,
|
||||
j->command );
|
||||
}
|
||||
|
@ -2444,7 +2411,7 @@ static int builtin_bg( wchar_t **argv )
|
|||
job_t *j;
|
||||
for( j=first_job; ((j!=0) && (!j->constructed) && (!job_is_stopped(j))); j=j->next )
|
||||
;
|
||||
send_to_bg( j, L"(default)");
|
||||
send_to_bg( j, _(L"(default)" ) );
|
||||
return 0;
|
||||
}
|
||||
for( argv++; *argv != 0; argv++ )
|
||||
|
@ -2498,11 +2465,11 @@ static void builtin_jobs_print( job_t *j, int mode, int header )
|
|||
/*
|
||||
Print table header before first job
|
||||
*/
|
||||
sb_append( sb_out, L"Job\tGroup\t");
|
||||
sb_append( sb_out, _( L"Job\tGroup\t" ));
|
||||
#ifdef HAVE__PROC_SELF_STAT
|
||||
sb_append( sb_out, L"CPU\t" );
|
||||
sb_append( sb_out, _( L"CPU\t" ) );
|
||||
#endif
|
||||
sb_append( sb_out, L"State\tCommand\n" );
|
||||
sb_append( sb_out, _( L"State\tCommand\n" ) );
|
||||
}
|
||||
|
||||
sb_printf( sb_out, L"%d\t%d\t", j->job_id, j->pgid );
|
||||
|
@ -2510,8 +2477,12 @@ static void builtin_jobs_print( job_t *j, int mode, int header )
|
|||
#ifdef HAVE__PROC_SELF_STAT
|
||||
sb_printf( sb_out, L"%d%%\t", cpu_use(j) );
|
||||
#endif
|
||||
sb_append2( sb_out, job_is_stopped(j)?L"stopped\t":L"running\t",
|
||||
j->command, L"\n", (void *)0 );
|
||||
sb_append2( sb_out,
|
||||
job_is_stopped(j)?_(L"stopped"):_(L"running"),
|
||||
L"\t",
|
||||
j->command,
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2522,7 +2493,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header )
|
|||
/*
|
||||
Print table header before first job
|
||||
*/
|
||||
sb_append( sb_out, L"Group\n");
|
||||
sb_append( sb_out, _( L"Group\n" ));
|
||||
}
|
||||
sb_printf( sb_out, L"%d\n", j->pgid );
|
||||
break;
|
||||
|
@ -2535,7 +2506,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header )
|
|||
/*
|
||||
Print table header before first job
|
||||
*/
|
||||
sb_append( sb_out, L"Procces\n");
|
||||
sb_append( sb_out, _( L"Procces\n" ));
|
||||
}
|
||||
|
||||
for( p=j->first_process; p; p=p->next )
|
||||
|
@ -2552,7 +2523,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header )
|
|||
/*
|
||||
Print table header before first job
|
||||
*/
|
||||
sb_append( sb_out, L"Command\n");
|
||||
sb_append( sb_out, _( L"Command\n" ));
|
||||
}
|
||||
|
||||
for( p=j->first_process; p; p=p->next )
|
||||
|
@ -2623,10 +2594,10 @@ static int builtin_jobs( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Unknown option '%ls'\n",
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
|
||||
sb_append( sb_err,
|
||||
parser_current_line() );
|
||||
|
@ -2704,7 +2675,7 @@ static int builtin_jobs( wchar_t **argv )
|
|||
if( errno || *end )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Not a process id: '%ls'\n",
|
||||
_( L"%ls: Not a process id: '%ls'\n" ),
|
||||
argv[0],
|
||||
argv[i] );
|
||||
return 1;
|
||||
|
@ -2719,7 +2690,7 @@ static int builtin_jobs( wchar_t **argv )
|
|||
else
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: No suitable job: %d\n",
|
||||
_( L"%ls: No suitable job: %d\n" ),
|
||||
argv[0],
|
||||
pid );
|
||||
return 1;
|
||||
|
@ -2745,7 +2716,7 @@ static int builtin_jobs( wchar_t **argv )
|
|||
if( !found )
|
||||
{
|
||||
sb_printf( sb_out,
|
||||
L"%ls: There are no running jobs\n",
|
||||
_( L"%ls: There are no jobs\n" ),
|
||||
argv[0] );
|
||||
}
|
||||
|
||||
|
@ -2764,14 +2735,14 @@ static int builtin_for( wchar_t **argv )
|
|||
if( argc < 3)
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Expected at least two arguments\n",
|
||||
_( L"%ls: Expected at least two arguments\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
}
|
||||
else if ( !wcsvarname(argv[1]) )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: '%ls' invalid variable name\n",
|
||||
_( L"%ls: '%ls' invalid variable name\n" ),
|
||||
argv[0],
|
||||
argv[1] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
@ -2779,7 +2750,7 @@ static int builtin_for( wchar_t **argv )
|
|||
else if (wcscmp( argv[2], L"in") != 0 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Second argument must be 'in'\n",
|
||||
_( L"%ls: Second argument must be 'in'\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
}
|
||||
|
@ -2841,7 +2812,7 @@ static int builtin_end( wchar_t **argv )
|
|||
current_block->type == AND )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Not inside of block\n",
|
||||
_( L"%ls: Not inside of block\n" ),
|
||||
argv[0] );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
@ -2965,7 +2936,7 @@ static int builtin_else( wchar_t **argv )
|
|||
current_block->param1.if_state != 1)
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: not inside of if block\n",
|
||||
_( L"%ls: Not inside of 'if' block\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
@ -2997,10 +2968,11 @@ static int builtin_break_continue( wchar_t **argv )
|
|||
|
||||
if( argc != 1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Unknown option '%ls'\n",
|
||||
argv[0],
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
argv[1] );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
@ -3016,7 +2988,7 @@ static int builtin_break_continue( wchar_t **argv )
|
|||
if( b == 0 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Not inside of loop\n",
|
||||
_( L"%ls: Not inside of loop\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
@ -3056,7 +3028,7 @@ static int builtin_return( wchar_t **argv )
|
|||
if( errno || *end != 0)
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Argument must be an integer '%ls'\n",
|
||||
_( L"%ls: Argument must be an integer '%ls'\n" ),
|
||||
argv[0],
|
||||
argv[1] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
@ -3067,7 +3039,7 @@ static int builtin_return( wchar_t **argv )
|
|||
}
|
||||
default:
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Too many arguments\n",
|
||||
_( L"%ls: Too many arguments\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
@ -3083,7 +3055,7 @@ static int builtin_return( wchar_t **argv )
|
|||
if( b == 0 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: Not inside of function\n",
|
||||
_( L"%ls: Not inside of function\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
@ -3112,7 +3084,7 @@ static int builtin_switch( wchar_t **argv )
|
|||
if( argc != 2 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls : syntax error, expected exactly one argument, got %d\n",
|
||||
_( L"%ls: Expected exactly one argument, got %d\n" ),
|
||||
argv[0],
|
||||
argc-1 );
|
||||
|
||||
|
@ -3143,7 +3115,7 @@ static int builtin_case( wchar_t **argv )
|
|||
if( current_block->type != SWITCH )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls: syntax error, case command while not in switch block\n",
|
||||
_( L"%ls: 'case' command while not in switch block\n" ),
|
||||
argv[0] );
|
||||
builtin_print_help( L"case", sb_err );
|
||||
return 1;
|
||||
|
@ -3341,7 +3313,7 @@ int builtin_run( wchar_t **argv )
|
|||
}
|
||||
else
|
||||
{
|
||||
debug( 0, L"Unknown builtin: ", argv[0], 0 );
|
||||
debug( 0, _( L"Unknown builtin '%ls'" ), argv[0] );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -3363,41 +3335,41 @@ const wchar_t *builtin_get_desc( const wchar_t *b )
|
|||
|
||||
hash_init( desc, &hash_wcs_func, &hash_wcs_cmp );
|
||||
|
||||
hash_put( desc, L"block", L"Temporarily block delivery of events" );
|
||||
hash_put( desc, L"builtin", L"Run a builtin command" );
|
||||
hash_put( desc, L"complete", L"Edit command specific completions" );
|
||||
hash_put( desc, L"cd", L"Change working directory" );
|
||||
hash_put( desc, L"exit", L"Exit the shell" );
|
||||
hash_put( desc, L"function", L"Define a new function" );
|
||||
hash_put( desc, L"functions", L"List or remove functions" );
|
||||
hash_put( desc, L"end", L"End a block of commands" );
|
||||
hash_put( desc, L"else", L"Evaluate block if condition is false" );
|
||||
hash_put( desc, L"eval", L"Evaluate parameters as a command" );
|
||||
hash_put( desc, L"for", L"Perform a set of commands multiple times" );
|
||||
hash_put( desc, L".", L"Evaluate contents of file" );
|
||||
hash_put( desc, L"set", L"Handle environment variables" );
|
||||
hash_put( desc, L"fg", L"Send job to foreground" );
|
||||
hash_put( desc, L"bg", L"Send job to background" );
|
||||
hash_put( desc, L"jobs", L"Print currently running jobs" );
|
||||
hash_put( desc, L"read", L"Read a line of input into variables" );
|
||||
hash_put( desc, L"break", L"Stop the innermost loop" );
|
||||
hash_put( desc, L"continue", L"Skip the rest of the current lap of the innermost loop" );
|
||||
hash_put( desc, L"return", L"Stop the innermost currently evaluated function" );
|
||||
hash_put( desc, L"commandline", L"Set the commandline" );
|
||||
hash_put( desc, L"switch", L"Conditionally execute a block of commands" );
|
||||
hash_put( desc, L"case", L"Conditionally execute a block of commands" );
|
||||
hash_put( desc, L"command", L"Run a program" );
|
||||
hash_put( desc, L"if", L"Conditionally execute a command" );
|
||||
hash_put( desc, L"while", L"Perform a command multiple times" );
|
||||
hash_put( desc, L"bind", L"Handle key bindings");
|
||||
hash_put( desc, L"random", L"Generate random number");
|
||||
hash_put( desc, L"exec", L"Run command in current process");
|
||||
hash_put( desc, L"not", L"Negate exit status of job");
|
||||
hash_put( desc, L"or", L"Execute second command if first fails");
|
||||
hash_put( desc, L"and", L"Execute second command if first suceeds");
|
||||
hash_put( desc, L"begin", L"Create a block of code" );
|
||||
hash_put( desc, L"status", L"Return status information about fish" );
|
||||
hash_put( desc, L"ulimit", L"Set or get the shells resurce usage limits" );
|
||||
hash_put( desc, L"block", _( L"Temporarily block delivery of events" ) );
|
||||
hash_put( desc, L"builtin", _( L"Run a builtin command" ) );
|
||||
hash_put( desc, L"complete", _( L"Edit command specific completions" ) );
|
||||
hash_put( desc, L"cd", _( L"Change working directory" ) );
|
||||
hash_put( desc, L"exit", _( L"Exit the shell" ) );
|
||||
hash_put( desc, L"function", _( L"Define a new function" ) );
|
||||
hash_put( desc, L"functions", _( L"List or remove functions" ) );
|
||||
hash_put( desc, L"end", _( L"End a block of commands" ) );
|
||||
hash_put( desc, L"else", _( L"Evaluate block if condition is false" ) );
|
||||
hash_put( desc, L"eval", _( L"Evaluate parameters as a command" ) );
|
||||
hash_put( desc, L"for", _( L"Perform a set of commands multiple times" ) );
|
||||
hash_put( desc, L".", _( L"Evaluate contents of file" ) );
|
||||
hash_put( desc, L"set", _( L"Handle environment variables" ) );
|
||||
hash_put( desc, L"fg", _( L"Send job to foreground" ) );
|
||||
hash_put( desc, L"bg", _( L"Send job to background" ) );
|
||||
hash_put( desc, L"jobs", _( L"Print currently running jobs" ) );
|
||||
hash_put( desc, L"read", _( L"Read a line of input into variables" ) );
|
||||
hash_put( desc, L"break", _( L"Stop the innermost loop" ) );
|
||||
hash_put( desc, L"continue", _( L"Skip the rest of the current lap of the innermost loop" ) );
|
||||
hash_put( desc, L"return", _( L"Stop the innermost currently evaluated function" ) );
|
||||
hash_put( desc, L"commandline", _( L"Set the commandline" ) );
|
||||
hash_put( desc, L"switch", _( L"Conditionally execute a block of commands" ) );
|
||||
hash_put( desc, L"case", _( L"Conditionally execute a block of commands" ) );
|
||||
hash_put( desc, L"command", _( L"Run a program" ) );
|
||||
hash_put( desc, L"if", _( L"Conditionally execute a command" ) );
|
||||
hash_put( desc, L"while", _( L"Perform a command multiple times" ) );
|
||||
hash_put( desc, L"bind", _( L"Handle key bindings" ));
|
||||
hash_put( desc, L"random", _( L"Generate random number" ));
|
||||
hash_put( desc, L"exec", _( L"Run command in current process" ));
|
||||
hash_put( desc, L"not", _( L"Negate exit status of job" ));
|
||||
hash_put( desc, L"or", _( L"Execute second command if first fails" ));
|
||||
hash_put( desc, L"and", _( L"Execute second command if first suceeds" ));
|
||||
hash_put( desc, L"begin", _( L"Create a block of code" ) );
|
||||
hash_put( desc, L"status", _( L"Return status information about fish" ) );
|
||||
hash_put( desc, L"ulimit", _( L"Set or get the shells resurce usage limits" ) );
|
||||
}
|
||||
|
||||
return hash_get( desc, b );
|
||||
|
|
19
builtin.h
19
builtin.h
|
@ -20,31 +20,36 @@ enum
|
|||
/**
|
||||
Error message on missing argument
|
||||
*/
|
||||
#define BUILTIN_ERR_MISSING L": Expected argument"
|
||||
#define BUILTIN_ERR_MISSING _( L"%ls: Expected argument\n" )
|
||||
|
||||
/**
|
||||
Error message on invalid combination of options
|
||||
*/
|
||||
#define BUILTIN_ERR_COMBO L": Invalid combination of options"
|
||||
#define BUILTIN_ERR_COMBO _( L"%ls: Invalid combination of options\n" )
|
||||
|
||||
/**
|
||||
Error message on invalid combination of options
|
||||
*/
|
||||
#define BUILTIN_ERR_COMBO2 _( L"%ls: Invalid combination of options,\n%ls\n" )
|
||||
|
||||
/**
|
||||
Error message on multiple scope levels for variables
|
||||
*/
|
||||
#define BUILTIN_ERR_GLOCAL L": Variable can only be one of universal, global and local"
|
||||
#define BUILTIN_ERR_GLOCAL _( L"%ls: Variable can only be one of universal, global and local\n%ls\n" )
|
||||
|
||||
/**
|
||||
Error message for specifying both export and unexport to set/read
|
||||
*/
|
||||
#define BUILTIN_ERR_EXPUNEXP L": Variable can't be both exported and unexported"
|
||||
#define BUILTIN_ERR_EXPUNEXP _( L"%ls: Variable can't be both exported and unexported\n%ls\n" )
|
||||
|
||||
/**
|
||||
Error message for unknown switch
|
||||
*/
|
||||
#define BUILTIN_ERR_UNKNOWN L": Unknown option"
|
||||
#define BUILTIN_ERR_UNKNOWN _( L"%ls: Unknown option '%ls'\n" )
|
||||
|
||||
#define BUILTIN_ERR_VARCHAR L"%ls: Invalid character in variable name: '%lc'. Only alphanumerical characters and underscores are valid in a variable name.\n"
|
||||
#define BUILTIN_ERR_VARCHAR _( L"%ls: Invalid character '%lc' in variable name. Only alphanumerical characters and underscores are valid in a variable name.\n" )
|
||||
|
||||
#define BUILTIN_ERR_VARNAME_ZERO L"%ls: Variable name can not be the empty string\n"
|
||||
#define BUILTIN_ERR_VARNAME_ZERO _( L"%ls: Variable name can not be the empty string\n" )
|
||||
|
||||
/**
|
||||
Stringbuffer used to represent standard output
|
||||
|
|
|
@ -22,6 +22,7 @@ Functions used for implementing the commandline builtin.
|
|||
#include "tokenizer.h"
|
||||
#include "input_common.h"
|
||||
#include "input.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Which part of the comandbuffer are we operating on
|
||||
|
@ -260,13 +261,10 @@ int builtin_commandline( wchar_t **argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
@ -322,10 +320,11 @@ int builtin_commandline( wchar_t **argv )
|
|||
*/
|
||||
if( buffer_part || cut_at_cursor || append_mode || tokenize )
|
||||
{
|
||||
sb_printf(sb_err,
|
||||
BUILTIN_ERR_COMBO,
|
||||
argv[0] );
|
||||
|
||||
sb_append2(sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_COMBO,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0);
|
||||
|
@ -335,10 +334,11 @@ int builtin_commandline( wchar_t **argv )
|
|||
|
||||
if( argc == woptind )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_MISSING,
|
||||
argv[0] );
|
||||
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_MISSING,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
|
@ -394,22 +394,23 @@ int builtin_commandline( wchar_t **argv )
|
|||
if( (tokenize || cut_at_cursor) && (argc-woptind) )
|
||||
{
|
||||
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_COMBO,
|
||||
L",\n --cut-at-cursor and --tokenize can not be used when setting the commandline",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_COMBO2,
|
||||
argv[0],
|
||||
L"--cut-at-cursor and --tokenize can not be used when setting the commandline" );
|
||||
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( append_mode && !(argc-woptind) )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_COMBO2,
|
||||
argv[0],
|
||||
BUILTIN_ERR_COMBO,
|
||||
L",\n insertion mode switches can not be used when not in insertion mode",
|
||||
(void *)0 );
|
||||
L"insertion mode switches can not be used when not in insertion mode" );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ Functions used for implementing the set builtin.
|
|||
#include "wgetopt.h"
|
||||
#include "proc.h"
|
||||
#include "parser.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Extract the name from a destination argument of the form name[index1 index2...]
|
||||
|
@ -92,9 +93,7 @@ static int parse_fill_indexes( array_list_t *indexes,
|
|||
long l_ind = wcstol(src, &end, 10);
|
||||
if (end == src)
|
||||
{
|
||||
wchar_t sbuf[256];
|
||||
swprintf(sbuf, 255, L"Invalid index starting at %ls\n", src);
|
||||
sb_append(sb_err, sbuf);
|
||||
sb_printf(sb_err, _(L"%ls: Invalid index starting at '%ls'\n"), L"set", src);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -362,13 +361,11 @@ int builtin_set( wchar_t **argv )
|
|||
|
||||
if( query && (erase || list || global || local || universal || export || unexport ) )
|
||||
{
|
||||
sb_append2(sb_err,
|
||||
sb_printf(sb_err,
|
||||
BUILTIN_ERR_COMBO2,
|
||||
argv[0],
|
||||
BUILTIN_ERR_COMBO,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0);
|
||||
parser_current_line() );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
@ -377,13 +374,11 @@ int builtin_set( wchar_t **argv )
|
|||
/* Check operation and modifiers sanity */
|
||||
if( erase && list )
|
||||
{
|
||||
sb_append2(sb_err,
|
||||
sb_printf(sb_err,
|
||||
BUILTIN_ERR_COMBO2,
|
||||
argv[0],
|
||||
BUILTIN_ERR_COMBO,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0);
|
||||
parser_current_line() );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
@ -391,9 +386,8 @@ int builtin_set( wchar_t **argv )
|
|||
if( local + global + universal > 1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
L"%ls%ls\n%ls\n",
|
||||
argv[0],
|
||||
BUILTIN_ERR_GLOCAL,
|
||||
argv[0],
|
||||
parser_current_line() );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
@ -401,13 +395,10 @@ int builtin_set( wchar_t **argv )
|
|||
|
||||
if( export && unexport )
|
||||
{
|
||||
sb_append2(sb_err,
|
||||
argv[0],
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_EXPUNEXP,
|
||||
L"\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0);
|
||||
argv[0],
|
||||
parser_current_line() );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
}
|
||||
|
@ -493,12 +484,11 @@ int builtin_set( wchar_t **argv )
|
|||
/* No arguments -- display name & value for all variables in scope */
|
||||
if( erase )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Erase needs a variable name\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
_(L"%ls: Erase needs a variable name\n%ls\n"),
|
||||
argv[0],
|
||||
parser_current_line() );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
retcode = 1;
|
||||
}
|
||||
|
@ -531,12 +521,11 @@ int builtin_set( wchar_t **argv )
|
|||
/* There are some arguments, we have at least a variable name */
|
||||
if( erase && al_get_count(&values) != 0 )
|
||||
{
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
L": Values cannot be specfied with erase\n",
|
||||
parser_current_line(),
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
_(L"%ls: Values cannot be specfied with erase\n%ls\n"),
|
||||
argv[0],
|
||||
parser_current_line() );
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
retcode = 1;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ Functions used for implementing the ulimit builtin.
|
|||
#include "builtin.h"
|
||||
#include "common.h"
|
||||
#include "wgetopt.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Struct describing a resource limit
|
||||
|
@ -344,13 +345,10 @@ int builtin_ulimit( wchar_t ** argv )
|
|||
case 0:
|
||||
if(long_options[opt_index].flag != 0)
|
||||
break;
|
||||
sb_append2( sb_err,
|
||||
argv[0],
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
L" ",
|
||||
long_options[opt_index].name,
|
||||
L"\n",
|
||||
(void *)0 );
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_ERR_UNKNOWN,
|
||||
argv[0],
|
||||
long_options[opt_index].name );
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
|
||||
return 1;
|
||||
|
|
10
common.c
10
common.c
|
@ -724,6 +724,7 @@ void fish_setlocale(int category, const wchar_t *locale)
|
|||
{
|
||||
char *lang = wcs2str( locale );
|
||||
setlocale(category,lang);
|
||||
|
||||
free( lang );
|
||||
/*
|
||||
Use ellipsis if on known unicode system, otherwise use $
|
||||
|
@ -784,11 +785,16 @@ int writeb( tputs_arg_t b )
|
|||
|
||||
void die_mem()
|
||||
{
|
||||
debug( 0, L"Out of memory, shutting down fish." );
|
||||
/*
|
||||
Do not translate this message, and do not send it through the
|
||||
usual channels. This increases the odds that the message gets
|
||||
through correctly, even if we are out of memory.
|
||||
*/
|
||||
fwprintf( stderr, L"Out of memory, shutting down fish.\n" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void debug( int level, wchar_t *msg, ... )
|
||||
void debug( int level, const wchar_t *msg, ... )
|
||||
{
|
||||
va_list va;
|
||||
string_buffer_t sb;
|
||||
|
|
12
common.h
12
common.h
|
@ -134,7 +134,6 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
|
|||
*/
|
||||
wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
||||
|
||||
#ifndef HAVE_WCSNDUP
|
||||
/**
|
||||
Returns a newly allocated wide character string wich is a copy of
|
||||
the string in, but of length c or shorter. The returned string is
|
||||
|
@ -142,7 +141,6 @@ wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
|||
length.
|
||||
*/
|
||||
wchar_t *wcsndup( const wchar_t *in, int c );
|
||||
#endif
|
||||
|
||||
/**
|
||||
Converts from wide char to digit in the specified base. If d is not
|
||||
|
@ -185,19 +183,14 @@ size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
|
|||
*/
|
||||
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
|
||||
|
||||
#ifndef HAVE_WCSDUP
|
||||
/**
|
||||
Create a duplicate string. Wide string version of strdup. Will
|
||||
automatically exit if out of memory.
|
||||
*/
|
||||
wchar_t *wcsdup(const wchar_t *in);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSLEN
|
||||
size_t wcslen(const wchar_t *in);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSCASECMP
|
||||
/**
|
||||
Case insensitive string compare function. Wide string version of
|
||||
strcasecmp.
|
||||
|
@ -210,9 +203,7 @@ size_t wcslen(const wchar_t *in);
|
|||
a user-supplied string should be considered a bug.
|
||||
*/
|
||||
int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSNCASECMP
|
||||
/**
|
||||
Case insensitive string compare function. Wide string version of
|
||||
strncasecmp.
|
||||
|
@ -225,7 +216,6 @@ int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
|||
a user-supplied string should be considered a bug.
|
||||
*/
|
||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
||||
#endif
|
||||
|
||||
/**
|
||||
Test if the given string is a valid variable name
|
||||
|
@ -314,7 +304,7 @@ void common_destroy();
|
|||
|
||||
will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'.
|
||||
*/
|
||||
void debug( int level, wchar_t *msg, ... );
|
||||
void debug( int level, const wchar_t *msg, ... );
|
||||
|
||||
/**
|
||||
Replace special characters with backslash escape sequences. Newline is
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "reader.h"
|
||||
#include "history.h"
|
||||
#include "intern.h"
|
||||
#include "translate.h"
|
||||
|
||||
#include "wutil.h"
|
||||
|
||||
|
@ -746,7 +747,7 @@ int complete_is_valid_option( const wchar_t *str,
|
|||
str[0] = opt[j];
|
||||
str[1]=0;
|
||||
al_push( errors,
|
||||
wcsdupcat2(L"Unknown option \'", str, L"\'", 0) );
|
||||
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", 0) );
|
||||
}
|
||||
|
||||
opt_found = 0;
|
||||
|
@ -765,12 +766,12 @@ int complete_is_valid_option( const wchar_t *str,
|
|||
if( hash_get_count( &gnu_match_hash )==0)
|
||||
{
|
||||
al_push( errors,
|
||||
wcsdupcat2(L"Unknown option \'", opt, L"\'", 0) );
|
||||
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", 0) );
|
||||
}
|
||||
else
|
||||
{
|
||||
al_push( errors,
|
||||
wcsdupcat2(L"Multiple matches for option \'", opt, L"\'", 0) );
|
||||
wcsdupcat2( _(L"Multiple matches for option: "), L"'", opt, L"\'", 0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -845,7 +846,7 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig )
|
|||
if( al_get_count( &l )>0 )
|
||||
{
|
||||
wchar_t *ln = (wchar_t *)al_get(&l, 0 );
|
||||
if( wcscmp( ln, L"unknown" ) != 0 )
|
||||
if( wcscmp( ln, _(L"unknown") ) != 0 )
|
||||
{
|
||||
desc = wcsdupcat( COMPLETE_SEP_STR, ln);
|
||||
/*
|
||||
|
|
18
configure.ac
18
configure.ac
|
@ -53,6 +53,9 @@ else
|
|||
AC_SUBST( PREFIX, [$prefix])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
|
||||
AC_SUBST( [LOCALEDIR], [$datadir/locale])
|
||||
|
||||
AC_SUBST(fishdir,[/fish.d])
|
||||
AC_SUBST(fishfile,[/fish])
|
||||
AC_SUBST(fishinputfile,[/fish_inputrc])
|
||||
|
@ -63,6 +66,7 @@ if test -z $docdir; then
|
|||
AC_SUBST(docdir,[$datadir/doc/fish])
|
||||
fi
|
||||
|
||||
|
||||
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
|
||||
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
|
||||
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
|
||||
|
@ -113,6 +117,7 @@ else
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
# Check for RLIMIT_NPROC in sys/resource.h.
|
||||
AC_MSG_CHECKING([for RLIMIT_NPROC in sys/resource.h])
|
||||
AC_TRY_COMPILE([#include <sys/resource.h>],
|
||||
|
@ -125,18 +130,17 @@ else
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(socket, connect, rt, nanosleep)
|
||||
AC_CHECK_FUNCS(wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext)
|
||||
|
||||
AC_CHECK_LIB(socket, connect)
|
||||
AC_CHECK_LIB(rt, nanosleep)
|
||||
|
||||
AC_CHECK_FUNCS(wcsdup wcsndup wcslen wcscasecmp wcsncasecmp)
|
||||
AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) )
|
||||
|
||||
# Check if we have ncurses, and use it rather than curses if possible.
|
||||
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
|
||||
|
||||
#Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
|
||||
#ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
|
||||
#does not properly support terminfo.
|
||||
# Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
|
||||
# ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
|
||||
# does not properly support terminfo.
|
||||
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
|
||||
|
||||
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish])
|
||||
|
|
|
@ -975,7 +975,68 @@ it's initalization files to function properly. To solve this
|
|||
problem, either copy the initialization files to each fish users home
|
||||
directory, or install them in /etc.
|
||||
|
||||
\section i18n Translating fish to other languages
|
||||
|
||||
Fish uses the GNU gettext library to implement translation to multiple
|
||||
languages. If fish is not available in your language, please consider
|
||||
making a translation. Currently, only the shell itself can be
|
||||
translated, a future version of fish should also include translated
|
||||
manuals.
|
||||
|
||||
To make a translation of fish, you will first need the sourcecode,
|
||||
available from the <a href='http://roo.no-ip.org/fish'>fish
|
||||
homepage</a>. Download the latest version, and then extract it using a
|
||||
command like <code>tar -zxf fish-VERSION.tar.gz</code>.
|
||||
|
||||
Next, cd into the newly created fish directory using <code>cd
|
||||
fish-VERSION</code>.
|
||||
|
||||
You will now need to configure the sourcecode using the command
|
||||
<code>./configure</code>. This step might take a while.
|
||||
|
||||
Before you continue, you will need to know the ISO 639 language code
|
||||
of the language you are translating to. These codes can be found <a
|
||||
href='http://www.w3.org/WAI/ER/IG/ert/iso639.htm'>here</a>. For
|
||||
example, the language code for Uighur is ug.
|
||||
|
||||
Now you have the sourcecode and it is properly configured. Lets start
|
||||
translating. To do this, first create an empty translation table for
|
||||
the language you wish to translate to by writing <code>make
|
||||
po/[LANGUAGE CODE].po</code> in the fish terminal. For example, if you
|
||||
are translating to Uighur, you should write <code>make
|
||||
po/ug.po</code>. This should create the file po/ug.po, a template
|
||||
translation table containing all the strings that need to be
|
||||
translated.
|
||||
|
||||
Now you are all set up to translate fish to a new language. Open the
|
||||
newly created .po file in your editor of choice, and start
|
||||
translating. The .po file format is rather simple. It contains pairs
|
||||
of string in a format like:
|
||||
|
||||
<pre>
|
||||
msgid "%ls: No suitable job\n"
|
||||
msgstr ""
|
||||
</pre>
|
||||
|
||||
The first line is the english string to translate, the second line
|
||||
should contain your translation. For example, in swedish the above
|
||||
might become:
|
||||
|
||||
<pre>
|
||||
msgid "%ls: No suitable job\n"
|
||||
msgstr "%ls: Inget jobb matchar\n"
|
||||
</pre>
|
||||
|
||||
%s, %ls, %d and other tokens beginning with a '%' are
|
||||
placeholders. These will be replaced by a value by fish at
|
||||
runtime. You must always take care to use exactly the same
|
||||
placeholders in the same order in your translation. (Actually, there
|
||||
are ways to avoid this, but they are to complicated for this short
|
||||
introduction. See the full manual for the printf C function for more
|
||||
information.)
|
||||
|
||||
Once you have provided a translation for fish, please send it to <a
|
||||
href='fish-users@lists.sf.net'>fish-users@lists.sf.net</a>.
|
||||
|
||||
\section todo Missing features and bugs
|
||||
|
||||
|
|
14
env.c
14
env.c
|
@ -41,6 +41,7 @@
|
|||
#include "env_universal.h"
|
||||
#include "input_common.h"
|
||||
#include "event.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Command used to start fishd
|
||||
|
@ -190,7 +191,7 @@ static void start_fishd()
|
|||
|
||||
if( !pw )
|
||||
{
|
||||
debug( 0, L"Could not get user information" );
|
||||
debug( 0, _( L"Could not get user information" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -417,7 +418,7 @@ void env_init()
|
|||
free( uname );
|
||||
}
|
||||
|
||||
env_universal_init( env_get( L"FISHD_SOKET_DIR"),
|
||||
env_universal_init( env_get( L"FISHD_SOCKET_DIR"),
|
||||
env_get( L"USER" ),
|
||||
&start_fishd,
|
||||
&universal_callback );
|
||||
|
@ -499,6 +500,11 @@ void env_set( const wchar_t *key,
|
|||
if( wcscmp(key, L"LANG" )==0 )
|
||||
{
|
||||
fish_setlocale(LC_ALL,val);
|
||||
/* Make change known to gettext. */
|
||||
{
|
||||
extern int _nl_msg_cat_cntr;
|
||||
++_nl_msg_cat_cntr;
|
||||
}
|
||||
}
|
||||
|
||||
if( wcscmp( key, L"umask" ) == 0)
|
||||
|
@ -754,7 +760,7 @@ wchar_t *env_get( const wchar_t *key )
|
|||
wchar_t *next = history_get( i-add_current );
|
||||
if( !next )
|
||||
{
|
||||
debug( 1, L"No history at idx %d\n", i );
|
||||
debug( 1, _( L"No history at idx %d\n" ), i );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -914,7 +920,7 @@ void env_pop()
|
|||
else
|
||||
{
|
||||
debug( 0,
|
||||
L"Tried to pop empty environment stack." );
|
||||
_( L"Tried to pop empty environment stack." ) );
|
||||
sanity_lose();
|
||||
}
|
||||
}
|
||||
|
|
3
event.c
3
event.c
|
@ -19,6 +19,7 @@
|
|||
#include "common.h"
|
||||
#include "event.h"
|
||||
#include "signal.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Number of signals that can be queued before an overflow occurs
|
||||
|
@ -486,7 +487,7 @@ static void event_fire_delayed()
|
|||
|
||||
if( lst->overflow )
|
||||
{
|
||||
debug( 0, L"Signal list overflow. Signals have been ignored" );
|
||||
debug( 0, _( L"Signal list overflow. Signals have been ignored." ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
21
exec.c
21
exec.c
|
@ -36,6 +36,7 @@
|
|||
#include "expand.h"
|
||||
#include "signal.h"
|
||||
#include "env_universal.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Prototype for the getpgid library function. The prototype for this
|
||||
|
@ -48,15 +49,15 @@ pid_t getpgid( pid_t pid );
|
|||
/**
|
||||
file descriptor redirection error message
|
||||
*/
|
||||
#define FD_ERROR L"An error occurred while redirecting file descriptor %d"
|
||||
#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" )
|
||||
/**
|
||||
file redirection error message
|
||||
*/
|
||||
#define FILE_ERROR L"An error occurred while redirecting file '%ls'"
|
||||
#define FILE_ERROR _( L"An error occurred while redirecting file '%ls'" )
|
||||
/**
|
||||
fork error message
|
||||
*/
|
||||
#define FORK_ERROR L"Could not create child process - exiting"
|
||||
#define FORK_ERROR _( L"Could not create child process - exiting" )
|
||||
|
||||
|
||||
/**
|
||||
|
@ -421,7 +422,7 @@ static void launch_process( process_t *p )
|
|||
|
||||
execve (wcs2str(p->actual_cmd), wcsv2strv( (const wchar_t **) p->argv), env_export_arr( 0 ) );
|
||||
debug( 0,
|
||||
L"Failed to execute process %ls",
|
||||
_( L"Failed to execute process '%ls'" ),
|
||||
p->actual_cmd );
|
||||
wperror( L"execve" );
|
||||
exit(1);
|
||||
|
@ -580,7 +581,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
|||
if( getpgid( p->pid) != j->pgid )
|
||||
{
|
||||
debug( 1,
|
||||
L"Could not send process %d from group %d to group %d",
|
||||
_( L"Could not send process %d from group %d to group %d" ),
|
||||
p->pid,
|
||||
getpgid( p->pid),
|
||||
j->pgid );
|
||||
|
@ -592,7 +593,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
|||
{
|
||||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1, L"Could not send job %d ('%ls')to foreground",
|
||||
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
|
@ -604,7 +605,7 @@ static int handle_new_child( job_t *j, process_t *p )
|
|||
{
|
||||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1, L"Could not send job %d ('%ls')to foreground",
|
||||
debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
|
@ -766,7 +767,7 @@ void exec( job_t *j )
|
|||
// fwprintf( stderr, L"run function %ls\n", argv[0] );
|
||||
if( def == 0 )
|
||||
{
|
||||
debug( 0, L"Unknown function %ls", p->argv[0] );
|
||||
debug( 0, _( L"Unknown function '%ls'" ), p->argv[0] );
|
||||
break;
|
||||
}
|
||||
parser_push_block( FUNCTION_CALL );
|
||||
|
@ -874,7 +875,7 @@ void exec( job_t *j )
|
|||
{
|
||||
builtin_stdin=-1;
|
||||
debug( 1,
|
||||
L"Unknown input redirection type %d",
|
||||
_( L"Unknown input redirection type %d" ),
|
||||
in->io_mode);
|
||||
break;
|
||||
}
|
||||
|
@ -1201,7 +1202,7 @@ int exec_subshell( const wchar_t *cmd,
|
|||
if( !cmd )
|
||||
{
|
||||
debug( 1,
|
||||
L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s",
|
||||
_( L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s." ),
|
||||
PACKAGE_BUGREPORT );
|
||||
return 0;
|
||||
}
|
||||
|
|
2
exec.h
2
exec.h
|
@ -16,7 +16,7 @@
|
|||
/**
|
||||
pipe redirection error message
|
||||
*/
|
||||
#define PIPE_ERROR L"An error occurred while setting up pipe"
|
||||
#define PIPE_ERROR _(L"An error occurred while setting up pipe")
|
||||
|
||||
/**
|
||||
Initialize the exec library
|
||||
|
|
|
@ -67,6 +67,7 @@ fi
|
|||
%config %_sysconfdir/fish.d/fish_*.fish
|
||||
%dir %_sysconfdir/fish.d/completions
|
||||
%config %_sysconfdir/fish.d/completions/*.fish
|
||||
%_datadir/locale/*/fish.cat
|
||||
|
||||
%changelog
|
||||
* Tue Nov 29 2005 Axel Liljencrantz <axel@liljencrantz.se> 1.17.0-0
|
||||
|
|
|
@ -70,6 +70,6 @@ for i in ls ll la
|
|||
complete -c $i -s X -d "sort by extension"
|
||||
complete -c $i -s 1 -d "List one file per line"
|
||||
complete -c $i -l help -d "Display help and exit"
|
||||
complete -c $i -l version -d "Output version and exit"
|
||||
complete -c $i -l version -d "Display version and exit"
|
||||
|
||||
end
|
||||
|
|
37
input.c
37
input.c
|
@ -50,6 +50,7 @@ implementation in fish is as of yet incomplete.
|
|||
#include "env.h"
|
||||
#include "expand.h"
|
||||
#include "event.h"
|
||||
#include "translate.h"
|
||||
|
||||
static void input_read_inputrc( wchar_t *fn );
|
||||
|
||||
|
@ -402,7 +403,7 @@ static wchar_t *input_symbolic_sequence( const wchar_t *in )
|
|||
in++;
|
||||
if( c < L'a' || c > L'z' )
|
||||
{
|
||||
debug( 1, L"Invalid Control sequence" );
|
||||
debug( 1, _( L"Invalid Control sequence" ) );
|
||||
return 0;
|
||||
}
|
||||
if( has_meta )
|
||||
|
@ -514,7 +515,7 @@ static wchar_t *input_symbolic_sequence( const wchar_t *in )
|
|||
}
|
||||
if( !res )
|
||||
{
|
||||
debug( 1, L"Could not parse sequence %ls", in );
|
||||
debug( 1, _( L"Could not parse sequence '%ls'" ), in );
|
||||
return 0;
|
||||
}
|
||||
if( !*in || *in == L'\n')
|
||||
|
@ -678,7 +679,7 @@ static wchar_t *input_expand_sequence( const wchar_t *in )
|
|||
if( *in != L'-' )
|
||||
{
|
||||
error=1;
|
||||
debug( 1, L"Invalid sequence - no dash after control\n" );
|
||||
debug( 1, _( L"Invalid sequence - no dash after control\n" ) );
|
||||
break;
|
||||
}
|
||||
in++;
|
||||
|
@ -696,7 +697,7 @@ static wchar_t *input_expand_sequence( const wchar_t *in )
|
|||
*(out++)=*in-L'A'+1;
|
||||
break;
|
||||
}
|
||||
debug( 1, L"Invalid sequence - Control-nothing?\n" );
|
||||
debug( 1, _( L"Invalid sequence - Control-nothing?\n" ) );
|
||||
error = 1;
|
||||
|
||||
break;
|
||||
|
@ -711,12 +712,12 @@ static wchar_t *input_expand_sequence( const wchar_t *in )
|
|||
if( *in != L'-' )
|
||||
{
|
||||
error=1;
|
||||
debug( 1, L"Invalid sequence - no dash after meta\n" );
|
||||
debug( 1, _( L"Invalid sequence - no dash after meta\n" ) );
|
||||
break;
|
||||
}
|
||||
if( !*(in+1) )
|
||||
{
|
||||
debug( 1, L"Invalid sequence - Meta-nothing?" );
|
||||
debug( 1, _( L"Invalid sequence - Meta-nothing?" ) );
|
||||
error=1;
|
||||
break;
|
||||
}
|
||||
|
@ -761,7 +762,7 @@ static wchar_t *input_expand_sequence( const wchar_t *in )
|
|||
{
|
||||
if( wcslen( res ) == 0 )
|
||||
{
|
||||
debug( 1, L"Invalid sequence - '%ls' expanded to zero characters", in_orig );
|
||||
debug( 1, _( L"Invalid sequence - '%ls' expanded to zero characters" ), in_orig );
|
||||
error =1;
|
||||
res = 0;
|
||||
}
|
||||
|
@ -825,7 +826,7 @@ void input_parse_inputrc_line( wchar_t *cmd )
|
|||
{
|
||||
inputrc_error = 1;
|
||||
debug( 1,
|
||||
L"Mismatched $endif in inputrc file" );
|
||||
_( L"Mismatched $endif in inputrc file" ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -877,7 +878,7 @@ void input_parse_inputrc_line( wchar_t *cmd )
|
|||
if( !*cmd )
|
||||
{
|
||||
debug( 1,
|
||||
L"Mismatched quote" );
|
||||
_( L"Mismatched quote" ) );
|
||||
inputrc_error = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -891,7 +892,7 @@ void input_parse_inputrc_line( wchar_t *cmd )
|
|||
if( *cmd != L':' )
|
||||
{
|
||||
debug( 1,
|
||||
L"Expected a \':\'" );
|
||||
_( L"Expected a \':\'" ) );
|
||||
inputrc_error = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -936,16 +937,16 @@ void input_parse_inputrc_line( wchar_t *cmd )
|
|||
|
||||
if( wcscmp( set, L"set" ) != 0 )
|
||||
{
|
||||
debug( 1, L"I don\'t know what %ls means", set );
|
||||
debug( 1, _( L"I don\'t know what '%ls' means" ), set );
|
||||
}
|
||||
else if( end )
|
||||
{
|
||||
debug( 1, L"Expected end of line, got '%ls'", end );
|
||||
debug( 1, _( L"Expected end of line, got '%ls'" ), end );
|
||||
|
||||
}
|
||||
else if( (!key) || (!value) )
|
||||
{
|
||||
debug( 1, L"Syntax: set KEY VALUE" );
|
||||
debug( 1, _( L"Syntax: set KEY VALUE" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1011,7 +1012,7 @@ void input_parse_inputrc_line( wchar_t *cmd )
|
|||
if( !cmd )
|
||||
{
|
||||
debug( 1,
|
||||
L"Unable to parse binding" );
|
||||
_( L"Unable to parse binding" ) );
|
||||
inputrc_error = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -1037,7 +1038,7 @@ void input_parse_inputrc_line( wchar_t *cmd )
|
|||
|
||||
}
|
||||
|
||||
debug( 1, L"I don\'t know what %ls means", cmd );
|
||||
debug( 1, _( L"I don\'t know what %ls means" ), cmd );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1063,7 +1064,7 @@ static void input_read_inputrc( wchar_t *fn )
|
|||
case -1:
|
||||
{
|
||||
debug( 1,
|
||||
L"Error while reading input information from file: %s",
|
||||
_( L"Error while reading input information from file '%ls'" ),
|
||||
fn );
|
||||
|
||||
wperror( L"fgetws2 (read_ni)" );
|
||||
|
@ -1168,6 +1169,8 @@ static void add_common_bindings()
|
|||
add_terminfo_mapping( name[i], (key_backspace), L"Backspace", L"backward-delete-char" );
|
||||
add_mapping( name[i], L"\x7f", L"Backspace", L"backward-delete-char" );
|
||||
|
||||
add_mapping( name[i], L"\e[H", L"Home", L"beginning-of-line" );
|
||||
add_mapping( name[i], L"\e[F", L"End", L"end-of-line" );
|
||||
add_terminfo_mapping( name[i], (key_home), L"Home", L"beginning-of-line" );
|
||||
add_terminfo_mapping( name[i], (key_end), L"End", L"end-of-line" );
|
||||
|
||||
|
@ -1288,7 +1291,7 @@ int input_init()
|
|||
|
||||
if( setupterm( 0, STDOUT_FILENO, 0) == ERR )
|
||||
{
|
||||
debug( 0, L"Could not set up terminal" );
|
||||
debug( 0, _( L"Could not set up terminal" ) );
|
||||
exit(1);
|
||||
}
|
||||
hash_init( &all_mappings, &hash_wcs_func, &hash_wcs_cmp );
|
||||
|
|
3
io.c
3
io.c
|
@ -32,6 +32,7 @@ Utilities for io redirection.
|
|||
#include "exec.h"
|
||||
#include "common.h"
|
||||
#include "io.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
|
||||
|
@ -69,7 +70,7 @@ void io_buffer_read( io_data_t *d )
|
|||
if( errno != EAGAIN )
|
||||
{
|
||||
debug( 1,
|
||||
L"An error occured while reading output from code block on fd %d",
|
||||
_(L"An error occured while reading output from code block on fd %d"),
|
||||
d->param1.pipe_fd[0] );
|
||||
wperror( L"io_buffer_read" );
|
||||
}
|
||||
|
|
5
main.c
5
main.c
|
@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "exec.h"
|
||||
#include "event.h"
|
||||
#include "output.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Parse init files
|
||||
|
@ -207,7 +208,8 @@ int main( int argc, char **argv )
|
|||
|
||||
if( force_interactive )
|
||||
is_interactive_session=1;
|
||||
|
||||
|
||||
translate_init();
|
||||
proc_init();
|
||||
output_init();
|
||||
event_init();
|
||||
|
@ -300,6 +302,7 @@ int main( int argc, char **argv )
|
|||
exec_destroy();
|
||||
event_destroy();
|
||||
output_destroy();
|
||||
translate_destroy();
|
||||
|
||||
intern_free_all();
|
||||
|
||||
|
|
194
parser.c
194
parser.c
|
@ -35,6 +35,8 @@ The fish parser. Contains functions for parsing code.
|
|||
#include "sanity.h"
|
||||
#include "env_universal.h"
|
||||
#include "event.h"
|
||||
#include "translate.h"
|
||||
#include "msgnrs.h"
|
||||
|
||||
/** Length of the lineinfo string used for describing the current tokenizer position */
|
||||
#define LINEINFO_SIZE 128
|
||||
|
@ -55,93 +57,188 @@ The fish parser. Contains functions for parsing code.
|
|||
Message about reporting bugs, used on weird internal error to
|
||||
hopefully get them to report stuff.
|
||||
*/
|
||||
#define BUGREPORT_MSG L"If this error can be reproduced, please send a bug report to %s."
|
||||
#define BUGREPORT_MSG _( L"If this error can be reproduced, please send a bug report to %s.")
|
||||
|
||||
/**
|
||||
Error message for improper use of the exec builtin
|
||||
*/
|
||||
#define EXEC_ERR_MSG L"this command can not be used in a pipeline"
|
||||
#define EXEC_ERR_MSG _(L"This command can not be used in a pipeline")
|
||||
|
||||
/**
|
||||
Error message for tokenizer error. The tokenizer message is
|
||||
appended to this message.
|
||||
*/
|
||||
#define TOK_ERR_MSG L"Tokenizer error: '%ls'"
|
||||
#define TOK_ERR_MSG _( L"Tokenizer error: '%ls'")
|
||||
|
||||
/**
|
||||
Error message for short circut command error.
|
||||
*/
|
||||
#define COND_ERR_MSG L"Short circut command requires additional command"
|
||||
#define COND_ERR_MSG _( L"Short circut command requires additional command")
|
||||
|
||||
/**
|
||||
Error message on reaching maximum recusrion depth
|
||||
*/
|
||||
#define RECURSION_ERR_MSG L"Maximum recursion depth reached. Accidental infinite loop?"
|
||||
#define RECURSION_ERR_MSG _( L"Maximum recursion depth reached. Accidental infinite loop?")
|
||||
|
||||
/**
|
||||
Error message used when the end of a block can't be located
|
||||
*/
|
||||
#define BLOCK_END_ERR_MSG L"Could not locate end of block. The 'end' command is missing, misspelled or a preceding ';' is missing."
|
||||
#define BLOCK_END_ERR_MSG _( L"Could not locate end of block. The 'end' command is missing, misspelled or a preceding ';' is missing.")
|
||||
|
||||
/**
|
||||
Error message on reaching maximum number of block calls
|
||||
*/
|
||||
#define BLOCK_ERR_MSG L"Maximum number of nested blocks reached."
|
||||
#define BLOCK_ERR_MSG _( L"Maximum number of nested blocks reached.")
|
||||
|
||||
/**
|
||||
Error message when a non-string token is found when expecting a command name
|
||||
*/
|
||||
#define CMD_ERR_MSG L"Expected a command string, got token of type '%ls'"
|
||||
#define CMD_ERR_MSG _( L"Expected a command string, got token of type '%ls'.")
|
||||
|
||||
/**
|
||||
Error message when encountering an illegal command name
|
||||
*/
|
||||
#define ILLEGAL_CMD_ERR_MSG L"Illegal command name '%ls'"
|
||||
#define ILLEGAL_CMD_ERR_MSG _( L"Illegal command name '%ls'.")
|
||||
|
||||
/**
|
||||
Error message for wildcards with no matches
|
||||
*/
|
||||
#define WILDCARD_ERR_MSG L"Warning: No match for wildcard '%ls'"
|
||||
#define WILDCARD_ERR_MSG _( L"Warning: No match for wildcard '%ls'. The command will not be executed.")
|
||||
|
||||
/**
|
||||
Error when using case builtin outside of switch block
|
||||
*/
|
||||
#define INVALID_CASE_ERR_MSG L"'case' builtin not inside of switch block"
|
||||
#define INVALID_CASE_ERR_MSG _( L"'case' builtin not inside of switch block")
|
||||
|
||||
/**
|
||||
Error when using loop control builtins (break or continue) outside of loop
|
||||
*/
|
||||
#define INVALID_LOOP_ERR_MSG L"Loop control command while not inside of loop"
|
||||
#define INVALID_LOOP_ERR_MSG _( L"Loop control command while not inside of loop" )
|
||||
|
||||
/**
|
||||
Error when using else builtin outside of if block
|
||||
*/
|
||||
#define INVALID_ELSE_ERR_MSG L"'else' builtin not inside of if block"
|
||||
#define INVALID_ELSE_ERR_MSG _( L"'else' builtin not inside of if block" )
|
||||
|
||||
/**
|
||||
Error when using end builtin outside of block
|
||||
*/
|
||||
#define INVALID_END_ERR_MSG L"'end' command outside of block"
|
||||
#define INVALID_END_ERR_MSG _( L"'end' command outside of block")
|
||||
|
||||
/**
|
||||
Error message for Posix-style assignment
|
||||
*/
|
||||
#define COMMAND_ASSIGN_ERR_MSG L"Unknown command '%ls'. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the manual section on the set command by typing 'help set'."
|
||||
#define COMMAND_ASSIGN_ERR_MSG _( L"Unknown command '%ls'. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the manual section on the set command by typing 'help set'.")
|
||||
|
||||
/**
|
||||
Error for invalid redirection token
|
||||
*/
|
||||
#define REDIRECT_TOKEN_ERR_MSG L"Expected redirection specification, got token of type '%ls'"
|
||||
#define REDIRECT_TOKEN_ERR_MSG _( L"Expected redirection specification, got token of type '%ls'")
|
||||
|
||||
/**
|
||||
Error when encountering redirection without a command
|
||||
*/
|
||||
#define INVALID_REDIRECTION_ERR_MSG L"Encountered redirection when expecting a command name. Fish does not allow a redirection operation before a command."
|
||||
#define INVALID_REDIRECTION_ERR_MSG _( L"Encountered redirection when expecting a command name. Fish does not allow a redirection operation before a command.")
|
||||
|
||||
/**
|
||||
Error for evaluating null pointer
|
||||
*/
|
||||
#define EVAL_NULL_ERR_MSG _( L"Tried to evaluate null pointer." )
|
||||
|
||||
/**
|
||||
Error for evaluating in illegal scope
|
||||
*/
|
||||
#define INVALID_SCOPE_ERR_MSG _( L"Tried to evaluate buffer using invalid block scope of type '%ls'." )
|
||||
|
||||
|
||||
/**
|
||||
Error for wrong token type
|
||||
*/
|
||||
#define UNEXPECTED_TOKEN_ERR_MSG L"Unexpected token of type '%ls'"
|
||||
#define UNEXPECTED_TOKEN_ERR_MSG _( L"Unexpected token of type '%ls'")
|
||||
|
||||
/**
|
||||
Unexpected error in parser_get_filename()
|
||||
*/
|
||||
#define MISSING_COMMAND_ERR_MSG _( L"Error while searching for command '%ls'" )
|
||||
|
||||
|
||||
/**
|
||||
While block description
|
||||
*/
|
||||
#define WHILE_BLOCK _( L"'while' block" )
|
||||
|
||||
|
||||
/**
|
||||
For block description
|
||||
*/
|
||||
#define FOR_BLOCK _( L"'for' block" )
|
||||
|
||||
|
||||
/**
|
||||
If block description
|
||||
*/
|
||||
#define IF_BLOCK _( L"'if' conditional block" )
|
||||
|
||||
|
||||
/**
|
||||
function definition block description
|
||||
*/
|
||||
#define FUNCTION_DEF_BLOCK _( L"function definition block" )
|
||||
|
||||
|
||||
/**
|
||||
Function invocation block description
|
||||
*/
|
||||
#define FUNCTION_CALL_BLOCK _( L"function invocation block" )
|
||||
|
||||
|
||||
/**
|
||||
Switch block description
|
||||
*/
|
||||
#define SWITCH_BLOCK _( L"'switch' block" )
|
||||
|
||||
|
||||
/**
|
||||
Fake block description
|
||||
*/
|
||||
#define FAKE_BLOCK _( L"unexecutable block" )
|
||||
|
||||
|
||||
/**
|
||||
Top block description
|
||||
*/
|
||||
#define TOP_BLOCK _( L"global root block" )
|
||||
|
||||
|
||||
/**
|
||||
Command substitution block description
|
||||
*/
|
||||
#define SUBST_BLOCK _( L"command substitution block" )
|
||||
|
||||
|
||||
/**
|
||||
Begin block description
|
||||
*/
|
||||
#define BEGIN_BLOCK _( L"unconditional block" )
|
||||
|
||||
|
||||
/**
|
||||
And block description
|
||||
*/
|
||||
#define AND_BLOCK _( L"'and' conditional block" )
|
||||
|
||||
|
||||
/**
|
||||
block description
|
||||
*/
|
||||
#define OR_BLOCK _( L"'or' conditional block" )
|
||||
|
||||
|
||||
/**
|
||||
Unknown block description
|
||||
*/
|
||||
#define UNKNOWN_BLOCK _( L"unknown/invalid block" )
|
||||
|
||||
|
||||
/** Last error code */
|
||||
int error_code;
|
||||
|
@ -322,48 +419,48 @@ void parser_pop_block()
|
|||
free( old );
|
||||
}
|
||||
|
||||
wchar_t *parser_get_block_desc( int block )
|
||||
const wchar_t *parser_get_block_desc( int block )
|
||||
{
|
||||
switch( block )
|
||||
{
|
||||
case WHILE:
|
||||
return L"while block";
|
||||
return WHILE_BLOCK;
|
||||
|
||||
case FOR:
|
||||
return L"for block";
|
||||
return FOR_BLOCK;
|
||||
|
||||
case IF:
|
||||
return L"'if' conditional block";
|
||||
return IF_BLOCK;
|
||||
|
||||
case FUNCTION_DEF:
|
||||
return L"function definition block";
|
||||
return FUNCTION_DEF_BLOCK;
|
||||
|
||||
case FUNCTION_CALL:
|
||||
return L"function invocation block";
|
||||
return FUNCTION_CALL_BLOCK;
|
||||
|
||||
case SWITCH:
|
||||
return L"switch block";
|
||||
return SWITCH_BLOCK;
|
||||
|
||||
case FAKE:
|
||||
return L"unexecutable block";
|
||||
return FAKE_BLOCK;
|
||||
|
||||
case TOP:
|
||||
return L"global root block";
|
||||
return TOP_BLOCK;
|
||||
|
||||
case SUBST:
|
||||
return L"command substitution block";
|
||||
return SUBST_BLOCK;
|
||||
|
||||
case BEGIN:
|
||||
return L"unconditional block";
|
||||
return BEGIN_BLOCK;
|
||||
|
||||
case AND:
|
||||
return L"'and' conditional command";
|
||||
return AND_BLOCK;
|
||||
|
||||
case OR:
|
||||
return L"'or' conditional command";
|
||||
return OR_BLOCK;
|
||||
|
||||
default:
|
||||
return L"unknown/invalid block";
|
||||
return UNKNOWN_BLOCK;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -714,7 +811,7 @@ wchar_t *get_filename( const wchar_t *cmd )
|
|||
break;
|
||||
default:
|
||||
debug( 1,
|
||||
L"Error while searching for command %ls",
|
||||
MISSING_COMMAND_ERR_MSG,
|
||||
new_cmd );
|
||||
wperror( L"access" );
|
||||
}
|
||||
|
@ -724,7 +821,6 @@ wchar_t *get_filename( const wchar_t *cmd )
|
|||
free( new_cmd );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -793,13 +889,13 @@ void parser_destroy()
|
|||
if( !f )
|
||||
{
|
||||
debug( 1,
|
||||
L"Could not write profiling information to file '%s'",
|
||||
_(L"Could not write profiling information to file '%s'"),
|
||||
profile );
|
||||
}
|
||||
else
|
||||
{
|
||||
fwprintf( f,
|
||||
L"Time\tSum\tCommand\n",
|
||||
_(L"Time\tSum\tCommand\n"),
|
||||
al_get_count( &profile_data ) );
|
||||
print_profile( &profile_data, 0, f );
|
||||
fclose( f );
|
||||
|
@ -949,7 +1045,7 @@ wchar_t *parser_current_line()
|
|||
{
|
||||
swprintf( lineinfo,
|
||||
LINEINFO_SIZE,
|
||||
L"%ls (line %d): %n",
|
||||
_(L"%ls (line %d): %n"),
|
||||
file,
|
||||
lineno,
|
||||
&offset );
|
||||
|
@ -1135,7 +1231,7 @@ static void parse_job_main_loop( process_t *p,
|
|||
{
|
||||
error( SYNTAX_ERROR,
|
||||
tok_get_pos( tok ),
|
||||
L"Could not expand string '%ls'",
|
||||
_(L"Could not expand string '%ls'"),
|
||||
tok_last(tok) );
|
||||
|
||||
}
|
||||
|
@ -1237,7 +1333,7 @@ static void parse_job_main_loop( process_t *p,
|
|||
if( error_code == 0 )
|
||||
error( SYNTAX_ERROR,
|
||||
tok_get_pos( tok ),
|
||||
L"Invalid IO redirection" );
|
||||
_(L"Invalid IO redirection") );
|
||||
tok_next(tok);
|
||||
}
|
||||
else
|
||||
|
@ -1280,8 +1376,7 @@ static void parse_job_main_loop( process_t *p,
|
|||
{
|
||||
error( SYNTAX_ERROR,
|
||||
tok_get_pos( tok ),
|
||||
L"Requested redirection to something "
|
||||
L"that is not a file descriptor %ls",
|
||||
_(L"Requested redirection to something that is not a file descriptor %ls"),
|
||||
target );
|
||||
|
||||
tok_next(tok);
|
||||
|
@ -1672,7 +1767,7 @@ static int parse_job( process_t *p,
|
|||
{
|
||||
error( EVAL_ERROR,
|
||||
tok_get_pos( tok ),
|
||||
L"Unknown command '%ls'",
|
||||
_(L"Unknown command '%ls'"),
|
||||
(wchar_t *)al_get( &args, 0 ) );
|
||||
|
||||
}
|
||||
|
@ -2046,7 +2141,9 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
|
|||
if( !cmd )
|
||||
{
|
||||
debug( 1,
|
||||
L"Tried to evaluate null pointer. " BUGREPORT_MSG,
|
||||
EVAL_NULL_ERR_MSG );
|
||||
debug( 1,
|
||||
BUGREPORT_MSG,
|
||||
PACKAGE_BUGREPORT );
|
||||
return 1;
|
||||
}
|
||||
|
@ -2056,8 +2153,11 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
|
|||
(block_type != SUBST))
|
||||
{
|
||||
debug( 1,
|
||||
L"Tried to evaluate buffer using invalid block scope of type '%ls'. " BUGREPORT_MSG,
|
||||
parser_get_block_desc( block_type ),
|
||||
INVALID_SCOPE_ERR_MSG,
|
||||
parser_get_block_desc( block_type ) );
|
||||
|
||||
debug( 1,
|
||||
BUGREPORT_MSG,
|
||||
PACKAGE_BUGREPORT );
|
||||
return 1;
|
||||
}
|
||||
|
@ -2092,8 +2192,8 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type )
|
|||
if( current_block == 0 )
|
||||
{
|
||||
debug( 0,
|
||||
L"End of block mismatch. "
|
||||
L"Program terminating. "
|
||||
_(L"End of block mismatch. Program terminating.") );
|
||||
debug( 0,
|
||||
BUGREPORT_MSG,
|
||||
PACKAGE_BUGREPORT );
|
||||
exit(1);
|
||||
|
|
2
parser.h
2
parser.h
|
@ -283,7 +283,7 @@ void parser_pop_block();
|
|||
/**
|
||||
Return a description of the given blocktype
|
||||
*/
|
||||
wchar_t *parser_get_block_desc( int block );
|
||||
const wchar_t *parser_get_block_desc( int block );
|
||||
|
||||
|
||||
/**
|
||||
|
|
54
proc.c
54
proc.c
|
@ -48,6 +48,7 @@ Some of the code in this file is based on code from the Glibc manual.
|
|||
#include "parser.h"
|
||||
#include "signal.h"
|
||||
#include "event.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Size of message buffer
|
||||
|
@ -139,7 +140,7 @@ static int job_remove( job_t *j )
|
|||
|
||||
if( j != curr )
|
||||
{
|
||||
debug( 1, L"Job inconsistency" );
|
||||
debug( 1, _( L"Job inconsistency" ) );
|
||||
sanity_lose();
|
||||
return 0;
|
||||
}
|
||||
|
@ -477,7 +478,7 @@ void job_handle_signal ( int signal, siginfo_t *info, void *con )
|
|||
*/
|
||||
static void format_job_info( const job_t *j, const wchar_t *status )
|
||||
{
|
||||
fwprintf (stdout, L"\rJob %d, \'%ls\' has %ls", j->job_id, j->command, status);
|
||||
fwprintf (stdout, _( L"\rJob %d, \'%ls\' has %ls" ), j->job_id, j->command, status);
|
||||
fflush( stdout );
|
||||
tputs(clr_eol,1,&writeb);
|
||||
fwprintf (stdout, L"\n" );
|
||||
|
@ -553,14 +554,16 @@ int job_reap( int interactive )
|
|||
{
|
||||
if( proc_is_job )
|
||||
fwprintf( stdout,
|
||||
L"fish: Job %d, \'%ls\' terminated by signal %ls (%ls)",
|
||||
_( L"%ls: Job %d, \'%ls\' terminated by signal %ls (%ls)" ),
|
||||
program_name,
|
||||
j->job_id,
|
||||
j->command,
|
||||
sig2wcs(WTERMSIG(p->status)),
|
||||
sig_description( WTERMSIG(p->status) ) );
|
||||
else
|
||||
fwprintf( stdout,
|
||||
L"fish: Process %d, \'%ls\' from job %d, \'%ls\' terminated by signal %ls (%ls)",
|
||||
_( L"%ls: Process %d, \'%ls\' from job %d, \'%ls\' terminated by signal %ls (%ls)" ),
|
||||
program_name,
|
||||
p->pid,
|
||||
p->argv[0],
|
||||
j->job_id,
|
||||
|
@ -590,7 +593,7 @@ int job_reap( int interactive )
|
|||
{
|
||||
if( !j->skip_notification )
|
||||
{
|
||||
format_job_info( j, L"ended" );
|
||||
format_job_info( j, _( L"ended" ) );
|
||||
found=1;
|
||||
}
|
||||
}
|
||||
|
@ -606,7 +609,7 @@ int job_reap( int interactive )
|
|||
*/
|
||||
if( !j->skip_notification )
|
||||
{
|
||||
format_job_info( j, L"stopped" );
|
||||
format_job_info( j, _( L"stopped" ) );
|
||||
found=1;
|
||||
}
|
||||
j->notified = 1;
|
||||
|
@ -805,7 +808,7 @@ static void read_try( job_t *j )
|
|||
if( errno != EAGAIN )
|
||||
{
|
||||
debug( 1,
|
||||
L"An error occured while reading output from code block" );
|
||||
_( L"An error occured while reading output from code block" ) );
|
||||
wperror( L"read_try" );
|
||||
}
|
||||
break;
|
||||
|
@ -848,7 +851,7 @@ void job_continue (job_t *j, int cont)
|
|||
if( tcsetpgrp (0, j->pgid) )
|
||||
{
|
||||
debug( 1,
|
||||
L"Could not send job %d ('%ls') to foreground",
|
||||
_( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetpgrp" );
|
||||
|
@ -860,7 +863,7 @@ void job_continue (job_t *j, int cont)
|
|||
if( tcsetattr (0, TCSADRAIN, &j->tmodes))
|
||||
{
|
||||
debug( 1,
|
||||
L"Could not send job %d ('%ls') to foreground",
|
||||
_( L"Could not send job %d ('%ls') to foreground" ),
|
||||
j->job_id,
|
||||
j->command );
|
||||
wperror( L"tcsetattr" );
|
||||
|
@ -972,7 +975,7 @@ void job_continue (job_t *j, int cont)
|
|||
signal_block();
|
||||
if( tcsetpgrp (0, getpid()) )
|
||||
{
|
||||
debug( 1, L"Could not return shell to foreground" );
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetpgrp" );
|
||||
return;
|
||||
}
|
||||
|
@ -982,7 +985,7 @@ void job_continue (job_t *j, int cont)
|
|||
*/
|
||||
if( tcgetattr (0, &j->tmodes) )
|
||||
{
|
||||
debug( 1, L"Could not return shell to foreground" );
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcgetattr" );
|
||||
return;
|
||||
}
|
||||
|
@ -992,7 +995,7 @@ void job_continue (job_t *j, int cont)
|
|||
*/
|
||||
if( tcsetattr (0, TCSADRAIN, &shell_modes))
|
||||
{
|
||||
debug( 1, L"Could not return shell to foreground" );
|
||||
debug( 1, _( L"Could not return shell to foreground" ) );
|
||||
wperror( L"tcsetattr" );
|
||||
return;
|
||||
}
|
||||
|
@ -1015,17 +1018,15 @@ void proc_sanity_check()
|
|||
|
||||
|
||||
validate_pointer( j->command,
|
||||
L"Job command",
|
||||
_( L"Job command" ),
|
||||
0 );
|
||||
validate_pointer( j->first_process,
|
||||
L"Process list pointer",
|
||||
_( L"Process list pointer" ),
|
||||
0 );
|
||||
validate_pointer( j->next,
|
||||
L"Job list pointer",
|
||||
_( L"Job list pointer" ),
|
||||
1 );
|
||||
validate_pointer( j->command,
|
||||
L"Job command",
|
||||
0 );
|
||||
|
||||
/*
|
||||
More than one foreground job?
|
||||
*/
|
||||
|
@ -1034,8 +1035,7 @@ void proc_sanity_check()
|
|||
if( fg_job != 0 )
|
||||
{
|
||||
debug( 0,
|
||||
L"More than one job in foreground:\n"
|
||||
L"job 1: %ls\njob 2: %ls",
|
||||
_( L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"),
|
||||
fg_job->command,
|
||||
j->command );
|
||||
sanity_lose();
|
||||
|
@ -1046,16 +1046,15 @@ void proc_sanity_check()
|
|||
p = j->first_process;
|
||||
while( p )
|
||||
{
|
||||
validate_pointer( p->argv, L"Process argument list", 0 );
|
||||
validate_pointer( p->argv[0], L"Process name", 0 );
|
||||
validate_pointer( p->next, L"Process list pointer", 1 );
|
||||
validate_pointer( p->actual_cmd, L"Process command", 1 );
|
||||
validate_pointer( p->argv, _( L"Process argument list" ), 0 );
|
||||
validate_pointer( p->argv[0], _( L"Process name" ), 0 );
|
||||
validate_pointer( p->next, _( L"Process list pointer" ), 1 );
|
||||
validate_pointer( p->actual_cmd, _( L"Process command" ), 1 );
|
||||
|
||||
if ( (p->stopped & (~0x00000001)) != 0 )
|
||||
{
|
||||
debug( 0,
|
||||
L"Job %ls, process %ls "
|
||||
L"has inconsistent state \'stopped\'=%d",
|
||||
_( L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d" ),
|
||||
j->command,
|
||||
p->argv[0],
|
||||
p->stopped );
|
||||
|
@ -1065,8 +1064,7 @@ void proc_sanity_check()
|
|||
if ( (p->completed & (~0x00000001)) != 0 )
|
||||
{
|
||||
debug( 0,
|
||||
L"Job %ls, process %ls "
|
||||
L"has inconsistent state \'completed\'=%d",
|
||||
_( L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d" ),
|
||||
j->command,
|
||||
p->argv[0],
|
||||
p->completed );
|
||||
|
|
27
reader.c
27
reader.c
|
@ -74,6 +74,7 @@ commence.
|
|||
#include "function.h"
|
||||
#include "output.h"
|
||||
#include "signal.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Maximum length of prefix string when printing completion
|
||||
|
@ -295,7 +296,7 @@ static void term_donate()
|
|||
{
|
||||
if( errno != EINTR )
|
||||
{
|
||||
debug( 1, L"Could not set terminal mode for new job" );
|
||||
debug( 1, _( L"Could not set terminal mode for new job" ) );
|
||||
wperror( L"tcsetattr" );
|
||||
break;
|
||||
}
|
||||
|
@ -316,7 +317,7 @@ static void term_steal()
|
|||
{
|
||||
if( errno != EINTR )
|
||||
{
|
||||
debug( 1, L"Could not set terminal mode for shell" );
|
||||
debug( 1, _( L"Could not set terminal mode for shell" ) );
|
||||
wperror( L"tcsetattr" );
|
||||
break;
|
||||
}
|
||||
|
@ -1593,7 +1594,7 @@ static void reader_interactive_init()
|
|||
if (setpgid (shell_pgid, shell_pgid) < 0)
|
||||
{
|
||||
debug( 1,
|
||||
L"Couldn't put the shell in its own process group");
|
||||
_( L"Couldn't put the shell in its own process group" ));
|
||||
wperror( L"setpgid" );
|
||||
exit (1);
|
||||
}
|
||||
|
@ -1603,7 +1604,7 @@ static void reader_interactive_init()
|
|||
if( tcsetpgrp (STDIN_FILENO, shell_pgid) )
|
||||
{
|
||||
debug( 1,
|
||||
L"Couldn't grab control of terminal" );
|
||||
_( L"Couldn't grab control of terminal" ) );
|
||||
wperror( L"tcsetpgrp" );
|
||||
exit(1);
|
||||
}
|
||||
|
@ -1635,7 +1636,7 @@ static void reader_interactive_init()
|
|||
original_pid = getpid();
|
||||
|
||||
if( atexit( &exit_func ) )
|
||||
debug( 1, L"Could not set exit function" );
|
||||
debug( 1, _( L"Could not set exit function" ) );
|
||||
|
||||
env_set( L"_", L"fish", ENV_GLOBAL );
|
||||
}
|
||||
|
@ -2367,7 +2368,7 @@ void reader_pop()
|
|||
|
||||
if( data == 0 )
|
||||
{
|
||||
debug( 0, L"Pop null reader block" );
|
||||
debug( 0, _( L"Pop null reader block" ) );
|
||||
sanity_lose();
|
||||
return;
|
||||
}
|
||||
|
@ -2509,7 +2510,7 @@ static int read_i()
|
|||
{
|
||||
if( !prev_end_loop && first_job != 0 )
|
||||
{
|
||||
writestr(L"There are stopped jobs\n");
|
||||
writestr(_( L"There are stopped jobs\n" ));
|
||||
write_prompt();
|
||||
data->end_loop = 0;
|
||||
prev_end_loop=1;
|
||||
|
@ -3025,7 +3026,7 @@ wchar_t *reader_readline()
|
|||
if( (!wchar_private(c)) && (c>31) && (c != 127) )
|
||||
insert_char( c );
|
||||
else
|
||||
debug( 0, L"Unknown keybinding %d", c );
|
||||
debug( 0, _( L"Unknown keybinding %d" ), c );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3095,7 +3096,7 @@ static int read_ni( int fd )
|
|||
if( ferror( in_stream ) )
|
||||
{
|
||||
debug( 1,
|
||||
L"Error while reading commands" );
|
||||
_( L"Error while reading commands" ) );
|
||||
|
||||
/*
|
||||
Reset buffer. We won't evaluate incomplete files.
|
||||
|
@ -3114,7 +3115,7 @@ static int read_ni( int fd )
|
|||
if( fclose( in_stream ))
|
||||
{
|
||||
debug( 1,
|
||||
L"Error while closing input" );
|
||||
_( L"Error while closing input" ) );
|
||||
wperror( L"fclose" );
|
||||
res = 1;
|
||||
}
|
||||
|
@ -3142,13 +3143,13 @@ static int read_ni( int fd )
|
|||
if( acc_used > 1 )
|
||||
{
|
||||
debug( 1,
|
||||
L"Could not convert input. Read %d bytes.",
|
||||
_( L"Could not convert input. Read %d bytes." ),
|
||||
acc_used-1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
debug( 1,
|
||||
L"Could not read input stream" );
|
||||
_( L"Could not read input stream" ) );
|
||||
}
|
||||
res=1;
|
||||
}
|
||||
|
@ -3157,7 +3158,7 @@ static int read_ni( int fd )
|
|||
else
|
||||
{
|
||||
debug( 1,
|
||||
L"Error while opening input" );
|
||||
_( L"Error while opening input" ) );
|
||||
wperror( L"fdopen" );
|
||||
free( buff );
|
||||
res=1;
|
||||
|
|
63
signal.c
63
signal.c
|
@ -21,6 +21,7 @@ The library for various signal related issues
|
|||
#include "event.h"
|
||||
#include "reader.h"
|
||||
#include "proc.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Struct describing an entry for the lookup table used to convert
|
||||
|
@ -51,182 +52,182 @@ static struct lookup_entry lookup[] =
|
|||
{
|
||||
SIGHUP,
|
||||
L"SIGHUP",
|
||||
L"Terminal hung up"
|
||||
N_( L"Terminal hung up" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGINT,
|
||||
L"SIGINT",
|
||||
L"Quit request from job control (^C)"
|
||||
N_( L"Quit request from job control (^C)" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGQUIT,
|
||||
L"SIGQUIT",
|
||||
L"Quit request from job control with core dump (^\\)"
|
||||
N_( L"Quit request from job control with core dump (^\\)" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGILL,
|
||||
L"SIGILL",
|
||||
L"Illegal instruction"
|
||||
N_( L"Illegal instruction" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGTRAP,
|
||||
L"SIGTRAP",
|
||||
L"Trace or breakpoint trap"
|
||||
N_( L"Trace or breakpoint trap" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGABRT,
|
||||
L"SIGABRT",
|
||||
L"Abort"
|
||||
N_( L"Abort" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGBUS,
|
||||
L"SIGBUS",
|
||||
L"Misaligned address error"
|
||||
N_( L"Misaligned address error" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGFPE,
|
||||
L"SIGFPE",
|
||||
L"Floating point exception"
|
||||
N_( L"Floating point exception" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGKILL,
|
||||
L"SIGKILL",
|
||||
L"Forced quit"
|
||||
N_( L"Forced quit" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGUSR1,
|
||||
L"SIGUSR1",
|
||||
L"User defined signal 1"
|
||||
N_( L"User defined signal 1" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGUSR2, L"SIGUSR2",
|
||||
L"User defined signal 2"
|
||||
N_( L"User defined signal 2" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGSEGV,
|
||||
L"SIGSEGV",
|
||||
L"Address boundary error"
|
||||
N_( L"Address boundary error" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGPIPE,
|
||||
L"SIGPIPE",
|
||||
L"Broken pipe"
|
||||
N_( L"Broken pipe" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGALRM,
|
||||
L"SIGALRM",
|
||||
L"Timer expired"
|
||||
N_( L"Timer expired" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGTERM,
|
||||
L"SIGTERM",
|
||||
L"Polite quit request"
|
||||
N_( L"Polite quit request" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGCHLD,
|
||||
L"SIGCHLD",
|
||||
L"Child process status changed"
|
||||
N_( L"Child process status changed" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGCONT,
|
||||
L"SIGCONT",
|
||||
L"Continue previously stopped process"
|
||||
N_( L"Continue previously stopped process" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGSTOP,
|
||||
L"SIGSTOP",
|
||||
L"Forced stop"
|
||||
N_( L"Forced stop" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGTSTP,
|
||||
L"SIGTSTP",
|
||||
L"Stop request from job control (^Z)"
|
||||
N_( L"Stop request from job control (^Z)" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGTTIN,
|
||||
L"SIGTTIN",
|
||||
L"Stop from terminal input"
|
||||
N_( L"Stop from terminal input" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGTTOU,
|
||||
L"SIGTTOU",
|
||||
L"Stop from terminal output"
|
||||
N_( L"Stop from terminal output" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGURG,
|
||||
L"SIGURG",
|
||||
L"Urgent socket condition"
|
||||
N_( L"Urgent socket condition" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGXCPU,
|
||||
L"SIGXCPU",
|
||||
L"CPU time limit exceeded"
|
||||
N_( L"CPU time limit exceeded" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGXFSZ,
|
||||
L"SIGXFSZ",
|
||||
L"File size limit exceeded"
|
||||
N_( L"File size limit exceeded" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGVTALRM,
|
||||
L"SIGVTALRM",
|
||||
L"Virtual timer expired"
|
||||
N_( L"Virtual timer expired" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGPROF,
|
||||
L"SIGPROF",
|
||||
L"Profiling timer expired"
|
||||
N_( L"Profiling timer expired" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGWINCH,
|
||||
L"SIGWINCH",
|
||||
L"Window size change"
|
||||
N_( L"Window size change" )
|
||||
}
|
||||
,
|
||||
{
|
||||
SIGIO,
|
||||
L"SIGIO",
|
||||
L"Asynchronous IO event"
|
||||
N_( L"Asynchronous IO event" )
|
||||
}
|
||||
,
|
||||
#ifdef SIGPWR
|
||||
{
|
||||
SIGPWR,
|
||||
L"SIGPWR",
|
||||
L"Power failure"
|
||||
N_( L"Power failure" )
|
||||
}
|
||||
,
|
||||
#endif
|
||||
{
|
||||
SIGSYS,
|
||||
L"SIGSYS",
|
||||
L"Bad system call"
|
||||
N_( L"Bad system call" )
|
||||
}
|
||||
,
|
||||
{
|
||||
|
@ -292,7 +293,7 @@ const wchar_t *sig_description( int sig )
|
|||
{
|
||||
if( lookup[i].signal == sig )
|
||||
{
|
||||
return lookup[i].desc;
|
||||
return _(lookup[i].desc);
|
||||
}
|
||||
}
|
||||
return L"Unknown";
|
||||
|
|
53
tokenizer.c
53
tokenizer.c
|
@ -20,64 +20,62 @@
|
|||
#include "tokenizer.h"
|
||||
#include "common.h"
|
||||
#include "wildcard.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
Error string for unexpected end of string
|
||||
*/
|
||||
#define EOL_ERROR L"Unexpected end of token"
|
||||
#define EOL_ERROR _( L"Unexpected end of token" )
|
||||
/**
|
||||
Error string for mismatched parenthesis
|
||||
*/
|
||||
#define PARAN_ERROR L"Parenthesis mismatch"
|
||||
#define PARAN_ERROR _( L"Parenthesis mismatch" )
|
||||
/**
|
||||
Error string for invalid redirections
|
||||
*/
|
||||
#define REDIRECT_ERROR L"Invalid redirection"
|
||||
#define REDIRECT_ERROR _( L"Invalid redirection" )
|
||||
/**
|
||||
Error string for invalid input
|
||||
*/
|
||||
#define INPUT_ERROR L"Invalid input"
|
||||
#define INPUT_ERROR _( L"Invalid input" )
|
||||
|
||||
/**
|
||||
Error string for when trying to pipe from fd 0
|
||||
*/
|
||||
#define PIPE_ERROR L"Can not use fd 0 as pipe output"
|
||||
#define PIPE_ERROR _( L"Can not use fd 0 as pipe output" )
|
||||
|
||||
/**
|
||||
Characters that separate tokens. They are ordered by frequency of occurrence to increase parsing speed.
|
||||
*/
|
||||
#define SEP L" \n|\t;#\r<>^&"
|
||||
/**
|
||||
Tests if the tokenizer buffer is large enough to hold contents of
|
||||
the specified length, and if not, reallocates the tokenizer buffer.
|
||||
|
||||
\return 0 if the system could not provide the memory needed, and 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
Maximum length of a string containing a file descriptor number
|
||||
*/
|
||||
#define FD_STR_MAX_LEN 16
|
||||
|
||||
const static wchar_t *tok_desc[] =
|
||||
static const wchar_t *tok_desc[] =
|
||||
{
|
||||
L"Tokenizer not yet initialized",
|
||||
L"Tokenizer error",
|
||||
L"Invalid token",
|
||||
L"String",
|
||||
L"Pipe",
|
||||
L"End of command",
|
||||
L"Redirect output to file",
|
||||
L"Append output to file",
|
||||
L"Redirect input to file",
|
||||
L"Redirect to file descriptor",
|
||||
L"Run job in background",
|
||||
L"Comment"
|
||||
N_(L"Tokenizer not yet initialized"),
|
||||
N_( L"Tokenizer error" ),
|
||||
N_( L"Invalid token" ),
|
||||
N_( L"String" ),
|
||||
N_( L"Pipe" ),
|
||||
N_( L"End of command" ),
|
||||
N_( L"Redirect output to file" ),
|
||||
N_( L"Append output to file" ),
|
||||
N_( L"Redirect input to file" ),
|
||||
N_( L"Redirect to file descriptor" ),
|
||||
N_( L"Run job in background" ),
|
||||
N_( L"Comment" )
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
/**
|
||||
Make sure the tokenizer buffer have room for a token of the specified size.
|
||||
Tests if the tokenizer buffer is large enough to hold contents of
|
||||
the specified length, and if not, reallocates the tokenizer buffer.
|
||||
|
||||
\return 0 if the system could not provide the memory needed, and 1 otherwise.
|
||||
*/
|
||||
static int check_size( tokenizer *tok, size_t len )
|
||||
{
|
||||
|
@ -484,7 +482,8 @@ static int my_iswspace( wchar_t c )
|
|||
|
||||
const wchar_t *tok_get_desc( int type )
|
||||
{
|
||||
return tok_desc[type];
|
||||
|
||||
return _(tok_desc[type]);
|
||||
}
|
||||
|
||||
|
||||
|
|
78
translate.c
Normal file
78
translate.c
Normal file
|
@ -0,0 +1,78 @@
|
|||
/** \file translate.c
|
||||
|
||||
Translation library, internally uses catgets
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
|
||||
#if HAVE_GETTEXT
|
||||
|
||||
#define BUFF_COUNT 64
|
||||
|
||||
static string_buffer_t buff[BUFF_COUNT];
|
||||
static int curr_buff=0;
|
||||
|
||||
const wchar_t *wgettext( const wchar_t *in )
|
||||
{
|
||||
char *mbs_in = wcs2str( in );
|
||||
char *out = gettext( mbs_in );
|
||||
wchar_t *wres=0;
|
||||
|
||||
sb_clear( &buff[curr_buff] );
|
||||
sb_printf( &buff[curr_buff], L"%s", out );
|
||||
wres = (wchar_t *)buff[curr_buff].buff;
|
||||
curr_buff = (curr_buff+1)%BUFF_COUNT;
|
||||
|
||||
/*
|
||||
write( 2, res, strlen(res) );
|
||||
*/
|
||||
// debug( 1, L"%ls -> %s (%d) -> %ls (%d)\n", in, out, strlen(out) , wres, wcslen(wres) );
|
||||
|
||||
return wres;
|
||||
}
|
||||
|
||||
|
||||
void translate_init()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<BUFF_COUNT; i++ )
|
||||
sb_init( &buff[i] );
|
||||
|
||||
bindtextdomain( PACKAGE_NAME, LOCALEDIR );
|
||||
textdomain( PACKAGE_NAME );
|
||||
|
||||
}
|
||||
|
||||
void translate_destroy()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<BUFF_COUNT; i++ )
|
||||
sb_destroy( &buff[i] );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
const wchar_t *wgettext( const wchar_t *in )
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
void translate_init()
|
||||
{
|
||||
}
|
||||
|
||||
void translate_destroy()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
27
translate.h
Normal file
27
translate.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/** \file translate.h
|
||||
|
||||
Translation library, internally uses catgets
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
Shorthand for wgettext call
|
||||
*/
|
||||
#define _(wstr) wgettext(wstr)
|
||||
|
||||
/**
|
||||
Noop, used to tell xgettext that a string should be translated, even though it is not directly sent to wgettext.
|
||||
*/
|
||||
#define N_(wstr) wstr
|
||||
|
||||
/**
|
||||
Wide character wwrapper around the gettext function
|
||||
*/
|
||||
const wchar_t *wgettext( const wchar_t *in );
|
||||
|
||||
/**
|
||||
Initialize (or reinitialize) the translation library
|
||||
\param lang The two-character language name, such as 'de' or 'en'
|
||||
*/
|
||||
void translate_init();
|
||||
void translate_destroy();
|
11
wildcard.c
11
wildcard.c
|
@ -1,8 +1,8 @@
|
|||
/** \file wildcard.c
|
||||
|
||||
Fish needs it's own globbing implementation to support
|
||||
tab-expansion of globbed parameters. Also provides recursive
|
||||
wildcards using **.
|
||||
Fish needs it's own globbing implementation to support
|
||||
tab-expansion of globbed parameters. Also provides recursive
|
||||
wildcards using **.
|
||||
|
||||
*/
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include "complete.h"
|
||||
#include "reader.h"
|
||||
#include "expand.h"
|
||||
#include "translate.h"
|
||||
|
||||
/**
|
||||
This flag is set in the flags parameter of wildcard_expand if the
|
||||
|
@ -272,11 +273,11 @@ void get_desc( wchar_t *fn, string_buffer_t *sb, int is_cmd )
|
|||
sb_append2( sb, desc, L", ", (void *)0 );
|
||||
if( sz < 0 )
|
||||
{
|
||||
sb_append( sb, L"unknown" );
|
||||
sb_append( sb, _(L"unknown") );
|
||||
}
|
||||
else if( sz < 1 )
|
||||
{
|
||||
sb_append( sb, L"empty" );
|
||||
sb_append( sb, _( L"empty" ) );
|
||||
}
|
||||
else if( sz < 1024 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue