Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=xcmenu.git;a=commitdiff;h=0cda5381c21dc338bfffa5fb83041040e89f1052

commit 0cda5381c21dc338bfffa5fb83041040e89f1052
Author: James Buren <[email protected]>
Date:   Mon Jan 5 07:19:48 2009 -0600

xcmenu.c
* implement a filechk function
* define some more macros
* extended init some

diff --git a/xcmenu.c b/xcmenu.c
index 585bec4..4989b57 100644
--- a/xcmenu.c
+++ b/xcmenu.c
@@ -1,9 +1,13 @@
/* define some useful stuff */
#define BUFFER 256
+#define TRUE   1
+#define FALSE  0
+#define FERROR "No such file or directory: "

/* include some essential header files */
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>

/* initialize some useful global variables */

@@ -28,12 +32,23 @@ static void error(const char *str1,const char *str2)
exit(1);
}

+/* check if a file need to be commited to the nut house */
+static int filechk(const char *filename)
+{
+       struct stat file;
+       if (stat(filename,&file)<0)
+               return(FALSE);
+       return(TRUE);
+}
+
/* lets get this party started! :D */
static void init()
{
home = getenv("HOME");
if (!home)
error("Failed to retrieve HOME environmental variable.",NULL);
+       if (!filechk(home))
+               error(FERROR,home);
}

/* stop defining functions */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to