| 1 | #define USE_THE_REPOSITORY_VARIABLE |
| 2 | #define DISABLE_SIGN_COMPARE_WARNINGS |
| 3 | |
| 4 | #include "test-tool.h" |
| 5 | #include "abspath.h" |
| 6 | #include "environment.h" |
| 7 | #include "path.h" |
| 8 | #include "read-cache-ll.h" |
| 9 | #include "setup.h" |
| 10 | #include "string-list.h" |
| 11 | #include "trace.h" |
| 12 | #include "utf8.h" |
| 13 | #include "copy.h" |
| 14 | |
| 15 | /* |
| 16 | * A "string_list_each_func_t" function that normalizes an entry from |
| 17 | * GIT_CEILING_DIRECTORIES. If the path is unusable for some reason, |
| 18 | * die with an explanation. |
| 19 | */ |
| 20 | static int normalize_ceiling_entry(struct string_list_item *item, |
| 21 | void *data UNUSED) |
| 22 | { |
| 23 | char *ceil = item->string; |
| 24 | |
| 25 | if (!*ceil) |
| 26 | die("Empty path is not supported"); |
| 27 | if (!is_absolute_path(ceil)) |
| 28 | die("Path \"%s\" is not absolute", ceil); |
| 29 | if (normalize_path_copy(ceil, ceil) < 0) |
| 30 | die("Path \"%s\" could not be normalized", ceil); |
| 31 | return 1; |
| 32 | } |
| 33 | |
| 34 | static void normalize_argv_string(const char **var, const char *input) |
| 35 | { |
| 36 | if (!strcmp(input, "<null>")) |
| 37 | *var = NULL; |
| 38 | else if (!strcmp(input, "<empty>")) |
| 39 | *var = ""; |
| 40 | else |
| 41 | *var = input; |
| 42 | |
| 43 | if (*var && (**var == '<' || **var == '(')) |
| 44 | die("Bad value: %s", input); |
| 45 | } |
| 46 | |
| 47 | struct test_data { |
| 48 | const char *from; /* input: transform from this ... */ |
| 49 | const char *to; /* output: ... to this. */ |
| 50 | const char *alternative; /* output: ... or this. */ |
| 51 | }; |
| 52 | |
| 53 | /* |
| 54 | * Compatibility wrappers for OpenBSD, whose basename(3) and dirname(3) |
| 55 | * have const parameters. |
| 56 | */ |
| 57 | static char *posix_basename(char *path) |
| 58 | { |
| 59 | return basename(path); |
| 60 | } |
| 61 | |
| 62 | static char *posix_dirname(char *path) |
| 63 | { |
| 64 | return dirname(path); |
| 65 | } |
| 66 | |
| 67 | static int test_function(struct test_data *data, char *(*func)(char *input), |
| 68 | const char *funcname) |
| 69 | { |
| 70 | int failed = 0, i; |
| 71 | char buffer[1024]; |
| 72 | char *to; |
| 73 | |
| 74 | for (i = 0; data[i].to; i++) { |
| 75 | if (!data[i].from) |
| 76 | to = func(NULL); |
| 77 | else { |
| 78 | xsnprintf(buffer, sizeof(buffer), "%s", data[i].from); |
| 79 | to = func(buffer); |
| 80 | } |
| 81 | if (!strcmp(to, data[i].to)) |
| 82 | continue; |
| 83 | if (!data[i].alternative) |
| 84 | error("FAIL: %s(%s) => '%s' != '%s'", |
| 85 | funcname, data[i].from, to, data[i].to); |
| 86 | else if (!strcmp(to, data[i].alternative)) |
| 87 | continue; |
| 88 | else |
| 89 | error("FAIL: %s(%s) => '%s' != '%s', '%s'", |
| 90 | funcname, data[i].from, to, data[i].to, |
| 91 | data[i].alternative); |
| 92 | failed = 1; |
| 93 | } |
| 94 | return failed; |
| 95 | } |
| 96 | |
| 97 | static struct test_data basename_data[] = { |
| 98 | /* --- POSIX type paths --- */ |
| 99 | { NULL, "." }, |
| 100 | { "", "." }, |
| 101 | { ".", "." }, |
| 102 | { "..", ".." }, |
| 103 | { "/", "/" }, |
| 104 | { "//", "/", "//" }, |
| 105 | { "///", "/", "//" }, |
| 106 | { "////", "/", "//" }, |
| 107 | { "usr", "usr" }, |
| 108 | { "/usr", "usr" }, |
| 109 | { "/usr/", "usr" }, |
| 110 | { "/usr//", "usr" }, |
| 111 | { "/usr/lib", "lib" }, |
| 112 | { "usr/lib", "lib" }, |
| 113 | { "usr/lib///", "lib" }, |
| 114 | |
| 115 | #if defined(__MINGW32__) || defined(_MSC_VER) |
| 116 | /* --- win32 type paths --- */ |
| 117 | { "\\usr", "usr" }, |
| 118 | { "\\usr\\", "usr" }, |
| 119 | { "\\usr\\\\", "usr" }, |
| 120 | { "\\usr\\lib", "lib" }, |
| 121 | { "usr\\lib", "lib" }, |
| 122 | { "usr\\lib\\\\\\", "lib" }, |
| 123 | { "C:/usr", "usr" }, |
| 124 | { "C:/usr", "usr" }, |
| 125 | { "C:/usr/", "usr" }, |
| 126 | { "C:/usr//", "usr" }, |
| 127 | { "C:/usr/lib", "lib" }, |
| 128 | { "C:usr/lib", "lib" }, |
| 129 | { "C:usr/lib///", "lib" }, |
| 130 | { "C:", "." }, |
| 131 | { "C:a", "a" }, |
| 132 | { "C:/", "/" }, |
| 133 | { "C:///", "/" }, |
| 134 | { "\\", "\\", "/" }, |
| 135 | { "\\\\", "\\", "/" }, |
| 136 | { "\\\\\\", "\\", "/" }, |
| 137 | #endif |
| 138 | { NULL, NULL } |
| 139 | }; |
| 140 | |
| 141 | static struct test_data dirname_data[] = { |
| 142 | /* --- POSIX type paths --- */ |
| 143 | { NULL, "." }, |
| 144 | { "", "." }, |
| 145 | { ".", "." }, |
| 146 | { "..", "." }, |
| 147 | { "/", "/" }, |
| 148 | { "//", "/", "//" }, |
| 149 | { "///", "/", "//" }, |
| 150 | { "////", "/", "//" }, |
| 151 | { "usr", "." }, |
| 152 | { "/usr", "/" }, |
| 153 | { "/usr/", "/" }, |
| 154 | { "/usr//", "/" }, |
| 155 | { "/usr/lib", "/usr" }, |
| 156 | { "usr/lib", "usr" }, |
| 157 | { "usr/lib///", "usr" }, |
| 158 | |
| 159 | #if defined(__MINGW32__) || defined(_MSC_VER) |
| 160 | /* --- win32 type paths --- */ |
| 161 | { "\\", "\\" }, |
| 162 | { "\\\\", "\\\\" }, |
| 163 | { "\\usr", "\\" }, |
| 164 | { "\\usr\\", "\\" }, |
| 165 | { "\\usr\\\\", "\\" }, |
| 166 | { "\\usr\\lib", "\\usr" }, |
| 167 | { "usr\\lib", "usr" }, |
| 168 | { "usr\\lib\\\\\\", "usr" }, |
| 169 | { "C:a", "C:." }, |
| 170 | { "C:/", "C:/" }, |
| 171 | { "C:///", "C:/" }, |
| 172 | { "C:/usr", "C:/" }, |
| 173 | { "C:/usr/", "C:/" }, |
| 174 | { "C:/usr//", "C:/" }, |
| 175 | { "C:/usr/lib", "C:/usr" }, |
| 176 | { "C:usr/lib", "C:usr" }, |
| 177 | { "C:usr/lib///", "C:usr" }, |
| 178 | { "\\\\\\", "\\" }, |
| 179 | { "\\\\\\\\", "\\" }, |
| 180 | { "C:", "C:.", "." }, |
| 181 | #endif |
| 182 | { NULL, NULL } |
| 183 | }; |
| 184 | |
| 185 | static int check_dotfile(const char *x, const char **argv, |
| 186 | int (*is_hfs)(const char *), |
| 187 | int (*is_ntfs)(const char *)) |
| 188 | { |
| 189 | int res = 0, expect = 1; |
| 190 | for (; *argv; argv++) { |
| 191 | if (!strcmp("--not", *argv)) |
| 192 | expect = !expect; |
| 193 | else if (expect != (is_hfs(*argv) || is_ntfs(*argv))) |
| 194 | res = error("'%s' is %s.git%s", *argv, |
| 195 | expect ? "not " : "", x); |
| 196 | else |
| 197 | fprintf(stderr, "ok: '%s' is %s.git%s\n", |
| 198 | *argv, expect ? "" : "not ", x); |
| 199 | } |
| 200 | return !!res; |
| 201 | } |
| 202 | |
| 203 | static int cmp_by_st_size(const void *a, const void *b) |
| 204 | { |
| 205 | intptr_t x = (intptr_t)((struct string_list_item *)a)->util; |
| 206 | intptr_t y = (intptr_t)((struct string_list_item *)b)->util; |
| 207 | |
| 208 | return x > y ? -1 : (x < y ? +1 : 0); |
| 209 | } |
| 210 | |
| 211 | /* |
| 212 | * A very simple, reproducible pseudo-random generator. Copied from |
| 213 | * `test-genrandom.c`. |
| 214 | */ |
| 215 | static uint64_t my_random_value = 1234; |
| 216 | |
| 217 | static uint64_t my_random(void) |
| 218 | { |
| 219 | my_random_value = my_random_value * 1103515245 + 12345; |
| 220 | return my_random_value; |
| 221 | } |
| 222 | |
| 223 | /* |
| 224 | * A fast approximation of the square root, without requiring math.h. |
| 225 | * |
| 226 | * It uses Newton's method to approximate the solution of 0 = x^2 - value. |
| 227 | */ |
| 228 | static double my_sqrt(double value) |
| 229 | { |
| 230 | const double epsilon = 1e-6; |
| 231 | double x = value; |
| 232 | |
| 233 | if (value == 0) |
| 234 | return 0; |
| 235 | |
| 236 | for (;;) { |
| 237 | double delta = (value / x - x) / 2; |
| 238 | if (delta < epsilon && delta > -epsilon) |
| 239 | return x + delta; |
| 240 | x += delta; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | static int protect_ntfs_hfs_benchmark(int argc, const char **argv) |
| 245 | { |
| 246 | size_t i, j, nr, min_len = 3, max_len = 20; |
| 247 | char **names; |
| 248 | int repetitions = 15, file_mode = 0100644; |
| 249 | uint64_t begin, end; |
| 250 | double m[3][2], v[3][2]; |
| 251 | uint64_t cumul; |
| 252 | double cumul2; |
| 253 | |
| 254 | if (argc > 1 && !strcmp(argv[1], "--with-symlink-mode")) { |
| 255 | file_mode = 0120000; |
| 256 | argc--; |
| 257 | argv++; |
| 258 | } |
| 259 | |
| 260 | nr = argc > 1 ? strtoul(argv[1], NULL, 0) : 1000000; |
| 261 | ALLOC_ARRAY(names, nr); |
| 262 | |
| 263 | if (argc > 2) { |
| 264 | min_len = strtoul(argv[2], NULL, 0); |
| 265 | if (argc > 3) |
| 266 | max_len = strtoul(argv[3], NULL, 0); |
| 267 | if (min_len > max_len) |
| 268 | die("min_len > max_len"); |
| 269 | } |
| 270 | |
| 271 | for (i = 0; i < nr; i++) { |
| 272 | size_t len = min_len + (my_random() % (max_len + 1 - min_len)); |
| 273 | |
| 274 | names[i] = xmallocz(len); |
| 275 | while (len > 0) |
| 276 | names[i][--len] = (char)(' ' + (my_random() % ('\x7f' - ' '))); |
| 277 | } |
| 278 | |
| 279 | for (protect_ntfs = 0; protect_ntfs < 2; protect_ntfs++) |
| 280 | for (protect_hfs = 0; protect_hfs < 2; protect_hfs++) { |
| 281 | cumul = 0; |
| 282 | cumul2 = 0; |
| 283 | for (i = 0; i < repetitions; i++) { |
| 284 | begin = getnanotime(); |
| 285 | for (j = 0; j < nr; j++) |
| 286 | verify_path(names[j], file_mode); |
| 287 | end = getnanotime(); |
| 288 | printf("protect_ntfs = %d, protect_hfs = %d: %lfms\n", protect_ntfs, protect_hfs, (end-begin) / (double)1e6); |
| 289 | cumul += end - begin; |
| 290 | cumul2 += (end - begin) * (end - begin); |
| 291 | } |
| 292 | m[protect_ntfs][protect_hfs] = cumul / (double)repetitions; |
| 293 | v[protect_ntfs][protect_hfs] = my_sqrt(cumul2 / (double)repetitions - m[protect_ntfs][protect_hfs] * m[protect_ntfs][protect_hfs]); |
| 294 | printf("mean: %lfms, stddev: %lfms\n", m[protect_ntfs][protect_hfs] / (double)1e6, v[protect_ntfs][protect_hfs] / (double)1e6); |
| 295 | } |
| 296 | |
| 297 | for (protect_ntfs = 0; protect_ntfs < 2; protect_ntfs++) |
| 298 | for (protect_hfs = 0; protect_hfs < 2; protect_hfs++) |
| 299 | printf("ntfs=%d/hfs=%d: %lf%% slower\n", protect_ntfs, protect_hfs, (m[protect_ntfs][protect_hfs] - m[0][0]) * 100 / m[0][0]); |
| 300 | |
| 301 | return 0; |
| 302 | } |
| 303 | |
| 304 | int cmd__path_utils(int argc, const char **argv) |
| 305 | { |
| 306 | if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) { |
| 307 | char *buf = xmallocz(strlen(argv[2])); |
| 308 | int rv = normalize_path_copy(buf, argv[2]); |
| 309 | puts(rv ? "++failed++" : buf); |
| 310 | free(buf); |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | if (argc >= 2 && !strcmp(argv[1], "real_path")) { |
| 315 | struct strbuf realpath = STRBUF_INIT; |
| 316 | while (argc > 2) { |
| 317 | strbuf_realpath(&realpath, argv[2], 1); |
| 318 | puts(realpath.buf); |
| 319 | argc--; |
| 320 | argv++; |
| 321 | } |
| 322 | strbuf_release(&realpath); |
| 323 | return 0; |
| 324 | } |
| 325 | |
| 326 | if (argc >= 2 && !strcmp(argv[1], "readlink")) { |
| 327 | struct strbuf target = STRBUF_INIT; |
| 328 | while (argc > 2) { |
| 329 | if (strbuf_readlink(&target, argv[2], 0) < 0) |
| 330 | die_errno("cannot read link at '%s'", argv[2]); |
| 331 | puts(target.buf); |
| 332 | argc--; |
| 333 | argv++; |
| 334 | } |
| 335 | strbuf_release(&target); |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | if (argc >= 2 && !strcmp(argv[1], "absolute_path")) { |
| 340 | while (argc > 2) { |
| 341 | puts(absolute_path(argv[2])); |
| 342 | argc--; |
| 343 | argv++; |
| 344 | } |
| 345 | return 0; |
| 346 | } |
| 347 | |
| 348 | if (argc == 4 && !strcmp(argv[1], "longest_ancestor_length")) { |
| 349 | int len; |
| 350 | struct string_list ceiling_dirs = STRING_LIST_INIT_DUP; |
| 351 | const char path_sep[] = { PATH_SEP, '\0' }; |
| 352 | char *path = xstrdup(argv[2]); |
| 353 | |
| 354 | /* |
| 355 | * We have to normalize the arguments because under |
| 356 | * Windows, bash mangles arguments that look like |
| 357 | * absolute POSIX paths or colon-separate lists of |
| 358 | * absolute POSIX paths into DOS paths (e.g., |
| 359 | * "/foo:/foo/bar" might be converted to |
| 360 | * "D:\Src\msysgit\foo;D:\Src\msysgit\foo\bar"), |
| 361 | * whereas longest_ancestor_length() requires paths |
| 362 | * that use forward slashes. |
| 363 | */ |
| 364 | if (normalize_path_copy(path, path)) |
| 365 | die("Path \"%s\" could not be normalized", argv[2]); |
| 366 | string_list_split(&ceiling_dirs, argv[3], path_sep, -1); |
| 367 | filter_string_list(&ceiling_dirs, 0, |
| 368 | normalize_ceiling_entry, NULL); |
| 369 | len = longest_ancestor_length(path, &ceiling_dirs); |
| 370 | string_list_clear(&ceiling_dirs, 0); |
| 371 | free(path); |
| 372 | printf("%d\n", len); |
| 373 | return 0; |
| 374 | } |
| 375 | |
| 376 | if (argc >= 4 && !strcmp(argv[1], "prefix_path")) { |
| 377 | const char *prefix = argv[2]; |
| 378 | int prefix_len = strlen(prefix); |
| 379 | int nongit_ok; |
| 380 | setup_git_directory_gently(the_repository, &nongit_ok); |
| 381 | while (argc > 3) { |
| 382 | char *pfx = prefix_path(the_repository, prefix, prefix_len, argv[3]); |
| 383 | |
| 384 | puts(pfx); |
| 385 | free(pfx); |
| 386 | argc--; |
| 387 | argv++; |
| 388 | } |
| 389 | return 0; |
| 390 | } |
| 391 | |
| 392 | if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) { |
| 393 | char *prefix = strip_path_suffix(argv[2], argv[3]); |
| 394 | printf("%s\n", prefix ? prefix : "(null)"); |
| 395 | free(prefix); |
| 396 | return 0; |
| 397 | } |
| 398 | |
| 399 | if (argc == 3 && !strcmp(argv[1], "print_path")) { |
| 400 | puts(argv[2]); |
| 401 | return 0; |
| 402 | } |
| 403 | |
| 404 | if (argc == 4 && !strcmp(argv[1], "relative_path")) { |
| 405 | struct strbuf sb = STRBUF_INIT; |
| 406 | const char *in, *prefix, *rel; |
| 407 | normalize_argv_string(&in, argv[2]); |
| 408 | normalize_argv_string(&prefix, argv[3]); |
| 409 | rel = relative_path(in, prefix, &sb); |
| 410 | if (!rel) |
| 411 | puts("(null)"); |
| 412 | else |
| 413 | puts(strlen(rel) > 0 ? rel : "(empty)"); |
| 414 | strbuf_release(&sb); |
| 415 | return 0; |
| 416 | } |
| 417 | |
| 418 | if (argc == 2 && !strcmp(argv[1], "basename")) |
| 419 | return test_function(basename_data, posix_basename, argv[1]); |
| 420 | |
| 421 | if (argc == 2 && !strcmp(argv[1], "dirname")) |
| 422 | return test_function(dirname_data, posix_dirname, argv[1]); |
| 423 | |
| 424 | if (argc > 2 && !strcmp(argv[1], "is_dotgitmodules")) { |
| 425 | return check_dotfile("modules", argv + 2, |
| 426 | is_hfs_dotgitmodules, |
| 427 | is_ntfs_dotgitmodules); |
| 428 | } |
| 429 | if (argc > 2 && !strcmp(argv[1], "is_dotgitignore")) { |
| 430 | return check_dotfile("ignore", argv + 2, |
| 431 | is_hfs_dotgitignore, |
| 432 | is_ntfs_dotgitignore); |
| 433 | } |
| 434 | if (argc > 2 && !strcmp(argv[1], "is_dotgitattributes")) { |
| 435 | return check_dotfile("attributes", argv + 2, |
| 436 | is_hfs_dotgitattributes, |
| 437 | is_ntfs_dotgitattributes); |
| 438 | } |
| 439 | if (argc > 2 && !strcmp(argv[1], "is_dotmailmap")) { |
| 440 | return check_dotfile("mailmap", argv + 2, |
| 441 | is_hfs_dotmailmap, |
| 442 | is_ntfs_dotmailmap); |
| 443 | } |
| 444 | |
| 445 | if (argc > 2 && !strcmp(argv[1], "file-size")) { |
| 446 | int res = 0, i; |
| 447 | struct stat st; |
| 448 | |
| 449 | for (i = 2; i < argc; i++) |
| 450 | if (stat(argv[i], &st)) |
| 451 | res = error_errno("Cannot stat '%s'", argv[i]); |
| 452 | else |
| 453 | printf("%"PRIuMAX"\n", (uintmax_t)st.st_size); |
| 454 | return !!res; |
| 455 | } |
| 456 | |
| 457 | if (argc == 4 && !strcmp(argv[1], "skip-n-bytes")) { |
| 458 | int fd = open(argv[2], O_RDONLY), offset = atoi(argv[3]); |
| 459 | char buffer[65536]; |
| 460 | |
| 461 | if (fd < 0) |
| 462 | die_errno("could not open '%s'", argv[2]); |
| 463 | if (lseek(fd, offset, SEEK_SET) < 0) |
| 464 | die_errno("could not skip %d bytes", offset); |
| 465 | for (;;) { |
| 466 | ssize_t count = read(fd, buffer, sizeof(buffer)); |
| 467 | if (count < 0) |
| 468 | die_errno("could not read '%s'", argv[2]); |
| 469 | if (!count) |
| 470 | break; |
| 471 | if (write(1, buffer, count) < 0) |
| 472 | die_errno("could not write to stdout"); |
| 473 | } |
| 474 | close(fd); |
| 475 | return 0; |
| 476 | } |
| 477 | |
| 478 | if (argc > 5 && !strcmp(argv[1], "slice-tests")) { |
| 479 | int res = 0; |
| 480 | long slice, slices_total, i; |
| 481 | struct string_list list = STRING_LIST_INIT_NODUP; |
| 482 | struct stat st; |
| 483 | |
| 484 | slices_total = strtol(argv[3], NULL, 10); |
| 485 | if (slices_total < 1) |
| 486 | die("there must be at least one slice, got '%s'", |
| 487 | argv[3]); |
| 488 | |
| 489 | slice = strtol(argv[2], NULL, 10); |
| 490 | if (1 > slice || slice > slices_total) |
| 491 | die("slice must be in the range 1 <= slice <= %ld, got '%s'", |
| 492 | slices_total, argv[2]); |
| 493 | |
| 494 | for (i = 4; i < argc; i++) |
| 495 | if (stat(argv[i], &st)) |
| 496 | res = error_errno("Cannot stat '%s'", argv[i]); |
| 497 | else |
| 498 | string_list_append(&list, argv[i])->util = |
| 499 | (void *)(intptr_t)st.st_size; |
| 500 | QSORT(list.items, list.nr, cmp_by_st_size); |
| 501 | for (i = slice - 1; i < list.nr; i+= slices_total) |
| 502 | printf("%s\n", list.items[i].string); |
| 503 | |
| 504 | return !!res; |
| 505 | } |
| 506 | |
| 507 | if (argc > 1 && !strcmp(argv[1], "protect_ntfs_hfs")) |
| 508 | return !!protect_ntfs_hfs_benchmark(argc - 1, argv + 1); |
| 509 | |
| 510 | if (argc > 1 && !strcmp(argv[1], "is_valid_path")) { |
| 511 | int res = 0, expect = 1, i; |
| 512 | |
| 513 | for (i = 2; i < argc; i++) |
| 514 | if (!strcmp("--not", argv[i])) |
| 515 | expect = 0; |
| 516 | else if (expect != is_valid_path(argv[i])) |
| 517 | res = error("'%s' is%s a valid path", |
| 518 | argv[i], expect ? " not" : ""); |
| 519 | else |
| 520 | fprintf(stderr, |
| 521 | "'%s' is%s a valid path\n", |
| 522 | argv[i], expect ? "" : " not"); |
| 523 | |
| 524 | return !!res; |
| 525 | } |
| 526 | |
| 527 | if (argc > 1 && !strcmp(argv[1], "is_path_owned_by_current_user")) { |
| 528 | int res = 0; |
| 529 | |
| 530 | for (int i = 2; i < argc; i++) { |
| 531 | struct strbuf buf = STRBUF_INIT; |
| 532 | |
| 533 | if (is_path_owned_by_current_user(argv[i], &buf)) |
| 534 | printf("'%s' is owned by current SID\n", argv[i]); |
| 535 | else { |
| 536 | printf("'%s' is not owned by current SID: %s\n", argv[i], buf.buf); |
| 537 | res = 1; |
| 538 | } |
| 539 | |
| 540 | strbuf_release(&buf); |
| 541 | } |
| 542 | |
| 543 | return res; |
| 544 | } |
| 545 | |
| 546 | fprintf(stderr, "%s: unknown function name: %s\n", argv[0], |
| 547 | argv[1] ? argv[1] : "(there was none)"); |
| 548 | return 1; |
| 549 | } |