00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "mpw.h"
00023
00024 #include <stdlib.h>
00025
00026 #ifndef USE_MW_HEADERS
00027 #include <sys/time.h>
00028 #include <sys/resource.h>
00029 #endif
00030
00031 #include <Types.h>
00032 #include <Files.h>
00033
00034 #include <Timer.h>
00035
00036
00037
00038 int sys_nerr = 0;
00039
00040
00041
00042 int DebugPI = -1;
00043
00044 void
00045 mpwify_filename(char *unixname, char *macname)
00046 {
00047 int i, j;
00048
00049
00050 if (strlen (unixname) > 255)
00051 {
00052 fprintf (stderr, "Pathname \"%s\" is too long for Macs, truncating\n",
00053 unixname);
00054 }
00055 j = 0;
00056
00057
00058
00059
00060 if (unixname[0] != '/' && ! strchr (unixname, ':') && strchr (unixname, '/'))
00061 {
00062 macname[j++] = ':';
00063 }
00064 for (i = 0; unixname[i] != '\0' && i < 255; ++i)
00065 {
00066 if (i == 0 && unixname[i] == '/')
00067 {
00068 if (strncmp (unixname, "/tmp/", 5) == 0)
00069 {
00070
00071
00072
00073
00074
00075
00076 macname[j++] = ':';
00077 macname[j++] = 't';
00078 macname[j++] = 'm';
00079 macname[j++] = 'p';
00080 macname[j++] = '_';
00081 i += 4;
00082 }
00083 else
00084 {
00085
00086 }
00087 }
00088 else if (unixname[i] == ':' && unixname[i+1] == '/')
00089 {
00090 macname[j++] = ':';
00091 i += 1;
00092 }
00093 else if (unixname[i] == '.' && unixname[i+1] == '/')
00094 {
00095 macname[j++] = ':';
00096 i += 1;
00097 }
00098 else if (unixname[i] == '.' && unixname[i+1] == '.' && unixname[i+2] == '/')
00099 {
00100 macname[j++] = ':';
00101 macname[j++] = ':';
00102 i += 2;
00103 }
00104 else if (unixname[i] == '/')
00105 {
00106 macname[j++] = ':';
00107 }
00108 else
00109 {
00110 macname[j++] = unixname[i];
00111 }
00112 }
00113 macname[j] = '\0';
00114
00115 if (DebugPI < 0)
00116 DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0);
00117 if (DebugPI)
00118 {
00119 fprintf (stderr, "# Made \"%s\"\n", unixname);
00120 fprintf (stderr, "# into \"%s\"\n", macname);
00121 }
00122 }
00123
00124
00125
00126 char *
00127 mpw_basename (name)
00128 char *name;
00129 {
00130 char *base = name;
00131
00132 while (*name)
00133 {
00134 if (*name++ == ':')
00135 {
00136 base = name;
00137 }
00138 }
00139 return base;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148 char *
00149 mpw_mixed_basename (name)
00150 char *name;
00151 {
00152 char *base = name;
00153
00154 while (*name)
00155 {
00156 if (*name == '/' || *name == ':')
00157 {
00158 base = name + 1;
00159 }
00160 ++name;
00161 }
00162 return base;
00163 }
00164
00165
00166
00167
00168 FILE *
00169 mpw_fopen (char *name, char *mode)
00170 {
00171 #undef fopen
00172 int errnum;
00173 FILE *fp;
00174 char tmpname[256];
00175
00176 mpwify_filename (name, tmpname);
00177 PROGRESS (1);
00178 fp = fopen (tmpname, mode);
00179 errnum = errno;
00180
00181
00182 if (strchr (mode, 'w'))
00183 {
00184 char *pname = (char *) malloc (strlen (tmpname) + 2);
00185 OSErr e;
00186 struct FInfo fi;
00187
00188 pname[0] = strlen (tmpname);
00189 strcpy (pname+1, tmpname);
00190
00191 e = GetFInfo ((ConstStr255Param) pname, 0, &fi);
00192
00193 if (e != 0)
00194 fprintf(stderr, "GetFInfo returns %d\n", e);
00195 if (strchr (mode, 'b'))
00196 {
00197 fi.fdType = (OSType) 'BIN ';
00198 }
00199 else
00200 {
00201 fi.fdType = (OSType) 'TEXT';
00202 }
00203 fi.fdCreator = (OSType) 'MPS ';
00204 e = SetFInfo ((ConstStr255Param) pname, 0, &fi);
00205 if (e != 0)
00206 fprintf(stderr, "SetFInfo returns %d\n", e);
00207 free (pname);
00208 }
00209 if (fp == NULL)
00210 errno = errnum;
00211 return fp;
00212 }
00213
00214
00215
00216
00217 #define ZEROBLKSIZE 4096
00218
00219 char zeros[ZEROBLKSIZE];
00220
00221 int
00222 mpw_fseek (FILE *fp, int offset, int whence)
00223 {
00224 #undef fseek
00225 int cursize, numleft;
00226
00227 PROGRESS (1);
00228 if (whence == SEEK_SET)
00229 {
00230 fseek (fp, 0, SEEK_END);
00231 cursize = ftell (fp);
00232 if (offset > cursize)
00233 {
00234 numleft = offset - cursize;
00235 while (numleft > ZEROBLKSIZE)
00236 {
00237
00238 PROGRESS (1);
00239 fwrite (zeros, 1, ZEROBLKSIZE, fp);
00240 numleft -= ZEROBLKSIZE;
00241 }
00242 PROGRESS (1);
00243 fwrite (zeros, 1, numleft, fp);
00244 fflush (fp);
00245 }
00246 }
00247 return fseek (fp, offset, whence);
00248 }
00249
00250 int
00251 mpw_fread (char *ptr, int size, int nitems, FILE *stream)
00252 {
00253 #undef fread
00254 int rslt;
00255
00256 PROGRESS (1);
00257 rslt = fread (ptr, size, nitems, stream);
00258 PROGRESS (1);
00259 return rslt;
00260 }
00261
00262 int
00263 mpw_fwrite (char *ptr, int size, int nitems, FILE *stream)
00264 {
00265 #undef fwrite
00266 int rslt;
00267
00268 PROGRESS (1);
00269 rslt = fwrite (ptr, size, nitems, stream);
00270 PROGRESS (1);
00271 return rslt;
00272 }
00273
00274 int
00275 link ()
00276 {
00277 fprintf (stderr, "link not available!\n");
00278 mpw_abort ();
00279 }
00280
00281 int
00282 fork ()
00283 {
00284 fprintf (stderr, "fork not available!\n");
00285 mpw_abort ();
00286 }
00287
00288 int
00289 vfork ()
00290 {
00291 fprintf (stderr, "vfork not available!\n");
00292 mpw_abort ();
00293 return (-1);
00294 }
00295
00296 int
00297 pipe (int *fd)
00298 {
00299 fprintf (stderr, "pipe not available!\n");
00300 mpw_abort ();
00301 return (-1);
00302 }
00303
00304 #ifndef USE_MW_HEADERS
00305 int
00306 execvp (char *file, char **argv)
00307 {
00308 fprintf (stderr, "execvp not available!\n");
00309 mpw_abort ();
00310 return (-1);
00311 }
00312
00313 int
00314 execv (char *path, char **argv)
00315 {
00316 fprintf (stderr, "execv not available!\n");
00317 mpw_abort ();
00318 return (-1);
00319 }
00320 #endif
00321
00322 int
00323 kill (int pid, int sig)
00324 {
00325 fprintf (stderr, "kill not available!\n");
00326 mpw_abort ();
00327 return (-1);
00328 }
00329
00330 int
00331 wait (int *status)
00332 {
00333 *status = 0;
00334 return 0;
00335 }
00336
00337 #ifndef USE_MW_HEADERS
00338 int
00339 sleep (int seconds)
00340 {
00341 unsigned long start_time, now;
00342
00343 time (&start_time);
00344
00345 while (1)
00346 {
00347 PROGRESS (1);
00348 time (&now);
00349 if (now > start_time + seconds)
00350 return 0;
00351 }
00352 }
00353 #endif
00354
00355 void
00356 putenv (char *str)
00357 {
00358
00359
00360 }
00361
00362 int
00363 chmod (char *path, int mode)
00364 {
00365
00366 return 0;
00367 }
00368
00369 #ifndef USE_MW_HEADERS
00370 int
00371 getuid ()
00372 {
00373
00374 return 0;
00375 }
00376
00377 int
00378 getgid ()
00379 {
00380
00381 return 0;
00382 }
00383 #endif
00384
00385
00386
00387
00388
00389 void
00390 mpw_abort ()
00391 {
00392
00393 fflush(stdout);
00394 fflush(stderr);
00395 printf("## Abort! ##\n");
00396 #ifdef MPW_SADE
00397 SysError(8005);
00398 #else
00399 Debugger();
00400 #endif
00401
00402 exit (1);
00403 }
00404
00405
00406
00407 int
00408 getrusage (int who, struct rusage *rusage)
00409 {
00410 int clk = clock ();
00411
00412 #if 0
00413 rusage->ru_utime.tv_sec = clk / CLOCKS_PER_SEC;
00414 rusage->ru_utime.tv_usec = ((clk * 1000) / CLOCKS_PER_SEC) * 1000;
00415 rusage->ru_stime.tv_sec = 0;
00416 rusage->ru_stime.tv_usec = 0;
00417 #endif
00418 }
00419
00420 int
00421 sbrk ()
00422 {
00423 return 0;
00424 }
00425
00426 #ifndef USE_MW_HEADERS
00427 int
00428 isatty (int fd)
00429 {
00430 return 0;
00431 }
00432
00433
00434
00435 #include "utime.h"
00436
00437 int
00438 utime (char *filename, struct utimbuf *times)
00439 {
00440 CInfoPBRec cipbr;
00441 HFileInfo *fpb = (HFileInfo *) &cipbr;
00442 DirInfo *dpb = (DirInfo *) &cipbr;
00443 unsigned char pname[256];
00444 short err;
00445
00446 strcpy ((char *) pname, filename);
00447 c2pstr (pname);
00448
00449 dpb->ioDrDirID = 0L;
00450 fpb->ioNamePtr = pname;
00451 fpb->ioVRefNum = 0;
00452 fpb->ioFDirIndex = 0;
00453 fpb->ioFVersNum = 0;
00454 err = PBGetCatInfo (&cipbr, 0);
00455 if (err != noErr) {
00456 errno = ENOENT;
00457 return -1;
00458 }
00459 dpb->ioDrDirID = 0L;
00460 fpb->ioFlMdDat = times->modtime;
00461 fpb->ioFlCrDat = times->actime;
00462 err = PBSetCatInfo (&cipbr, 0);
00463 if (err != noErr) {
00464 errno = EACCES;
00465 return -1;
00466 }
00467 return 0;
00468 }
00469
00470 int
00471 mkdir (char *path, int mode)
00472 {
00473 errno = ENOSYS;
00474 return -1;
00475 }
00476
00477 int
00478 rmdir ()
00479 {
00480 errno = ENOSYS;
00481 return -1;
00482 }
00483 #endif
00484
00485 chown ()
00486 {
00487 errno = ENOSYS;
00488 return -1;
00489 }
00490
00491 char *myenviron[] = {NULL};
00492
00493 char **environ = myenviron;
00494
00495 #ifndef USE_MW_HEADERS
00496
00497
00498
00499
00500
00501
00502
00503 extern int __uid, __gid;
00504
00505 int __uid = 0;
00506 int __gid = 0;
00507
00508
00509 #define LOCKBIT (1<<0)
00510 #define DIRBIT (1<<4)
00511
00512
00513
00514
00515 static int
00516 _stat (char *name, long dirid, struct stat *buf)
00517 {
00518 CInfoPBRec cipbr;
00519 HFileInfo *fpb = (HFileInfo*) &cipbr;
00520 DirInfo *dpb = (DirInfo*) &cipbr;
00521 Str255 pname;
00522 short err;
00523
00524
00525 strcpy ((char *) pname, name);
00526 c2pstr (pname);
00527
00528 cipbr.dirInfo.ioDrDirID = dirid;
00529 cipbr.hFileInfo.ioNamePtr = pname;
00530 cipbr.hFileInfo.ioVRefNum = 0;
00531 cipbr.hFileInfo.ioFDirIndex = 0;
00532 cipbr.hFileInfo.ioFVersNum = 0;
00533 err = PBGetCatInfo (&cipbr, 0);
00534 if (err != noErr)
00535 {
00536 errno = ENOENT;
00537 return -1;
00538 }
00539
00540 buf->st_mode = 0444;
00541
00542 if (!(fpb->ioFlAttrib & LOCKBIT))
00543 buf->st_mode |= 0222;
00544 if (fpb->ioFlAttrib & DIRBIT)
00545 {
00546
00547 buf->st_mode |= 0111 | S_IFDIR;
00548 buf->st_size = dpb->ioDrNmFls;
00549 buf->st_rsize = 0;
00550 }
00551 else
00552 {
00553 buf->st_mode |= S_IFREG;
00554
00555 if (fpb->ioFlFndrInfo.fdType == 'APPL')
00556 buf->st_mode |= 0111;
00557
00558 buf->st_size = fpb->ioFlLgLen;
00559 buf->st_rsize = fpb->ioFlRLgLen;
00560 }
00561
00562 buf->st_atime = fpb->ioFlCrDat;
00563 buf->st_mtime = fpb->ioFlMdDat;
00564 buf->st_ctime = fpb->ioFlCrDat;
00565
00566 buf->st_ino = (unsigned short) fpb->ioDirID;
00567
00568 GetVRefNum (buf->st_ino, &buf->st_dev);
00569 buf->st_uid = __uid;
00570 buf->st_gid = __gid;
00571
00572 return 0;
00573 }
00574
00575
00576
00577 int
00578 stat (char *path, struct stat *buf)
00579 {
00580 long rslt, errnum;
00581 char tmpname[256];
00582
00583 mpwify_filename (path, tmpname);
00584 if (DebugPI)
00585 fprintf (stderr, "# stat (%s, %x)", tmpname, buf);
00586 PROGRESS (1);
00587 rslt = _stat (tmpname, 0L, buf);
00588 errnum = errno;
00589 if (DebugPI)
00590 {
00591 fprintf (stderr, " -> %d", rslt);
00592 if (rslt != 0)
00593 fprintf (stderr, " (errno is %d)", errnum);
00594 fprintf (stderr, "\n");
00595 fflush (stderr);
00596 }
00597 if (rslt != 0)
00598 errno = errnum;
00599 return rslt;
00600 }
00601
00602 int
00603 fstat (int fd, struct stat *buf)
00604 {
00605 FCBPBRec fcb;
00606 FILE *fp;
00607 Str255 pathname;
00608 long dirid = 0L, temp;
00609 long rslt, errnum;
00610 short err;
00611
00612 if (DebugPI < 0)
00613 DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0);
00614 if (DebugPI)
00615 fprintf (stderr, "# fstat (%d, %x)", fd, buf);
00616 PROGRESS (1);
00617 pathname[0] = 0;
00618 #ifdef FIOFNAME
00619
00620
00621 ioctl (fd, FIOFNAME, (long *) pathname);
00622 #else
00623 you lose
00624 #endif
00625 if (DebugPI)
00626 fprintf (stderr, " (name is %s)", pathname);
00627 dirid = 0L ;
00628 rslt = _stat ((char *) pathname, dirid, buf);
00629 errnum = errno;
00630 if (DebugPI)
00631 {
00632 fprintf (stderr, " -> %d", rslt);
00633 if (rslt != 0)
00634 fprintf (stderr, " (errno is %d)", errnum);
00635 fprintf (stderr, "\n");
00636 fflush (stderr);
00637 }
00638 if (rslt != 0)
00639 errno = errnum;
00640 return rslt;
00641 }
00642
00643 #endif
00644
00645 chdir ()
00646 {
00647 errno = ENOSYS;
00648 return (-1);
00649 }
00650
00651 char *
00652 getcwd (char *buf, int size)
00653 {
00654 if (buf == NULL)
00655 buf = (char *) malloc (size);
00656 strcpy(buf, ":");
00657 return buf;
00658 }
00659
00660
00661
00662 char *
00663 getpwd ()
00664 {
00665 return ":";
00666 }
00667
00668 int
00669 mpw_open (char *filename, int arg2, int arg3)
00670 {
00671 #undef open
00672 int fd, errnum = 0;
00673 char tmpname[256];
00674
00675 mpwify_filename (filename, tmpname);
00676 fd = open (tmpname, arg2);
00677 errnum = errno;
00678
00679 if (DebugPI)
00680 {
00681 fprintf (stderr, "# open (%s, %d, %d)", tmpname, arg2, arg3);
00682 fprintf (stderr, " -> %d", fd);
00683 if (fd == -1)
00684 fprintf (stderr, " (errno is %d)", errnum);
00685 fprintf (stderr, "\n");
00686 }
00687 if (fd == -1)
00688 errno = errnum;
00689 return fd;
00690 }
00691
00692 int
00693 mpw_access (char *filename, unsigned int cmd)
00694 {
00695 #undef access
00696
00697 int rslt, errnum = 0;
00698 struct stat st;
00699 char tmpname[256];
00700
00701 mpwify_filename (filename, tmpname);
00702 if (cmd & R_OK || cmd & X_OK)
00703 {
00704 rslt = stat (tmpname, &st);
00705 errnum = errno;
00706 if (rslt >= 0)
00707 {
00708 if ((((st.st_mode & 004) == 0) && (cmd & R_OK))
00709 || (((st.st_mode & 002) == 0) && (cmd & W_OK))
00710 || (((st.st_mode & 001) == 0) && (cmd & X_OK)))
00711 {
00712 rslt = -1;
00713 errnum = EACCES;
00714 }
00715 }
00716 }
00717 if (DebugPI)
00718 {
00719 fprintf (stderr, "# mpw_access (%s, %d)", tmpname, cmd);
00720 fprintf (stderr, " -> %d", rslt);
00721 if (rslt != 0)
00722 fprintf (stderr, " (errno is %d)", errnum);
00723 fprintf (stderr, "\n");
00724 }
00725 if (rslt != 0)
00726 errno = errnum;
00727 return rslt;
00728 }
00729
00730
00731
00732 int
00733 mpw_creat (char *path, int mode)
00734 {
00735 #undef creat
00736
00737 #ifdef USE_MW_HEADERS
00738 return creat (path, mode);
00739 #else
00740 return creat (path);
00741 #endif
00742 }
00743
00744
00745
00746
00747 mpw_special_init (name)
00748 char *name;
00749 {
00750 if (strstr (name, "DEBUG"))
00751 DebugStr("\pat beginning of program");
00752 }
00753
00754 static int current_umask;
00755
00756 int
00757 umask(int mask)
00758 {
00759 int oldmask = current_umask;
00760
00761 current_umask = mask;
00762 return oldmask;
00763 }
00764
00765
00766
00767
00768
00769 int cursor_inited;
00770
00771
00772
00773 int measure_spin;
00774
00775
00776
00777 int dump_spin_data;
00778
00779 long warning_threshold = 400000;
00780
00781 long bucket_size = 1024;
00782
00783 long bucket_power = 10;
00784
00785 long numbuckets = 300;
00786
00787 int *delay_counts;
00788
00789 int overflow_count;
00790
00791 char *current_progress;
00792
00793 static UnsignedWide last_microseconds;
00794
00795 static char *last_spin_file = "";
00796
00797 static int last_spin_line;
00798
00799 void
00800 warn_if_spin_delay (char *file, int line)
00801 {
00802 long diff, ix;
00803 UnsignedWide now;
00804
00805 Microseconds(&now);
00806
00807 diff = now.lo - last_microseconds.lo;
00808
00809 if (diff > warning_threshold)
00810 fprintf (stderr, "# %s: %ld.%06ld sec delay getting from %s:%d to %s:%d\n",
00811 (current_progress ? current_progress : ""),
00812 diff / 1000000, diff % 1000000,
00813 last_spin_file, last_spin_line, file, line);
00814 if (dump_spin_data)
00815 {
00816 if (diff >= 0)
00817 {
00818 ix = diff >> bucket_power;
00819 if (ix >= 0 && ix < numbuckets && delay_counts != NULL)
00820 ++delay_counts[ix];
00821 else
00822 ++overflow_count;
00823 }
00824 else
00825 fprintf (stderr, "raw diff is %ld (?)\n", diff);
00826 }
00827 }
00828
00829 void
00830 record_for_spin_delay (char *file, int line)
00831 {
00832 Microseconds (&last_microseconds);
00833 last_spin_file = file;
00834 last_spin_line = line;
00835 }
00836
00837 void
00838 mpw_start_progress (char *str, int n, char *file, int line)
00839 {
00840 int i;
00841 char *measure, *threshold;
00842
00843 if (!cursor_inited)
00844 {
00845 InitCursorCtl (nil);
00846 cursor_inited = 1;
00847 record_for_spin_delay (file, line);
00848 measure = getenv ("MEASURE_SPIN");
00849 if (measure != NULL && measure[0] != '\0')
00850 {
00851 measure_spin = 1;
00852 if (strcmp (measure, "all") == 0)
00853 dump_spin_data = 1;
00854 }
00855 threshold = getenv ("SPIN_WARN_THRESHOLD");
00856 if (threshold != NULL && threshold[0] != '\0')
00857 warning_threshold = atol (threshold);
00858 if (dump_spin_data)
00859 {
00860 if (delay_counts == NULL)
00861 delay_counts = (int *) malloc (numbuckets * sizeof (int));
00862 for (i = 0; i < numbuckets; ++i)
00863 delay_counts[i] = 0;
00864 overflow_count = 0;
00865 }
00866 }
00867 current_progress = str;
00868
00869 sys_nerr = errno_max ();
00870
00871 mpw_special_init (str);
00872 }
00873
00874 void
00875 mpw_progress (int n)
00876 {
00877 SpinCursor (32);
00878 }
00879
00880 void
00881 mpw_progress_measured (int n, char *file, int line)
00882 {
00883 if (measure_spin)
00884 warn_if_spin_delay (file, line);
00885 SpinCursor (32);
00886 if (measure_spin)
00887 record_for_spin_delay (file, line);
00888 }
00889
00890 void
00891 mpw_end_progress (char *str, char *file, int line)
00892 {
00893 long i, delay, count = 0, sum = 0, avgdelay, spinrate;
00894 long curpower = 0, curgroup = 0;
00895
00896
00897 if (measure_spin)
00898 warn_if_spin_delay (file, line);
00899
00900
00901 if (dump_spin_data && delay_counts != NULL)
00902 {
00903 for (i = 0; i < numbuckets; ++i)
00904 {
00905 delay = (i + 1) * bucket_size;
00906 sum += delay_counts[i] * (i + 1);
00907 count += delay_counts[i];
00908 if (delay <= (1 << curpower))
00909 {
00910 curgroup += delay_counts[i];
00911 }
00912 else
00913 {
00914 if (curgroup > 0)
00915 fprintf (stderr,
00916 "# %s: %d delays between %ld.%06ld and %ld.%06ld sec\n",
00917 (str ? str : ""),
00918 curgroup,
00919 (1 << curpower) / 1000000,
00920 (1 << curpower) % 1000000,
00921 (1 << (curpower + 1)) / 1000000,
00922 (1 << (curpower + 1)) % 1000000);
00923 ++curpower;
00924 curgroup = 0;
00925 }
00926 }
00927 if (count > 0)
00928 {
00929 avgdelay = (sum * bucket_size) / count;
00930 spinrate = 1000000 / avgdelay;
00931 fprintf (stderr, "# %s: Average spin rate is %d times/sec\n",
00932 (str ? str : ""), spinrate);
00933 }
00934 }
00935 }
00936
00937 #ifdef PROGRESS_TEST
00938
00939
00940
00941 main ()
00942 {
00943 int i, j;
00944 double x = 1.0, y = 2.4;
00945 long start = Microseconds (), tm; FIXME
00946
00947 START_PROGRESS ("hi", 0);
00948
00949 for (i = 0; i < 1000; ++i)
00950 {
00951 PROGRESS (1);
00952
00953 for (j = 0; j < (i * 100); ++j)
00954 {
00955 x += (x * y) / j;
00956 }
00957 }
00958
00959 END_PROGRESS ("hi");
00960
00961 tm = Microseconds () - start;
00962
00963 printf ("Total time is %d.%d secs\n", tm / 1000000, tm % 1000000);
00964 }
00965
00966 #endif
00967
00968 #ifdef USE_MW_HEADERS
00969
00970
00971 #ifndef __CONSOLE__
00972 #include <console.h>
00973 #endif
00974
00975 short
00976 InstallConsole(short fd)
00977 {
00978 #pragma unused (fd)
00979 return 0;
00980 }
00981
00982 void
00983 RemoveConsole(void)
00984 {
00985 }
00986
00987 long
00988 WriteCharsToConsole(char *buf, long n)
00989 {
00990 #pragma unused (buf, n)
00991 return 0;
00992 }
00993
00994 long ReadCharsFromConsole(char *buf, long n)
00995 {
00996 #pragma unused (buf, n)
00997 return 0;
00998 }
00999
01000 extern char *
01001 __ttyname(long fd)
01002 {
01003 static char *__devicename = "null device";
01004
01005 if (fd >= 0 && fd <= 2)
01006 return (__devicename);
01007 return NULL;
01008 }
01009
01010 #endif