Make the cmd config file parser build on Windows

Change-Id: Id6c3515869529b6fb5c48a06661b63bed974e436
Reviewed-on: http://gerrit.openafs.org/7141
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
Simon Wilkinson 2012-04-22 10:20:18 -04:00 committed by Derrick Brashear
parent 1a823e9326
commit f45ed29d5f
2 changed files with 56 additions and 20 deletions

View File

@ -15,6 +15,8 @@ INCFILEDIR = $(DESTDIR)\include\afs
INCFILES =\ INCFILES =\
$(INCFILEDIR)\cmd.h $(INCFILEDIR)\cmd.h
HEIMDAL = ..\external\heimdal\krb5
# build afscmd.lib # build afscmd.lib
LIBFILE = $(DESTDIR)\lib\afs\afscmd.lib LIBFILE = $(DESTDIR)\lib\afs\afscmd.lib
@ -23,11 +25,21 @@ LIBOBJS =\
$(OUT)\cmd_errors.obj \ $(OUT)\cmd_errors.obj \
$(OUT)\cmd.obj \ $(OUT)\cmd.obj \
$(OUT)\AFS_component_version_number.obj $(OUT)\AFS_component_version_number.obj
HEIMOBJS =\
$(OUT)\config_file.obj \
$(OUT)\expand_path.obj
$(LIBOBJS): $$(@B).c $(LIBOBJS): $$(@B).c
$(C2OBJ) $** $(C2OBJ) $**
$(LIBFILE): $(LIBOBJS) $(OUT)\expand_path.obj: $(HEIMDAL)\$$(@B).c
$(C2OBJ) -I$(HEIMDAL) -DEXPAND_PATH_HEADER $**
$(OUT)\config_file.obj: $(HEIMDAL)\$$(@B).c
$(C2OBJ) -I$(HEIMDAL) -DKRB5_USE_PATH_TOKENS $**
$(LIBFILE): $(LIBOBJS) $(HEIMOBJS)
$(LIBARCH) $(LIBARCH)
$(INCFILES):$$(@F) $(INCFILES):$$(@F)

View File

@ -7,22 +7,15 @@
#include <afsconfig.h> #include <afsconfig.h>
#include <afs/stds.h> #include <afs/stds.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <roken.h> #include <roken.h>
#include <assert.h>
#include <ctype.h>
#include "cmd.h" #include "cmd.h"
#define PACKAGE "openafs"
#ifndef TRUE #ifndef TRUE
# define TRUE 1 # define TRUE 1
#endif #endif
@ -37,8 +30,6 @@
#define KRB5_DEPRECATED_FUNCTION(x) #define KRB5_DEPRECATED_FUNCTION(x)
#define KRB5_CONFIG_BADFORMAT CMD_BADFORMAT
#define N_(X,Y) X #define N_(X,Y) X
typedef struct cmd_config_binding krb5_config_binding; typedef struct cmd_config_binding krb5_config_binding;
@ -56,6 +47,41 @@ typedef int krb5_error_code;
typedef int krb5_boolean; typedef int krb5_boolean;
typedef time_t krb5_deltat; typedef time_t krb5_deltat;
static void krb5_set_error_message(krb5_context context, krb5_error_code ret,
const char *fmt, ...) {
return;
}
#ifdef EXPAND_PATH_HEADER
#include <shlobj.h>
static int _krb5_expand_path_tokens(krb5_context, const char *, char**);
int
_cmd_ExpandPathTokens(krb5_context context, const char *in, char **out) {
return _krb5_expand_path_tokens(context, in, out);
}
HINSTANCE _krb5_hInstance = NULL;
/* This bodge avoids the need for everything linking against cmd to also
* link against the shell library on Windows */
#undef SHGetFolderPath
#define SHGetFolderPath internal_getpath
HRESULT internal_getpath(void *a, int b, void *c, DWORD d, LPTSTR out) {
return E_INVALIDARG;
}
#else
#define KRB5_CONFIG_BADFORMAT CMD_BADFORMAT
#define _krb5_expand_path_tokens _cmd_ExpandPathTokens
extern int _cmd_ExpandPathTokens(krb5_context, const char *, char **);
static const void *_krb5_config_vget(krb5_context, static const void *_krb5_config_vget(krb5_context,
const krb5_config_section *, int, const krb5_config_section *, int,
va_list); va_list);
@ -92,10 +118,6 @@ KRB5_LIB_FUNCTION void krb5_clear_error_message(krb5_context context) {
return; return;
} }
static void krb5_set_error_message(krb5_context context, krb5_error_code ret,
const char *fmt, ...) {
return;
}
static int _krb5_homedir_access(krb5_context context) { static int _krb5_homedir_access(krb5_context context) {
return 0; return 0;
@ -115,6 +137,7 @@ krb5_abortx(krb5_context context, const char *fmt, ...)
/* Wrappers */ /* Wrappers */
int int
cmd_RawConfigParseFileMulti(const char *fname, cmd_config_section **res) { cmd_RawConfigParseFileMulti(const char *fname, cmd_config_section **res) {
return krb5_config_parse_file_multi(NULL, fname, res); return krb5_config_parse_file_multi(NULL, fname, res);
@ -187,3 +210,4 @@ cmd_RawConfigGetList(const cmd_config_section *c, ...)
return ret; return ret;
} }
#endif