antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright ./ChangeLog ./configure lib/graph.c l...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright ./ChangeLog ./configure lib/graph.c l...
Date: Fri, 21 Apr 2006 09:35:00 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Branch:         
Changes by:     Jeffrey Bedard <address@hidden> 06/04/21 09:34:59

Modified files:
        .              : ChangeLog configure 
        lib            : graph.c graph.h library.h pixmap.c 
        src            : ACE AntiRight 
        src/arshell    : arguments.c clockload.c clockload.h file.c 
                         file.h update.c 

Log message:
        Updated ChangeLog.
        Improved graph appearance through use of lighter colors.
        Graphing of equation commands now works.
        Desktop publishing, IRC, and disk space admin commands were added to 
ACE.
        Functions were moved into clockload.c after futher extraction from 
update.c.
        Handling of nonexistant and read-only files has been added to file.c.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/ChangeLog.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/configure.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/lib/graph.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/lib/graph.h.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/lib/library.h.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/lib/pixmap.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/ACE.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/AntiRight.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/arguments.c.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/clockload.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/clockload.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/file.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/file.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/antiright/antiright/src/arshell/update.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text

Patches:
Index: antiright/ChangeLog
diff -u antiright/ChangeLog:1.54 antiright/ChangeLog:1.55
--- antiright/ChangeLog:1.54    Tue Mar 14 02:58:56 2006
+++ antiright/ChangeLog Fri Apr 21 09:34:59 2006
@@ -1,3 +1,109 @@
+2006-04-16 19:20  jefbed
+
+       * lib/menubar.c, lib/pipe.c, src/ACE, src/system.antiright,
+         src/arshell/arshell.c, src/arshell/main.c, src/arshell/update.c:
+         Fixed a major memory leak.  Removed references to manual pages
+         that are no longer used.  Added Dashboard() to ACE.  Added
+         geometry specifications to all of ACE's invocations of arshell
+         which use the work area.
+
+2006-04-14 22:47  jefbed
+
+       * configure, lib/label.c, lib/pipe.c, src/ACE,
+         src/system.antiright, src/arshell/arguments.c,
+         src/arshell/update.c: Fixed a long-standing memory leak in
+         antiright_pipe_read.  Bumped version number to 2.15.  Refactored
+         clockload applet code.
+
+2006-04-03 23:00  jefbed
+
+       * src/ACE: Fixed invalid comparison notation in test statement
+         within CD_Player().
+
+2006-04-03 22:18  jefbed
+
+       * src/ACE: Added a manual page browser.  Provided link to manual
+         page browser in lynx panel.  Increased usage of ACE configuration
+         environment.
+
+2006-03-28 21:09  jefbed
+
+       * Makefile.in, postinstall-pak, lib/menubar.c, src/ACE, src/AR,
+         src/ARO: Integrated AR and ARO scripts into ACE.
+
+2006-03-28 21:06  jefbed
+
+       * doc/: ACE.1, AR.1, ARO.1, arshell.1, system.antiright.5: Removed
+         unneeded manual pages.  Removed references to nonextant manual
+         pages.
+
+2006-03-28 20:45  jefbed
+
+       * src/ACE: Fixed launching of Diff utility from the
+         File_System_Panel.
+
+2006-03-28 20:43  jefbed
+
+       * src/ACE: Added Diff() utility.
+
+2006-03-26 20:21  jefbed
+
+       * Makefile.in, src/arshell/appendage.c, src/arshell/appendage.h,
+         src/arshell/arshell.h: Removed appendage code because of its
+         utterly useless state and purpose.
+
+2006-03-26 20:16  jefbed
+
+       * lib/menubar.c: Added manual page buttons to help menu for AR and
+         ARO.
+
+2006-03-26 20:02  jefbed
+
+       * lib/menubar.c: Removed arcd manual page item in help menu.
+
+2006-03-26 19:59  jefbed
+
+       * Makefile.in, src/arshell/arguments.c, src/arshell/arshell.h,
+         src/arshell/interface_file.c, src/arshell/interface_file.h:
+         Removed the interface file language code, for the same
+         functionality can be implemented in awk.  It was originally
+         implemented to overcome the limitation on the number of command
+         line arguments, but the allowed amount on most unix systems is
+         definately not a limiting factor.
+
+2006-03-26 19:33  jefbed
+
+       * configure, lib/app.c, lib/app.h, lib/graph.c, lib/library.h,
+         lib/list.c, src/arshell/arshell.c: Version number bumped to 2.14.
+         Yaclib was removed in order to ensure license purity of package
+         and to reduce package size.
+
+2006-03-26 02:16  jefbed
+
+       * src/ACE: Fixed problem with AWK variable not being set.  Improved
+         ACE_read_configuration_value to use variable insertion as
+         provided by awk itself, rather than funky quote stuff.
+
+2006-03-18 23:04  jefbed
+
+       * src/ACE: Fixed bug caused by there not being a space between '-r'
+         and 4 on the NetBSD panel.
+
+2006-03-18 22:58  jefbed
+
+       * src/ACE: Unset the display of the script as processed.  Added
+         this setting to the debug section.  Added a NetBSD panel.
+
+2006-03-18 22:46  jefbed
+
+       * README, src/ACE: Updated README to indicate the necessity of GNU
+         Make for building.  Fixed a problem with misplaced parentheses in
+         ACE.
+
+2006-03-13 21:58  jefbed
+
+       * ChangeLog: Updated ChangeLog for release 2.13.
+
 2006-03-12 23:16  jefbed
 
        * src/ACE: Finalized desktop removal.
@@ -32,10 +138,9 @@
 
        * lib/graph.c, lib/pipe.c, lib/pixmap.c, src/ARpanel,
          src/arshell/arshell.c, src/arshell/search.c,
-         src/arshell/textedit.h, src/arshell/update.c, yaclib/list.c,
-         yaclib/parse.c: Refactored updating code in efforts to eliminate
-         memory leak in label updater.  Fixed all warnings. Added ARpanel
-         as a simple, prudent panel.
+         src/arshell/textedit.h, src/arshell/update.c: Refactored updating
+         code in efforts to eliminate memory leak in label updater.  Fixed
+         all warnings. Added ARpanel as a simple, prudent panel.
 
 2006-01-26 22:50  jefbed
 
@@ -54,8 +159,7 @@
 
 2005-11-13 20:56  jefbed
 
-       * Makefile.in, configure, lib/library.c, yaclib/parse.c: Fixed
-         prefixes.
+       * Makefile.in, configure, lib/library.c: Fixed prefixes.
 
 2005-11-13 20:43  jefbed
 
@@ -208,10 +312,9 @@
          src/bitmaps/right_arrow.xpm, src/bitmaps/rocket.xpm,
          src/bitmaps/spell.xpm, src/bitmaps/sticky.xpm,
          src/bitmaps/term.xpm, src/bitmaps/tools.xpm,
-         src/bitmaps/up_arrow.xpm, src/bitmaps/www.xpm, yaclib/parse.c,
-         yaclib/parse.h, yaclib/yaclib.h: Changed email address from
-         address@hidden to address@hidden  Fixed lowering on
-         fvwm.  Removed unused pixmaps.
+         src/bitmaps/up_arrow.xpm, src/bitmaps/www.xpm: Changed email
+         address from address@hidden to address@hidden  Fixed
+         lowering on fvwm.  Removed unused pixmaps.
 
 2005-07-16 19:53  jefbed
 
@@ -315,13 +418,8 @@
 
        * Makefile.in, configure, src/ACE, src/system.antiright,
          src/arshell/arguments.c, src/arshell/arshell.c,
-         src/arshell/interface_file.c, yaclib/COPYING, yaclib/algo.c,
-         yaclib/algo.h, yaclib/date.c, yaclib/date.h, yaclib/defs.h,
-         yaclib/hash.c, yaclib/hash.h, yaclib/list.c, yaclib/list.h,
-         yaclib/parse.c, yaclib/parse.h, yaclib/pred.h, yaclib/sort.c,
-         yaclib/sort.h, yaclib/stamp-h.in, yaclib/vector.c,
-         yaclib/vector.h, yaclib/yaclib.h: Added pongr and yetanotherclib
-         to source tree.
+         src/arshell/interface_file.c: Added pongr and yetanotherclib to
+         source tree.
 
 2005-07-03 16:43  jefbed
 
Index: antiright/configure
diff -u antiright/configure:1.65 antiright/configure:1.66
--- antiright/configure:1.65    Sat Apr 15 02:47:13 2006
+++ antiright/configure Fri Apr 21 09:34:59 2006
@@ -25,6 +25,15 @@
 ###############################################################################
 
 VERSION=2.15
+
+if [ "$1" = "-d" ]; then
+        echo 'Configuring with debug options...'
+        CFLAGS="-g3 -Wall -W -Werror -DDEBUG"
+elif [ "$1" = "-s" ]; then
+        echo 'Setting up PREFIX for user install in ~/opt.'
+        PREFIX=~/opt/antiright
+fi
+
 DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"
 
 ICONDIR=$PREFIX/include/X11/bitmaps/antiright
@@ -32,15 +41,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
-   DEFS="$DEFS -DPREFIX='\"$PREFIX\"'"
+
+DEFS="$DEFS -DPREFIX='\"$PREFIX\"'"
 
 # Set up resource file installation directory.
 RESDIR="$PREFIX/lib/X11/app-defaults"
Index: antiright/lib/graph.c
diff -u antiright/lib/graph.c:1.7 antiright/lib/graph.c:1.8
--- antiright/lib/graph.c:1.7   Mon Mar 27 00:33:02 2006
+++ antiright/lib/graph.c       Fri Apr 21 09:34:59 2006
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2003-2005 Jeffrey Bedard
+  (c) 2003-2006 Jeffrey Bedard
   address@hidden
    
   This file is part of AntiRight.
@@ -25,6 +25,7 @@
 #define AR_WHITE 255,255,255
 #define AR_GREY0 192,192,192
 #define AR_GREY1 96,96,96
+#define AR_GREY2 225,225,225
 #define AR_RED 192,0,0
 #define AR_BLACK 0,0,0
 
@@ -34,7 +35,7 @@
   unsigned int counter;
 
   antiright_widget_background(antiright.graph.widget, AR_WHITE);
-  antiright_draw_foreground(&antiright.graph.drawing,AR_GREY1);
+  antiright_draw_foreground(&antiright.graph.drawing,AR_GREY2);
   
   for(counter=antiright.graph.width/2; 
       counter<antiright.graph.width;
@@ -82,6 +83,7 @@
   antiright_draw_line(&antiright.graph.drawing,
                      0, antiright.graph.height/2,
                      antiright.graph.width, antiright.graph.height/2);
+  antiright_draw_foreground(&antiright.graph.drawing,AR_BLACK);
 }
 
 void
@@ -110,7 +112,9 @@
 antiright_graph_point(int x_arg, int y_arg)
 {
   antiright_graph_object(x_arg, y_arg, 0,0,0,0,POINT);
+#ifdef DEBUG
   ARBUG;
+#endif /* DEBUG */
   
 }
 
@@ -145,6 +149,11 @@
            {
              antiright_graph_point(column, -line);
            }
+           
+#ifdef DEBUG
+           ARBUG;
+#endif /* DEBUG */
+
        }
     }
   free(output);
@@ -156,10 +165,23 @@
   char *system_command;
   char *output;
   int x;
-  for(x=0; x<(int)antiright.graph.width; x++)
+
+  /*antiright_graph_resize(antiright.graph.widget, NULL, NULL);*/
+
+#ifdef DEBUG
+  ARBUG;
+#endif /* DEBUG */
+
+  for(x=-255; x<256; x++)
     {
+
+#ifdef DEBUG
+       ARBUG;
+#endif /* DEBUG */
+
       asprintf(&system_command, "%s %d", command, x);
-      output=antiright_pipe_read(command);
+      output=antiright_pipe_read(system_command);
+      free(system_command);
       antiright_graph_point(x, atoi(output));
       free(output);
     }
@@ -185,14 +207,18 @@
          
          x=antiright.graph.points[counter].x+(antiright.graph.width/2);
          y=antiright.graph.points[counter].y+(antiright.graph.height/2);
+#ifdef DEBUG
          printf("actual x: %d, y: %d\n",
                 antiright.graph.points[counter].x, 
                 antiright.graph.points[counter].y  );
+#endif /* DEBUG */
          if(antiright.graph.points[counter].shape==POINT)
            {
              antiright_draw_point(&antiright.graph.drawing, x, y);
+#ifdef DEBUG
              printf("x: %d, y: %d\n", x, y);
              fflush(stdout);
+#endif /* DEBUG */
            }
          else if(antiright.graph.points[counter].shape==RECT)
            {
@@ -233,7 +259,9 @@
                XmNwidth, &width,
                XmNheight, &height,
                NULL);
-  
+#ifdef DEBUG
+  printf("width:  %d\n", width);
+#endif /* DEBUG */
   antiright.graph.width=width;
   antiright.graph.height=height;
   antiright_graph_expose(widget, client_data, NULL);
@@ -268,8 +296,6 @@
                antiright_graph_resize,
                NULL);
   
-
-  
   return(antiright.graph.widget);
 }
 
Index: antiright/lib/graph.h
diff -u antiright/lib/graph.h:1.4 antiright/lib/graph.h:1.5
--- antiright/lib/graph.h:1.4   Tue Jul 26 01:03:22 2005
+++ antiright/lib/graph.h       Fri Apr 21 09:34:59 2006
@@ -75,5 +75,7 @@
                     unsigned int width, 
                     unsigned int height);
 
-
+void
+antiright_graph_resize(Widget widget,
+                      XtPointer client_data, XtPointer call_data);
 #endif /* not AR_GRAPH_H  */
Index: antiright/lib/library.h
diff -u antiright/lib/library.h:1.19 antiright/lib/library.h:1.20
--- antiright/lib/library.h:1.19        Mon Mar 27 00:33:02 2006
+++ antiright/lib/library.h     Fri Apr 21 09:34:59 2006
@@ -58,7 +58,6 @@
 #include "util.h"
 #include "window.h"
 #include "xmstring.h"
-#include "linked-list.h"
 
 #ifdef HAVE_XLT
 #include <Xlt/Xlt.h>
Index: antiright/lib/pixmap.c
diff -u antiright/lib/pixmap.c:1.3 antiright/lib/pixmap.c:1.4
--- antiright/lib/pixmap.c:1.3  Mon Jan 30 02:13:29 2006
+++ antiright/lib/pixmap.c      Fri Apr 21 09:34:59 2006
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2002-2005 Jeffrey Bedard
+  (c) 2002-2006 Jeffrey Bedard
   address@hidden
  
   This file is part of AntiRight.
@@ -124,3 +124,4 @@
                                                      icon_bits,width, height),
                NULL);
 }
+
Index: antiright/src/ACE
diff -u antiright/src/ACE:1.73 antiright/src/ACE:1.74
--- antiright/src/ACE:1.73      Sun Apr 16 23:20:48 2006
+++ antiright/src/ACE   Fri Apr 21 09:34:59 2006
@@ -23,8 +23,8 @@
        set -vx
 fi
 
-ARSHELL=arshell
-AWK=awk
+ARSHELL=arshell 
+AWK=awk 
 
 ACE_Verification()
 {
@@ -556,7 +556,8 @@
 }
 texted_base()
 {
-       $ARSHELL -Am -Aw -As -geometry 550x400 -xrm '*XmText.fontList: fixed' $@
+       $ARSHELL -Am -Aw -As -geometry 550x400 -xrm '*XmText.fontList: fixed' \
+               -Amf 'ACE -A Text_Editor' $@
 }
 Text_Editor()
 {
@@ -616,6 +617,197 @@
     fi
 }
 
+# desktop pulishing with roff
+arroff()
+{
+       groff -Tps \
+       "$(ACE roff_flags)"\
+       "$(ACE roff_file)" \
+       > /tmp/roff.ps.$$
+}
+clean_roff()
+{
+       rm -f /tmp/roff.ps.$$
+}
+Preview_roff()
+{
+       arroff
+       gv /tmp/roff.ps.$$ &
+       clean_roff
+}
+Print_roff()
+{
+       arroff
+       $(ACE print_command)\
+       /tmp/roff.ps.$$ 
+       clean_roff
+}
+Save_PS()
+{
+       arroff
+       mv /tmp/roff.ps.$$ \
+       $(ACE roff_file).ps
+}
+Save_PDF()
+{
+       arroff
+       ps2pdf /tmp/roff.ps.$$\
+               $(ACE roff_file).pdf
+       clean_roff
+}
+Publishing_Panel()
+{
+       arshell -r 4\
+               'ACE -A Preview_roff'\
+               'ACE -A Print_roff'\
+               'ACE -A Save_PDF'\
+               'ACE -A Save_PS'\
+               'ACE -A Save_TEXT'\
+               'ACE -A Save_JPEG'\
+               'ACE -A Word_Count_roff'
+}
+Word_Count_roff()
+{
+       wc "$(ACE roff_file)"\
+               | arshell -Aw -p
+}
+Save_JPEG()
+{
+       arroff
+       convert /tmp/roff.ps.$$\
+               $(ACE roff_file).jpg
+       clean_roff
+}
+Save_TEXT()
+{
+       groff -Tascii\
+       "$(ACE roff_flags)"\
+       "$(ACE roff_file)"\
+       > $(ACE roff_file).txt
+}
+# Disk space admin commands
+Select_Directory()
+{
+       directory="$(arshell \ 
+               -Al 'Select the directory'\
+               -Al 'in which you wish to'\
+               -Al 'operate.'\
+               -At Directory: \
+               | cut -d : -f 2)"
+}
+Get_Largest_Files()
+{
+       du -a | sort -n | tail -n\
+       "$(arshell \
+       -Al 'Enter the number'\
+       -Al 'of files to show.'\
+       -At Directory:\
+       | cut -d : -f 2)"
+}
+Show_Largest_Files()
+{
+       Get_Largest_Files\
+               | arshell -Aw -p
+}
+ask_del()
+{
+       local file_type=\
+       "$(file $1)"
+       local choice=$(arshell \
+               -Al "Delete $1?"\
+               -Al 'File type:'\
+               -Al "$file_type"\
+               'echo Yes' 'echo No')
+       if ["$choice" = "Yes"]; then
+               rm -rf $1
+       fi
+}
+Prompt_to_Clean()      
+{
+       local files="$(ACE -A \
+               Get_Largest_Files)"
+       echo $files | arshell -Aw -p &
+       for file in "$files"; do
+               ask_del $file
+       done
+}
+IRC_Panel()
+{
+       arshell -r 4 \
+               'ACE -A IRC_Kick' \
+               'ACE -A IRC_Ban' \
+               'ACE -A IRC_Topic' \
+               'ACE -A IRC_Invite'\
+               'ACE -A IRC_Mode'\
+               'ACE -A X_Command'
+}
+X_Command()
+{
+       local command=\
+       "$(arshell \
+       -Al 'Enter the command to'\
+       -Al 'pass to X'\
+       -At Command:\
+       | cut -d : -f 2)"
+       echo "msg \
+       address@hidden
+       $command"
+}
+getirc()
+{
+       nick="$(ACE -A getircuser)"
+       chan="$(ACE -A getircchan)"
+}
+IRC_Topic()
+{
+       getirc
+       local topic=\
+               "$(arshell -At Text:\
+               | cut -d : -f 2)"
+       echo "topic $chan $topic"
+}
+IRC_Kick()
+{
+       getirc
+       echo "kick $chan $nick"
+}
+IRC_Ban()
+{
+       getirc
+       echo "mode $chan +b $nick"
+}
+getircchan()
+{
+       arshell \
+               -Al 'Enter the name of'\
+               -Al 'the channel on which'\
+               -Al 'you wishbto perform'\
+               -Al 'an operation'\
+               -At Channel: | cut -d : -f 2
+}
+getircuser()
+{
+       arshell \
+               -Al 'Enter the user on'\
+               -Al 'which you wish to'\
+               -Al 'perform an operation.'\
+               -At Nick: | cut -d : -f 2
+}
+IRC_Mode()
+{
+       echo "mode\
+               $(arshell -At Object:\
+                | cut -d : -f 2) $(arshell \
+                -At Flag: | cut -d : -f 2) \
+               $(arshell -At Value: \
+               | cut -d : -f 2)"
+               
+}
+IRC_Invite()
+{
+       getirc
+       echo "$nick $channel"
+}
 ACE_show_usage_and_exit()
 {
     echo "usage: `basename $1` [+-ctr ARG] [+-p ARG] [+-L ARG] [+-V ARG]\
@@ -681,3 +873,6 @@
 
 
 
+
+
+
Index: antiright/src/AntiRight
diff -u antiright/src/AntiRight:1.9 antiright/src/AntiRight:1.10
--- antiright/src/AntiRight:1.9 Sat Jul 23 17:10:09 2005
+++ antiright/src/AntiRight     Fri Apr 21 09:34:59 2006
@@ -218,3 +218,5 @@
 *About_popup*form.XmPushButton.foreground: blue
 *About_popup*form.XmPushButton.fontList: -*-times-medium-i-*-*-12-*-*-*-*-*-*-*
 *About_popup*form.description.fontList: -*-times-*-r-*-*-12-*-*-*-*-*-*-*
+*XmNpathMode: True
+
Index: antiright/src/arshell/arguments.c
diff -u antiright/src/arshell/arguments.c:1.26 
antiright/src/arshell/arguments.c:1.27
--- antiright/src/arshell/arguments.c:1.26      Sat Apr 15 02:47:13 2006
+++ antiright/src/arshell/arguments.c   Fri Apr 21 09:34:59 2006
@@ -151,8 +151,9 @@
     }
   if (!strncmp (option, "test", length))
     {
+       /* This is an area where new features can be tested.  */
       puts ("TESTING");
-      antiright_pipe_write ("cut -d ' ' -f 2", "num 1 2 3");
+      antiright_pipe_write ("cut -d ' ' -f 2", "num 1 2 3\n");
       puts ("TESTING");
       exit (0);
     }
Index: antiright/src/arshell/clockload.c
diff -u antiright/src/arshell/clockload.c:1.6 
antiright/src/arshell/clockload.c:1.7
--- antiright/src/arshell/clockload.c:1.6       Sun Jul 31 16:19:50 2005
+++ antiright/src/arshell/clockload.c   Fri Apr 21 09:34:59 2006
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2003-2005 Jeffrey Bedard
+  (c) 2003-2006 Jeffrey Bedard
   address@hidden
    
   This file is part of AntiRight.
@@ -21,6 +21,7 @@
 */
 
 #include "arshell.h"
+#include <time.h>
 
 Widget
 arshell_clockload_applet (Widget parent)
@@ -37,3 +38,69 @@
   arshell_update ();
   return (clockload_form);
 }
+
+/* Update the clock and biff label.  */
+char*
+arshell_clockload_mail()
+{
+       char *mail_string;
+       char *mailfile;
+       
+       struct stat mailfile_stat;
+
+       const char *maildir="/var/mail";
+       const char *user=getenv("USER");
+
+       asprintf (&mailfile, "%s/%s", maildir, user);
+       stat (mailfile, &mailfile_stat);
+       free (mailfile);
+
+       if (mailfile_stat.st_size > 0)
+       {
+               mail_string = "Mail";
+       }
+       else
+       {
+               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] = ' ';
+
+       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);
+}
+
Index: antiright/src/arshell/clockload.h
diff -u antiright/src/arshell/clockload.h:1.6 
antiright/src/arshell/clockload.h:1.7
--- antiright/src/arshell/clockload.h:1.6       Sun Jul 31 16:19:50 2005
+++ antiright/src/arshell/clockload.h   Fri Apr 21 09:34:59 2006
@@ -31,4 +31,7 @@
 
 Widget arshell_clockload_applet (Widget parent);
 
+void
+arshell_clockload(struct arshell_update_struct **iterator);
+
 #endif /* ARSHELL_CLOCKLOAD_H  */
Index: antiright/src/arshell/file.c
diff -u antiright/src/arshell/file.c:1.10 antiright/src/arshell/file.c:1.11
--- antiright/src/arshell/file.c:1.10   Sun Jul 31 16:19:50 2005
+++ antiright/src/arshell/file.c        Fri Apr 21 09:34:59 2006
@@ -21,6 +21,71 @@
 
 #include "arshell.h"
 
+
+char *arshell_file_dir=NULL;
+
+unsigned int
+arshell_get_file_dir_string_position(char *filename)
+{
+       unsigned int counter;
+       
+       for(    counter=strlen(filename);
+               filename[counter]!='/';
+               counter--)
+       {
+
+#ifdef DEBUG
+               printf("counter: %d\n", counter);
+#endif /* DEBUG */
+
+       }
+
+       return(counter);
+}
+void
+arshell_set_file_dir_memory(unsigned int counter)
+{
+       if(arshell_file_dir!=NULL)
+       {
+               if(     !((arshell_file_dir[0]=='/')
+                       && (arshell_file_dir[1]=='\0')))
+               {
+                       free(arshell_file_dir);
+               }
+       }
+       arshell_file_dir=(char*)malloc(counter+1);
+}
+void
+arshell_set_file_dir_string(char *filename, unsigned int position)
+{
+       unsigned int counter;
+       
+       for(counter=0; counter<=position; counter++)
+       {
+
+#ifdef DEBUG
+               printf("counter0: %d\n", counter);
+#endif /* DEBUG */
+
+               arshell_file_dir[counter]=filename[counter];
+       }
+       arshell_file_dir[counter]='\0';
+
+#ifdef DEBUG   
+       puts(arshell_file_dir);
+#endif /* DEBUG */
+
+}
+void
+arshell_set_file_dir(char *filename)
+{
+       unsigned int position;
+       position=arshell_get_file_dir_string_position(filename);
+       arshell_set_file_dir_memory(position);
+       arshell_set_file_dir_string(filename, position);
+       
+}
+
 void
 arshell_insert_file_cb ()
 {
@@ -81,15 +146,12 @@
   XmFileSelectionBoxCallbackStruct *call_pointer = call_data;
   char *c_string;
 
-  /*  if(arshell.flags.file_open)
-     { 
-     arshell_save_work_area();
-     } */
-
   c_string = antiright_c_string (call_pointer->value);
   strncpy (arshell.edit.filename, c_string, ARSHELL_MAX_STRLEN);
   XtFree (c_string);
   XtDestroyWidget (widget);
+       
+       arshell_set_file_dir(arshell.edit.filename);
 
   if (arshell.flags.saving && !arshell.flags.opening)
     {
@@ -113,14 +175,34 @@
 {
 
   Widget file_selection_widget;
-  ARCLARG;
-  antiright_set (XmNtitle, (XtArgVal) "File Selector");
-  file_selection_widget =
-    XmCreateFileSelectionDialog (antiright.parent_widget,
-                                "file_selection_widget", antiright.arguments,
-                                antiright.arguments_int);
-  antiright_set_widget_title (file_selection_widget, "File Selector");
+       XmString directory;
+
+       antiright_set(XmNtitle, (XtArgVal) "Select a File");
+       antiright_set(XmNpathMode, (XtArgVal)True);
+
+       if(arshell_file_dir == NULL)
+       {
+               arshell_file_dir="/";
+       }
+
+#ifdef DEBUG
+       puts(arshell_file_dir);
+#endif /* DEBUG */
+
+       directory=antiright_motif_string(arshell_file_dir);
+       antiright_set(XmNdirectory, (XtArgVal)directory);
+       antiright_set(XmNwidth, (XtArgVal)480);
+       antiright_set(XmNheight, (XtArgVal)400);
+       antiright_set(XmNallowShellResize, (XtArgVal)False);
+       file_selection_widget =
+               XmCreateFileSelectionDialog(    antiright.parent_widget,
+                                               "file_selection_widget",
+                                               antiright.arguments,
+                                               antiright.arguments_int);
+       XmStringFree(directory);
+
   XtManageChild (file_selection_widget);
+
   XtAddCallback (file_selection_widget, XmNcancelCallback,
                 antiright_close_cb, NULL);
   XtAddCallback (file_selection_widget, XmNhelpCallback,
@@ -133,39 +215,60 @@
 arshell_put_text_into_file (FILE * file)
 {
   char *text_string;
-  assert (arshell.gui.widgets.work != NULL);
+
+       assert(arshell.gui.widgets.work);
+       assert(file);
+
   text_string = XmTextGetString (arshell.gui.widgets.work);
   fprintf (file, "%s\n", text_string);
   XtFree (text_string);
 }
 
-void
+int
 arshell_open_file_for_writing (FILE ** file_pointer)
 {
-  (*file_pointer) = fopen (arshell.edit.filename, "w");
-  if ((*file_pointer) == NULL)
-    {
-      arshell_select_filename ();
-    }
+       int access_result;
+       access_result=access(arshell.edit.filename, W_OK);
+
+#ifdef DEBUG
+       printf("int access(,): %d\n", access_result);
+#endif /* DEBUG */
+
+       if(access_result == -1)
+       {
+               arshell_select_filename();
+               return(-1);
+       }
+       else
+       {
+               (*file_pointer) = fopen (arshell.edit.filename, "w");
+               assert((*file_pointer)!=NULL);
+               return(0);
+       }
 }
 
 void
 arshell_save_work_area ()
 {
-  FILE *file_pointer;
-  arshell.flags.saving = True;
-  if (arshell.flags.file_open == False)
-    {
-      arshell_select_filename ();
-    }
-  else
-    {
-      arshell_open_file_for_writing (&file_pointer);
-      arshell_put_text_into_file (file_pointer);
-      fclose (file_pointer);
-      arshell_get_rid_of_modified_status ();
-      antiright_set_title (arshell.edit.filename);
-    }
+       FILE *file_pointer;
+
+       arshell.flags.saving = True;
+       file_pointer=NULL;
+
+       if (arshell.flags.file_open == False)
+       {
+               arshell_select_filename ();
+       }
+
+       if(arshell_open_file_for_writing(&file_pointer)!=-1)
+       {
+               assert(file_pointer!=NULL);
+               arshell_put_text_into_file (file_pointer);
+               fclose (file_pointer);
+               arshell_get_rid_of_modified_status ();
+               antiright_set_title (arshell.edit.filename);
+       }
+  
 }
 
 void
@@ -182,3 +285,4 @@
   arshell.flags.saving = False;
   arshell_select_filename ();
 }
+
Index: antiright/src/arshell/file.h
diff -u antiright/src/arshell/file.h:1.6 antiright/src/arshell/file.h:1.7
--- antiright/src/arshell/file.h:1.6    Sun Jul 31 16:19:50 2005
+++ antiright/src/arshell/file.h        Fri Apr 21 09:34:59 2006
@@ -30,10 +30,11 @@
 void arshell_open_file ();
 void arshell_select_filename ();
 void arshell_put_text_into_file (FILE * file);
-void arshell_open_file_for_writing (FILE ** file_pointer);
+int arshell_open_file_for_writing (FILE ** file_pointer);
 void arshell_save_work_area ();
 void arshell_save_as_cb ();
 void arshell_open_cb ();
 void arshell_revert_file_cb ();
 
 #endif /* ARSHELL_FILE_H  */
+
Index: antiright/src/arshell/update.c
diff -u antiright/src/arshell/update.c:1.12 antiright/src/arshell/update.c:1.13
--- antiright/src/arshell/update.c:1.12 Sun Apr 16 23:20:48 2006
+++ antiright/src/arshell/update.c      Fri Apr 21 09:34:59 2006
@@ -21,72 +21,6 @@
 */
 
 #include "arshell.h"
-#include <time.h>
-
-/* Update the clock and biff label.  */
-char*
-arshell_clockload_mail()
-{
-       char *mail_string;
-       char *mailfile;
-       
-       struct stat mailfile_stat;
-
-       const char *maildir="/var/mail";
-       const char *user=getenv("USER");
-
-       asprintf (&mailfile, "%s/%s", maildir, user);
-       stat (mailfile, &mailfile_stat);
-       free (mailfile);
-
-       if (mailfile_stat.st_size > 0)
-       {
-               mail_string = "Mail";
-       }
-       else
-       {
-               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] = ' ';
-
-       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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]