Diff

Differences From Artifact [341b40c218]:

To Artifact [508cc92a36]:


34
35
36
37
38
39
40

41
42
43
44
45
46
47

#ifdef HAVE_PWD_H
#include <pwd.h>
#endif

struct lc_varhandler_st *varhandlers = NULL;
lc_err_t lc_errno = LC_ERR_NONE;

const char *lc_errfile = NULL;
int lc_optind = 0;
int lc_errline = 0;

extern char **environ;

static int lc_process_var_string(void *data, const char *value, const char **endptr) {







>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

#ifdef HAVE_PWD_H
#include <pwd.h>
#endif

struct lc_varhandler_st *varhandlers = NULL;
lc_err_t lc_errno = LC_ERR_NONE;
const char *lc_err_usererrmsg = NULL;
const char *lc_errfile = NULL;
int lc_optind = 0;
int lc_errline = 0;

extern char **environ;

static int lc_process_var_string(void *data, const char *value, const char **endptr) {
977
978
979
980
981
982
983






984
985
986
987
988
989
990

		next = handler->_next;

		free(handler);

		handler = next;
	}







	varhandlers = NULL;

	return;
}

int lc_process(int argc, char **argv, const char *appname, lc_conf_type_t type, const char *extra) {







>
>
>
>
>
>







978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997

		next = handler->_next;

		free(handler);

		handler = next;
	}

	if (lc_err_usererrmsg) {
		free((char *) lc_err_usererrmsg);

		lc_err_usererrmsg = NULL;
	}

	varhandlers = NULL;

	return;
}

int lc_process(int argc, char **argv, const char *appname, lc_conf_type_t type, const char *extra) {
1017
1018
1019
1020
1021
1022
1023




1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034

	retval = lc_errno;

	lc_errno = LC_ERR_NONE;

	return(retval);
}





char *lc_geterrstr(void) {
	static char retval[512];
	char *errmsg = NULL;

	switch (lc_errno) {
		case LC_ERR_NONE:
			errmsg = "Success";
			break;
		case LC_ERR_INVCMD:
			errmsg = "Invalid command or option";







>
>
>
>



|







1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045

	retval = lc_errno;

	lc_errno = LC_ERR_NONE;

	return(retval);
}

void lc_seterrstr(const char *usererrmsg) {
	lc_err_usererrmsg = strdup(usererrmsg);
}

char *lc_geterrstr(void) {
	static char retval[512];
	const char *errmsg = NULL;

	switch (lc_errno) {
		case LC_ERR_NONE:
			errmsg = "Success";
			break;
		case LC_ERR_INVCMD:
			errmsg = "Invalid command or option";
1042
1043
1044
1045
1046
1047
1048



1049

1050
1051
1052
1053
1054
1055
1056
		case LC_ERR_BADFORMAT:
			errmsg = "Bad data specified or incorrect format.";
			break;
		case LC_ERR_CANTOPEN:
			errmsg = "Can't open file.";
			break;
		case LC_ERR_CALLBACK:



			errmsg = "Error return from application handler.";

			break;
		case LC_ERR_ENOMEM:
			errmsg = "Insuffcient memory.";
			break;
	}

	/*







>
>
>
|
>







1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
		case LC_ERR_BADFORMAT:
			errmsg = "Bad data specified or incorrect format.";
			break;
		case LC_ERR_CANTOPEN:
			errmsg = "Can't open file.";
			break;
		case LC_ERR_CALLBACK:
			if (lc_err_usererrmsg) {
				errmsg = lc_err_usererrmsg;
			} else {
				errmsg = "Error return from application handler.";
			}
			break;
		case LC_ERR_ENOMEM:
			errmsg = "Insuffcient memory.";
			break;
	}

	/*