ports/irc/psybnc/files/patch-src_psybnc.c
Mathieu Arnold 7ae7b018cc With the power of USES=dos2unix, get rid of most patches and files
with CRLF.

While there, run make makepatch, rename patches to use the new scheme,
and various fixes.

With hat:	portmgr
Sponsored by:	Absolight
2016-06-20 16:23:28 +00:00

47 lines
1.3 KiB
C

--- src/psybnc.c.orig 2016-06-20 14:41:27 UTC
+++ src/psybnc.c
@@ -44,6 +44,8 @@ int slice=0;
#ifdef HAVE_SSL
+int fexists(char *fname);
+
void initSSL()
{
SSL_load_error_strings();
@@ -171,13 +173,17 @@ main (int argc, char **argv)
if(argc==2)
{
strmncpy(configfile,argv[1],sizeof(configfile));
- } else {
+ } else if (fexists("psybnc.conf")) {
+ strcpy(configfile, "psybnc.conf");
+ } else if (fexists(PREFIX "/etc/psybnc.conf")) {
strcpy(configfile,"psybnc.conf"); /* rcsid */
+ } else {
+ strcpy(configfile, "psybnc.conf");
}
conffile=fopen(configfile,"r");
if(conffile==NULL)
{
- printf("Configuration File %s not found, aborting\nRun 'make menuconfig' for creating a configuration or create the file manually.\n",conffile); /* rcsid */
+ printf("Configuration file psybnc.conf not found in current directory or in " PREFIX "/etc/psybnc.conf.\n Copy " PREFIX "/etc/psybnc.conf.sample to the current directory as psybnc.conf :\n cp " PREFIX "/etc/psybnc.conf.sample psybnc.conf\n\nOR create the file manually.\n"); /* rcsid */
exit (0x0);
}
fclose(conffile);
@@ -302,3 +308,15 @@ main (int argc, char **argv)
bncmain();
}
+int fexists(char *fname)
+{
+ FILE *fn;
+ int rc=0;
+ fn=fopen(fname,"r");
+ if(fn!=NULL)
+ {
+ fclose(fn);
+ rc=1;
+ }
+ return rc;
+}