Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
bee
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
0
Code
Issues
7
Pull requests
3
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
a2426f2
buildtypes
conf
contrib
hooks
manpages
src
bee-cache-inventory.c
bee-cache-update.sh.in
bee-cache.sh.in
bee-check.sh.in
bee-download.sh.in
bee-init.sh.in
bee-install.sh.in
bee-list.sh.in
bee-query.sh.in
bee-remove.sh.in
bee-update.sh.in
bee.sh.in
bee_getopt.c
bee_getopt.h
bee_tree.c
bee_tree.h
bee_version.h
bee_version_compare.c
bee_version_compare.h
bee_version_output.c
bee_version_output.h
bee_version_parse.c
bee_version_parse.h
beecut.c
beefind.sh.in
beeflock.c
beegetopt.c
beelib.config.sh.in
beesep.c
beesh.sh.in
beesort.c
beeuniq.c
beeversion.c
compat-filesfile2contentfile.sh.in
compat-fixmetadir.sh.in
content2filelist.sh.in
filelist2content.sh.in
test.c
.gitattributes
.gitignore
COPYING
DEPENDENCIES
INSTALL
Makefile
TODO
Breadcrumbs
bee
/
src
/
bee_version_output.c
Blame
Blame
Latest commit
History
History
197 lines (172 loc) · 5.42 KB
Breadcrumbs
bee
/
src
/
bee_version_output.c
Top
File metadata and controls
Code
Blame
197 lines (172 loc) · 5.42 KB
Raw
/* ** beeversion - compare bee package versionnumbers ** Copyright (C) 2010-2016 ** Marius Tolzmann <m@rius.berlin> ** David Fessler <dfessler@uni-potsdam.de> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> #include <assert.h> #include "bee_version.h" static void cut_and_print(char *string, char delimiter, char opt_short) { char *p, *s; assert(string); p = s = string; printf("%s", string); while((p=strchr(p, delimiter))) { putchar(' '); while(s < p) putchar(*(s++)); p++; s = (opt_short) ? p : string; } printf(" %s", s); } void print_format(char* s, struct beeversion *v, char *filter_pkgfullname) { char *p; size_t len; assert(s); assert(v); assert(v->pkgname); assert(v->subname); assert(v->version); assert(v->extraversion); assert(v->pkgrevision); assert(v->arch); assert(v->suffix); p=s; if(filter_pkgfullname) { len = strlen(v->pkgname); if(len > strlen(filter_pkgfullname)) return; if(strncmp(v->pkgname, filter_pkgfullname, len)) return; p = filter_pkgfullname+len; if((!*p && *(v->subname)) || (*p && *p++ != '_')) return; if(strcmp(p, v->subname)) return; } for(p=s; *p; p++) { if(*p == '%') { switch(*(++p)) { case '%': printf("%%"); break; case 'p': printf("%s", v->pkgname); break; case 's': if(*(v->suffix)) printf(".%s", v->suffix); break; case 'x': printf("%s", v->subname); break; case 'v': printf("%s", v->version); break; case 'e': printf("%s", v->extraversion); break; case 'r': printf("%s", v->pkgrevision); break; case 'a': printf("%s", v->arch); break; case 'P': printf("%s", v->pkgname); if(*(v->subname)) printf("_%s", v->subname); break; case 'V': printf("%s", v->version); if(*(v->extraversion)) printf("_%s", v->extraversion); break; case 'F': case 'A': if(*(v->pkgname)) printf("%s", v->pkgname); if(*(v->subname)) printf("_%s", v->subname); if(*(v->version)) printf("-%s", v->version); if(*(v->extraversion)) printf("_%s", v->extraversion); if(*(v->pkgrevision)) printf("-%s", v->pkgrevision); if(*p == 'A' && *(v->arch)) printf(".%s", v->arch); break; case '-': case '_': switch(*(p+1)) { case 'x': if (*(v->subname)) printf("%c%s", *p, v->subname); p++; break; case 'e': if (*(v->extraversion)) printf("%c%s", *p, v->extraversion); p++; break; } break; } continue; } /* if '%' */ if(*p == '@') { switch(*(++p)) { case 'v': cut_and_print(v->version, '.', 0); break; case 'e': cut_and_print(v->extraversion, '_', 0); break; case 'V': cut_and_print(v->version, '.', 1); break; case 'E': cut_and_print(v->extraversion, '_', 1); break; } continue; } /* if '@' */ if(*p == '\\') { switch(*(++p)) { case 'n': printf("\n"); break; case 't': printf("\t"); break; case '0': printf("%c", '\0'); break; default: printf("%c", *p); break; } continue; } /* if '\' */ printf("%c", *p); } /* for *p */ }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
You can’t perform that action at this time.