summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.bsd-wrapper5
-rw-r--r--src/menus.c10
-rw-r--r--src/system.twmrc56
-rw-r--r--src/util.c15
4 files changed, 65 insertions, 21 deletions
diff --git a/Makefile.bsd-wrapper b/Makefile.bsd-wrapper
new file mode 100644
index 0000000..0b229ee
--- /dev/null
+++ b/Makefile.bsd-wrapper
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile.bsd-wrapper,v 1.3 2006/11/28 19:04:48 matthieu Exp $
+
+CONFIGURE_ARGS= --datadir=/etc
+
+.include <bsd.xorg.mk>
diff --git a/src/menus.c b/src/menus.c
index 7814771..6e37279 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -1913,9 +1913,9 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
break;
case F_CUT:
- strcpy(tmp, action);
- strcat(tmp, "\n");
- XStoreBytes(dpy, tmp, (int) strlen(tmp));
+ strlcpy(tmp, action, sizeof(tmp));
+ strlcat(tmp, "\n", sizeof(tmp));
+ XStoreBytes(dpy, tmp, (int)strlen(tmp));
break;
case F_CUTFILE:
@@ -2312,8 +2312,8 @@ Execute(const char *s)
if (update != NULL) {
char *dot1;
- strcpy(update, display_eqls);
- strcat(update, ds);
+ strlcpy(update, display_eqls, need);
+ strlcat(update, ds, need);
colon = strrchr(update, ':');
dot1 = strchr(colon, '.'); /* first period after colon */
if (dot1 == NULL)
diff --git a/src/system.twmrc b/src/system.twmrc
index 548f5dd..f346dbe 100644
--- a/src/system.twmrc
+++ b/src/system.twmrc
@@ -69,6 +69,38 @@ Button2 = : iconmgr : f.iconify
menu "defops"
{
"Twm" f.title
+"XTerm" !"xterm &"
+"" f.nop
+"Utilities" f.menu "Utilities"
+"" f.nop
+"Window Ops" f.menu "Window Ops"
+"" f.nop
+"Kill" f.destroy
+"Delete" f.delete
+"" f.nop
+"Refresh" f.refresh
+"" f.nop
+"(Re)Start" f.menu "Restart"
+"Exit" f.menu "Quit"
+}
+
+menu "Utilities"
+{
+"Top" !"xterm -T Top -n Top -e top &"
+"Calculator" !"xcalc &"
+"Xman" !"xman &"
+"Xmag" !"xmag &"
+"Editres" !"editres &"
+"" f.nop
+#"XEmacs" !"xemacs &"
+#"Mail" !"xmh -font fixed &"
+#"" f.nop
+"XLock" !"xlock -mode random &"
+"Reset X defaults" !"xrdb -load $HOME/.Xdefaults"
+}
+
+menu "Window Ops"
+{
"Iconify" f.iconify
"Resize" f.resize
"Move" f.move
@@ -79,12 +111,24 @@ menu "defops"
"Unfocus" f.unfocus
"Show Iconmgr" f.showiconmgr
"Hide Iconmgr" f.hideiconmgr
+}
+
+menu "Restart"
+{
+"Restart" f.restart
"" f.nop
-"Xterm" f.exec "exec xterm &"
-"" f.nop
-"Kill" f.destroy
-"Delete" f.delete
+"twm" f.startwm "twm"
+"fvwm" f.startwm "fvwm"
+"wm2" f.startwm "wm2"
+"ctwm" f.startwm "ctwm"
+"mwm" f.startwm "mwm"
+"olwm" f.startwm "olwm"
"" f.nop
-"Restart" f.restart
-"Exit" f.quit
+"dummy" f.startwm "xterm"
+}
+menu "Quit"
+{
+"Don't quit" f.nop
+ "" f.nop
+"Really Quit" f.quit
}
diff --git a/src/util.c b/src/util.c
index 52f6148..e25206a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -255,20 +255,17 @@ char *
ExpandFilename(const char *name)
{
char *newname;
+ int retval;
if (name[0] != '~')
return strdup(name);
- newname = (char *) malloc((size_t) HomeLen + strlen(name) + 2);
- if (!newname) {
+ retval = asprintf(&newname, "%s/%s", Home, &name[1]);
+ if (retval == -1 || !newname) {
twmWarning("unable to allocate %lu bytes to expand filename %s/%s",
(unsigned long) HomeLen + (unsigned long) strlen(name) + 2,
Home, &name[1]);
}
- else {
- (void) sprintf(newname, "%s/%s", Home, &name[1]);
- }
-
return newname;
}
@@ -358,16 +355,14 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp)
/*
* Attempt to find icon in old IconDirectory (now obsolete)
*/
- bigname = (char *)
- malloc(strlen(name) + strlen(Scr->IconDirectory) + 2);
+ asprintf(&bigname, "%s/%s", Scr->IconDirectory, name);
if (!bigname) {
twmWarning("unable to allocate memory for \"%s/%s\"",
Scr->IconDirectory, name);
return None;
}
- (void) sprintf(bigname, "%s/%s", Scr->IconDirectory, name);
if (XReadBitmapFile(dpy, Scr->Root, bigname, widthp, heightp, &pm,
- &HotX, &HotY) != BitmapSuccess) {
+ &HotX, &HotY) != BitmapSuccess) {
pm = None;
}
}