[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright ./configure lib/label.c lib/pipe.c sr...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright ./configure lib/label.c lib/pipe.c sr... |
Date: |
Sat, 15 Apr 2006 02:47:13 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Branch:
Changes by: Jeffrey Bedard <address@hidden> 06/04/15 02:47:13
Modified files:
. : configure
lib : label.c pipe.c
src : ACE system.antiright
src/arshell : arguments.c update.c
Log message:
Fixed a long-standing memory leak in antiright_pipe_read.
Bumped version number to 2.15.
Refactored clockload applet code.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/configure.diff?tr1=1.64&tr2=1.65&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/lib/label.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/lib/pipe.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/ACE.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/system.antiright.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/arguments.c.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/update.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: antiright/configure
diff -u antiright/configure:1.64 antiright/configure:1.65
--- antiright/configure:1.64 Mon Mar 27 00:33:02 2006
+++ antiright/configure Sat Apr 15 02:47:13 2006
@@ -24,7 +24,7 @@
#
###############################################################################
-VERSION=2.14
+VERSION=2.15
DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"
ICONDIR=$PREFIX/include/X11/bitmaps/antiright
@@ -32,6 +32,11 @@
cp Makefile.in Makefile
+if [ "$1" = "-d" ]; then
+ echo Configuring with debug options...
+ CFLAGS="-g3 -Wall -W -Werror"
+fi
+
if [ "$PREFIX" = "" ]; then
PREFIX=/usr/local
fi
Index: antiright/lib/label.c
diff -u antiright/lib/label.c:1.6 antiright/lib/label.c:1.7
--- antiright/lib/label.c:1.6 Sat Jul 23 17:10:09 2005
+++ antiright/lib/label.c Sat Apr 15 02:47:13 2006
@@ -1,6 +1,6 @@
/*
AntiRight
- (c) 2003-2004 Jeffrey Bedard
+ (c) 2003-2006 Jeffrey Bedard
address@hidden
This file is part of AntiRight.
@@ -38,8 +38,9 @@
char *label_string)
{
XmString label_motif_string=XmStringCreateLocalized(label_string);
- XtVaSetValues(label_widget,
- XmNlabelString, label_motif_string,
- NULL);
+ ARCLARG;
+ antiright_set(XmNlabelString, (XtArgVal)label_motif_string);
+ antiright_set_values(label_widget);
XmStringFree(label_motif_string);
}
+
Index: antiright/lib/pipe.c
diff -u antiright/lib/pipe.c:1.4 antiright/lib/pipe.c:1.5
--- antiright/lib/pipe.c:1.4 Mon Jan 30 02:13:29 2006
+++ antiright/lib/pipe.c Sat Apr 15 02:47:13 2006
@@ -27,9 +27,9 @@
antiright_pipe_read(char *command_string)
{
char *text_string;
- /* Is BUFSIZ an appropriate constant for here? */
char buffer[BUFSIZ];
FILE *pipe_fp;
+ unsigned int buffer_size=BUFSIZ;
/* Execute the command indicated by command_string. */
/* Pipe is read-only. Stdout will be directed to it. */
@@ -42,10 +42,11 @@
/* Read in the rest of the buffer segments. */
while(fgets(buffer, BUFSIZ, pipe_fp))
{
- /* Append to previous buffer contents. */
- asprintf(&text_string, "%s%s", text_string, buffer);
+ buffer_size+=BUFSIZ;
+ text_string=(char*)realloc(text_string,buffer_size);
+ snprintf(text_string, buffer_size,
+ "%s%s", text_string, buffer);
}
-
/* Close the pipe once fgets() returns a false condition. */
pclose(pipe_fp);
Index: antiright/src/ACE
diff -u antiright/src/ACE:1.71 antiright/src/ACE:1.72
--- antiright/src/ACE:1.71 Tue Apr 4 03:00:43 2006
+++ antiright/src/ACE Sat Apr 15 02:47:13 2006
@@ -151,7 +151,8 @@
chmod u+x $tf
echo '#!/bin/sh' >> $tf
echo 'arshell -r 42 -W Manual\' >> $tf
- cd /usr/share/man/man$1
+ manual_root=$(ACE Manual_Root)
+ cd $manual_root/man$1
echo " -Al 'Manual Section "$1"' \\" >> $tf
for file in $(ls | cut -d. -f1); do
echo " 'ACE -A rmp "$1 $file"' \\" >> $tf
@@ -171,6 +172,10 @@
'ACE -A mbs 3' 'ACE -A mbs 4' 'ACE -A mbs 5'\
'ACE -A mbs 6' 'ACE -A mbs 7' 'ACE -A mbs 8' 'ACE -A mbs 9'
}
+Manual()
+{
+ Manual_Browser
+}
Man_Page()
{
rmp " " $1
@@ -226,7 +231,7 @@
'ACE File_Manager' \
'ACE -A Sticky_Note' \
'ACE Lock' \
- 'ACE -A Desktop' \
+ 'ACE -A Manual' \
'ACE Editor' \
'ACE -A Alarm' \
'ACE Load_Meter' \
@@ -341,7 +346,7 @@
{
new_value=$($ARSHELL\
-ADp "$1: [$(ACE_read_configuration_value $1)]")
- echo new value is $new_value
+ #echo new value is $new_value
if [ "$new_value" != "" ]; then
set_value $1 "$new_value"
fi
@@ -350,7 +355,7 @@
{
ACE_Check_Configuration_File
TMP=${TMPDIR:-/tmp}/ACE.$$
- echo "$ARSHELL -W Settings -Am -r 14"\\ > $TMP
+ echo "$ARSHELL -W Settings -Am -r 8"\\ > $TMP
for title in $(ACE_record_titles)
do
echo " \"ACE -A Settings_Node $title\""\\ >> $TMP
@@ -393,21 +398,6 @@
{
$ARSHELL -Uf 5000 -UL 'vmstat' -xrm '*fontList: fixed'
}
-CD_Player()
-{
- local xmcd_path="$(which xmcd)"
-
- # This allows the conditional to work with NetBSD's which command.
- if [ "$(echo $xmcd_path | cut -d ' ' -f 1)" = "no" ]; then
- xmcd_path=""
- fi
- # Run xmcd if available.
- if [ "$xmcd_path" != "" ]; then
- xmcd &
- else
- $ARSHELL -ADm 'You must install xmcd.'
- fi
-}
Alarm()
{
@@ -424,17 +414,17 @@
File_System_Panel()
{
$ARSHELL -Am -r 2 -W 'File Systems'\
- 'ACE Mount_File_System'\
- 'ACE Unmount_File_System'\
+ 'ACE -A Mount_File_System'\
+ 'ACE -A Unmount_File_System'\
'ACE See_Free_Space'\
- 'ACE Show_All_File_Systems'\
+ 'ACE -A Show_All_File_Systems'\
'ACE -A Diff'
}
Network_Panel()
{
$ARSHELL -Am -r 4 -W 'Network Panel'\
- 'ACE Open_Display' 'ACE Open_URL'\
+ 'ACE -A Open_Display' 'ACE Open_URL'\
'ACE -A ACE_peer_operation ftp'\
'ACE -A ACE_peer_operation telnet'\
'ACE -A ACE_Peer_operation ssh'\
@@ -455,17 +445,17 @@
Administration_Panel()
{
$ARSHELL -W Administration -Am -r 5 \
- 'ACE Fix_File_Permissions'\
+ 'ACE -A Secure_Permissions'\
'ACE Root_Shell'\
- 'ACE See_All_Processes'\
- 'ACE See_All_Users'\
- 'ACE See_Disk_Info'\
- 'ACE SysV_Init'\
- 'ACE See_Open_Ports'\
- 'ACE See_User_Processes'\
+ 'ACE -A See_All_Processes'\
+ 'ACE -A See_All_Users'\
+ 'ACE -A See_Disk_Info'\
+ 'ACE -A SysV_Init'\
+ 'ACE -A See_Open_Ports'\
+ 'ACE -A See_User_Processes'\
'ACE System_Monitor'\
'ACE -A VMStat & # Memory_Statistics' \
- 'arshell -A Uptime' \
+ 'ACE -A Uptime' \
'ACE -A Load_Meter'\
'ACE -A System_Accounting'\
'xload -bg red4 -fg yellow -hl yellow & # X_Load'
@@ -483,7 +473,7 @@
$ARSHELL -ADm 'SAR must be installed.' &
fi
}
-Fix_File_Permissions()
+Secure_Permissions()
{
chmod og-rwx ~/.*/*
}
Index: antiright/src/arshell/arguments.c
diff -u antiright/src/arshell/arguments.c:1.25
antiright/src/arshell/arguments.c:1.26
--- antiright/src/arshell/arguments.c:1.25 Mon Mar 27 00:59:46 2006
+++ antiright/src/arshell/arguments.c Sat Apr 15 02:47:13 2006
@@ -1,6 +1,6 @@
/*
AntiRight
- (c) 2003-2005 Jeffrey Bedard
+ (c) 2003-2006 Jeffrey Bedard
address@hidden
This file is part of AntiRight.
Index: antiright/src/arshell/update.c
diff -u antiright/src/arshell/update.c:1.10 antiright/src/arshell/update.c:1.11
--- antiright/src/arshell/update.c:1.10 Mon Jan 30 02:13:29 2006
+++ antiright/src/arshell/update.c Sat Apr 15 02:47:13 2006
@@ -1,6 +1,6 @@
/*
AntiRight
- (c) 2003-2005 Jeffrey Bedard
+ (c) 2003-2006 Jeffrey Bedard
address@hidden
This file is part of AntiRight.
@@ -24,20 +24,17 @@
#include <time.h>
/* Update the clock and biff label. */
-void
-arshell_clockload(struct arshell_update_struct **iterator)
+char*
+arshell_clockload_mail()
{
- char *clockload_label_string;
- char *time_string;
- time_t time_date;
- double load[3];
+ char *mail_string;
char *mailfile;
+
struct stat mailfile_stat;
- char *mail_string;
- const char *maildir = "/var/mail";
+ const char *maildir="/var/mail";
const char *user=getenv("USER");
-
+
asprintf (&mailfile, "%s/%s", maildir, user);
stat (mailfile, &mailfile_stat);
free (mailfile);
@@ -51,23 +48,60 @@
mail_string = "";
}
+ return(mail_string);
+}
+
+int
+arshell_clockload_load()
+{
+ double load[3];
+
getloadavg (load, 3);
+
+ return((int)(load[1]*100));
+}
+
+char*
+arshell_clockload_time()
+{
+ char *time_string;
+ time_t time_date;
+
(void) time (&time_date);
time_string = ctime (&time_date);
time_string[strlen (time_string) - 1] = ' ';
- asprintf (&clockload_label_string, " %s %d%% %s", time_string,
- (int) (load[1] * 100), mail_string);
+
+ return(time_string);
+}
+
+void
+arshell_clockload(struct arshell_update_struct **iterator)
+{
+ char *clockload_label_string;
+
+ asprintf (&clockload_label_string,
+ " %s %d%% %s",
+ arshell_clockload_time(),
+ arshell_clockload_load(),
+ arshell_clockload_mail());
antiright_label_string ((*iterator)->widget, clockload_label_string);
free (clockload_label_string);
}
+
void
arshell_update_label(struct arshell_update_struct **iterator)
{
char *input_string;
+ char *label_string;
+ unsigned int size;
+
input_string = antiright_pipe_read ((*iterator)->command_string);
- input_string[(strlen (input_string)) - 1] = '\0';
- antiright_label_string ((*iterator)->widget, input_string);
- free (input_string);
+ size=strlen(input_string);
+ label_string=(char*)malloc(sizeof(char)*(size+1));
+ strncpy(label_string, input_string, size);
+ free(input_string);
+ antiright_label_string ((*iterator)->widget, label_string);
+ free(label_string);
}
void
@@ -193,8 +227,8 @@
updating of the work area, labels, etc. */
switch (argv[(*counter_int)][2])
{
- case 'f': /* Change the updating frequency. The value
passed is
- in miliseconds. */
+ case 'f': /* Change the updating frequency. The value passed is
+ in miliseconds. */
(*counter_int)++;
arshell.update_frequency = atoi (argv[(*counter_int)]);
break;
@@ -204,21 +238,21 @@
(arshell.gui.widgets.row, "AntiRight"),
argv[(*counter_int)]);
break;
- case 'P': /* Add progress bar. The command must return a
value
- between and including 1 and 100. The value
is such
- that indicates the percentage of the bar to
be
- filled. */
+ case 'P': /* Add progress bar. The command must return a value
+ between and including 1 and 100. The value is such
+ that indicates the percentage of the bar to be
+ filled. */
(*counter_int)++;
arshell_add_updater (arshell_progress_bar (arshell.gui.widgets.row),
argv[(*counter_int)]);
break;
- case 'T': /* Append updating output to work area. */
+ case 'T': /* Append updating output to work area. */
(*counter_int)++;
if (arshell.gui.widgets.work == NULL)
arshell_create_text_work_area ();
arshell_add_updater (arshell.gui.widgets.work, argv[(*counter_int)]);
break;
- case 'W':
+ case 'W': /* This allows the window title to be updated. */
(*counter_int)++;
arshell_add_updater (antiright.parent_widget, argv[(*counter_int)]);
break;
Index: antiright/src/system.antiright
diff -u antiright/src/system.antiright:1.17 antiright/src/system.antiright:1.18
--- antiright/src/system.antiright:1.17 Fri Sep 23 21:35:57 2005
+++ antiright/src/system.antiright Sat Apr 15 02:47:13 2006
@@ -1,7 +1,7 @@
###############################################################################
#
# AntiRight
-# (c) 2002-2004 Jeffrey Bedard
+# (c) 2002-2006 Jeffrey Bedard
# address@hidden
#
# This file is part of AntiRight.
@@ -41,71 +41,33 @@
File_Manager: ACE -A File_Manager
Calculator: xcalc
Text_Editor: ACE -A Text_Editor
-CD_Player:ACE -A CD_Player
+CD_Player:xmcd
Cal: ACE -A Calendar
System_Monitor: xterm -e top
Print:lpr
Terminal:xterm
-IRC:xterm -e BitchX
+IRC:xterm -e irssi
PPP_On:wvdial
PPP_Off:killall wvdial
mp3_dir:~/mp3
mp3_player:mpg123
-# These are the CD Player configurations.
-Play_CD: arcd -t 1
-Pause_CD: arcd -P
-Resume_CD: arcd -r
-Full_Desktop: echo 0
-Stop_CD: arcd -s
# This is the administration panel configuration.
-Fix_File_Permissions: ACE -A Fix_File_Permissions
-Root_Shell: xterm -e su
-See_All_Processes: ACE -A See_All_Processes
-See_All_Users: ACE -A See_All_Users
-See_Disk_Info: ACE -A See_Disk_Info
-See_Open_Ports: ACE -A See_Open_Ports
-See_User_Processes: ACE -A See_User_Processes
+Root_Shell: ACE Terminal -e su
# This is the file system panel configuration.
-Mount_File_System: ACE -A Mount_File_System
-Unmount_File_System: ACE -A Unmount_File_System
See_Free_space: ACE -A See_Free_Space
-Show_All_File_Systems: ACE -A Show_All_File_Systems
# This is the network panel configuration
-Open_Display: ACE -A Open_Display
Open_URL: ACE -L Open_URL xterm -e lynx
# Meta Information
-cdrom:/dev/cdrom
-is_paged: echo 0
-is_clocked: echo 1
background: echo skyblue
foreground: echo black
# Customizations
+Terminal:xterm
+IRC:xterm -e irssi
-Imager:gimp
-Terminal:rxvt
-is_paged:echo 1
-is_clocked:echo 1
-Browser:dillo
-background:ACE -A rgb_background
-background:ACE -A rgb_background
-background:ACE -A rgb_background
-mp3_player:mpg321
-background:ACE -A rgb_background
-background:ACE -A rgb_background
-background:ACE -A rgb_background
-Browser:firefox
-Custom_Apps: echo gimp emacs openoffice dillo gaim civclient
-foreground:echo
-foreground:echo
-foreground:echo red
-foreground:echo azure
-background:ACE -A rgb_background
-Custom_Apps:echo gimp emacs openoffice dillo gaim civclient xvncviewer
-is_paged:echo 0
-Custom_Apps:emacs gaim civclient xvncviewer xtomac
-Browser:dillo
-Custom_Apps:echo emacs gaim civclient xvncviewer xtomac
-background:ACE -A rgb_background
-is_paged:echo 1
-Custom_Apps:echo emacs firefox civclient
+PPP_Off:pkill pppd
+background:black
+foreground:white
+mp3_dir:~/archive/music
+Manual_Root:echo /usr/share/man
+Lock_Display:xscreensaver-command -lock
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright ./configure lib/label.c lib/pipe.c sr...,
Jeffrey Bedard <=