diff options
-rw-r--r-- | Makefile.bsd-wrapper | 5 | ||||
-rw-r--r-- | src/menus.c | 10 | ||||
-rw-r--r-- | src/system.twmrc | 56 | ||||
-rw-r--r-- | src/util.c | 21 |
4 files changed, 68 insertions, 24 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 41f5bad..4cbe751 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 } @@ -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; } @@ -354,24 +351,22 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp) pm = XmuLocateBitmapFile(ScreenOfDisplay(dpy, Scr->screen), bigname, NULL, 0, (int *) widthp, (int *) heightp, &HotX, &HotY); if (pm == None && Scr->IconDirectory && bigname[0] != '/') { - free(bigname); + free (bigname); /* * 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) { + if (XReadBitmapFile (dpy, Scr->Root, bigname, widthp, heightp, &pm, + &HotX, &HotY) != BitmapSuccess) { pm = None; } } - free(bigname); + free (bigname); if (pm == None) { twmWarning("unable to find bitmap \"%s\"", name); } |