* Let's tell we are using GTK+
@ 2003-08-03 15:14 Terje Rosten
2003-08-04 1:20 ` Miles Bader
2003-08-04 8:33 ` Lute Kamstra
0 siblings, 2 replies; 23+ messages in thread
From: Terje Rosten @ 2003-08-03 15:14 UTC (permalink / raw)
Here are two patches which together let the lisp function
emacs-version tell about the presence of GTK+ support.
Please apply.
Thanks,
- Terje
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.590
diff -c -r1.590 xfns.c
*** src/xfns.c 31 Jul 2003 16:10:53 -0000 1.590
--- src/xfns.c 3 Aug 2003 14:52:35 -0000
***************
*** 10886,10891 ****
--- 10886,10895 ----
#endif /* USE_MOTIF */
#endif /* USE_X_TOOLKIT */
+ #ifdef USE_GTK
+ Fprovide (intern ("gtk+-toolkit"), Qnil);
+ #endif /* USE_GTK */
+
/* X window properties. */
defsubr (&Sx_change_window_property);
defsubr (&Sx_delete_window_property);
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.3331
diff -c -r1.3331 ChangeLog
*** src/ChangeLog 31 Jul 2003 16:10:53 -0000 1.3331
--- src/ChangeLog 3 Aug 2003 14:52:37 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2003-08-03 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * xfns.c (syms_of_xfns): Let's tell we are using GTK+.
+
2003-07-31 Jan Djärv <jan.h.d@swipnet.se>
* xfns.c (xg_set_icon): Rewrite to compile with GTK 2.0 and 2.2.
Index: lisp/version.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/version.el,v
retrieving revision 2.32
diff -c -r2.32 version.el
*** lisp/version.el 4 Feb 2003 12:12:31 -0000 2.32
--- lisp/version.el 3 Aug 2003 14:53:36 -0000
***************
*** 62,67 ****
--- 62,68 ----
(cond ((featurep 'motif)
(concat ", " (substring motif-version-string 4)))
((featurep 'x-toolkit) ", X toolkit")
+ ((featurep 'gtk+-toolkit) ", GTK+ toolkit")
(t ""))
(if (and (boundp 'x-toolkit-scroll-bars)
(memq x-toolkit-scroll-bars '(xaw xaw3d)))
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.5321
diff -c -r1.5321 ChangeLog
*** lisp/ChangeLog 2 Aug 2003 20:36:51 -0000 1.5321
--- lisp/ChangeLog 3 Aug 2003 14:53:39 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2003-08-03 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * version.el (emacs-version): Check for gtk+-toolkit.
+
2003-08-02 Andreas Schwab <schwab@suse.de>
* apropos.el (apropos-words-to-regexp): Only add `wild' if `words'
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-03 15:14 Let's tell we are using GTK+ Terje Rosten
@ 2003-08-04 1:20 ` Miles Bader
2003-08-04 7:33 ` Terje Rosten
` (2 more replies)
2003-08-04 8:33 ` Lute Kamstra
1 sibling, 3 replies; 23+ messages in thread
From: Miles Bader @ 2003-08-04 1:20 UTC (permalink / raw)
Cc: emacs-devel
Do people really always include the `+' in the name? It seems sort of
superfluous and annoying in this case. Why not just use the symbol
`gtk-toolkit' for emacs?
-Miles
--
Suburbia: where they tear out the trees and then name streets after them.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 1:20 ` Miles Bader
@ 2003-08-04 7:33 ` Terje Rosten
2003-08-04 17:31 ` Paul Jarc
2003-08-05 19:15 ` Richard Stallman
2 siblings, 0 replies; 23+ messages in thread
From: Terje Rosten @ 2003-08-04 7:33 UTC (permalink / raw)
Cc: emacs-devel
* Miles Bader
|
| Do people really always include the `+' in the name?
I don't know.
| It seems sort of superfluous and annoying in this case. Why not
| just use the symbol `gtk-toolkit' for emacs?
That's fine. Want a updated patch?
- Terje
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-03 15:14 Let's tell we are using GTK+ Terje Rosten
2003-08-04 1:20 ` Miles Bader
@ 2003-08-04 8:33 ` Lute Kamstra
2003-08-04 19:33 ` Terje Rosten
1 sibling, 1 reply; 23+ messages in thread
From: Lute Kamstra @ 2003-08-04 8:33 UTC (permalink / raw)
Cc: emacs-devel
Terje Rosten <terjeros@phys.ntnu.no> writes:
> Here are two patches which together let the lisp function
> emacs-version tell about the presence of GTK+ support.
[...]
> Index: lisp/version.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/version.el,v
> retrieving revision 2.32
> diff -c -r2.32 version.el
> *** lisp/version.el 4 Feb 2003 12:12:31 -0000 2.32
> --- lisp/version.el 3 Aug 2003 14:53:36 -0000
> ***************
> *** 62,67 ****
> --- 62,68 ----
> (cond ((featurep 'motif)
> (concat ", " (substring motif-version-string 4)))
> ((featurep 'x-toolkit) ", X toolkit")
> + ((featurep 'gtk+-toolkit) ", GTK+ toolkit")
Maybe the GTK version should be mentioned as well. Handy for bug reports.
> (t ""))
> (if (and (boundp 'x-toolkit-scroll-bars)
> (memq x-toolkit-scroll-bars '(xaw xaw3d)))
[...]
Lute.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 1:20 ` Miles Bader
2003-08-04 7:33 ` Terje Rosten
@ 2003-08-04 17:31 ` Paul Jarc
2003-08-05 1:27 ` Miles Bader
2003-08-05 4:42 ` Stephen J. Turnbull
2003-08-05 19:15 ` Richard Stallman
2 siblings, 2 replies; 23+ messages in thread
From: Paul Jarc @ 2003-08-04 17:31 UTC (permalink / raw)
Cc: terjeros, emacs-devel
Miles Bader <miles@gnu.org> wrote:
> Do people really always include the `+' in the name? It seems sort of
> superfluous and annoying in this case. Why not just use the symbol
> `gtk-toolkit' for emacs?
It would be nice if the same name were used everywhere. So in the
absence of any concrete problem, I'd prefer "gtk+", since that's the
name given to that package by its maintainers. What makes + any more
superfluous or annoying than g, t, or k?
paul
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 8:33 ` Lute Kamstra
@ 2003-08-04 19:33 ` Terje Rosten
2003-08-19 9:46 ` Lute Kamstra
0 siblings, 1 reply; 23+ messages in thread
From: Terje Rosten @ 2003-08-04 19:33 UTC (permalink / raw)
* Lute Kamstra
|
| Maybe the GTK version should be mentioned as well.
Updated patches with version information and the (annoying?) +
sign removed. emacs-version will now display something like this:
GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, GTK+ 2.2.1) of 2003-08-04 on
myhost.net
- Terje
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.590
diff -u -r1.590 xfns.c
--- src/xfns.c 31 Jul 2003 16:10:53 -0000 1.590
+++ src/xfns.c 4 Aug 2003 19:27:05 -0000
@@ -125,6 +125,14 @@
#endif /* USE_X_TOOLKIT */
+#ifdef USE_GTK
+
+/* GTK+ version info */
+
+static Lisp_Object Vgtk_version_string;
+
+#endif /* USE_GTK */
+
#ifdef HAVE_X11R4
#define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
#else
@@ -10885,6 +10893,19 @@
Vmotif_version_string = build_string (XmVERSION_STRING);
#endif /* USE_MOTIF */
#endif /* USE_X_TOOLKIT */
+
+#ifdef USE_GTK
+ Fprovide (intern ("gtk-toolkit"), Qnil);
+
+ DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
+ doc: /* Version info for GTK+. */);
+ {
+ char gtk_version[8];
+ sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
+ GTK_MICRO_VERSION);
+ Vgtk_version_string = build_string (gtk_version);
+ }
+#endif /* USE_GTK */
/* X window properties. */
defsubr (&Sx_change_window_property);
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.3331
diff -u -r1.3331 ChangeLog
--- src/ChangeLog 31 Jul 2003 16:10:53 -0000 1.3331
+++ src/ChangeLog 4 Aug 2003 19:27:08 -0000
@@ -1,3 +1,7 @@
+2003-08-04 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * xfns.c (syms_of_xfns): Add information about GTK+ version.
+
2003-07-31 Jan Djärv <jan.h.d@swipnet.se>
* xfns.c (xg_set_icon): Rewrite to compile with GTK 2.0 and 2.2.
Index: lisp/version.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/version.el,v
retrieving revision 2.32
diff -u -r2.32 version.el
--- lisp/version.el 4 Feb 2003 12:12:31 -0000 2.32
+++ lisp/version.el 4 Aug 2003 19:26:46 -0000
@@ -62,6 +62,8 @@
(cond ((featurep 'motif)
(concat ", " (substring motif-version-string 4)))
((featurep 'x-toolkit) ", X toolkit")
+ ((featurep 'gtk-toolkit)
+ (concat ", GTK+ " gtk-version-string))
(t ""))
(if (and (boundp 'x-toolkit-scroll-bars)
(memq x-toolkit-scroll-bars '(xaw xaw3d)))
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.5325
diff -u -r1.5325 ChangeLog
--- lisp/ChangeLog 3 Aug 2003 14:10:33 -0000 1.5325
+++ lisp/ChangeLog 4 Aug 2003 19:26:48 -0000
@@ -1,3 +1,7 @@
+2003-08-04 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * version.el (emacs-version): Check for gtk-toolkit.
+
2003-08-03 Glenn Morris <gmorris@ast.cam.ac.uk>
* calendar/calendar.el (diary-file, diary-file-name-prefix)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 17:31 ` Paul Jarc
@ 2003-08-05 1:27 ` Miles Bader
2003-08-05 4:42 ` Stephen J. Turnbull
1 sibling, 0 replies; 23+ messages in thread
From: Miles Bader @ 2003-08-05 1:27 UTC (permalink / raw)
Cc: emacs-devel
Paul Jarc wrote:
> > Do people really always include the `+' in the name? It seems sort of
> > superfluous and annoying in this case. Why not just use the symbol
> > `gtk-toolkit' for emacs?
>
> It would be nice if the same name were used everywhere. So in the
> absence of any concrete problem, I'd prefer "gtk+", since that's the
> name given to that package by its maintainers.
It's not used consistently as it is; in fact, it seems to be used more
often _without_ the `+' than with it, e.g.:
name of the library: libgtk.so
name of the init file: .gtkrc
name of include file: <gtk-2.0/gtk/gtk.h> (thrice!)
name of the feature macro: USE_GTK (in emacs)
prefix used by functions: gtk_...
path for rc file in themes: gtk/gtkrc
Really the only place the `+' ever seems to be used is in documentation;
otherwise dropping it is apparently the convention, especially in
`technical' contexts.
> What makes + any more superfluous or annoying than g, t, or k?
Because in contexts like this (naming of symbols used in an programming
interface), punctuation tends to be be one of two things:
(1) Noise added for readability, usually in a standard way (e.g., `_'
in function names); usually in this case it acts basically like
whitespace, and so tends to be ignored.
(2) `Meaningful,' but again, used in a very stylized fashion, e.g., the
`?' suffix used for scheme predicates, or various C conventions for
underline prefixes.
Anything that doesn't follow these conventions ends up being harder to
use, because your brain likes to force things to fit with rules it's
used to, even when it really shouldn't.
This is especially true with `+', as it's visually not all that distinct
from other characters that _are_ used in one of the above standardized
ways (and in the case of the suggested emacs lisp symbol, the `+' was
adjacent to a `-', which makes things even more fuzzy).
-Miles
--
80% of success is just showing up. --Woody Allen
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 17:31 ` Paul Jarc
2003-08-05 1:27 ` Miles Bader
@ 2003-08-05 4:42 ` Stephen J. Turnbull
1 sibling, 0 replies; 23+ messages in thread
From: Stephen J. Turnbull @ 2003-08-05 4:42 UTC (permalink / raw)
Cc: terjeros, emacs-devel
>>>>> "Paul" == Paul Jarc <prj@po.cwru.edu> writes:
Paul> It would be nice if the same name were used everywhere. So
Paul> in the absence of any concrete problem, I'd prefer "gtk+",
Paul> since that's the name given to that package by its
Paul> maintainers. What makes + any more superfluous or annoying
Paul> than g, t, or k?
Nothing. But common practice seems to be to drop the "+". For
example, Debian shows 251 packages containing the string "gtk", of
which only 2 contain "gtk+". None of the library names contain the
"+". Fink (Mac OS X) names the GTK+ library and doc packages
themselves as "gtk+", but all the packages that call GTK+ use the
shorter "gtk" (or even shorter leading "g").
So if Debian and Fink are at all representative, having the same name
everywhere favors "gtk" over "gtk+".
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 1:20 ` Miles Bader
2003-08-04 7:33 ` Terje Rosten
2003-08-04 17:31 ` Paul Jarc
@ 2003-08-05 19:15 ` Richard Stallman
2003-08-05 23:04 ` Kenichi Handa
2 siblings, 1 reply; 23+ messages in thread
From: Richard Stallman @ 2003-08-05 19:15 UTC (permalink / raw)
Cc: lektu, terjeros, emacs-devel
Do people really always include the `+' in the name? It seems sort of
superfluous and annoying in this case. Why not just use the symbol
`gtk-toolkit' for emacs?
I agree with you.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-05 19:15 ` Richard Stallman
@ 2003-08-05 23:04 ` Kenichi Handa
2003-08-05 23:59 ` Masatake YAMATO
2003-08-06 7:56 ` Terje Rosten
0 siblings, 2 replies; 23+ messages in thread
From: Kenichi Handa @ 2003-08-05 23:04 UTC (permalink / raw)
Cc: terjeros, emacs-devel, lektu, miles
In article <E19k7Gy-0002W0-O1@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> Do people really always include the `+' in the name? It seems sort of
> superfluous and annoying in this case. Why not just use the symbol
> `gtk-toolkit' for emacs?
> I agree with you.
As "gtk" stands for "Gimp ToolKit", "gtk-toolkit" sounds
strange to me.
---
Ken'ichi HANDA
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-05 23:04 ` Kenichi Handa
@ 2003-08-05 23:59 ` Masatake YAMATO
2003-08-06 7:56 ` Terje Rosten
1 sibling, 0 replies; 23+ messages in thread
From: Masatake YAMATO @ 2003-08-05 23:59 UTC (permalink / raw)
Cc: miles, lektu, emacs-devel, rms, terjeros
;; Off topic
> In article <E19k7Gy-0002W0-O1@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> > Do people really always include the `+' in the name? It seems sort of
> > superfluous and annoying in this case. Why not just use the symbol
> > `gtk-toolkit' for emacs?
>
> > I agree with you.
>
> As "gtk" stands for "Gimp ToolKit", "gtk-toolkit" sounds
> strange to me.
Few years ago I heard that NT of WindowsNT meant for "New Technology"
from someone. However, I can see "Windows 2000 --- based on NT
Technology" on the screen when MS-Windows2000 is booted:-P
Masatake
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-05 23:04 ` Kenichi Handa
2003-08-05 23:59 ` Masatake YAMATO
@ 2003-08-06 7:56 ` Terje Rosten
1 sibling, 0 replies; 23+ messages in thread
From: Terje Rosten @ 2003-08-06 7:56 UTC (permalink / raw)
Cc: miles, lektu, rms, handa
* Kenichi Handa
|
| As "gtk" stands for "Gimp ToolKit", "gtk-toolkit" sounds strange to
| me.
Agree. Updated patches follows.
Please apply.
Thanks,
- Terje
src/ part:
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.590
diff -c -r1.590 xfns.c
*** src/xfns.c 31 Jul 2003 16:10:53 -0000 1.590
--- src/xfns.c 6 Aug 2003 07:42:47 -0000
***************
*** 125,130 ****
--- 125,138 ----
#endif /* USE_X_TOOLKIT */
+ #ifdef USE_GTK
+
+ /* GTK+ version info */
+
+ static Lisp_Object Vgtk_version_string;
+
+ #endif /* USE_GTK */
+
#ifdef HAVE_X11R4
#define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
#else
***************
*** 10885,10890 ****
--- 10893,10911 ----
Vmotif_version_string = build_string (XmVERSION_STRING);
#endif /* USE_MOTIF */
#endif /* USE_X_TOOLKIT */
+
+ #ifdef USE_GTK
+ Fprovide (intern ("gtk"), Qnil);
+
+ DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
+ doc: /* Version info for GTK+. */);
+ {
+ char gtk_version[12];
+ sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
+ GTK_MICRO_VERSION);
+ Vgtk_version_string = build_string (gtk_version);
+ }
+ #endif /* USE_GTK */
/* X window properties. */
defsubr (&Sx_change_window_property);
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.3331
diff -c -r1.3331 ChangeLog
*** src/ChangeLog 31 Jul 2003 16:10:53 -0000 1.3331
--- src/ChangeLog 6 Aug 2003 07:42:48 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-08-06 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * xfns.c (Vgtk_version_string): New variable.
+ (syms_of_xfns): DEFVAR_LISP it. Provide gtk.
+
2003-07-31 Jan Djärv <jan.h.d@swipnet.se>
* xfns.c (xg_set_icon): Rewrite to compile with GTK 2.0 and 2.2.
lisp/ part:
Index: lisp/version.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/version.el,v
retrieving revision 2.32
diff -c -r2.32 version.el
*** lisp/version.el 4 Feb 2003 12:12:31 -0000 2.32
--- lisp/version.el 6 Aug 2003 07:42:27 -0000
***************
*** 62,67 ****
--- 62,69 ----
(cond ((featurep 'motif)
(concat ", " (substring motif-version-string 4)))
((featurep 'x-toolkit) ", X toolkit")
+ ((featurep 'gtk)
+ (concat ", GTK+ " gtk-version-string))
(t ""))
(if (and (boundp 'x-toolkit-scroll-bars)
(memq x-toolkit-scroll-bars '(xaw xaw3d)))
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.5328
diff -c -r1.5328 ChangeLog
*** lisp/ChangeLog 6 Aug 2003 01:11:11 -0000 1.5328
--- lisp/ChangeLog 6 Aug 2003 07:42:32 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2003-08-06 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * version.el (emacs-version): Check for gtk. Include gtk version info.
+
2003-08-05 Richard M. Stallman <rms@gnu.org>
* emacs-lisp/testcover.el (noreturn): Report error if does return.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-04 19:33 ` Terje Rosten
@ 2003-08-19 9:46 ` Lute Kamstra
2003-08-19 10:46 ` Terje Rosten
` (3 more replies)
0 siblings, 4 replies; 23+ messages in thread
From: Lute Kamstra @ 2003-08-19 9:46 UTC (permalink / raw)
Cc: emacs-devel
Terje Rosten <terjeros@phys.ntnu.no> writes:
> * Lute Kamstra
> |
> | Maybe the GTK version should be mentioned as well.
>
> Updated patches with version information and the (annoying?) +
> sign removed. emacs-version will now display something like this:
>
> GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, GTK+ 2.2.1) of 2003-08-04 on
> myhost.net
I like it, but...
[...]
> + {
> + char gtk_version[8];
> + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
> + GTK_MICRO_VERSION);
> + Vgtk_version_string = build_string (gtk_version);
> + }
this seems vulnerable to a buffer overflow. It is acceptable to use
snprintf instead, or isn't that portable enough? (I'm not really
intimate with C.) What could be used instead, a larger string?
Lute.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-19 9:46 ` Lute Kamstra
@ 2003-08-19 10:46 ` Terje Rosten
2003-08-19 12:34 ` Lute Kamstra
2003-08-19 13:39 ` José Roberto B. de A. Monteiro
` (2 subsequent siblings)
3 siblings, 1 reply; 23+ messages in thread
From: Terje Rosten @ 2003-08-19 10:46 UTC (permalink / raw)
Cc: emacs-devel
* Lute Kamstra
|
| > + {
| > + char gtk_version[8];
| > + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
| > + GTK_MICRO_VERSION);
| > + Vgtk_version_string = build_string (gtk_version);
| > + }
|
| this seems vulnerable to a buffer overflow.
That's right. In a updated patch I increased to gtk_version[12], but
that's not large enough if a GTK+ release is named e.g 2.2.cvs20030819.
| It is acceptable to use snprintf instead, or isn't that portable
| enough? (I'm not really intimate with C.) What could be used
| instead, a larger string?
What about using glib? If GTK+ is available then is glib available
too. A updated patch using the glib function g_snprintf is included.
- Terje
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.5348
diff -c -r1.5348 ChangeLog
*** lisp/ChangeLog 18 Aug 2003 22:46:02 -0000 1.5348
--- lisp/ChangeLog 19 Aug 2003 10:42:16 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-08-18 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * version.el (emacs-version): Check for gtk. Include gtk version
+ info.
+
2003-08-18 Luc Teirlinck <teirllm@mail.auburn.edu>
* wid-edit.el (widget-echo-help): Make it handle expressions that
Index: lisp/version.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/version.el,v
retrieving revision 2.32
diff -c -r2.32 version.el
*** lisp/version.el 4 Feb 2003 12:12:31 -0000 2.32
--- lisp/version.el 19 Aug 2003 10:42:16 -0000
***************
*** 62,67 ****
--- 62,69 ----
(cond ((featurep 'motif)
(concat ", " (substring motif-version-string 4)))
((featurep 'x-toolkit) ", X toolkit")
+ ((featurep 'gtk)
+ (concat ", GTK+ " gtk-version-string))
(t ""))
(if (and (boundp 'x-toolkit-scroll-bars)
(memq x-toolkit-scroll-bars '(xaw xaw3d)))
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.3335
diff -c -r1.3335 ChangeLog
*** src/ChangeLog 17 Aug 2003 00:25:37 -0000 1.3335
--- src/ChangeLog 19 Aug 2003 10:42:18 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-08-18 Terje Rosten <terjeros@phys.ntnu.no>
+
+ * xfns.c (Vgtk_version_string): New variable.
+ (syms_of_xfns): DEFVAR_LISP it. Provide gtk.
+
2003-08-16 Richard M. Stallman <rms@gnu.org>
* editfns.c (Fencode_time): Doc fix.
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.590
diff -c -r1.590 xfns.c
*** src/xfns.c 31 Jul 2003 16:10:53 -0000 1.590
--- src/xfns.c 19 Aug 2003 10:42:19 -0000
***************
*** 125,130 ****
--- 125,138 ----
#endif /* USE_X_TOOLKIT */
+ #ifdef USE_GTK
+
+ /* GTK+ version info */
+
+ static Lisp_Object Vgtk_version_string;
+
+ #endif /* USE_GTK */
+
#ifdef HAVE_X11R4
#define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
#else
***************
*** 10885,10890 ****
--- 10893,10911 ----
Vmotif_version_string = build_string (XmVERSION_STRING);
#endif /* USE_MOTIF */
#endif /* USE_X_TOOLKIT */
+
+ #ifdef USE_GTK
+ Fprovide (intern ("gtk"), Qnil);
+
+ DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
+ doc: /* Version info for GTK+. */);
+ {
+ char gtk_version[12];
+ g_snprintf (gtk_version, sizeof (gtk_version), "%d.%d.%d",
+ GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+ Vgtk_version_string = build_string (gtk_version);
+ }
+ #endif /* USE_GTK */
/* X window properties. */
defsubr (&Sx_change_window_property);
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-19 10:46 ` Terje Rosten
@ 2003-08-19 12:34 ` Lute Kamstra
0 siblings, 0 replies; 23+ messages in thread
From: Lute Kamstra @ 2003-08-19 12:34 UTC (permalink / raw)
Cc: emacs-devel
Terje Rosten <terjeros@phys.ntnu.no> writes:
> * Lute Kamstra
> |
> | > + {
> | > + char gtk_version[8];
> | > + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
> | > + GTK_MICRO_VERSION);
> | > + Vgtk_version_string = build_string (gtk_version);
> | > + }
> |
> | this seems vulnerable to a buffer overflow.
>
> That's right. In a updated patch I increased to gtk_version[12], but
> that's not large enough if a GTK+ release is named e.g
> 2.2.cvs20030819.
So, let's make it 40 then, to be on the safe side.
> | It is acceptable to use snprintf instead, or isn't that portable
> | enough? (I'm not really intimate with C.) What could be used
> | instead, a larger string?
>
> What about using glib? If GTK+ is available then is glib available
> too. A updated patch using the glib function g_snprintf is included.
Makes sense.
Terje, did you sign copyright papers for Emacs? If so I'll apply your
patch in a few days if nobody objects.
Lute.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-19 9:46 ` Lute Kamstra
2003-08-19 10:46 ` Terje Rosten
@ 2003-08-19 13:39 ` José Roberto B. de A. Monteiro
2003-08-19 14:31 ` Betoes
2003-08-20 18:24 ` Betoes
3 siblings, 0 replies; 23+ messages in thread
From: José Roberto B. de A. Monteiro @ 2003-08-19 13:39 UTC (permalink / raw)
On Tue, Aug 19, 2003 at 11:46:21AM +0200, Lute Kamstra wrote:
> Terje Rosten <terjeros@phys.ntnu.no> writes:
>
> > * Lute Kamstra
> > |
> > | Maybe the GTK version should be mentioned as well.
> >
> > Updated patches with version information and the (annoying?) +
> > sign removed. emacs-version will now display something like this:
> >
> > GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, GTK+ 2.2.1) of 2003-08-04 on
> > myhost.net
>
> I like it, but...
>
> [...]
>
> > + {
> > + char gtk_version[8];
> > + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
> > + GTK_MICRO_VERSION);
> > + Vgtk_version_string = build_string (gtk_version);
> > + }
>
> this seems vulnerable to a buffer overflow. It is acceptable to use
> snprintf instead, or isn't that portable enough? (I'm not really
> intimate with C.) What could be used instead, a larger string?
I believe, asprintf would be better, but I don't know about portability...
{
char * gtk_version;
asprintf (>k_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
GTK_MICRO_VERSION);
Vgtk_version_string = build_string (gtk_version);
free(gtk_version);
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-19 9:46 ` Lute Kamstra
2003-08-19 10:46 ` Terje Rosten
2003-08-19 13:39 ` José Roberto B. de A. Monteiro
@ 2003-08-19 14:31 ` Betoes
2003-08-20 18:24 ` Betoes
3 siblings, 0 replies; 23+ messages in thread
From: Betoes @ 2003-08-19 14:31 UTC (permalink / raw)
On Tue, Aug 19, 2003 at 11:46:21AM +0200, Lute Kamstra wrote:
> Terje Rosten <terjeros@phys.ntnu.no> writes:
>
> > * Lute Kamstra
> > |
> > | Maybe the GTK version should be mentioned as well.
> >
> > Updated patches with version information and the (annoying?) +
> > sign removed. emacs-version will now display something like this:
> >
> > GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, GTK+ 2.2.1) of 2003-08-04 on
> > myhost.net
>
> I like it, but...
>
> [...]
>
> > + {
> > + char gtk_version[8];
> > + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
> > + GTK_MICRO_VERSION);
> > + Vgtk_version_string = build_string (gtk_version);
> > + }
>
> this seems vulnerable to a buffer overflow. It is acceptable to use
> snprintf instead, or isn't that portable enough? (I'm not really
> intimate with C.) What could be used instead, a larger string?
I believe, asprintf would be better, but I don't know about portability...
{
char * gtk_version;
asprintf (>k_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
GTK_MICRO_VERSION);
Vgtk_version_string = build_string (gtk_version);
free(gtk_version);
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-19 9:46 ` Lute Kamstra
` (2 preceding siblings ...)
2003-08-19 14:31 ` Betoes
@ 2003-08-20 18:24 ` Betoes
2003-08-21 9:59 ` Andreas Schwab
2003-08-22 14:38 ` Richard Stallman
3 siblings, 2 replies; 23+ messages in thread
From: Betoes @ 2003-08-20 18:24 UTC (permalink / raw)
On Tue, Aug 19, 2003 at 11:46:21AM +0200, Lute Kamstra wrote:
> Terje Rosten <terjeros@phys.ntnu.no> writes:
>
> > * Lute Kamstra
> > |
> > | Maybe the GTK version should be mentioned as well.
> >
> > Updated patches with version information and the (annoying?) +
> > sign removed. emacs-version will now display something like this:
> >
> > GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, GTK+ 2.2.1) of 2003-08-04 on
> > myhost.net
>
> I like it, but...
>
> [...]
>
> > + {
> > + char gtk_version[8];
> > + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
> > + GTK_MICRO_VERSION);
> > + Vgtk_version_string = build_string (gtk_version);
> > + }
>
> this seems vulnerable to a buffer overflow. It is acceptable to use
> snprintf instead, or isn't that portable enough? (I'm not really
> intimate with C.) What could be used instead, a larger string?
I believe, asprintf would be better, but I don't know about portability...
{
char * gtk_version;
asprintf (>k_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
GTK_MICRO_VERSION);
Vgtk_version_string = build_string (gtk_version);
free(gtk_version);
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-20 18:24 ` Betoes
@ 2003-08-21 9:59 ` Andreas Schwab
2003-08-24 0:10 ` Richard Stallman
2003-08-22 14:38 ` Richard Stallman
1 sibling, 1 reply; 23+ messages in thread
From: Andreas Schwab @ 2003-08-21 9:59 UTC (permalink / raw)
Cc: emacs-devel
Betoes <betoes@member.fsf.org> writes:
|> I believe, asprintf would be better, but I don't know about portability...
It's a GNU extension, but a portable implementation is part of libiberty.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-20 18:24 ` Betoes
2003-08-21 9:59 ` Andreas Schwab
@ 2003-08-22 14:38 ` Richard Stallman
2003-08-23 20:07 ` Simon Josefsson
1 sibling, 1 reply; 23+ messages in thread
From: Richard Stallman @ 2003-08-22 14:38 UTC (permalink / raw)
Cc: emacs-devel
I believe, asprintf would be better, but I don't know about portability...
isn't asprintf a GNU libc extension?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-22 14:38 ` Richard Stallman
@ 2003-08-23 20:07 ` Simon Josefsson
0 siblings, 0 replies; 23+ messages in thread
From: Simon Josefsson @ 2003-08-23 20:07 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> I believe, asprintf would be better, but I don't know about portability...
>
> isn't asprintf a GNU libc extension?
Yes, although GNULib contain a portable stand-alone version of it,
suitable for inclusion in projects that need it. I don't think it is
worth adding it to Emacs just to solve this problem, though, as
simpler solutions to this problem exists, at least compared to
including a printf() implementation.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-21 9:59 ` Andreas Schwab
@ 2003-08-24 0:10 ` Richard Stallman
2003-08-24 10:28 ` Lute Kamstra
0 siblings, 1 reply; 23+ messages in thread
From: Richard Stallman @ 2003-08-24 0:10 UTC (permalink / raw)
Cc: emacs-devel
|> I believe, asprintf would be better, but I don't know about portability...
It's a GNU extension, but a portable implementation is part of libiberty.
It would be ok to use this if we copy that code into Emacs,
but if it is easy to avoid, let's avoid it.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Let's tell we are using GTK+
2003-08-24 0:10 ` Richard Stallman
@ 2003-08-24 10:28 ` Lute Kamstra
0 siblings, 0 replies; 23+ messages in thread
From: Lute Kamstra @ 2003-08-24 10:28 UTC (permalink / raw)
Cc: Andreas Schwab, emacs-devel
Richard Stallman <rms@gnu.org> writes:
> |> I believe, asprintf would be better, but I don't know about portability...
>
> It's a GNU extension, but a portable implementation is part of libiberty.
>
> It would be ok to use this if we copy that code into Emacs,
> but if it is easy to avoid, let's avoid it.
It's easy to avoid it by using g_snprintf from glib, a library
required for the GTK+ build of Emacs (as suggested by Terje Rosten).
I'll commit the patch tomorrow.
Lute.
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2003-08-24 10:28 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-03 15:14 Let's tell we are using GTK+ Terje Rosten
2003-08-04 1:20 ` Miles Bader
2003-08-04 7:33 ` Terje Rosten
2003-08-04 17:31 ` Paul Jarc
2003-08-05 1:27 ` Miles Bader
2003-08-05 4:42 ` Stephen J. Turnbull
2003-08-05 19:15 ` Richard Stallman
2003-08-05 23:04 ` Kenichi Handa
2003-08-05 23:59 ` Masatake YAMATO
2003-08-06 7:56 ` Terje Rosten
2003-08-04 8:33 ` Lute Kamstra
2003-08-04 19:33 ` Terje Rosten
2003-08-19 9:46 ` Lute Kamstra
2003-08-19 10:46 ` Terje Rosten
2003-08-19 12:34 ` Lute Kamstra
2003-08-19 13:39 ` José Roberto B. de A. Monteiro
2003-08-19 14:31 ` Betoes
2003-08-20 18:24 ` Betoes
2003-08-21 9:59 ` Andreas Schwab
2003-08-24 0:10 ` Richard Stallman
2003-08-24 10:28 ` Lute Kamstra
2003-08-22 14:38 ` Richard Stallman
2003-08-23 20:07 ` Simon Josefsson
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).