Enlightenment CVS committal

Author  : fletch3k
Project : misc
Module  : enotes

Dir     : misc/enotes/src


Modified Files:
        Makefile.am main.c main.h newentry.c 
Added Files:
        allocmem.c argsparser.c confparse.c setdefconf.c variables.c 


Log Message:
Modulising My code because it was getting hard to maintain (benr's advice :-) )

===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Makefile.am 28 Feb 2003 19:06:12 -0000      1.2
+++ Makefile.am 28 Feb 2003 20:27:39 -0000      1.3
@@ -10,6 +10,11 @@
 main.h \
 newentry.c \
 notecmds.c \
-notenum.c
+notenum.c \
+allocmem.c \
+argsparser.c \
+confparse.c \
+setdefconf.c \
+variables.c
 
 enotes_LDADD = @ewl_libs@ @eprog_libs@
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/main.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- main.c      26 Feb 2003 20:38:02 -0000      1.14
+++ main.c      28 Feb 2003 20:27:40 -0000      1.15
@@ -16,105 +16,6 @@
 
 #include "main.h"
 
-char *tmp;
-char *str;
-
-char *fn;
-char *fontdir;
-char *bgfile;
-char *font;
-char *configfn;
-char *xbtnfn;
-char *openwinimg;
-char *lastbtn;
-char *firstbtn;
-char *nubtn;
-char *newbtn;
-char *barimg;
-
-FILE *file;
-
-unsigned int r;
-unsigned int g;
-unsigned int b;
-
-unsigned int bar_r;
-unsigned int bar_g;
-unsigned int bar_b;
-
-unsigned int w;
-unsigned int h;
-
-unsigned int font_size;
-unsigned int title_font_size;
-
-
-unsigned int win_x;
-unsigned int win_y;
-unsigned int win_width;
-unsigned int win_height;
-
-unsigned int firstbtn_x;
-unsigned int firstbtn_y;
-unsigned int firstbtn_width;
-unsigned int firstbtn_height;
-
-unsigned int lastbtn_x;
-unsigned int lastbtn_y;
-unsigned int lastbtn_width;
-unsigned int lastbtn_height;
-
-unsigned int nubtn_x;
-unsigned int nubtn_y;
-unsigned int nubtn_width;
-unsigned int nubtn_height;
-
-unsigned int newbtn_x;
-unsigned int newbtn_y;
-unsigned int newbtn_width;
-unsigned int newbtn_height;
-
-unsigned int exitbtn_x;
-unsigned int exitbtn_y;
-unsigned int exitbtn_width;
-unsigned int exitbtn_height;
-
-char *bgimg;
-char *firstbtnimg;
-char *lastbtnimg;
-char *newbtnimg;
-char *nubtnimg;
-char *exitbtnimg;
-
-E_Prog *bar;
-Evas_Object *bar_bg;
-Evas_Object *bar_firstbtn;
-Evas_Object *bar_lastbtn;
-Evas_Object *bar_nubtn;
-Evas_Object *bar_newbtn;
-Evas_Object *bar_exitbtn;
-
-
-E_Prog *root;
-Evas_Object *bg;
-Evas_Object *title;
-Evas_Object *txt[11];
-Evas_Object *exitbtn;
-Evas_Object *rectbar;
-
-Evas_Object *lastbtnob;
-Evas_Object *firstbtnob;
-Evas_Object *nubtnob;
-Evas_Object *newbtnob;
-
-Ewl_Widget *main_win;
-Ewl_Widget *main_box;
-Ewl_Widget *ewltitle;
-Ewl_Widget *note[11];
-Ewl_Widget *okbtn;
-Ewl_Widget *cancelbtn;
-
-
 int
 main (int argc, char *argv[])
 {
@@ -122,1265 +23,15 @@
        int actionbool = 0;
        char *mtmp = malloc (str_size);
 
-       tmp = malloc (str_size);
-       str = malloc (str_size);
-       fn = malloc (100);
-       fontdir = malloc (str_size);
-       bgfile = malloc (str_size);
-       font = malloc (str_size);
-       configfn = malloc (str_size);
-       xbtnfn = malloc (str_size);
-       openwinimg = malloc (str_size);
-       lastbtn = malloc (str_size);
-       firstbtn = malloc (str_size);
-       nubtn = malloc (str_size);
-       newbtn = malloc (str_size);
-
-       barimg = malloc (str_size);
-       bgimg = malloc (str_size);
-       firstbtnimg = malloc (str_size);
-       lastbtnimg = malloc (str_size);
-       firstbtnimg = malloc (str_size);
-       nubtnimg = malloc (str_size);
-       newbtnimg = malloc (str_size);
-       exitbtnimg = malloc (str_size);
-
-       strcat (fontdir, ".");
-       strcpy (fn, getenv ("HOME"));
-       strcat (fn, "/.e/enotes/notes");
-       strcpy (bgfile, "/usr/local/share/enotes/data/bg.jpg");
-       strcpy (font, "/usr/local/share/enotes/data/arial.ttf");
-       strcpy (configfn, getenv ("HOME"));
-       strcat (configfn, "/.e/enotes/config");
-       strcpy (xbtnfn, "/usr/local/share/enotes/data/x.png");
-       strcpy (openwinimg, "/usr/local/share/enotes/data/titleimg.jpg");
-       strcpy (lastbtn, "/usr/local/share/enotes/data/lastbtn.png");
-       strcpy (firstbtn, "/usr/local/share/enotes/data/firstbtn.png");
-       strcpy (nubtn, "/usr/local/share/enotes/data/nubtn.png");
-       strcpy (newbtn, "/usr/local/share/enotes/data/newbtn.png");
-       strcpy (barimg, "/usr/local/share/enotes/data/panel.png");
-       r = 0;
-       g = 0;
-       b = 0;
-       w = 250;
-       h = 250;
-       title_font_size = 16;
-       font_size = 12;
-
-
-       win_x = 0;
-       win_y = 0;
-       win_width = 100;
-       win_height = 25;
-
-       firstbtn_x = 2;
-       firstbtn_y = 2;
-       firstbtn_width = 17;
-       firstbtn_height = 21;
-
-       lastbtn_x = 21;
-       lastbtn_y = 2;
-       lastbtn_width = 17;
-       lastbtn_height = 21;
-
-       nubtn_x = 40;
-       nubtn_y = 2;
-       nubtn_width = 17;
-       nubtn_height = 21;
-
-       newbtn_x = 59;
-       newbtn_y = 2;
-       newbtn_width = 17;
-       newbtn_height = 21;
-
-       exitbtn_x = 78;
-       exitbtn_y = 2;
-       exitbtn_width = 17;
-       exitbtn_height = 21;
-
-       strcpy (bgimg, "/usr/local/share/enotes/data/barbg.png");
-       strcpy (firstbtnimg,
-               "/usr/local/share/enotes/data/barfirstbtnimg.png");
-       strcpy (lastbtnimg, "/usr/local/share/enotes/data/barlastbtnimg.png");
-       strcpy (nubtnimg, "/usr/local/share/enotes/data/barnubtnimg.png");
-       strcpy (newbtnimg, "/usr/local/share/enotes/data/barnewbtnimg.png");
-       strcpy (exitbtnimg, "/usr/local/share/enotes/data/barexitbtnimg.png");
-
+       allocatemem ();
+       setdefaults ();
 
        eprog_init ();
 
        setconfig ();
+       parseusage (argc, argv);
 
-       if (argc < 2)
-         {
-                 openwin ();
-                 eprog_event_loop ();
-                 return (0);
-         }
-
-
-       while (argv[a] != NULL)
-         {
-                 if (!strcmp (argv[a], "-d") || !strcmp (argv[a], "--db"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (fn, argv[a + 1]);
-                           a++;
-                   }
-                 else if (!strcmp (argv[a], "-t")
-                          || !strcmp (argv[a], "--titleimg"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (openwinimg, argv[a + 1]);
-                   }
-                 else if (!strcmp (argv[a], "-x")
-                          || !strcmp (argv[a], "--xbtnimg"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (xbtnfn, argv[a + 1]);
-                           a++;
-                   }
-                 else if (!strcmp (argv[a], "-s")
-                          || !strcmp (argv[a], "--config"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (configfn, argv[a + 1]);
-                           a++;
-
-                   }
-                 else if (!strcmp (argv[a], "-f")
-                          || !strcmp (argv[a], "--font"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (font, argv[a + 1]);
-                           a++;
-                   }
-                 else if (!strcmp (argv[a], "-b")
-                          || !strcmp (argv[a], "--bg"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (bgfile, argv[a + 1]);
-                           a++;
-                   }
-                 else if (!strcmp (argv[a], "--lastbtn"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (lastbtn, argv[a + 1]);
-                   }
-                 else if (!strcmp (argv[a], "--firstbtn"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (firstbtn, argv[a + 1]);
-                   }
-                 else if (!strcmp (argv[a], "--nubtn"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (nubtn, argv[a + 1]);
-                   }
-                 else if (!strcmp (argv[a], "--newbtn"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (newbtn, argv[a + 1]);
-                   }
-                 else if (!strcmp (argv[a], "-B")
-                          || !strcmp (argv[a], "--barimg"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (barimg, argv[a + 1]);
-                   }
-                 else if (!strcmp (argv[a], "-S")
-                          || !strcmp (argv[a], "--fontsize"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           font_size = atoi (mtmp);
-                   }
-                 else if (!strcmp (argv[a], "-T")
-                          || !strcmp (argv[a], "--tsize"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           title_font_size = atoi (mtmp);
-                   }
-                 else if (!strcmp (argv[a], "--barwin_x"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           win_x = atoi (mtmp);
-                   }
-                 else if (!strcmp (argv[a], "--barwin_y"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           win_y = atoi (mtmp);
-                   }
-                 else if (!strcmp (argv[a], "--barwin_width"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           win_width = atoi (mtmp);
-                   }
-                 else if (!strcmp (argv[a], "--barwin_height"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-
-                           win_height = atoi (mtmp);
-                   }
-                 else if (!strcmp (argv[a], "--barwin_bg"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-
-                           strcpy (bgimg, mtmp);
-                   }
-                 else if (!strcmp (argv[a], "--firstbtn_x"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           firstbtn_x = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--firstbtn_y"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           firstbtn_y = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--firstbtn_width"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           firstbtn_width = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--firstbtn_height"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           firstbtn_height = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--lastbtn_x"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           lastbtn_x = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--lastbtn_y"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           lastbtn_y = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--lastbtn_width"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           lastbtn_width = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--lastbtn_height"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           lastbtn_height = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--nubtn_x"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           nubtn_x = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--nubtn_y"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           nubtn_y = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--nubtn_width"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           nubtn_width = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--nubtn_height"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           nubtn_height = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--newbtn_x"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           newbtn_x = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--newbtn_y"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           newbtn_y = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--newbtn_width"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           newbtn_width = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--newbtn_height"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           newbtn_height = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--exitbtn_x"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           exitbtn_x = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--exitbtn_y"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           exitbtn_y = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--exitbtn_width"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           exitbtn_width = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--exitbtn_height"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           exitbtn_height = atoi (mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--firstbtn_img"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (firstbtnimg, mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--lastbtn_img"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (lastbtnimg, mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--nubtn_img"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (nubtnimg, mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--newbtn_img"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (newbtnimg, mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "--exitbtn_img"))
-                   {
-                           mtmp = argv[a + 1];
-                           if (mtmp == NULL || mtmp[0] == '-')
-                             {
-                                     printf ("Missing Argument!\n");
-                                     return (0);
-                             }
-                           strcpy (exitbtnimg, mtmp);
-
-                   }
-                 else if (!strcmp (argv[a], "-u")
-                          || !strcmp (argv[a], "--usage")
-                          || !strcmp (argv[a], "-h")
-                          || !strcmp (argv[a], "--help"))
-                   {
-                           printf (usage);
-                           return (0);
-                   }
-                 else if (!strcmp (argv[a], "-v")
-                          || !strcmp (argv[a], "--version"))
-                   {
-                           printf (version);
-                           return (0);
-                   }
-                 a++;
-         }
-       a = 1;
-
-
-       while (argv[a] != NULL)
-         {
-                 if (!strcmp (argv[a], "-o") || !strcmp (argv[a], "--first"))
-                   {
-                           fnotenum (1);
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "-l")
-                          || !strcmp (argv[a], "--last"))
-                   {
-                           dislast ();
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "--nu"))
-                   {
-                           notengui ();
-                           a++;
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "-n")
-                          || !strcmp (argv[a], "--num"))
-                   {
-                           fnotenum (atoi (argv[a + 1]));
-                           a++;
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "-c")
-                          || !strcmp (argv[a], "--clear"))
-                   {
-                           clear ();
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "-N")
-                          || !strcmp (argv[a], "--new"))
-                   {
-                           newnote (argc, argv);
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "-C")
-                          || !strcmp (argv[a], "--count"))
-                   {
-                           count ();
-                           actionbool = 1;
-                   }
-                 else if (!strcmp (argv[a], "--bar"))
-                   {
-                           runbar ();
-                           actionbool = 1;
-                   }
-                 a++;
-         }
-       a = 0;
-
-       if (actionbool == 0)
-         {
-                 openwin ();
-                 eprog_event_loop ();
-                 return (0);
-         }
-
-       freethem ();
+       deallocatemem ();
 
        eprog_event_loop ();
-}
-
-void
-freethem ()
-{
-       if (tmp)
-               free (tmp);
-       if (str)
-               free (str);
-       if (fn)
-               free (fn);
-       if (fontdir)
-               free (fontdir);
-       if (bgfile)
-               free (bgfile);
-       if (font)
-               free (font);
-       if (configfn)
-               free (configfn);
-       if (xbtnfn)
-               free (xbtnfn);
-       if (barimg)
-               free (barimg);
-}
-
-void
-setconfig ()
-{
-       char *tmp2 = malloc (str_size);
-       int sectiontype = 0;
-       int donebool[43];
-       if (file != NULL)
-         {
-                 fclose (file);
-         }
-       file = fopen (configfn, "r");
-       if (file == NULL)
-         {
-                 printf ("No Configuration File Found.\nUsing Defaults.\n");
-                 return;
-         }
-       while (fgets (tmp2, str_size, file) != NULL)
-         {
-                 if (!strcmp (tmp2, "\n"))
-                   {
-                           goto lp1;
-                   }
-
-                 if (tmp2[0] == '#')
-                   {
-                           goto lp1;
-                   }
-
-                 if (!strncmp (tmp2, "[storage]", (size_t) 9))
-                   {
-                           sectiontype = 1;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[font]", 6))
-                   {
-                           sectiontype = 3;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[bg]", 4))
-                   {
-                           sectiontype = 4;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[txtcolour]", 11))
-                   {
-                           sectiontype = 5;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[xbtnimg]", 9))
-                   {
-                           sectiontype = 9;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barimg]", 8))
-                   {
-                           sectiontype = 10;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[titleimg]", 10))
-                   {
-                           sectiontype = 13;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[lastbtnimg]", 12))
-                   {
-                           sectiontype = 14;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[firstbtnimg]", 13))
-                   {
-                           sectiontype = 15;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[nubtnimg]", 10))
-                   {
-                           sectiontype = 16;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[newbtnimg]", 11))
-                   {
-                           sectiontype = 17;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[fontsize]", 10))
-                   {
-                           sectiontype = 18;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[titlefontsize]", 15))
-                   {
-                           sectiontype = 19;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barwin]", 8))
-                   {
-                           sectiontype = 20;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barfirstbtn]", 13))
-                   {
-                           sectiontype = 25;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barlastbtn]", 12))
-                   {
-                           sectiontype = 30;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barnubtn]", 10))
-                   {
-                           sectiontype = 35;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barnewbtn]", 11))
-                   {
-                           sectiontype = 40;
-                           goto lp1;
-                   }
-                 else if (!strncmp (tmp2, "[barexitbtn]", 12))
-                   {
-                           sectiontype = 45;
-                           goto lp1;
-                   }
-
-                 if (sectiontype == 1)
-                   {
-                           if (donebool[0] != 1)
-                             {
-                                     strncpy (fn, tmp2, strlen (tmp2) - 1);
-                                     donebool[0] = 1;
-                             }
-                           sectiontype == 0;
-                   }
-                 else if (sectiontype == 3)
-                   {
-                           if (donebool[1] != 1)
-                             {
-                                     strncpy (font, tmp2, strlen (tmp2) - 1);
-                                     donebool[1] = 1;
-                             }
-                           sectiontype == 0;
-                   }
-                 else if (sectiontype == 4)
-                   {
-                           if (donebool[2] != 1)
-                             {
-                                     strncpy (bgfile, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[2] == 1;
-                             }
-                           sectiontype == 0;
-                   }
-                 else if (sectiontype == 5)
-                   {
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 6)
-                   {
-                           r = atoi (tmp2);
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 7)
-                   {
-                           g = atoi (tmp2);
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 8)
-                   {
-                           b = atoi (tmp2);
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 9)
-                   {
-                           if (donebool[3] != 1)
-                             {
-                                     strncpy (xbtnfn, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[3] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 10)
-                   {
-                           if (donebool[4] != 1)
-                             {
-                                     strncpy (barimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[4] = 1;
-                             }
-                           sectiontype = 13;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 13)
-                   {
-                           if (donebool[7] != 1)
-                             {
-                                     strncpy (openwinimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[7] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 14)
-                   {
-                           if (donebool[8] != 1)
-                             {
-                                     strncpy (lastbtn, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[8] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 15)
-                   {
-                           if (donebool[9] != 1)
-                             {
-                                     strncpy (firstbtn, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[9] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 16)
-                   {
-                           if (donebool[10] != 1)
-                             {
-                                     strncpy (nubtn, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[10] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 17)
-                   {
-                           if (donebool[11] != 1)
-                             {
-                                     strncpy (newbtn, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[11] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 18)
-                   {
-                           if (donebool[12] != 1)
-                             {
-                                     font_size = atoi (tmp2);
-                                     donebool[12] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 19)
-                   {
-                           if (donebool[13] != 1)
-                             {
-                                     title_font_size = atoi (tmp2);
-                                     donebool[13] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 20)
-                   {
-                           if (donebool[14] != 1)
-                             {
-                                     win_x = atoi (tmp2);
-                                     donebool[14] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 21)
-                   {
-                           if (donebool[15] != 1)
-                             {
-                                     win_y = atoi (tmp2);
-                                     donebool[15] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 22)
-                   {
-                           if (donebool[16] != 1)
-                             {
-                                     win_width = atoi (tmp2);
-                                     donebool[16] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 23)
-                   {
-                           if (donebool[17] != 1)
-                             {
-                                     win_height = atoi (tmp2);
-                                     donebool[17] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 24)
-                   {
-                           if (donebool[18] != 1)
-                             {
-                                     strncpy (bgimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[18] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 25)
-                   {
-                           if (donebool[19] != 1)
-                             {
-                                     firstbtn_x = atoi (tmp2);
-                                     donebool[19] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 26)
-                   {
-                           if (donebool[20] != 1)
-                             {
-                                     firstbtn_y = atoi (tmp2);
-                                     donebool[20] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 27)
-                   {
-                           if (donebool[21] != 1)
-                             {
-                                     firstbtn_width = atoi (tmp2);
-                                     donebool[21] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 28)
-                   {
-                           if (donebool[22] != 1)
-                             {
-                                     firstbtn_height = atoi (tmp2);
-                                     donebool[22] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 29)
-                   {
-                           if (donebool[23] != 1)
-                             {
-                                     strncpy (firstbtnimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[23] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 30)
-                   {
-                           if (donebool[24] != 1)
-                             {
-                                     lastbtn_x = atoi (tmp2);
-                                     donebool[24] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 31)
-                   {
-                           if (donebool[25] != 1)
-                             {
-                                     lastbtn_y = atoi (tmp2);
-                                     donebool[25] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 32)
-                   {
-                           if (donebool[26] != 1)
-                             {
-                                     lastbtn_width = atoi (tmp2);
-                                     donebool[26] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 33)
-                   {
-                           if (donebool[27] != 1)
-                             {
-                                     lastbtn_height = atoi (tmp2);
-                                     donebool[27] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 34)
-                   {
-                           if (donebool[28] != 1)
-                             {
-                                     strncpy (lastbtnimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[28] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 35)
-                   {
-                           if (donebool[29] != 1)
-                             {
-                                     nubtn_x = atoi (tmp2);
-                                     donebool[29] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 36)
-                   {
-                           if (donebool[30] != 1)
-                             {
-                                     nubtn_y = atoi (tmp2);
-                                     donebool[30] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 37)
-                   {
-                           if (donebool[31] != 1)
-                             {
-                                     nubtn_width = atoi (tmp2);
-                                     donebool[31] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 38)
-                   {
-                           if (donebool[32] != 1)
-                             {
-                                     nubtn_height = atoi (tmp2);
-                                     donebool[32] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 39)
-                   {
-                           if (donebool[33] != 1)
-                             {
-                                     strncpy (nubtnimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[33] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 40)
-                   {
-                           if (donebool[34] != 1)
-                             {
-                                     newbtn_x = atoi (tmp2);
-                                     donebool[34] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 41)
-                   {
-                           if (donebool[35] != 1)
-                             {
-                                     newbtn_y = atoi (tmp2);
-                                     donebool[35] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 42)
-                   {
-                           if (donebool[36] != 1)
-                             {
-                                     newbtn_width = atoi (tmp2);
-                                     donebool[36] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 43)
-                   {
-                           if (donebool[37] != 1)
-                             {
-                                     newbtn_height = atoi (tmp2);
-                                     donebool[37] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 44)
-                   {
-                           if (donebool[38] != 1)
-                             {
-                                     strncpy (newbtnimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[38] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 45)
-                   {
-                           if (donebool[39] != 1)
-                             {
-                                     exitbtn_x = atoi (tmp2);
-                                     donebool[39] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 46)
-                   {
-                           if (donebool[40] != 1)
-                             {
-                                     exitbtn_y = atoi (tmp2);
-                                     donebool[40] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 47)
-                   {
-                           if (donebool[41] != 1)
-                             {
-                                     exitbtn_width = atoi (tmp2);
-                                     donebool[41] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 48)
-                   {
-                           if (donebool[42] != 1)
-                             {
-                                     exitbtn_height = atoi (tmp2);
-                                     donebool[42] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-                 else if (sectiontype == 49)
-                   {
-                           if (donebool[43] != 1)
-                             {
-                                     strncpy (exitbtnimg, tmp2,
-                                              strlen (tmp2) - 1);
-                                     donebool[43] = 1;
-                             }
-                           sectiontype++;
-                           goto lp1;
-                   }
-               lp1:
-                 memset (tmp2, 0, sizeof (tmp2));
-         }
-       fclose (file);
-       free (tmp2);
-       return;
 }
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/main.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- main.h      28 Feb 2003 19:06:13 -0000      1.18
+++ main.h      28 Feb 2003 20:27:40 -0000      1.19
@@ -282,8 +282,8 @@
 
 void move_object (Evas_Object * ob, int x, int y);
 void resize_object (Evas_Object * ob, int width, int height);
-void init ();
-void floop ();
+void init (void);
+void floop (void);
 void onclick (Evas_Object * ob, void (*func), const void *data);
 void addtimer (char *name, double interval, void (*func),
               int initloopval /*Optional For Use */ , const void *data);
@@ -294,7 +294,7 @@
 /* Should I do this or not? */
 
 void parseconfig (int argc, char **argv[]);
-void setdefaultvalues ();
+void setdefaultvalues (void);
 
 void openwin (void);
 void makebar (void);
@@ -318,13 +318,19 @@
 
 void fadein (int fadeloop, char *tmpstr);
 void fadeout (int fadeloop);
-void freethem (void);
 
 void slideout (int slideloop);
 void slidein (int slideloop);
 
 void mousemoveevent (Ecore_Event * event);
 
-void okbtnclicked ();
+void okbtnclicked (void);
 
-void runbar ();
+void runbar (void);
+
+void parseusage (int argc, char *argv[]);
+void setconfig (void);
+void setdefaults (void);
+
+void allocatemem (void);
+void deallocatemem (void);
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/newentry.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- newentry.c  26 Feb 2003 20:38:04 -0000      1.7
+++ newentry.c  28 Feb 2003 20:27:40 -0000      1.8
@@ -89,7 +89,8 @@
        ewl_widget_show (cancelbtn);
        ewl_widget_show (okbtn);
 
-       ewl_callback_append (okbtn, EWL_CALLBACK_CLICKED, okbtnclicked, NULL);
+       ewl_callback_append (okbtn, EWL_CALLBACK_CLICKED,
+                            (void *) okbtnclicked, NULL);
        ewl_callback_append (cancelbtn, EWL_CALLBACK_CLICKED, (void *) exit,
                             "-1");
 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to