Skip to content

Commit 628dd43

Browse files
committed
fix the usage() printout message
1 parent 4aafd76 commit 628dd43

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

src/Test_General.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ void TestIt(long R, long p, long r, long d, long c, long k, long w,
179179
}
180180

181181

182-
void usage()
182+
void usage(char *prog)
183183
{
184-
cerr << "Usage: Test_PAlgebra_x [ optional parameters ]...\n";
184+
cerr << "Usage: "<<prog<<" [ optional parameters ]...\n";
185185
cerr << " optional parameters have the form 'attr1=val1 attr2=val2 ...'\n";
186186
cerr << " e.g, 'R=4 L=9 k=80'\n\n";
187187
cerr << " R is the number of rounds\n";
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
212212
argmap["m"] = "0";
213213

214214
// get parameters from the command line
215-
if (!parseArgs(argc, argv, argmap)) usage();
215+
if (!parseArgs(argc, argv, argmap)) usage(argv[0]);
216216

217217
long R = atoi(argmap["R"]);
218218
long p = atoi(argmap["p"]);

src/Test_LinPoly.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
NTL_CLIENT
2323

2424

25-
void usage()
25+
void usage(char *prog)
2626
{
27-
cerr << "bad command line\n";
28-
exit(0);
27+
cerr << "Usage: "<<prog<<" [ optional parameters ]...\n";
28+
cerr << " optional parameters have the form 'attr1=val1 attr2=val2 ...'\n";
29+
cerr << " e.g, 'p=5 r=1 m=101'\n\n";
30+
cerr << " p is the plaintext base [default=5]" << endl;
31+
cerr << " r is the lifting [default=1]" << endl;
32+
cerr << " m defines the cyclotomic polynomial Phi_m(X) [default=101]"<< endl;
33+
exit(0);
2934
}
3035

3136
int main(int argc, char *argv[])
@@ -35,7 +40,7 @@ int main(int argc, char *argv[])
3540
argmap["m"] = "101";
3641
argmap["r"] = "1";
3742

38-
if (!parseArgs(argc, argv, argmap)) usage();
43+
if (!parseArgs(argc, argv, argmap)) usage(argv[0]);
3944

4045
long p = atoi(argmap["p"]);
4146
long m = atoi(argmap["m"]);

src/Test_Replicate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ void TestIt(long p, long r, long d, long c, long k, long w,
203203
}
204204

205205

206-
void usage()
206+
void usage(char *prog)
207207
{
208-
cerr << "Usage: Test_PAlgebra_x [ optional parameters ]...\n";
208+
cerr << "Usage: "<<prog<<" [ optional parameters ]...\n";
209209
cerr << " p is the plaintext base [default=2]" << endl;
210210
cerr << " r is the lifting [default=1]" << endl;
211211
cerr << " d is the degree of the field extension [default==1]\n";
@@ -237,7 +237,7 @@ int main(int argc, char *argv[])
237237
argmap["M"] = "0";
238238
argmap["v"] = "0";
239239

240-
if (!parseArgs(argc, argv, argmap)) usage();
240+
if (!parseArgs(argc, argv, argmap)) usage(argv[0]);
241241

242242
long p = atoi(argmap["p"]);
243243
long r = atoi(argmap["r"]);

src/Test_matmul.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ void TestIt(long R, long p, long r, long d, long c, long k, long w,
222222

223223
}
224224

225-
void usage()
225+
void usage(char *prog)
226226
{
227-
cerr << "Usage: Test_PAlgebra_x [ optional parameters ]...\n";
227+
cerr << "Usage: "<<prog<<" [ optional parameters ]...\n";
228228
cerr << " optional parameters have the form 'attr1=val1 attr2=val2 ...'\n";
229-
cerr << " e.g, 'R=4 L=9 k=80'\n\n";
229+
cerr << " e.g, 'R=1 p=2 k=80'\n\n";
230230
cerr << " R is the number of rounds\n";
231231
cerr << " p is the plaintext base [default=2]" << endl;
232232
cerr << " r is the lifting [default=1]" << endl;
@@ -236,7 +236,7 @@ void usage()
236236
cerr << " k is the security parameter [default=80]\n";
237237
cerr << " L is the # of primes in the modulus chai [default=4*R]\n";
238238
cerr << " s is the minimum number of slots [default=4]\n";
239-
cerr << " m is a specific modulus\n";
239+
cerr << " m defined the cyclotomic polynomial Phi_m(X)\n";
240240
exit(0);
241241
}
242242

@@ -255,7 +255,7 @@ int main(int argc, char *argv[])
255255
argmap["m"] = "0";
256256

257257
// get parameters from the command line
258-
if (!parseArgs(argc, argv, argmap)) usage();
258+
if (!parseArgs(argc, argv, argmap)) usage(argv[0]);
259259

260260
long R = atoi(argmap["R"]);
261261
long p = atoi(argmap["p"]);

0 commit comments

Comments
 (0)