Showing the changes to Source/Tools/UnixTools/test.c (1 of 9 files). Show all
Unified · Split
| @@ -0,0 +1,63 @@ | ||
| 1 | +//****************************************************************************************************** | |
| 2 | +// test.c - Gbtc | |
| 3 | +// | |
| 4 | +// Copyright � 2014, Grid Protection Alliance. All Rights Reserved. | |
| 5 | +// | |
| 6 | +// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See | |
| 7 | +// the NOTICE file distributed with this work for additional information regarding copyright ownership. | |
| 8 | +// The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may | |
| 9 | +// not use this file except in compliance with the License. You may obtain a copy of the License at: | |
| 10 | +// | |
| 11 | +// http://www.opensource.org/licenses/eclipse-1.0.php | |
| 12 | +// | |
| 13 | +// Unless agreed to in writing, the subject software distributed under the License is distributed on an | |
| 14 | +// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the | |
| 15 | +// License for the specific language governing permissions and limitations. | |
| 16 | +// | |
| 17 | +// Code Modification History: | |
| 18 | +// ---------------------------------------------------------------------------------------------------- | |
| 19 | +// 08/29/2014 - J. Ritchie Carroll | |
| 20 | +// Generated original version of source code. | |
| 21 | +// | |
| 22 | +//****************************************************************************************************** | |
| 23 | + | |
| 24 | +// Compiling for Linux: | |
| 25 | +// | |
| 26 | +// Compile GSF.POSIX.o object library first, then... | |
| 27 | +// | |
| 28 | +// To compile as a mono hosted executable: | |
| 29 | +// gcc -o test test.c GSF.POSIX.o -lpam -lpam_misc -lcrypt | |
| 30 | +// | |
| 31 | + | |
| 32 | +#include <stdlib.h> | |
| 33 | +#include <stdio.h> | |
| 34 | +#include "GSF.POSIX.h" | |
| 35 | + | |
| 36 | +int main(int argc, char* argv[]) | |
| 37 | +{ | |
| 38 | + int retval; | |
| 39 | + | |
| 40 | + if (argc != 2) | |
| 41 | + { | |
| 42 | + fprintf(stderr, "Specify user name as an argument.\n"); | |
| 43 | + retval = 1; | |
| 44 | + } | |
| 45 | + else | |
| 46 | + { | |
| 47 | + struct UserPasswordInformation info; | |
| 48 | + int status; | |
| 49 | + int retval = GetLocalUserPasswordInformation(argv[1], &info, &status); | |
| 50 | + | |
| 51 | + fprintf(stdout, "retval = %d\n", retval); | |
| 52 | + | |
| 53 | + if (retval == 0) | |
| 54 | + { | |
| 55 | + fprintf(stdout, "lastChangeDate = %ld\n", info.lastChangeDate); | |
| 56 | + fprintf(stdout, "minDaysForChange = %ld\n", info.minDaysForChange); | |
| 57 | + fprintf(stdout, "maxDaysForChange = %ld\n", info.maxDaysForChange); | |
| 58 | + fprintf(stdout, "status = %d\n", status); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 62 | + return retval; | |
| 63 | +} | |