emergency commit
[cl-cudd.git] / distr / util / test-sav.c
blob3140671be3bbd09f8ce1daa9a5fdb20648c5b917
1 #include <stdio.h>
2 #include "util.h"
5 /* ARGSUSED */
6 static int
7 saveit(prog, file2)
8 char *prog, *file2;
10 char *file1;
12 /* get current executable name by searching the path ... */
13 file1 = util_path_search(prog);
14 if (file1 == 0) {
15 (void) fprintf(stderr, "cannot locate current executable\n");
16 return 1;
19 /* users name for the new executable -- perform tilde-expansion */
20 if (! util_save_image(file1, file2)) {
21 (void) fprintf(stderr, "error occured during save ...\n");
22 return 1;
24 FREE(file1);
25 return 0;
28 int restart;
30 main(argc, argv)
31 char **argv;
33 if (restart) {
34 (void) printf("restarted ...\n");
35 exit(0);
37 restart = 1;
38 exit(saveit(argv[0], "foobar"));