forked from RefPerSys/RefPerSys
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo-build-refpersys-plugin.cc
More file actions
642 lines (610 loc) · 21 KB
/
Copy pathdo-build-refpersys-plugin.cc
File metadata and controls
642 lines (610 loc) · 21 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
/// file do-build-refpersys-plugin.cc in refpersys.org
/// SPDX-License-Identifier: GPL-3.0-or-later
///
/// Description:
/// This file is part of the Reflective Persistent System.
/// © Copyright 2024 - 2025 The Reflective Persistent System Team
/// team@refpersys.org & http://refpersys.org/
///
/// Purpose: build a plugin for RefPerSys
///
/// Caveat: this do-build-refpersys-plugin program should run quickly
/// and uses GNU make or ninja from ninja-build.org. It could leak
/// memory.
///
/// invocation: do-build-refpersys-plugin <plugin-c++-source> -o <plugin-shared-object>
/// e.g. do-build-refpersys-plugin plugins_dir/foo.cc -o /tmp/foo.so
/// other program options are:
/// ./do-build-refpersys-plugin --version | -V #give also defaults
/// ./do-build-refpersys-plugin --verbose | -v #verbose execution
/// ./do-build-refpersys-plugin --output=PLUGIN | -o PLUGIN #output generated .so
/// ./do-build-refpersys-plugin --dirobj=OBJ_DIR | -d OBJ_DIR #directory for object files
/// ./do-build-refpersys-plugin --shell=CMD | -S CMD #run shell command
/// ./do-build-refpersys-plugin --plugin-src=DIRNAME | -s DIRNAME #plugin source directory
/// ./do-build-refpersys-plugin --help | -h #this help
/// ./do-build-refpersys-plugin --ninja=NINJAFILE | -N NINJAFILE #add to generated ninja-build script
///
///// The C++ plugin sources may contain comments driving the compilation
///
/// Author(s):
/// Basile Starynkevitch <basile@starynkevitch.net>
/// License: GPLv3+ (file COPYING-GPLv3)
/// This software 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.
///
#define _GNU_SOURCE 1
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <cassert>
#include <set>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
#include <libgen.h>
//// www.gnu.org/software/guile/ version 3
#include <libguile.h>
///
#define BP_HEAD_LINES_THRESHOLD 512
#define BP_MAX_OPTIONS 32
/// a macro to ease GDB breakpoint
#define BP_NOP_BREAKPOINT() do {asm volatile ("nop; nop");} while(0)
#pragma message "compiling " __FILE__
#warning perhaps replace pkg-config with "https://github.com/pkgconf/pkgconf"
#warning fix issue #24 on github.com/RefPerSys/RefPerSys
extern "C" {
#include "__timestamp.c"
const char bp_git_id[]=GIT_ID;
char bp_hostname[128];
const char* bp_progname;
int bp_argc_prog;
char**bp_argv_prog;
const char** bp_env_prog;
const char* bp_plugin_binary; // generated shared object
std::string bp_srcdir; // plugin source directory
void bp_initialize_guile_scheme(void);
#warning bp_srcdir plugin source directory incompletely handled
// if only once C++ source given set bp_srcdir to its dirname
std::string bp_objdir; // plugin object directory
std::vector<std::string> bp_vect_cpp_sources; // vector of C++ sources
std::string bp_temp_ninja; // temporary generated file for ninja-build.org
std::set<std::string> bp_set_objects; // set of object files
std::map<std::string,int> bp_map_ixobj; // mapping from objects to
// indexes in
// bp_vect_cpp_sources
bool bp_verbose;
struct option* bp_options_ptr;
}; // end extern "C"
struct option bp_options_arr[BP_MAX_OPTIONS] =
{
{
.name= "verbose", // --verbose | -v
.has_arg= no_argument,
.flag= nullptr,
.val= 'v',
},
{
.name= "version", // --version | -V
.has_arg= no_argument,
.flag= nullptr,
.val= 'V',
},
{
.name= "output", // --output=PLUGIN | -o PLUGIN
.has_arg= required_argument,
.flag= nullptr,
.val= 'o',
},
{
.name= "dirobj", // --dirobj=OBJECT_DIR | -d OBJECT_DIR
.has_arg= required_argument,
.flag= nullptr,
.val= 'd',
},
{
.name= "guile", // --guile=GUILE_CODE | -G GUILE_CODE
.has_arg= required_argument,
.flag= nullptr,
.val = 'G',
},
{
.name= "shell", // --shell="command" | -S cmd
.has_arg= required_argument,
.flag= nullptr,
.val= 'S',
},
{
.name= "plugin-source", // --plugin-source="DIR" | -s DIRNAME
.has_arg= required_argument,
.flag= nullptr,
.val= 's',
},
{
.name= nullptr,
.has_arg= no_argument,
.flag= nullptr,
.val= 0
},
}; // end bp_options_arr
void
bp_version (void)
{
std::cout << bp_progname << " version " << bp_git_id
<< " built " __DATE__ "@" << __TIME__ << " [refpersys.org]"
<< std::endl
<< " tool source <" << __FILE__ ":" << __LINE__ << ">"
<< std::endl;
std::cout << "\t top directory " << rps_topdirectory << std::endl;
std::cout << "\t GNUmakefile " << rps_gnumakefile << std::endl;
std::cout << "\t timestamp: " << rps_timestamp <<std::endl;
std::cout << "\t gnu-make is " << rps_gnu_make
<< "::" << rps_gnu_make_version << std::endl;
std::cout << "# run " << bp_progname <<" --help for details." << std::endl;
std::cout << "\t\t see refpersys.org and github.com/RefPerSys/RefPerSys" << std::endl;
} // end bp_version
void
bp_usage(void)
{
std::string bp_spaces(strlen(bp_progname), ' ');
std::cout << "usage: " << bp_progname
<< " <plugin-source-code> ... -o <plugin-shared-object>" << std::endl;
std::cout << '\t' << bp_progname << " --version | -V #give also defaults" << std::endl;
std::cout << '\t' << bp_progname << " --verbose | -v #verbose execution" << std::endl;
std::cout << '\t' << bp_progname << " --output=PLUGIN | -o PLUGIN #output generated .so" << std::endl;
std::cout << '\t' << bp_progname << " --dirobj=OBJ_DIR | -d OBJ_DIR #directory for object files" << std::endl;
std::cout << '\t' << bp_progname << " --shell=CMD | -S CMD #run shell command" << std::endl;
std::cout << '\t' << bp_progname << " --plugin-src=DIRNAME | -s DIRNAME #plugin source directory" << std::endl;
std::cout << '\t' << bp_progname << " --guile=GUILE_CODE | -G GUILE_CODE #GUILE code for GNU make" << std::endl;
std::cout << '\t' << bp_spaces << "if GUILE_CODE starts with a left-paren, space or semicolon, it is passed to the interpreter inside make"
<< std::endl;
std::cout << '\t' << bp_spaces << "if GUILE_CODE starts with a pipe or exclamation, it is popen-ed"
<< std::endl;
std::cout << '\t' << bp_spaces << "otherwise GUILE_CODE is a file with GNU Guile Scheme code"
<< std::endl;
std::cout << '\t' << bp_progname << " --help | -h #this help" << std::endl;
std::cout << "\t #from " << __FILE__ << ':' << __LINE__ << " git " << bp_git_id << std::endl;
std::cout << "\t #see refpersys.org and github.com/RefPerSys/RefPerSys" << std::endl;
std::cout << "\t #uses $RPSPLUGIN_CXXFLAGS and $RPSPLUGIN_LDFLAGS if provided"
<< std::endl;
std::cout << "\t #the C++ plugin sources may contain comments to drive the compilation" << std::endl;
std::cout << "\t\t\t //@PKGCONFIG <package-name> #e.g. ////@PKGCONFIG sfml-graphics" <<std::endl;
std::cout << "\t\t\t //@NINJA.<tag> up to //@ENDNINJA.<tag> #e.g. //@NINJA.foo ... //@ENDNINJA.foo copy lines to ninja file" <<std::endl;
std::cout << "\t\t\t //@OBJECT <object-file> #eg //@OBJECT /usr/local/lib/libnwcc.o to add a new object file" <<std::endl;
} // end bp_usage
void
bp_prog_options(int argc, char**argv)
{
int opt= 0;
int ix= 0;
do
{
opt = getopt_long(argc, argv, "Vhvs:o:N:S:d:G:", bp_options_ptr, &ix);
if (ix >= argc)
break;
switch (opt)
{
case 'V': // --version
bp_version();
exit(EXIT_SUCCESS);
break;
case 'h': // --help
bp_usage();
exit(EXIT_SUCCESS);
break;
case 'v': // --verbose
bp_verbose= true;
break;
case 'd':
{
static char dirbuf[1024];
struct stat dirstat = {};
if (stat(optarg, &dirstat) == 0)
{
if (!S_ISDIR(dirstat.st_mode))
{
std::cerr << bp_progname
<< " : specified object directory " << optarg
<< " is not a directory." << std::endl;
exit(EXIT_FAILURE);
};
}
else // stat failed, try mkdir
{
if (mkdir(optarg, 0700))
{
std::cerr << bp_progname
<< " : failed to mkdir object directory "
<< optarg
<< " - " << strerror(errno)
<< std::endl;
exit(EXIT_FAILURE);
}
};
char*dirpath = realpath(optarg, dirbuf);
if (!dirpath)
{
std::cerr << bp_progname
<< " : failed to get real path of object directory "
<< optarg
<< " - " << strerror(errno)
<< std::endl;
exit(EXIT_FAILURE);
}
bp_objdir = dirpath;
}
break;
case 's': // --plugin-src=SRC_DIR
{
static char dirbuf[1024];
struct stat dirstat = {};
if (stat(optarg, &dirstat) == 0)
{
if (!S_ISDIR(dirstat.st_mode))
{
std::cerr << bp_progname
<< " : specified plugin source directory " << optarg
<< " is not a directory." << std::endl;
exit(EXIT_FAILURE);
};
}
else // stat failed, try mkdir
{
if (mkdir(optarg, 0700))
{
std::cerr << bp_progname
<< " : failed to mkdir plugin source directory "
<< optarg
<< " - " << strerror(errno)
<< std::endl;
exit(EXIT_FAILURE);
}
};
char*dirpath = realpath(optarg, dirbuf);
if (!dirpath)
{
std::cerr << bp_progname
<< " : failed to get real path of plugin source directory "
<< optarg
<< " - " << strerror(errno)
<< std::endl;
exit(EXIT_FAILURE);
}
bp_srcdir = dirpath;
}
break;
case 'o': // --output=PLUGIN
{
char bufbak[384];
memset (bufbak, 0, sizeof(bufbak));
bp_plugin_binary = optarg;
if (!access(optarg, F_OK) && strlen(optarg)<sizeof(bufbak)-2)
{
snprintf(bufbak, sizeof(bufbak), "%s~", optarg);
if (!rename(optarg, bufbak) && bp_verbose)
printf("%s renamed old plugin: %s -> %s\n", bp_progname, optarg, bufbak);
};
}
break;
case 'S': // --shell COMMAND
{
printf("%s running shell %s [%s:%d]\n",
bp_progname, optarg, __FILE__, __LINE__-1);
fflush(nullptr);
int shfail = system(optarg);
fflush(nullptr);
if (shfail!=0)
{
fprintf(stderr,
"%s failed to run shell command %s (%d) [%s:%d]\n",
bp_progname, optarg,
shfail, __FILE__, __LINE__-2);
exit(EXIT_FAILURE);
};
if (bp_verbose)
{
printf("%s did run shell %s [%s:%d]\n",
bp_progname, optarg, __FILE__, __LINE__-1);
};
fflush(nullptr);
}
break;
case 'G': // --guile GUILECODE
{
if (bp_verbose)
{
printf("%s is running GUILE Scheme code %s [%s:%d]\n",
bp_progname, optarg, __FILE__, __LINE__-1);
}
fflush(nullptr);
/// https://lists.gnu.org/archive/html/guile-user/2025-05/msg00005.html
SCM guilexp = scm_c_read_string(optarg);
SCM resguile = scm_primitive_eval(guilexp);
fflush(nullptr);
if (bp_verbose)
{
char*strguile = scm_to_utf8_string(resguile);
printf("%s evaluated GUILE code %s as %s [%s:%d]\n",
bp_progname, optarg, strguile, __FILE__, __LINE__-1);
};
fflush(nullptr);
}
break;
} // end switch opt
}
while (opt > 0 && ix < argc);
fflush(nullptr);
asm volatile ("nop; nop; nop; nop");
while (optind < argc)
{
std::string curarg=argv[optind];
int srcix=1+(int)bp_vect_cpp_sources.size();
if (access(curarg.c_str(), R_OK))
{
fprintf(stderr,
"%s failed to access plugin source#%d %s (%s) [%s:%d]\n",
bp_progname, srcix, curarg.c_str(),
strerror(errno), __FILE__, __LINE__-2);
exit(EXIT_FAILURE);
};
for (char c: curarg)
{
if (isspace(c) || !isprint(c))
{
fprintf(stderr,
"%s bad plugin source#%d has forbidden character %0ux (%s) [%s:%d]\n",
bp_progname, srcix, (unsigned)c, curarg.c_str(),
__FILE__, __LINE__-2);
exit(EXIT_FAILURE);
};
}
{
std::string realfile;
char*rp = realpath(curarg.c_str(),nullptr);
if (rp) realfile.assign(rp);
else
realfile = curarg;
if (bp_verbose)
{
printf("%s adding plugin C++ source file#%d %s really %s\n",
bp_progname, srcix, curarg.c_str(), realfile.c_str());
fflush(nullptr);
};
bp_vect_cpp_sources.push_back(realfile);
/// dont bother freeing rp....
}
optind++;
}; // end while(optind<argc)
asm volatile ("nop; nop; nop; nop");
////
if (bp_vect_cpp_sources.empty())
{
fprintf(stderr,
"%s got no plugin C++ source [%s:%d]\n",
bp_progname, __FILE__, __LINE__-2);
exit(EXIT_FAILURE);
};
// default the source directory to the directory of first C++ plugin source if none given
if (bp_srcdir.empty())
{
char*dn = dirname(const_cast<char*>(bp_vect_cpp_sources[0].c_str()));
char rpbuf[PATH_MAX];
memset(rpbuf, 0, sizeof(rpbuf));
char*rp = realpath(dn, rpbuf);
if (!rp)
{
fprintf(stderr,
"%s failed to call realpath of %s (%s) [%s:%d]\n",
bp_progname, dn, strerror(errno),
__FILE__, __LINE__-2);
exit(EXIT_FAILURE);
};
bp_srcdir.assign(rp);
if (bp_verbose)
{
printf("%s defaulted plugin source directory to %s [%s:%d]\n",
bp_progname, bp_srcdir.c_str(), __FILE__, __LINE__-1);
}
};
} // end bp_prog_options
/// by convention Scheme primitives for GNU guile are prefixed by bpscm
static SCM
bpscm_false0(void)
{
//// just in case to use the breakpoint below from GDB
BP_NOP_BREAKPOINT();
return SCM_BOOL_F;
} // end bpscm_false0
static SCM
bpscm_false1(void)
{
//// just in case to use the breakpoint below from GDB
BP_NOP_BREAKPOINT();
return SCM_BOOL_F;
} // end bpscm_false1
static SCM
bpscm_git_id(void)
{
BP_NOP_BREAKPOINT();
return scm_from_utf8_string(bp_git_id);
} // end bpscm_git_id
void
bp_initialize_guile_scheme(void)
{
scm_c_define_gsubr ("bpscm:false0", /*nbreq:*/0, /*nbopt:*/0, /*nbrest:*/0,
(scm_t_subr)bpscm_false0);
scm_c_define_gsubr ("bpscm:false1", /*nbreq:*/0, /*nbopt:*/0, /*nbrest:*/0,
(scm_t_subr)bpscm_false1);
scm_c_define_gsubr ("bpscm:git_id", /*nbreq:*/0, /*nbopt:*/0, /*nbrest:*/0,
(scm_t_subr)bpscm_git_id);
} // end bp_initialize_guile_scheme
////////////////////////////////////////////////////////////////
int
main(int argc, char**argv, const char**env)
{
bp_progname = argv[0];
bp_argc_prog = argc;
bp_argv_prog = argv;
bp_env_prog = env;
bp_options_ptr = bp_options_arr;
scm_init_guile();
bp_initialize_guile_scheme();
BP_NOP_BREAKPOINT();
std::string bp_first_base;
#warning do-build-refpersys-plugin should be much improved and fixed
///TODO to accept secondary source files for the plugin and more
///program options and improve GNUmakefile
memset (bp_hostname, 0, sizeof(bp_hostname));
gethostname(bp_hostname, sizeof(bp_hostname)-1);
char symlkbuf[384];
memset(symlkbuf, 0, sizeof(symlkbuf));
if (argc<2)
{
bp_usage();
return 0;
};
if (argc>1 && !strcmp(argv[1], "--version"))
{
bp_version();
return 0;
}
else if (argc>1 && !strcmp(argv[1], "--help"))
{
bp_usage();
return 0;
}
else if (argc>1 &&
(!strcmp(argv[1], "--verbose") || !strcmp(argv[1], "-v")))
{
bp_verbose = true;
};
bp_prog_options(argc, argv);
if (chdir(rps_topdirectory))
{
std::clog << bp_progname << " failed to chdir " << rps_topdirectory
<< " : " << strerror(errno) << std::endl;
exit(EXIT_FAILURE);
};
asm volatile ("nop; nop; nop; nop");
if (bp_verbose)
{
char cwdbuf[256];
memset(cwdbuf, 0, sizeof(cwdbuf));
const char*cwd = getcwd(cwdbuf, sizeof(cwdbuf)-2);
std::cout << "Running on " << bp_hostname;
for (int ix=0; ix<argc; ix++)
{
std::cout << ' ' << argv[ix];
};
std::cout << " git " << bp_git_id << " in " << (cwd?cwd:"./") << std::endl;
};
asm volatile ("nop; nop; nop; nop");
std::set<std::string> bp_base_src_set;
if (bp_vect_cpp_sources.empty())
{
std::cerr << bp_progname << " : no C++ source files given" << std::endl;
exit(EXIT_FAILURE);
}
assert(bp_first_base.empty());
for (std::string cursrc: bp_vect_cpp_sources)
{
const char*lastslash = nullptr;
char buf[128];
memset (buf, 0, sizeof(buf));
lastslash = strrchr(cursrc.c_str(), (int) '/');
if (lastslash)
{
sscanf(lastslash+1, "%100[A-Za-z0-9_+-]", buf);
}
else
sscanf(cursrc.c_str(), "%100[A-Za-z0-9_+-]", buf);
std::string bufstr{buf};
if (bp_base_src_set.find(bufstr) != bp_base_src_set.end())
{
std::cerr << bp_progname << " : the base name " << bufstr << " appears more than once, last in C++ file " << cursrc
<< " [" << __FILE__ << ":" << __LINE__ <<"]" <<std::endl;
exit(EXIT_FAILURE);
};
if (bp_first_base.empty())
bp_first_base = bufstr;
bp_base_src_set.insert({bufstr,cursrc});
};
/// run the script to build the plugin
{
char buildcmd[384];
memset (buildcmd, 0, sizeof(buildcmd));
BP_NOP_BREAKPOINT();
if (bp_verbose)
snprintf (buildcmd, sizeof(buildcmd), "%s -v -C %s %s",
rps_gnu_make,
rps_topdirectory,
bp_plugin_binary);
else
snprintf (buildcmd, sizeof(buildcmd), "%s -C %s %s",
rps_gnu_make,
rps_topdirectory,
bp_plugin_binary);
printf("%s [%s:%d] running GNU make in %s as \n %s"
"\n (plugin binary %s, %d sources starting with %s)\n",
bp_progname,
__FILE__, __LINE__-2,
rps_topdirectory,
buildcmd, bp_plugin_binary,
(int)bp_vect_cpp_sources.size(),
bp_vect_cpp_sources.at(0).c_str());
fflush (nullptr);
BP_NOP_BREAKPOINT();
int ex = system(buildcmd);
sync ();
if (ex)
return ex;
}
/// temporary files should be removed using at(1) utility in ten minutes
/// see https://linuxize.com/post/at-command-in-linux/
if (!bp_temp_ninja.empty() || symlkbuf[0])
{
char atcmd[80];
memset (atcmd, 0, sizeof(atcmd));
snprintf(atcmd, sizeof(atcmd), "/bin/at now + 10 minutes");
FILE *p = popen(atcmd, "w");
if (!p)
{
fprintf(stderr, "%s won't remove later file %s\n",
bp_progname, bp_temp_ninja.c_str());
return 0;
}
fprintf (p, "/bin/rm -f '%s'\n", bp_temp_ninja.c_str());
if (symlkbuf[0])
fprintf(p, "/bin/rm -f '%s'\n", symlkbuf);
pclose(p);
if (bp_verbose)
{
printf("%s: will remove ninja temporary script %s in ten minutes thru /bin/at\n",
bp_progname, bp_temp_ninja.c_str());
if (symlkbuf[0])
printf("%s: will remove symlink %s in ten minutes thru /bin/at\n",
bp_progname, symlkbuf);
}
}
fflush(nullptr);
bp_options_ptr = nullptr;
/// synchronize the disk
sync();
return 0;
} // end main
/****************
** for Emacs...
** Local Variables: ;;
** compile-command: "cd $RPS_TOPDIR && make do-build-refpersys-plugin" ;;
** End: ;;
****************/