atari.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /*
  2. Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 1999-Oct-05 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, both of these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
  7. */
  8. #include "zip.h"
  9. #ifndef UTIL /* the companion #endif is a bit of ways down ... */
  10. #include <time.h>
  11. #include <errno.h>
  12. #include <dirent.h>
  13. #include <mintbind.h>
  14. #include <osbind.h>
  15. #include <ostruct.h>
  16. #define PAD 0
  17. #define PATH_END '/'
  18. extern char *label; /* defined in fileio.c */
  19. local ulg label_time = 0;
  20. local ulg label_mode = 0;
  21. local time_t label_utim = 0;
  22. local char *readd(d)
  23. DIR *d; /* directory stream to read from */
  24. /* Return a pointer to the next name in the directory stream d, or NULL if
  25. no more entries or an error occurs. */
  26. {
  27. struct dirent *e;
  28. e = readdir(d);
  29. return e == NULL ? (char *) NULL : e->d_name;
  30. }
  31. local char *getVolumeLabel(drive, vtime, vmode, utim)
  32. int drive; /* drive name: 'A' .. 'Z' or '\0' for current drive */
  33. ulg *vtime; /* volume label creation time (DOS format) */
  34. ulg *vmode; /* volume label file mode */
  35. time_t utim;/* volume label creation time (UNIX format) */
  36. /* If a volume label exists for the given drive, return its name and
  37. set its time and mode. The returned name must be static data. */
  38. {
  39. static char vol[14];
  40. _DTA *dtaptr;
  41. if (drive) {
  42. vol[0] = (char)drive;
  43. strcpy(vol+1, ":/");
  44. } else {
  45. strcpy(vol, "/");
  46. }
  47. strcat(vol, "*.*");
  48. if (Fsfirst(vol, FA_LABEL) == 0) {
  49. dtaptr = Fgetdta();
  50. strncpy(vol, dtaptr->dta_name, sizeof(vol)-1);
  51. *vtime = ((ulg)dtaptr->dta_date << 16) |
  52. ((ulg)dtaptr->dta_time & 0xffff);
  53. *vmode = (ulg)dtaptr->dta_attribute;
  54. return vol;
  55. }
  56. return NULL;
  57. }
  58. char GetFileMode(char *name)
  59. {
  60. struct stat sb;
  61. sb.st_attr = 0;
  62. Fxattr(linkput ? 1 : 0, name, &sb);
  63. if (errno == EINVAL) {
  64. _DTA *dtaptr, *old;
  65. old = Fgetdta();
  66. Fsfirst(name, FA_RDONLY+FA_HIDDEN+FA_SYSTEM+FA_DIR);
  67. dtaptr = Fgetdta();
  68. sb.st_attr = dtaptr->dta_attribute;
  69. Fsetdta(old);
  70. }
  71. return sb.st_attr & 0x3f;
  72. }
  73. int wild2(w)
  74. char *w; /* path/pattern to match */
  75. /* If not in exclude mode, expand the pattern based on the contents of the
  76. file system. Return an error code in the ZE_ class. */
  77. {
  78. DIR *d; /* stream for reading directory */
  79. char *e; /* name found in directory */
  80. int r; /* temporary variable */
  81. char *n; /* constructed name from directory */
  82. int f; /* true if there was a match */
  83. char *a; /* alloc'ed space for name */
  84. char *p; /* path */
  85. char *q; /* name */
  86. char v[5]; /* space for device current directory */
  87. if (volume_label == 1) {
  88. volume_label = 2;
  89. label = getVolumeLabel(w[1] == ':' ? to_up(w[0]) : '\0',
  90. &label_time, &label_mode, &label_utim);
  91. if (label != NULL) {
  92. newname(label, 0, 0);
  93. }
  94. if (w[1] == ':' && w[2] == '\0') return ZE_OK;
  95. /* "zip -$ foo a:" can be used to force drive name */
  96. }
  97. /* special handling of stdin request */
  98. if (strcmp(w, "-") == 0) /* if compressing stdin */
  99. return newname(w, 0, 0);
  100. /* Allocate and copy pattern */
  101. if ((p = a = malloc(strlen(w) + 1)) == NULL)
  102. return ZE_MEM;
  103. strcpy(p, w);
  104. /* Normalize path delimiter as '/'. */
  105. for (q = p; *q; q++) /* use / consistently */
  106. if (*q == '\\')
  107. *q = '/';
  108. /* Only name can have special matching characters */
  109. if ((q = isshexp(p)) != NULL &&
  110. (strrchr(q, '/') != NULL || strrchr(q, ':') != NULL))
  111. {
  112. free((zvoid *)a);
  113. return ZE_PARMS;
  114. }
  115. /* Separate path and name into p and q */
  116. if ((q = strrchr(p, '/')) != NULL && (q == p || q[-1] != ':'))
  117. {
  118. *q++ = '\0'; /* path/name -> path, name */
  119. if (*p == '\0') /* path is just / */
  120. p = strcpy(v, "/.");
  121. }
  122. else if ((q = strrchr(p, ':')) != NULL)
  123. { /* has device and no or root path */
  124. *q++ = '\0';
  125. p = strcat(strcpy(v, p), ":"); /* copy device as path */
  126. if (*q == '/') /* -> device:/., name */
  127. {
  128. strcat(p, "/");
  129. q++;
  130. }
  131. strcat(p, ".");
  132. }
  133. else if (recurse && (strcmp(p, ".") == 0 || strcmp(p, "..") == 0))
  134. { /* current or parent directory */
  135. /* I can't understand Mark's code so I am adding a hack here to get
  136. * "zip -r foo ." to work. Allow the dubious "zip -r foo .." but
  137. * reject "zip -rm foo ..".
  138. */
  139. if (dispose && strcmp(p, "..") == 0)
  140. ziperr(ZE_PARMS, "cannot remove parent directory");
  141. q = "*.*";
  142. }
  143. else /* no path or device */
  144. {
  145. q = p;
  146. p = strcpy(v, ".");
  147. }
  148. if (recurse && *q == '\0') {
  149. q = "*.*";
  150. }
  151. /* Search that level for matching names */
  152. if ((d = opendir(p)) == NULL)
  153. {
  154. free((zvoid *)a);
  155. return ZE_MISS;
  156. }
  157. if ((r = strlen(p)) > 1 &&
  158. (strcmp(p + r - 2, ":.") == 0 || strcmp(p + r - 2, "/.") == 0))
  159. *(p + r - 1) = '\0';
  160. f = 0;
  161. while ((e = readd(d)) != NULL) {
  162. if (strcmp(e, ".") && strcmp(e, "..") && MATCH(q, e, 0))
  163. {
  164. f = 1;
  165. if (strcmp(p, ".") == 0) { /* path is . */
  166. r = procname(e, 0); /* name is name */
  167. if (r) {
  168. f = 0;
  169. break;
  170. }
  171. } else
  172. {
  173. if ((n = malloc(strlen(p) + strlen(e) + 2)) == NULL)
  174. {
  175. free((zvoid *)a);
  176. closedir(d);
  177. return ZE_MEM;
  178. }
  179. n = strcpy(n, p);
  180. if (n[r = strlen(n) - 1] != '/' && n[r] != ':')
  181. strcat(n, "/");
  182. r = procname(strcat(n, e), 0); /* name is path/name */
  183. free((zvoid *)n);
  184. if (r) {
  185. f = 0;
  186. break;
  187. }
  188. }
  189. }
  190. }
  191. closedir(d);
  192. /* Done */
  193. free((zvoid *)a);
  194. return f ? ZE_OK : ZE_MISS;
  195. }
  196. #include <regexp.h>
  197. #include <osbind.h>
  198. void regerror( char ZCONST *msg ) {
  199. perror( msg );
  200. }
  201. static int ret;
  202. static regexp *regptr;
  203. static short is_w, ind_w;
  204. static char fullpath[FILENAME_MAX], file_arg[FILENAME_MAX];
  205. #define FTW_F 0
  206. #define FTW_D 1
  207. #define FTW_DNR 2
  208. #define FTW_NS 3
  209. static int ftwfunc( struct stat *stats, int ftw_status )
  210. {
  211. char *path = &fullpath[0];
  212. if (strncmp(path, "./", 2) == 0) path += 2;
  213. switch (ftw_status) {
  214. case FTW_NS:
  215. zipwarn("can't stat file: ", path);
  216. ret = ZE_MISS;
  217. return 0;
  218. case FTW_F:
  219. if (!is_w || regexec(regptr, path, 1)) {
  220. #if 0
  221. char fn[FILENAME_MAX];
  222. int k;
  223. if (S_ISLNK(stats->st_mode) &&
  224. (k = readlink(path, fn, FILENAME_MAX)) > 0) {
  225. int l = strlen(path);
  226. fn[k] = '\0';
  227. strcat(strcat(path, " -> "), fn);
  228. ret = newname(path, 0, 0); /* procname(path, 0); */
  229. path[l] = '\0';
  230. } else
  231. #endif
  232. ret = newname(path, 0, 0); /* procname(path, 0); */
  233. }
  234. return 0;
  235. case FTW_DNR:
  236. zipwarn("can't open directory: ", path);
  237. ret = ZE_MISS;
  238. return 0;
  239. case FTW_D:
  240. if (strcmp(path, ".") == 0) return 0;
  241. if (is_w && ind_w > 0 && strncmp(path, file_arg, ind_w) != 0)
  242. return 4;
  243. }
  244. return 0;
  245. }
  246. static int myftw( int depth )
  247. {
  248. register DIR *dirp;
  249. struct dirent *entp;
  250. struct stat stats;
  251. register char *p,*q;
  252. register long i;
  253. if (LSSTAT(fullpath, &stats) < 0)
  254. return ftwfunc(&stats, FTW_NS);
  255. if (!S_ISDIR(stats.st_mode))
  256. return ftwfunc(&stats, FTW_F);
  257. if ((dirp = opendir(fullpath)) == NULL)
  258. return ftwfunc(&stats, FTW_DNR);
  259. if (i = ftwfunc(&stats, FTW_D)) {
  260. closedir(dirp);
  261. return (i == 4 ? 0 : (int)i);
  262. }
  263. i = strlen(fullpath);
  264. p = &fullpath[i];
  265. *p++ = '/'; *p = '\0';
  266. if (dirnames && i > 1) {
  267. q = (strncmp(fullpath, "./", 2) == 0 ? &fullpath[2] : &fullpath[0]);
  268. ret = newname(q, 1, 0);
  269. }
  270. i = 0;
  271. while (depth > 0 && (entp = readdir(dirp)) != 0)
  272. if (strcmp(entp->d_name,".") != 0 && strcmp(entp->d_name,"..") != 0) {
  273. strcpy(p, entp->d_name);
  274. if (i = myftw(depth-1))
  275. depth = 0; /* force User's finish */
  276. }
  277. closedir(dirp);
  278. return (int)i;
  279. }
  280. int wild( char *p )
  281. {
  282. char *d;
  283. ret = ZE_OK;
  284. if (p == NULL) p = "*";
  285. if (strcmp(p, "-") == 0) /* if compressing stdin */
  286. ret = newname(p, 0, 0);
  287. strcpy(fullpath, p);
  288. /* now turning UNIX-Wildcards into basic regular expressions */
  289. for (is_w = ind_w = 0, d = &file_arg[0]; *p; d++, p++)
  290. switch (*p) {
  291. case '*': *d++ = '.'; *d = *p; is_w = 1; break;
  292. case '?': *d = '.'; is_w = 1; break;
  293. case '[': *d = *p;
  294. if (*(p+1) == '!') {
  295. *++d = '^'; p++;
  296. } is_w = 1; break;
  297. case '.': *d++ = '\\'; *d = *p; break;
  298. default : *d = *p;
  299. if (!is_w) ind_w++;
  300. }
  301. *++d = '\0';
  302. if (is_w) {
  303. strcat( file_arg, "$" ); /* to get things like *.[ch] work */
  304. if ((regptr = regcomp( file_arg )) == NULL)
  305. return ZE_MEM;
  306. strcpy( fullpath, "." );
  307. myftw( recurse ? 99 : 1 );
  308. free(regptr);
  309. } else if (recurse) {
  310. myftw( 99 );
  311. } else
  312. myftw( 1 ); /* ret = procname( fullpath, 0 ); */
  313. return ret;
  314. }
  315. int procname(n, caseflag)
  316. char *n; /* name to process */
  317. int caseflag; /* true to force case-sensitive match */
  318. /* Process a name or sh expression to operate on (or exclude). Return
  319. an error code in the ZE_ class. */
  320. {
  321. char *a; /* path and name for recursion */
  322. DIR *d; /* directory stream from opendir() */
  323. char *e; /* pointer to name from readd() */
  324. int m; /* matched flag */
  325. char *p; /* path for recursion */
  326. struct stat s; /* result of stat() */
  327. struct zlist far *z; /* steps through zfiles list */
  328. if (strcmp(n, "-") == 0) /* if compressing stdin */
  329. return newname(n, 0, caseflag);
  330. else if (LSSTAT(n, &s))
  331. {
  332. /* Not a file or directory--search for shell expression in zip file */
  333. p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
  334. m = 1;
  335. for (z = zfiles; z != NULL; z = z->nxt) {
  336. if (MATCH(p, z->iname, caseflag))
  337. {
  338. z->mark = pcount ? filter(z->zname, caseflag) : 1;
  339. if (verbose)
  340. fprintf(mesg, "zip diagnostic: %scluding %s\n",
  341. z->mark ? "in" : "ex", z->name);
  342. m = 0;
  343. }
  344. }
  345. free((zvoid *)p);
  346. return m ? ZE_MISS : ZE_OK;
  347. }
  348. /* Live name--use if file, recurse if directory */
  349. for (p = n; *p; p++) /* use / consistently */
  350. if (*p == '\\')
  351. *p = '/';
  352. if (!S_ISDIR(s.st_mode))
  353. {
  354. /* add or remove name of file */
  355. if ((m = newname(n, 0, caseflag)) != ZE_OK)
  356. return m;
  357. } else {
  358. /* Add trailing / to the directory name */
  359. if ((p = malloc(strlen(n)+2)) == NULL)
  360. return ZE_MEM;
  361. if (strcmp(n, ".") == 0) {
  362. *p = '\0'; /* avoid "./" prefix and do not create zip entry */
  363. } else {
  364. strcpy(p, n);
  365. a = p + strlen(p);
  366. if (a[-1] != '/')
  367. strcpy(a, "/");
  368. if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
  369. free((zvoid *)p);
  370. return m;
  371. }
  372. }
  373. /* recurse into directory */
  374. if (recurse && (d = opendir(n)) != NULL)
  375. {
  376. while ((e = readd(d)) != NULL) {
  377. if (strcmp(e, ".") && strcmp(e, ".."))
  378. {
  379. if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
  380. {
  381. closedir(d);
  382. free((zvoid *)p);
  383. return ZE_MEM;
  384. }
  385. strcat(strcpy(a, p), e);
  386. if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
  387. {
  388. if (m == ZE_MISS)
  389. zipwarn("name not matched: ", a);
  390. else
  391. ziperr(m, a);
  392. }
  393. free((zvoid *)a);
  394. }
  395. }
  396. closedir(d);
  397. }
  398. free((zvoid *)p);
  399. } /* (s.st_mode & S_IFDIR) == 0) */
  400. return ZE_OK;
  401. }
  402. char *ex2in(x, isdir, pdosflag)
  403. char *x; /* external file name */
  404. int isdir; /* input: x is a directory */
  405. int *pdosflag; /* output: force MSDOS file attributes? */
  406. /* Convert the external file name to a zip file name, returning the malloc'ed
  407. string or NULL if not enough memory. */
  408. {
  409. char *n; /* internal file name (malloc'ed) */
  410. char *t, *p; /* shortened name */
  411. int dosflag;
  412. dosflag = 0;
  413. /* Find starting point in name before doing malloc */
  414. t = *x && *(x + 1) == ':' ? x + 2 : x;
  415. while (*t == '/' || *t == '\\')
  416. t++;
  417. /* Make changes, if any, to the copied name (leave original intact) */
  418. for (n = t; *n; n++)
  419. if (*n == '\\')
  420. *n = '/';
  421. if (!pathput)
  422. t = last(t, PATH_END);
  423. /* Malloc space for internal name and copy it */
  424. if ((n = malloc(strlen(t) + 1)) == NULL)
  425. return NULL;
  426. strcpy(n, t);
  427. #if 0
  428. if (p = strstr(t, " -> ")) /* shorten "link -> data" to "link" */
  429. *p = '\0';
  430. #endif
  431. if (dosify)
  432. msname(n);
  433. /* Returned malloc'ed name */
  434. if (pdosflag)
  435. *pdosflag = dosflag;
  436. return n;
  437. }
  438. char *in2ex(n)
  439. char *n; /* internal file name */
  440. /* Convert the zip file name to an external file name, returning the malloc'ed
  441. string or NULL if not enough memory. */
  442. {
  443. char *x; /* external file name */
  444. if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
  445. return NULL;
  446. strcpy(x, n);
  447. return x;
  448. }
  449. void stamp(f, d)
  450. char *f; /* name of file to change */
  451. ulg d; /* dos-style time to change it to */
  452. /* Set last updated and accessed time of file f to the DOS time d. */
  453. {
  454. struct utimbuf u; /* argument for utime() const ?? */
  455. /* Convert DOS time to time_t format in u[0] and u[1] */
  456. u.actime = u.modtime = dos2unixtime(d);
  457. /* Set updated and accessed times of f */
  458. utime(f, &u);
  459. }
  460. ulg filetime(f, a, n, t)
  461. char *f; /* name of file to get info on */
  462. ulg *a; /* return value: file attributes */
  463. long *n; /* return value: file size */
  464. iztimes *t; /* return value: access, modific. and creation times */
  465. /* If file *f does not exist, return 0. Else, return the file's last
  466. modified date and time as an MSDOS date and time. The date and
  467. time is returned in a long with the date most significant to allow
  468. unsigned integer comparison of absolute times. Also, if a is not
  469. a NULL pointer, store the file attributes there, with the high two
  470. bytes being the Unix attributes, and the low byte being a mapping
  471. of that to DOS attributes. If n is not NULL, store the file size
  472. there. If t is not NULL, the file's access, modification and creation
  473. times are stored there as UNIX time_t values.
  474. If f is "-", use standard input as the file. If f is a device, return
  475. a file size of -1 */
  476. {
  477. struct stat s; /* results of stat() */
  478. /* convert FNMAX to malloc - 11/8/04 EG */
  479. char *name;
  480. int len = strlen(f);
  481. if (f == label) {
  482. if (a != NULL)
  483. *a = label_mode;
  484. if (n != NULL)
  485. *n = -2L; /* convention for a label name */
  486. if (t != NULL)
  487. t->atime = t->mtime = t->ctime = label_utim;
  488. return label_time;
  489. }
  490. if ((name = malloc(len + 1)) == NULL) {
  491. ZIPERR(ZE_MEM, "filetime");
  492. }
  493. strcpy(name, f);
  494. if (name[len - 1] == '/')
  495. name[len - 1] = '\0';
  496. /* not all systems allow stat'ing a file with / appended */
  497. if (strcmp(f, "-") == 0) {
  498. if (fstat(fileno(stdin), &s) != 0) {
  499. free(name);
  500. error("fstat(stdin)");
  501. }
  502. } else if (LSSTAT(name, &s) != 0) {
  503. /* Accept about any file kind including directories
  504. * (stored with trailing / with -r option)
  505. */
  506. free(name);
  507. return 0;
  508. }
  509. if (a != NULL) {
  510. /* *a = ((ulg)s.st_mode << 16) | (ulg)GetFileMode(name); */
  511. *a = ((ulg)s.st_mode << 16) | (ulg)s.st_attr;
  512. }
  513. free(name);
  514. if (n != NULL)
  515. *n = S_ISREG(s.st_mode) ? s.st_size : -1L;
  516. if (t != NULL) {
  517. t->atime = s.st_atime;
  518. t->mtime = s.st_mtime;
  519. t->ctime = s.st_ctime;
  520. }
  521. return unix2dostime(&s.st_mtime);
  522. }
  523. int set_extra_field(z, z_utim)
  524. struct zlist far *z;
  525. iztimes *z_utim;
  526. /* create extra field and change z->att if desired */
  527. {
  528. #ifdef USE_EF_UT_TIME
  529. #ifdef IZ_CHECK_TZ
  530. if (!zp_tz_is_valid) return ZE_OK; /* skip silently if no valid TZ info */
  531. #endif
  532. if ((z->extra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(2))) == NULL)
  533. return ZE_MEM;
  534. if ((z->cextra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(1))) == NULL)
  535. return ZE_MEM;
  536. z->extra[0] = 'U';
  537. z->extra[1] = 'T';
  538. z->extra[2] = EB_UT_LEN(2); /* length of data part of e.f. */
  539. z->extra[3] = 0;
  540. z->extra[4] = EB_UT_FL_MTIME | EB_UT_FL_ATIME;
  541. z->extra[5] = (char)(z_utim->mtime);
  542. z->extra[6] = (char)(z_utim->mtime >> 8);
  543. z->extra[7] = (char)(z_utim->mtime >> 16);
  544. z->extra[8] = (char)(z_utim->mtime >> 24);
  545. z->extra[9] = (char)(z_utim->atime);
  546. z->extra[10] = (char)(z_utim->atime >> 8);
  547. z->extra[11] = (char)(z_utim->atime >> 16);
  548. z->extra[12] = (char)(z_utim->atime >> 24);
  549. z->ext = (EB_HEADSIZE+EB_UX_LEN(2));
  550. memcpy(z->cextra, z->extra, (EB_HEADSIZE+EB_UT_LEN(1)));
  551. z->cextra[EB_LEN] = EB_UT_LEN(1);
  552. z->cext = (EB_HEADSIZE+EB_UX_LEN(1));
  553. return ZE_OK;
  554. #else /* !USE_EF_UT_TIME */
  555. return (int)(z-z);
  556. #endif /* ?USE_EF_UT_TIME */
  557. }
  558. int deletedir(d)
  559. char *d; /* directory to delete */
  560. /* Delete the directory *d if it is empty, do nothing otherwise.
  561. Return the result of rmdir(), delete(), or system().
  562. For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
  563. */
  564. {
  565. return rmdir(d);
  566. }
  567. #endif /* !UTIL */
  568. /******************************/
  569. /* Function version_local() */
  570. /******************************/
  571. void version_local()
  572. {
  573. static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
  574. #ifdef __TURBOC__
  575. char buf[40];
  576. #endif
  577. printf(CompiledWith,
  578. #ifdef __GNUC__
  579. "gcc ", __VERSION__,
  580. #else
  581. # if 0
  582. "cc ", (sprintf(buf, " version %d", _RELEASE), buf),
  583. # else
  584. # ifdef __TURBOC__
  585. "Turbo C", (sprintf(buf, " (0x%04x = %d)", __TURBOC__, __TURBOC__), buf),
  586. # else
  587. "unknown compiler", "",
  588. # endif
  589. # endif
  590. #endif
  591. #ifdef __MINT__
  592. "Atari TOS/MiNT",
  593. #else
  594. "Atari TOS",
  595. #endif
  596. " (Atari ST/TT/Falcon030)",
  597. #ifdef __DATE__
  598. " on ", __DATE__
  599. #else
  600. "", ""
  601. #endif
  602. );
  603. } /* end function version_local() */