Package: sympow / 1.023-8

upstream-versiontuple.patch Patch series | download
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
Description: version-tuple
 Implemtent a scheme to add flavour to the version string;
 by flavour, read either something as distribution version
 or type (BETA, ALPHA, RELEASE) or a combination of both.
 An option is added to display the release version numbers
 as formatted in the upstream source, Major version number
 and minor version number concatenated with a dot at the
 time of writing.
Origin: vendor, Debian
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2014-10-25

--- a/main.c
+++ b/main.c
@@ -191,7 +191,7 @@
 
 int main(int argc,char **argv)
 {char INSTRING[1024]="2w3s1p32,3bp16d1,4p8\0",CSTR[1024]="\0",LSTR[1024]="\0";
- char TYPE[16]; int i=1; llint NT,UB=(((llint) 1)<<45);
+ char TYPE[128]; int i=1; llint NT,UB=(((llint) 1)<<45);
  int NO_CM=FALSE,info=0,ROOTNO=FALSE,SLOPPY=0,QD_CHECK;
  NO_QT=FALSE; VERBOSE=VERBOSE_DEFAULT; GLOBAL=TRUE; HECKE=FALSE; TWIST=FALSE; AP_SAVE=0;
  CM_CASE=FALSE; GET=malloc(1024); COND0=1; fp3=0; fp2=0; MAX_TABLE=1<<27;
@@ -200,7 +200,7 @@
 #if defined(ISOC99_FENV) || defined(FPUCONTROLH) || defined(x86)
  fpu_53bits();
 #endif
- strcpy(TYPE,"RELEASE"); MD_SPEED=2.0;
+ snprintf(TYPE,sizeof(TYPE),"%s",FLAVOUR); MD_SPEED=2.0;
  while(i<argc)
  {if (!strcmp(argv[i],"-quiet")) {VERBOSE=0; i++;}
   else if ((!strcmp(argv[i],"-sympow")) || (!strcmp(argv[i],"-sp")))
@@ -208,8 +208,9 @@
   else if (!strcmp(argv[i],"-terse")) {VERBOSE=1; i++;}
   else if (!strcmp(argv[i],"-verbose")) {VERBOSE=2; i++;}
   else if (!strcmp(argv[i],"-help")) help_message();
-  else if (!strcmp(argv[i],"-version")) { printf("%s\n",VERSION); exit(0);}
+  else if (!strcmp(argv[i],"-version")) { printf("%s %s\n",VERSION,TYPE); exit(0);}
   else if (!strcmp(argv[i],"-dump-endiantuple")) { printf("%s\n",ENDIANTUPLE); exit(0);}
+  else if (!strcmp(argv[i],"-dump-versiontuple")) { printf("%s\n",VERSION); exit(0);}
   else if (!strcmp(argv[i],"-curve")) {strcpy(CSTR,argv[i+1]); i+=2;}
   else if (!strcmp(argv[i],"-label")) {strcpy(LSTR,argv[i+1]); i+=2;}
   else if (!strcmp(argv[i],"-info")) {info=i+1; i+=3;}
--- a/help.c
+++ b/help.c
@@ -65,6 +65,7 @@
  printf("\n");
  printf(" -dump-endiantuple  display the endian-tuple, used as a component\n");
  printf("                    in the binary data paths, and exit\n");
+ printf(" -dump-versiontuple display the version-tuple (Major.minor) and exit\n");
  printf("\n");
  printf(" -version      print program version and exit\n");
  printf(" -help         display this help and exit\n");
--- a/sympow.h
+++ b/sympow.h
@@ -6,6 +6,11 @@
 #include <strings.h>
 #include "config.h"
 
+/* flavour/type */
+#ifndef FLAVOUR
+#define FLAVOUR "RELEASE"
+#endif
+
 /* user level usage */
 #define SYMPOW_ENV_CACHEDIR    "SYMPOW_CACHEDIR"