From fce48fa1b462ded1453520355bf2dce0f607b8dc Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Tue, 31 May 2005 23:42:29 +0000 Subject: [PATCH] r7156: file was missing; svn isn't smart enough to even notify me. sigh. --- examples/libsmbclient/get_auth_data_fn.h | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 examples/libsmbclient/get_auth_data_fn.h diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h new file mode 100644 index 00000000000..2954039f0aa --- /dev/null +++ b/examples/libsmbclient/get_auth_data_fn.h @@ -0,0 +1,52 @@ +static void +get_auth_data_fn(const char * pServer, + const char * pShare, + char * pWorkgroup, + int maxLenWorkgroup, + char * pUsername, + int maxLenUsername, + char * pPassword, + int maxLenPassword) + +{ + char temp[128]; + + fprintf(stdout, "Workgroup: [%s] ", pWorkgroup); + fgets(temp, sizeof(temp), stdin); + + if (temp[strlen(temp) - 1] == '\n') /* A new line? */ + { + temp[strlen(temp) - 1] = '\0'; + } + + if (temp[0] != '\0') + { + strncpy(pWorkgroup, temp, maxLenWorkgroup - 1); + } + + fprintf(stdout, "Username: [%s] ", pUsername); + fgets(temp, sizeof(temp), stdin); + + if (temp[strlen(temp) - 1] == '\n') /* A new line? */ + { + temp[strlen(temp) - 1] = '\0'; + } + + if (temp[0] != '\0') + { + strncpy(pUsername, temp, maxLenUsername - 1); + } + + fprintf(stdout, "Password: "); + fgets(temp, sizeof(temp), stdin); + + if (temp[strlen(temp) - 1] == '\n') /* A new line? */ + { + temp[strlen(temp) - 1] = '\0'; + } + + if (temp[0] != '\0') + { + strncpy(pPassword, temp, maxLenPassword - 1); + } +} -- 2.34.1