masqmail

changeset 260:bd3109ec0f0a

substituted get_progname() with a call to strrchr()
author markus schnalke <meillo@marmaro.de>
date Thu, 02 Dec 2010 16:45:26 -0300
parents f4117fd5a163
children 0afe18a9ee03
files src/masqmail.c
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line diff
     1.1 --- a/src/masqmail.c	Thu Dec 02 16:22:55 2010 -0300
     1.2 +++ b/src/masqmail.c	Thu Dec 02 16:45:26 2010 -0300
     1.3 @@ -114,18 +114,6 @@
     1.4  	return NULL;
     1.5  }
     1.6  
     1.7 -gchar*
     1.8 -get_progname(gchar * arg0)
     1.9 -{
    1.10 -	gchar *p = arg0 + strlen(arg0) - 1;
    1.11 -	while (p > arg0) {
    1.12 -		if (*p == '/')
    1.13 -			return p + 1;
    1.14 -		p--;
    1.15 -	}
    1.16 -	return p;
    1.17 -}
    1.18 -
    1.19  gboolean
    1.20  write_pidfile(gchar * name)
    1.21  {
    1.22 @@ -400,7 +388,9 @@
    1.23  	gboolean do_verbose = FALSE;
    1.24  	gint debug_level = -1;
    1.25  
    1.26 -	progname = get_progname(argv[0]);
    1.27 +	/* strip the path part */
    1.28 +	progname = strrchr(argc[0], '/');
    1.29 +	progname = (progname) ? progname+1 : argc[0];
    1.30  
    1.31  	if (strcmp(progname, "mailq") == 0) {
    1.32  		mta_mode = MODE_LIST;
    1.33 @@ -537,7 +527,6 @@
    1.34  	}
    1.35  
    1.36  	if (!mta_mode) {
    1.37 -		fprintf(stderr, "arg:%d argc:%d\n", arg, argc);
    1.38  		mta_mode = (arg<argc || opt_t) ? MODE_ACCEPT : MODE_VERSION;
    1.39  	}
    1.40