Mercurial > libpst
annotate src/nick2ldif.cpp @ 388:292ad0f71fd4
Add operator and quotes to the AX_PYTHON_DEVEL parameter
The operator is required and the quotes are needed to protect PYTHON_VERSION.
See-also: https://www.gnu.org/software/autoconf-archive/ax_python_devel.html
Fixes:
checking whether to build the libpst python interface... yes
checking for python build information...
checking for python3.7... python3.7
checking for main in -lpython3.7... no
checking for main in -lpython3.7m... yes
results of the Python check:
Binary: python3.7
Library: python3.7m
Include Dir: /usr/include/python3.7m
checking for python3.7... /usr/bin/python3.7
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python 3.7... File "<string>", line 1
import sys; ver = sys.version.split ()[0]; print (ver 3.7)
^
SyntaxError: invalid syntax
no
configure: error: this package requires Python 3.7.
If you have it installed, but it isn't the default Python
interpreter in your system path, please pass the PYTHON_VERSION
variable to configure. See ``configure --help'' for reference.
author | Paul Wise <pabs3@bonedaddy.net> |
---|---|
date | Sat, 21 Dec 2019 21:25:45 +0800 |
parents | 8ad8fd1c5451 |
children |
rev | line source |
---|---|
16 | 1 /* |
2 | |
3 Copyright (c) 2004 Carl Byington - 510 Software Group, released under | |
4 the GPL version 2 or any later version at your choice available at | |
5 http://www.fsf.org/licenses/gpl.txt | |
6 | |
7 */ | |
8 | |
9 #include <iostream> | |
123
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
10 |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
21
diff
changeset
|
11 extern "C" { |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
21
diff
changeset
|
12 #include "define.h" |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
21
diff
changeset
|
13 } |
16 | 14 |
15 char *ldap_base = NULL; | |
16 char *ldap_org = NULL; | |
17 char *ldap_class = NULL; | |
18 | |
19 using namespace std; | |
20 | |
258
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
21 int main(int argc, char* const* argv) { |
16 | 22 char c; |
23 char *temp; | |
24 while ((c = getopt(argc, argv, "b:c:"))!= -1) { | |
25 switch (c) { | |
26 case 'b': | |
27 ldap_base = optarg; | |
28 temp = strchr(ldap_base, ','); | |
29 if (temp) { | |
30 *temp = '\0'; | |
31 ldap_org = strdup(ldap_base); | |
32 *temp = ','; | |
33 } | |
34 break; | |
35 case 'c': | |
36 ldap_class = optarg; | |
37 break; | |
38 default: | |
39 break; | |
40 } | |
41 } | |
42 | |
43 const int LINE_SIZE = 2000; | |
44 char line[LINE_SIZE]; | |
45 while (!cin.eof()) { | |
46 cin.getline(line, LINE_SIZE); | |
47 int n = strlen(line); | |
48 if (!n) continue; | |
258
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
49 if (strncmp(line, "alias", 5) != 0) continue; // not alias |
16 | 50 char *f = line + 6; // skip alias keyword |
51 char *e; | |
52 if (*f == '"') { | |
53 f++; | |
54 e = strchr(f, '"'); | |
55 } | |
56 else { | |
57 e = strchr(f, ' '); | |
58 } | |
59 if (!e) continue; | |
60 *e = '\0'; | |
61 char *m = e+1; | |
62 while (*m == ' ') m++; | |
63 if (*m != '\0') { | |
258
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
64 char cn[1000], givenName[1000], sn[1000]; |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
65 snprintf(cn, sizeof(cn), "%s", f); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
66 char *ff = strchr(f, ' '); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
67 if (ff) { |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
68 strncpy(givenName, ff+1, sizeof(givenName)-1); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
69 *ff = '\0'; |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
70 strncpy(sn, f, sizeof(sn)-1); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
71 } |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
72 else { |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
73 strcpy(givenName, cn); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
74 strcpy(sn, cn); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
75 } |
16 | 76 printf("dn: cn=%s, %s\n", cn, ldap_base); |
77 printf("cn: %s\n", cn); | |
258
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
78 printf("givenName: %s\n", givenName); |
8ad8fd1c5451
check return codes from forked processes
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
79 printf("sn: %s\n", sn); |
16 | 80 printf("mail: %s\n", m); |
81 printf("objectClass: %s\n\n", ldap_class); | |
82 } | |
83 } | |
84 } |