diff --git a/ChangeLog b/ChangeLog index cc3229849..2a5fa4582 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +1999-09-19 David Martin + + * gtkedit/editcmd.c (edit_print_string): Use unsigned char so that + 8 bit chars from strftime get displayed when inserting date. + + * lib/mc.ext.in: Add entries for bzip2 compressed pages as used in + Mandrake 6.0. The generic entry for bzip2 moved to the end of the + file to avoid interferences. In this one I changed the extension check + to a type check (as used for gzip) which might give problems in some + systems. + + * configure.in: Use -Tlatin1 to format man pages when available and + "view" 8 bit chars. + +1999-09-19 Norbert Warmuth + + * gtkedit/edit.h: Include file reordering to make it compile with + --with-debug + + * gtkedit/editcmd.c (menu_save_mode_cmd): calculate dialog width + dependent on lenght of translated strings to display. + 1999-09-16 Owen Taylor * Remove the magicdev autoconf test in favor of just diff --git a/configure.in b/configure.in index 467ab69b8..e0d6ceaf4 100644 --- a/configure.in +++ b/configure.in @@ -582,19 +582,26 @@ fi AC_SUBST(MANDOC) dnl -dnl Check if nroff accepts -Tascii +dnl Check if nroff accepts -Tlatin1 or -Tascii dnl if $HAVE_nroff; then - AC_MSG_CHECKING(If nroff accepts -Tascii) + AC_MSG_CHECKING(if nroff accepts -Tlatin1 or -Tascii) AC_CACHE_VAL(ac_cv_nroff_tascii, [ - nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null + nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null if test $? = 0 then - ac_cv_nroff_tascii=" -Tascii" + ac_cv_nroff_tascii=" -Tlatin1" AC_MSG_RESULT(yes) else - ac_cv_nroff_tascii="" - AC_MSG_RESULT(no) + nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null + if test $? = 0 + then + ac_cv_nroff_tascii=" -Tascii" + AC_MSG_RESULT(yes) + else + ac_cv_nroff_tascii="" + AC_MSG_RESULT(no) + fi fi ]) fi diff --git a/gnome/Makefile.in b/gnome/Makefile.in index 587f7ac7d..860de1c9b 100644 --- a/gnome/Makefile.in +++ b/gnome/Makefile.in @@ -211,7 +211,7 @@ CLIENTOBJS = \ $(CORBA_GENERATED): $(rootdir)/idl/FileManager.idl orbit-idl `gnome-config --cflags idl` $(rootdir)/idl/FileManager.idl -$(MAGICDEV_GENERATED): magicdev.idl +$(MAGICDEV_GENERATED): $(srcdir)/magicdev.idl orbit-idl `gnome-config --cflags idl` --noskels $(srcdir)/magicdev.idl FileManager-impl.c: FileManager.h diff --git a/gtkedit/edit.h b/gtkedit/edit.h index e9d0c20c9..86e383509 100644 --- a/gtkedit/edit.h +++ b/gtkedit/edit.h @@ -115,6 +115,7 @@ #else +# include "src/global.h" # include "src/main.h" /* for char *shell */ # include "src/mad.h" # include "src/dlg.h" @@ -122,7 +123,6 @@ # include "src/color.h" # include "src/dialog.h" # include "src/mouse.h" -# include "src/global.h" # include "src/help.h" # include "src/key.h" # include "src/wtools.h" /* for QuickWidgets */ diff --git a/gtkedit/editcmd.c b/gtkedit/editcmd.c index 0390e4a33..418482dfe 100644 --- a/gtkedit/editcmd.c +++ b/gtkedit/editcmd.c @@ -326,7 +326,6 @@ int edit_save_file (WEdit * edit, const char *filename) */ void menu_save_mode_cmd (void) { -#define DLG_X 38 #define DLG_Y 10 static char *str_result; static int save_mode_new; @@ -337,29 +336,52 @@ void menu_save_mode_cmd (void) N_("Do backups -->")}; static QuickWidget widgets[] = { - {quick_button, 18, DLG_X, 7, DLG_Y, N_("&Cancel"), 0, + {quick_button, 18, 0, 7, DLG_Y, N_("&Cancel"), 0, B_CANCEL, 0, 0, XV_WLAY_DONTCARE, "c"}, - {quick_button, 6, DLG_X, 7, DLG_Y, N_("&Ok"), 0, + {quick_button, 6, 0, 7, DLG_Y, N_("&Ok"), 0, B_ENTER, 0, 0, XV_WLAY_DONTCARE, "o"}, - {quick_input, 23, DLG_X, 5, DLG_Y, 0, 9, + {quick_input, 23, 0, 5, DLG_Y, 0, 9, 0, 0, &str_result, XV_WLAY_DONTCARE, "i"}, - {quick_label, 22, DLG_X, 4, DLG_Y, N_("Extension:"), 0, + {quick_label, 23, 0, 4, DLG_Y, N_("Extension:"), 0, 0, 0, 0, XV_WLAY_DONTCARE, "savemext"}, - {quick_radio, 4, DLG_X, 3, DLG_Y, "", 3, + {quick_radio, 4, 0, 3, DLG_Y, "", 3, 0, &save_mode_new, str, XV_WLAY_DONTCARE, "t"}, {0}}; static QuickDialog dialog = /* NLS ? */ - {DLG_X, DLG_Y, -1, -1, N_(" Edit Save Mode "), "[Edit Save Mode]", + {0, DLG_Y, -1, -1, N_(" Edit Save Mode "), "[Edit Save Mode]", "esm", widgets}; static int i18n_flag = 0; if (!i18n_flag) { int i; + int maxlen = 0; + int dlg_x; + int l1; + + /* Ok/Cancel buttons */ + l1 = strlen (_(widgets[0].text)) + strlen (_(widgets[1].text)) + 5; + maxlen = max (maxlen, l1); - for (i = 0; i < 3; i++ ) + for (i = 0; i < 3; i++ ) { str[i] = _(str[i]); + maxlen = max (maxlen, strlen (str[i]) + 7); + } i18n_flag = 1; + + dlg_x = maxlen + strlen (_(widgets[3].text)) + 5 + 1; + widgets[2].hotkey_pos = strlen (_(widgets[3].text)); /* input field length */ + dlg_x = min (COLS, dlg_x); + dialog.xlen = dlg_x; + + i = (dlg_x - l1)/3; + widgets[1].relative_x = i; + widgets[0].relative_x = i + strlen (_(widgets[1].text)) + i + 4; + + widgets[2].relative_x = widgets[3].relative_x = maxlen + 2; + + for (i = 0; i < sizeof (widgets)/sizeof (widgets[0]); i++) + widgets[i].x_divisions = dlg_x; } widgets[2].text = option_backup_ext; @@ -2828,7 +2850,7 @@ int edit_print_string (WEdit * e, const char *s) { int i = 0; while (s[i]) - edit_execute_cmd (e, -1, s[i++]); + edit_execute_cmd (e, -1, (unsigned char) s[i++]); e->force |= REDRAW_COMPLETELY; edit_update_screen (e); return i; diff --git a/lib/mc.ext.in b/lib/mc.ext.in index d0058a475..7a19bd304 100644 --- a/lib/mc.ext.in +++ b/lib/mc.ext.in @@ -127,21 +127,6 @@ shell/.tar Extract=tar xf %f Icon=tar.xpm -# bzipped -regex/\.bz$ - Open=bzip -dc %f | %var{PAGER:more} - View=%view{ascii} bzip -dc %f 2>/dev/null - Edit=I=`date +%%s`; export I; bzip -cd %f >/tmp/bzed.$I && %var{EDITOR:vi} /tmp/bzed.$I && bzip -c /tmp/bzed.$I > %f; rm -f /tmp/bzed.$I - Uncompress=bunzip %f - Icon=compressed.xpm - -regex/\.bz2$ - Open=bzip2 -dc %f | %var{PAGER:more} - View=%view{ascii} bzip2 -dc %f 2>/dev/null - Edit=I=`date +%%s`; export I; bzip2 -cd %f >/tmp/bzed.$I && %var{EDITOR:vi} /tmp/bzed.$I && bzip2 -c /tmp/bzed.$I > %f; rm -f /tmp/bzed.$I - Uncompress=bunzip2 %f - Icon=compressed.xpm - # Programs shell/rm Open=if test ! -d ~/.trash; then mkdir ~/.trash; fi; I=%{Enter file to be safely deleted}; if test -n "$I"; then mv -f -b -V numbered %q ~/.trash; fi @@ -369,8 +354,18 @@ shell/.ms # Manual page - compressed regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.g?[Zz]$ - Open=gunzip -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more} - View=%view{ascii,nroff} gunzip -dc %f | nroff @TROFFASCII@ @MANDOC@ + Open=gzip -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more} + View=%view{ascii,nroff} gzip -dc %f | nroff @TROFFASCII@ @MANDOC@ + Icon=man.xpm + +regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.bz$ + Open=bzip -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more} + View=%view{ascii,nroff} bzip -dc %f | nroff @TROFFASCII@ @MANDOC@ + Icon=man.xpm + +regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.bz2$ + Open=bzip2 -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more} + View=%view{ascii,nroff} bzip2 -dc %f | nroff @TROFFASCII@ @MANDOC@ Icon=man.xpm regex/(read\.?me$)|(README) @@ -465,20 +460,6 @@ type/mail Icon=mail.xpm View=%view{ascii} mcmfmt < %f -# gzipped -type/gzip - Open=gzip -dc %f | %var{PAGER:more} - View=%view{ascii} gzip -dc %f 2>/dev/null - Edit=I=`date +%%s`; export I; gzip -cd %f >/tmp/gzed.$I && %var{EDITOR:vi} /tmp/gzed.$I && gzip -c /tmp/gzed.$I > %f; rm -f /tmp/gzed.$I - Uncompress=gunzip %f - Icon=compressed.xpm - -type/compress - Open=gzip -dc %f | %var{PAGER:more} - View=%view{ascii} gzip -dc %f 2>/dev/null - Edit=I=`date +%%s`; export I; gzip -cd %f >/tmp/gzed.$I && %var{EDITOR:vi} /tmp/gzed.$I && gzip -c /tmp/gzed.$I > %f; rm -f /tmp/gzed.$I - Icon=compressed.xpm - # Makefile regex/[Mm]akefile Open=make -f %f %{Enter parameters} @@ -582,6 +563,35 @@ regex/\.trpm$ Open=%cd trpm:%p View=%view{ascii} rpm -qivl --scripts `basename %p .trpm` +# gzipped +type/gzip + Open=gzip -dc %f | %var{PAGER:more} + View=%view{ascii} gzip -dc %f 2>/dev/null + Edit=I=`date +%%s`; export I; gzip -cd %f >/tmp/gzed.$I && %var{EDITOR:vi} /tmp/gzed.$I && gzip -c /tmp/gzed.$I > %f; rm -f /tmp/gzed.$I + Uncompress=gunzip %f + Icon=compressed.xpm + +# bzipped +type/bzip2 + Open=bzip2 -dc %f | %var{PAGER:more} + View=%view{ascii} bzip2 -dc %f 2>/dev/null + Edit=I=`date +%%s`; export I; bzip2 -cd %f >/tmp/bzed.$I && %var{EDITOR:vi} /tmp/bzed.$I && bzip2 -c /tmp/bzed.$I > %f; rm -f /tmp/bzed.$I + Uncompress=bunzip2 %f + Icon=compressed.xpm + +type/bzip + Open=bzip -dc %f | %var{PAGER:more} + View=%view{ascii} bzip -dc %f 2>/dev/null + Edit=I=`date +%%s`; export I; bzip -cd %f >/tmp/bzed.$I && %var{EDITOR:vi} /tmp/bzed.$I && bzip -c /tmp/bzed.$I > %f; rm -f /tmp/bzed.$I + Uncompress=bunzip %f + Icon=compressed.xpm + +type/compress + Open=gzip -dc %f | %var{PAGER:more} + View=%view{ascii} gzip -dc %f 2>/dev/null + Edit=I=`date +%%s`; export I; gzip -cd %f >/tmp/gzed.$I && %var{EDITOR:vi} /tmp/gzed.$I && gzip -c /tmp/gzed.$I > %f; rm -f /tmp/gzed.$I + Icon=compressed.xpm + # Default target for anything not described above default/* Open= diff --git a/po/ChangeLog b/po/ChangeLog index a63244bae..c9d41ee68 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +1999-09-19 Norbert Warmuth + + * *.po: s/defination/definition/ + 1999-09-18 Kjartan Maraas * no.po: Updated translation. diff --git a/po/ca.po b/po/ca.po index 097bdeba0..38d6bfeb1 100644 --- a/po/ca.po +++ b/po/ca.po @@ -5652,7 +5652,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " La definició «%c» del patró d'intèrpret no és vàlida. " #: src/user.c:394 diff --git a/po/cs.po b/po/cs.po index e1e1c9f36..b85e256df 100644 --- a/po/cs.po +++ b/po/cs.po @@ -5592,7 +5592,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Chybná definice vzoru shellu \"%c\". " #: src/user.c:394 diff --git a/po/da.po b/po/da.po index b006af5df..62d77f3f2 100644 --- a/po/da.po +++ b/po/da.po @@ -5548,7 +5548,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Ugyldig mønsterdefinition for skal \"%c\". " #: src/user.c:394 diff --git a/po/de.po b/po/de.po index fe7a30fef..7f8cc1090 100644 --- a/po/de.po +++ b/po/de.po @@ -5597,7 +5597,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Ungültige Definition vom Shell-Pattern \"%c\". " #: src/user.c:394 diff --git a/po/el.po b/po/el.po index e7fb0f3a6..b984c298a 100644 --- a/po/el.po +++ b/po/el.po @@ -5377,7 +5377,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:394 diff --git a/po/es.po b/po/es.po index e87736f22..808c656a3 100644 --- a/po/es.po +++ b/po/es.po @@ -5585,7 +5585,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Definición inválida del patrón de shell %c " #: src/user.c:394 diff --git a/po/es_ES.po b/po/es_ES.po index 81a3b73ec..0ed88a5c5 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -5585,7 +5585,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Definición inválida del patrón de shell %c " #: src/user.c:394 diff --git a/po/fi.po b/po/fi.po index cb797f4bc..626be9b75 100644 --- a/po/fi.po +++ b/po/fi.po @@ -5474,7 +5474,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:394 diff --git a/po/fr.po b/po/fr.po index f39df9a84..1480487ce 100644 --- a/po/fr.po +++ b/po/fr.po @@ -5628,7 +5628,7 @@ msgstr "Impossible d' #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "Définition d'un motif de shell invalide \"%c\". " #: src/user.c:394 diff --git a/po/hu.po b/po/hu.po index 4966e42a7..c435aea88 100644 --- a/po/hu.po +++ b/po/hu.po @@ -5590,7 +5590,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Érvénytelen shell minta defininíció \"%c\". " #: src/user.c:394 diff --git a/po/it.po b/po/it.po index d8cef4260..0a45aab94 100644 --- a/po/it.po +++ b/po/it.po @@ -5589,7 +5589,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Definizione inesatta dei pattern della shell %c " #: src/user.c:394 diff --git a/po/ja.po b/po/ja.po index 4f70fbe23..00084c0f5 100644 --- a/po/ja.po +++ b/po/ja.po @@ -5430,7 +5430,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:394 diff --git a/po/ko.po b/po/ko.po index 4ca6c8f2e..1fd38d4f3 100644 --- a/po/ko.po +++ b/po/ko.po @@ -5594,7 +5594,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " \"%c\"´Â ¾Ë¼ö ¾ø´Â ¸í·ÉÇؼ®±â ÆÐÅÏÀÔ´Ï´Ù. " #: src/user.c:394 diff --git a/po/nl.po b/po/nl.po index ecb39a8c2..b0faba38c 100644 --- a/po/nl.po +++ b/po/nl.po @@ -5595,7 +5595,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Ongeldige definitie van shell patroon \"%c\". " #: src/user.c:394 diff --git a/po/no.po b/po/no.po index 1976a7fea..a09f782be 100644 --- a/po/no.po +++ b/po/no.po @@ -5638,7 +5638,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Ugyldig mønsterdefinisjon for skall \"%c\". " #: src/user.c:394 diff --git a/po/pl.po b/po/pl.po index 9f054be22..ebdf430e4 100644 --- a/po/pl.po +++ b/po/pl.po @@ -5598,7 +5598,7 @@ msgstr "" #: src/user.c:1 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:1 diff --git a/po/ro.po b/po/ro.po index 3100e0898..1baf071f2 100644 --- a/po/ro.po +++ b/po/ro.po @@ -5707,7 +5707,7 @@ msgstr " Nu pot scrie #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:394 diff --git a/po/ru.po b/po/ru.po index 942b901ce..6bea03971 100644 --- a/po/ru.po +++ b/po/ru.po @@ -5487,7 +5487,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:394 diff --git a/po/sv.po b/po/sv.po index d771d3133..fa4b0bd94 100644 --- a/po/sv.po +++ b/po/sv.po @@ -5688,7 +5688,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " Ogiltigt skalmönster \"%c\"." # kort och bra diff --git a/po/wa.po b/po/wa.po index 6e72286a8..73e7bbacc 100644 --- a/po/wa.po +++ b/po/wa.po @@ -5588,7 +5588,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr "" #: src/user.c:394 diff --git a/po/zh_TW.Big5.po b/po/zh_TW.Big5.po index e8cacdf28..1f82719bf 100644 --- a/po/zh_TW.Big5.po +++ b/po/zh_TW.Big5.po @@ -5575,7 +5575,7 @@ msgstr "" #: src/user.c:261 #, c-format -msgid " Invalid shell pattern defination \"%c\". " +msgid " Invalid shell pattern definition \"%c\". " msgstr " µL®Äªº¨t²Î´ß¸U¥Î¦r¤¸©w¸q \"%c\". " #: src/user.c:394 diff --git a/src/ChangeLog b/src/ChangeLog index 865f0b510..a8610d3f4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +1999-09-19 Andrew V. Samoilov + + * user.c (check_patterns): char* is used instead of char [] in sizeof + + * util.c (string_perm): prefix named pipes by 'p' and not by `s' + +1999-09-19 Norbert Warmuth + + * mad.c, mad.h, util.c, util.h: Move mad-functions from util.[ch] + to mad.[ch] + + * option.c: Include files reordered in order to make it compile with + --with-debug + + * mad.c (mad_init): New function. Initialize debug FILE pointer to + stderr (moved to a function because not on every system stderr is + a constant). + (mad_set_debug): added const qualifier + + * main.c (main): call mad_init + 1999-09-14 Norbert Warmuth * widget.[ch] (input_new): added const qualifier diff --git a/src/mad.c b/src/mad.c index 61b5f6773..151dd78b1 100644 --- a/src/mad.c +++ b/src/mad.c @@ -66,11 +66,17 @@ typedef struct { } mad_mem_area; static mad_mem_area mem_areas [MAD_MAX_AREAS]; -static FILE *memlog = stderr; +static FILE *memlog; void *watch_free_pointer = 0; -void mad_set_debug (char *file) +void +mad_init (void) +{ + memlog = stderr; +} + +void mad_set_debug (const char *file) { if((memlog=fopen (file, "w+")) == NULL) memlog = stderr; @@ -297,4 +303,64 @@ void mad_finalize (char *file, int line) #endif } +char * +mad_strconcat (const char *first, ...) +{ + va_list ap; + long len; + char *data, *result; + + if (!first) + return 0; + + len = strlen (first) + 1; + va_start (ap, first); + + while ((data = va_arg (ap, char *)) != 0) + len += strlen (data); + + result = g_malloc (len); + + va_end (ap); + + va_start (ap, first); + strcpy (result, first); + + while ((data = va_arg (ap, char *)) != 0) + strcat (result, data); + + va_end (ap); + + return result; +} + +/* This two functions grabbed from GLib's gstrfuncs.c */ +char* +mad_strdup_vprintf (const char *format, va_list args1) +{ + char *buffer; + va_list args2; + + G_VA_COPY (args2, args1); + + buffer = g_new (char, g_printf_string_upper_bound (format, args1)); + + vsprintf (buffer, format, args2); + va_end (args2); + + return buffer; +} + +char* +mad_strdup_printf (const char *format, ...) +{ + char *buffer; + va_list args; + + va_start (args, format); + buffer = g_strdup_vprintf (format, args); + va_end (args); + + return buffer; +} #endif /* HAVE_MAD */ diff --git a/src/mad.h b/src/mad.h index 0e8896109..ca4fe2f4c 100644 --- a/src/mad.h +++ b/src/mad.h @@ -14,6 +14,7 @@ #endif #ifdef HAVE_MAD +#include /* The Memory Allocation Debugging system */ @@ -32,6 +33,7 @@ #define calloc(x, y) mad_alloc ((x) * (y), __FILE__, __LINE__) #define realloc(x, y) mad_realloc (x, y, __FILE__, __LINE__) #define xmalloc(x, y) mad_alloc (x, __FILE__, __LINE__) +#undef strdup #define strdup(x) mad_strdup (x, __FILE__, __LINE__) #define free(x) mad_free (x, __FILE__, __LINE__) @@ -49,8 +51,12 @@ #define g_realloc(x, y) mad_realloc (x, y, __FILE__, __LINE__) #define g_strdup(x) mad_strdup (x, __FILE__, __LINE__) #define g_free(x) mad_free (x, __FILE__, __LINE__) +#define g_strconcat mad_strconcat +#define g_strdup_printf mad_strdup_printf +#define g_strdup_vprintf mad_strdup_vprintf -void mad_set_debug (char *file); +void mad_init (void); +void mad_set_debug (const char *file); void mad_check (char *file, int line); void *mad_alloc (int size, char *file, int line); void *mad_alloc0 (int size, char *file, int line); @@ -59,9 +65,13 @@ char *mad_strdup (const char *s, char *file, int line); void mad_free (void *ptr, char *file, int line); void mad_finalize (char *file, int line); char *mad_tempnam (char *s1, char *s2); +char *mad_strconcat (const char *first, ...); +char *mad_strdup_printf (const char *format, ...); +char *mad_strdup_vprintf (const char *format, va_list args); #else +#define mad_init() #define mad_finalize(x, y) #define mad_check(file,line) diff --git a/src/main.c b/src/main.c index 00a0ded0f..392625313 100644 --- a/src/main.c +++ b/src/main.c @@ -2949,6 +2949,7 @@ main (int argc, char *argv []) setlocale (LC_ALL, ""); bindtextdomain ("mc", LOCALEDIR); textdomain ("mc"); + mad_init (); #if 0 /* This is here to debug startup stuff */ { diff --git a/src/option.c b/src/option.c index 293f44648..93efac1f8 100644 --- a/src/option.c +++ b/src/option.c @@ -26,9 +26,8 @@ #ifdef HAVE_UNISTD_H # include #endif +#include "global.h" #include "tty.h" -#include "mad.h" -#include "util.h" #include "win.h" #include "color.h" #include "dlg.h" diff --git a/src/user.c b/src/user.c index c1b02138d..914552b58 100644 --- a/src/user.c +++ b/src/user.c @@ -246,19 +246,19 @@ char *expand_format (char c, int quote) return g_strdup (""); } -/* Checks for shell patterns defination */ +/* Checks for shell patterns definition */ char *check_patterns (char *p) { - const char *def_name = "shell_patterns="; + static const char def_name [] = "shell_patterns="; int value; - if (strncmp (p, def_name, sizeof (def_name)) == 0){ - p += strlen (def_name); + if (strncmp (p, def_name, sizeof (def_name) - 1) == 0){ + p += sizeof (def_name) - 1; value = *p++ - '0'; if (value == 0 || value == 1) easy_patterns = value; else - message (1, MSG_ERROR, _(" Invalid shell pattern defination \"%c\". "), value + '0'); + message (1, MSG_ERROR, _(" Invalid shell pattern definition \"%c\". "), value + '0'); } while (*p == '\n' || *p == '\t' || *p == ' ') p++; return p; diff --git a/src/util.c b/src/util.c index af74edd38..41e6e52e0 100644 --- a/src/util.c +++ b/src/util.c @@ -328,7 +328,7 @@ char *string_perm (mode_t mode_bits) if (ismode (mode_bits, S_IFBLK)) mode [0] = 'b'; if (ismode (mode_bits, S_ISVTX)) mode [9] = (mode [9] == 'x') ? 't' : 'T'; if (ismode (mode_bits, S_IFLNK)) mode [0] = 'l'; - if (ismode (mode_bits, S_IFIFO)) mode [0] = 's'; + if (ismode (mode_bits, S_IFIFO)) mode [0] = 'p'; #endif return mode; } @@ -1271,64 +1271,3 @@ concat_dir_and_file (const char *dir, const char *file) return g_strconcat (dir, PATH_SEP_STR, file, NULL); } -#ifdef HAVE_MAD -char *mad_strconcat (const char *first, ...) -{ - va_list ap; - long len; - char *data, *result; - - if (!first) - return 0; - - len = strlen (first) + 1; - va_start (ap, first); - - while ((data = va_arg (ap, char *)) != 0) - len += strlen (data); - - result = g_malloc (len); - - va_end (ap); - - va_start (ap, first); - strcpy (result, first); - - while ((data = va_arg (ap, char *)) != 0) - strcat (result, data); - - va_end (ap); - - return result; -} - -/* This two functions grabbed from GLib's gstrfuncs.c */ -char* -mad_strdup_vprintf (const char *format, va_list args1) -{ - char *buffer; - va_list args2; - - G_VA_COPY (args2, args1); - - buffer = g_new (char, g_printf_string_upper_bound (format, args1)); - - vsprintf (buffer, format, args2); - va_end (args2); - - return buffer; -} - -char* -mad_strdup_printf (const char *format, ...) -{ - char *buffer; - va_list args; - - va_start (args, format); - buffer = g_strdup_vprintf (format, args); - va_end (args); - - return buffer; -} -#endif /* HAVE_MAD */ diff --git a/src/util.h b/src/util.h index d4ce57816..6d87ae04f 100644 --- a/src/util.h +++ b/src/util.h @@ -41,16 +41,6 @@ char *g_readlink (char *path); extern int align_extensions; -#ifdef HAVE_MAD -char *mad_strconcat (const char *first, ...); -char *mad_strdup_printf (const char *format, ...); -char *mad_strdup_vprintf (const char *format, va_list args); - -#define g_strconcat mad_strconcat -#define g_strdup_printf mad_strdup_printf -#define g_strdup_vprintf mad_strdup_vprintf -#endif - /* Profile managing functions */ int set_int (char *, char *, int); int get_int (char *, char *, int); diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 5e04177c6..b402b72bc 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,10 @@ +1999-09-19 Norbert Warmuth + + * ftpfs.c (ftpfs_set_debug), vfs.h: added const qualifier. + + * mcserv.c: removed definition of mad_strconcat which is also + in mad.c. + 1999-09-17 Federico Mena Quintero * smbfs.c: #define NO_CONFIG_H before including the samba diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 7b4cada21..4c42cf8aa 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1817,7 +1817,7 @@ static int ftpfs_rmdir (vfs *me, char *path) return send_ftp_command(path, "RMD %s", OPT_FLUSH); } -void ftpfs_set_debug (char *file) +void ftpfs_set_debug (const char *file) { logfile = fopen (file, "w+"); } diff --git a/vfs/mcserv.c b/vfs/mcserv.c index a5e9e95c6..4195106c5 100644 --- a/vfs/mcserv.c +++ b/vfs/mcserv.c @@ -1311,35 +1311,5 @@ void vfs_die( char *m ) { fprintf (stderr, m); exit (1); - } -#ifdef HAVE_MAD -char * mad_strconcat (const char *first, ...) -{ - va_list ap; - long len; - char *data, *result; - - if (!first) - return 0; - - len = strlen (first) + 1; - va_start (ap, first); - - while ((data = va_arg (ap, char *)) != 0) - len += strlen (data); - - result = g_malloc (len); - - va_end (ap); - - va_start (ap, first); - strcpy (result, first); - - while ((data = va_arg (ap, char *)) != 0) - strcat (result, data); - - va_end (ap); - - return result; } -#endif /* HAVE_MAD */ + diff --git a/vfs/vfs.h b/vfs/vfs.h index 86fa5e009..90bdad7bb 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -180,7 +180,7 @@ struct utimbuf { void vfs_fill_names (void (*)(char *)); char *vfs_translate_url (char *); - void ftpfs_set_debug (char *file); + void ftpfs_set_debug (const char *file); #ifdef USE_NETCODE void ftpfs_hint_reread(int reread); void ftpfs_flushdir(void);