Changeset 90


Ignore:
Timestamp:
Mar 6, 2008, 3:18:30 PM (10 years ago)
Author:
Sam Hocevar
Message:
  • Get rid of WATCOMC tests.
Location:
abuse/trunk/src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/filesel.cpp

    r56 r90  
    99
    1010#include "config.h"
    11 
    12 #ifdef __WATCOMC__
    13 #   include <direct.h>
    14 #endif
    1511
    1612#include "filesel.hpp"
  • abuse/trunk/src/imlib/jmalloc.cpp

    r58 r90  
    680680      case HI_BLOCK :
    681681      { free(bmanage[i].addr); } break;
    682 #ifdef __WATCOMC__     
    683       case LOW_BLOCK :
    684       { free_low_memory(bmanage[i].addr); } break;
    685 #endif     
    686682    }
    687683  }
     
    700696    "    DOS users  : Remove any TSR's and device drivers you can.\n"
    701697    "    UNIX users : Do you have a swapfile/partition setup?\n";
    702 #ifdef __WATCOMC__
    703 static char const *not_enough_low_memory_message =
    704     "Memory Manager : Not enough low memory available (%d : need %d)\n"
    705     "  Suggestions...\n"
    706     "    - make a boot disk\n"
    707     "    - remove TSRs & drivers not needed by ABUSE\n"
    708     "    - add memory to your system\n";
    709 #endif
    710698
    711699void jmalloc_init(int32_t min_size)
     
    750738    bmanage_total++;      */
    751739
    752 #ifdef __WATCOMC__
    753     if (size!=jmalloc_max_size)
    754     {
    755       do
    756       {
    757         size=low_memory_available();
    758         if (size>jmalloc_min_low_size+0x1000)              // save 64K for misc low memory needs
    759         {
    760           bmanage[bmanage_total].init(alloc_low_memory(size-jmalloc_min_low_size-0x1000),size-jmalloc_min_low_size-0x1000,LOW_BLOCK);
    761           bmanage_total++;
    762           fprintf(stderr,"Added low memory block (%d bytes)\n",size);
    763         }
    764       } while (size>jmalloc_min_low_size+0x1000);
    765       if (size<jmalloc_min_low_size)
    766       {
    767         fprintf(stderr,not_enough_low_memory_message,size,jmalloc_min_low_size);
    768         exit(0);
    769       }
    770     }
    771 #endif
    772  
    773740    fprintf(stderr,"Memory available : %d\n",j_available());
    774741    if (j_available()<min_size)
  • abuse/trunk/src/imlib/specs.cpp

    r86 r90  
    330330
    331331//  int old_mask=umask(S_IRWXU | S_IRWXG | S_IRWXO);
    332 #ifdef __WATCOMC__
    333   flags|=O_BINARY;
    334 #endif
    335332  if (flags&O_WRONLY)
    336333  {
  • abuse/trunk/src/imlib/system.h

    r57 r90  
    1919
    2020
    21 #if defined( __WATCOMC__ )
    22   // they didn't include this def in their math include
    23   #ifndef M_PI
    24     #define M_PI 3.141592654
    25   #endif
    26   // so stuff can find proper file ops
    27   #include <io.h>
    28 #elif defined( __POWERPC__ )
    29   // they didn't include this def in their math include
    30   #ifndef M_PI
    31     #define M_PI 3.141592654
    32   #endif
    33         #include <unistd.h>
    34 #else
    35   // so apps can find unlink
    36   #include <unistd.h>
    37   #include <stdint.h>
    38 #endif
    39 
     21#include <unistd.h>
     22#include <stdint.h>
    4023
    4124#define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
  • abuse/trunk/src/innet.cpp

    r61 r90  
    3838of a abuse and therefore is a bit simpler.
    3939*/
    40 
    41 #ifdef __WATCOMC__
    42 #define getlogin() "DOS user"
    43 #endif
    4440
    4541base_memory_struct *base;   // points to shm_addr
  • abuse/trunk/src/install.cpp

    r56 r90  
    3333#ifdef __linux__
    3434  return LINUX;
    35 #endif
    36 
    37 #ifdef __WATCOMC__
    38   return WATCOM;
    3935#endif
    4036
     
    270266    case 10 :
    271267    {
    272       char str[200];
    273       strcpy(str,lstring_value(eval(CAR(arg))));
    274       modify_install_path(str);
    275       return new_lisp_string(str);
     268      /* This is now a no-op --sam */
     269      return new_lisp_string(lstring_value(eval(CAR(arg))));
    276270    } break;
    277271  }
  • abuse/trunk/src/light.cpp

    r56 r90  
    608608}
    609609
    610 /*
    611 #ifdef __WATCOMC__
    612 extern "C" {
    613 extern int32_t MAP_PUT(int32_t pad, int32_t screen_addr, int32_t remap, int32_t w);
    614 } ;
    615 #else*/
    616 
    617610inline void MAP_PUT(uint8_t * screen_addr, uint8_t * remap, int w)
    618611{
     
    636629  }
    637630}
    638 
    639 /*
    640 #endif
    641 
    642 inline void PUT8(int32_t *addr, uint8_t *remap)
    643 {
    644   register uint32_t in_pixels;
    645   register uint32_t pixel;
    646   register uint32_t out_pixels;
    647   in_pixels=*addr;
    648   pixel=in_pixels;
    649   out_pixels=remap[(uint8_t)pixel];
    650  
    651   pixel=in_pixels;
    652   pixel>>=8;
    653   pixel=remap[(uint8_t)pixel];
    654   pixel<<=8;
    655   out_pixels|=pixel;
    656 
    657   pixel=in_pixels;
    658   pixel>>=16;
    659   pixel=remap[(uint8_t)pixel];
    660   pixel<<=16;
    661   out_pixels|=pixel;
    662 
    663   pixel=in_pixels;
    664   pixel>>=24;
    665   pixel=remap[(uint8_t)pixel];
    666   pixel<<=24;
    667   out_pixels|=pixel;
    668 
    669   *addr=out_pixels;        // send out bus
    670 
    671   // do next 4
    672   in_pixels=addr[1];
    673 
    674   pixel=in_pixels;
    675   pixel&=0xff;
    676   out_pixels=remap[pixel];
    677  
    678   pixel=in_pixels;
    679   pixel>>=8;
    680   pixel=remap[(uint8_t)pixel];
    681   pixel<<=8;
    682   out_pixels|=pixel;
    683 
    684   pixel=in_pixels;
    685   pixel>>=16;
    686   pixel=remap[(uint8_t)pixel];
    687   pixel<<=16;
    688   out_pixels|=pixel;
    689 
    690   pixel=in_pixels;
    691   pixel>>=24;
    692   pixel=remap[(uint8_t)pixel];
    693   pixel<<=24;
    694   out_pixels|=pixel; 
    695   addr[1]=out_pixels;        // send out bus
    696  
    697 }
    698 
    699 inline int32_t MAP_PUT2(int32_t dest_addr, int32_t screen_addr, int32_t remap, int32_t w)
    700 { while (w--)
    701   {
    702     *((uint8_t *)(dest_addr))=*((uint8_t *)remap+*((uint8_t *)screen_addr));
    703     screen_addr++;
    704     dest_addr++;
    705   }
    706   return dest_addr;
    707 }
    708 
    709 */
    710631
    711632uint16_t min_light_level;
     
    759680
    760681
    761 /*#ifdef __WATCOMC__
    762 
    763 extern "C" void remap_line_asm(uint8_t *screen_line,uint8_t *light_lookup,uint8_t *remap_line,int count);
    764 
    765 #else */
    766 
    767682void remap_line_asm2(uint8_t *addr,uint8_t *light_lookup,uint8_t *remap_line,int count)
    768683//inline void remap_line_asm2(uint8_t *addr,uint8_t *light_lookup,uint8_t *remap_line,int count)
     
    785700  }
    786701}
    787 
    788 //#endif
    789 
    790702
    791703inline void put_8line(uint8_t *in_line, uint8_t *out_line, uint8_t *remap, uint8_t *light_lookup, int count)
  • abuse/trunk/src/maker.cpp

    r56 r90  
    1515#include <string.h>
    1616#include <stdlib.h>
    17 #ifdef __WATCOMC__
    18 #   include <sys\types.h>
    19 #   include <direct.h>
    20 #   define make_dir(dir) mkdir(dir)
    21 #else
    22 #   include <sys/stat.h>
    23 #   define make_dir(dir) mkdir(dir,511)
    24 #endif
     17#include <sys/stat.h>
     18#define make_dir(dir) mkdir(dir,511)
    2519
    2620#define NO_LIBS 1
     
    4539#ifdef __linux__
    4640  return LINUX;
    47 #endif
    48 
    49 #ifdef __WATCOMC__
    50   return WATCOM;
    5141#endif
    5242
     
    10090
    10191
    102 #ifdef __WATCOMC__
    103 #include <dos.h>
    104 #endif
    105 
    10692int change_dir(char *path)
    10793{
    108 #ifdef __WATCOMC__
    109   unsigned cur_drive;
    110   _dos_getdrive(&cur_drive);
    111   if (path[1]==':')
    112   {
    113     unsigned total;
    114     _dos_setdrive(toupper(path[0])-'A'+1,&total);
    115 
    116 
    117     unsigned new_drive;
    118     _dos_getdrive(&new_drive);
    119 
    120     if (new_drive!=toupper(path[0])-'A'+1)
    121     {
    122       return 0;
    123     }
    124 
    125     path+=2;
    126   }
    127  
    128   int er=chdir(path);
    129   if (er)
    130   {
    131     unsigned total;
    132     _dos_setdrive(cur_drive,&total);
    133   }
    134   return !er;
    135 #else
    136   int ret=chdir(path);    // weird
    137   ret=chdir(path);
    138   return ret==0;
    139 #endif 
     94    int ret = chdir(path); // weird
     95    ret = chdir(path);
     96    return ret == 0;
    14097}
    14198
  • abuse/trunk/src/net/fileman.cpp

    r56 r90  
    1616#include <string.h>
    1717#include <signal.h>
    18 
    19 #ifndef __WATCOMC__
    20 #   include <sys/stat.h>
    21 #endif
     18#include <sys/stat.h>
    2219
    2320#include "macs.hpp"
     
    239236  int flags=0;
    240237
    241 #ifdef __WATCOMC__
    242     flags|=O_BINARY;
    243 #endif
    244 
    245238  while (*mp)
    246239  {
  • abuse/trunk/src/newlight.cpp

    r56 r90  
    494494
    495495
    496 #ifdef __WATCOMC__
    497 extern "C" {
    498 extern long MAP_PUT(long pad, long screen_addr, long remap, long w);
    499 extern long MAP_PUT2(long dest, long screen_addr, long remap, long w);
    500 } ;
    501 #else
    502496inline long MAP_PUT(long pad, long screen_addr, long remap, long w)
    503497{ while (w--)
     
    518512  return dest_addr;
    519513}
    520 
    521 #endif
    522 
    523514
    524515inline long calc_lv(light_patch *lp, long sx, long sy)
     
    600591    {
    601592      unsigned char *sl=screen->scan_line(lp->y1)+lp->x1,*dest;
    602 #ifdef __WATCOMC__
    603       if (get_vmode()==19) dest=(uchar *)0xa0000+lp->y1*320+lp->x1;
    604       else dest=sl;
    605 #else
    606593      dest=sl;
    607 #endif
    608594     
    609595      int y2=lp->y2;
     
    623609
    624610      uchar *yaddr=screen->scan_line(lp->y1)+lp->x1,*dyaddr;
    625 #ifdef __WATCOMC__
    626       if (get_vmode()==19) dyaddr=((uchar *)0xa0000)+lp->y1*320+lp->x1;
    627       else dyaddr=yaddr;
    628 #else
    629611      dyaddr=yaddr;
    630 #endif
    631612
    632613      for (int y=lp->y1;y<=y2;)
  • abuse/trunk/src/old_server.cpp

    r56 r90  
    1010#include "config.h"
    1111
    12 #ifdef __WATCOMC__
    13 #   define getlogin() "DOS user"
    14 #   include <dos.h>
    15 #else
    16 #   include <unistd.h>
    17 #endif
     12#include <unistd.h>
    1813
    1914#include "nfserver.hpp"
  • abuse/trunk/src/text_gui.cpp

    r56 r90  
    1717#include <stdlib.h>
    1818
    19 #if defined( __WATCOMC__ )
    20 #   include <sys\types.h>
    21 #   include <direct.h>
    22 #   define make_dir(dir) mkdir(dir)
    23 #else
    24 #   include <sys/stat.h>
    25 #   define make_dir(dir) mkdir(dir,S_IRWXU | S_IRWXG | S_IRWXO)
    26     void modify_install_path(char *path) { ; }
    27 #endif
     19#include <sys/stat.h>
     20#define make_dir(dir) mkdir(dir,S_IRWXU | S_IRWXG | S_IRWXO)
    2821
    2922#include "lisp.hpp"
    3023#include "lisp_gc.hpp"
    3124
    32 #ifdef __WATCOMC__
    33 void modify_install_path(char *path)
    34 {
    35   char ret[100],*r,*i_path=path;
    36   int dc=0;
    37   r=ret;
    38 
    39   if (path[1]==':')   // if "c:\blahblah "  skip the c:
    40   {
    41     r[0]=path[0];
    42     r[1]=path[1];
    43     r+=2;
    44     path+=2;
    45   }
    46 
    47   while (*path)       // eliminate double slashes and reduce more than 8 char dirs
    48   {
    49    
    50     if (*path=='\\' || *path=='/')
    51     {
    52       dc=0;
    53       *r=*path;
    54       r++;
    55       path++;
    56       while (*path=='\\' || *path=='/') path++;
    57     } else if (dc<8)
    58     {
    59       dc++;
    60       *r=*path;
    61       r++;
    62       path++;
    63     } else path++;
    64   }
    65 
    66 
    67   *r=0;
    68   strcpy(i_path,ret);
    69 }
    70 
    71 #include <dos.h>
    72 #endif
    73 
    7425int change_dir(char *path)
    7526{
    76 #ifdef __WATCOMC__
    77   unsigned cur_drive;
    78   _dos_getdrive(&cur_drive);
    79   if (path[1]==':')
    80   {
    81     unsigned total;
    82     _dos_setdrive(toupper(path[0])-'A'+1,&total);
    83 
    84 
    85     unsigned new_drive;
    86     _dos_getdrive(&new_drive);
    87 
    88     if (new_drive!=toupper(path[0])-'A'+1)
    89     {
    90       return 0;
    91     }
    92 
    93     path+=2;
    94   }
    95  
    96   int er=chdir(path);
    97   if (er)
    98   {
    99     unsigned total;
    100     _dos_setdrive(cur_drive,&total);
    101   }
    102   return !er;
    103 #else
    104   int ret=chdir(path);    // weird
    105   ret=chdir(path);
    106   return ret==0;
    107 #endif 
     27    int ret = chdir(path); // weird
     28    ret = chdir(path);
     29    return ret == 0;
    10830}
    10931
    11032long K_avail(char *path);
    111 
    112 #ifdef __WATCOMC__
    113 #include "i86.h"
    114 #include <conio.h>
    115 #include <bios.h>
    116 
    117 long K_avail(char *path)
    118 {
    119   unsigned drive=0;
    120   if (path[1]==':') drive=toupper(path[0])-'A'+1;
    121   else _dos_getdrive(&drive);
    122 
    123   struct diskfree_t f;
    124   _dos_getdiskfree(drive,&f);
    125  
    126   return (long)((long)f.sectors_per_cluster*(long)f.bytes_per_sector/1024)*(long)f.avail_clusters;
    127 }
    128 
    129 void set_cursor(int x, int y) {
    130   union  REGS in,out;
    131   memset(&in,0,sizeof(in));
    132   in.w.ax=0x0200; in.w.bx=0; in.w.dx=(y<<8)|x;
    133   int386(0x10,&in,&in);
    134 }
    135  
    136 void put_char(int x, int y, int val, int color) { *((unsigned short *)(0xb8000+y*2*80+x*2))=(val)|(color<<8); }
    137 unsigned short get_char(int x, int y, int val) { return *((unsigned short *)(0xb8000+y*2*80+x*2)); }
    138 void put_string(int x,int y,char *s, int c) { while (*s) put_char(x++,y,*(s++),c); }
    139 void bar(int x1, int y1, int x2, int y2, int v, int c)
    140 { int x,y;
    141   for (x=x1;x<=x2;x++)
    142     for (y=y1;y<=y2;y++)
    143       put_char(x,y,v,c);
    144 }
    145 
    146 void cls() { bar(0,0,79,25,' ',0x07); set_cursor(0,0); }
    147 
    148 void box(int x1, int y1, int x2, int y2, int c)
    149 {
    150   unsigned char bc[]={  218,191,217,192,196,179 };
    151   put_char(x1,y1,bc[0],c);
    152   put_char(x2,y1,bc[1],c);
    153   put_char(x2,y2,bc[2],c);
    154   put_char(x1,y2,bc[3],c);
    155   int x; for (x=x1+1;x<x2;x++) { put_char(x,y1,bc[4],c);  put_char(x,y2,bc[4],c); }
    156   int y; for (y=y1+1;y<y2;y++) { put_char(x1,y,bc[5],c);  put_char(x2,y,bc[5],c); }
    157 }
    158 
    159 void put_title(char *t)
    160 {
    161   int x1=0,y1=0,x2=79,y2=25;
    162   bar(x1,y1,x2,y1,' ',0x4f);
    163   put_string((x1+x2)/2-strlen(t)/2,y1,t,0x4f);
    164 }
    165 
    166 
    167 
    168 
    169 int nice_copy(char *title, char *source, char *dest)
    170 {
    171   int x1=0,y1=0,x2=79,y2=25;
    172   bar(x1,y1+1,x2,y2,176,0x01);
    173   put_title(title);
    174 
    175   box(x1,(y1+y2)/2-1,x2,(y1+y2)/2+3,0x17);
    176   bar(x1+1,(y1+y2)/2,x2-1,(y1+y2)/2+2,' ',0x17);
    177  
    178   char msg[100];
    179   sprintf(msg,"Copying %s -> %s",source,dest);
    180   put_string(x1+1,(y1+y2)/2,msg,0x17);
    181   bar(x1+1,(y1+y2)/2+2,x2-1,(y1+y2)/2+2,176,0x17);
    182 
    183   char *buffer=(char *)jmalloc(0xf000,"read buf");
    184   if (!buffer) return 0;
    185   FILE *out=fopen(dest,"wb");
    186   if (!out) { jfree(buffer) ; return 0; }
    187   FILE *in=fopen(source,"rb");
    188   if (!in) { jfree(buffer); fclose(out); unlink(dest); return 0; }
    189 
    190   fseek(in,0,SEEK_END);
    191   long size=ftell(in);
    192   fseek(in,0,SEEK_SET);
    193   int osize=size;
    194   while (size)
    195   {
    196     long tr=fread(buffer,1,0xf000,in);
    197     bar(x1+1,(y1+y2)/2+2,x1+1+(x2-x1)*(osize-size-tr)/osize,(y1+y2)/2+2,178,0x17);
    198 
    199     if (fwrite(buffer,1,tr,out)!=tr)
    200     {
    201       fclose(out);
    202       fclose(in);
    203       unlink(dest);
    204       jfree(buffer);
    205       return 0;
    206     }
    207     size-=tr;
    208    
    209   }
    210   fclose(in);
    211   fclose(out);
    212   jfree(buffer);
    213   cls();
    214   return 1;
    215 }
    216 
    217 void *nice_input(char *t, char *p, char *d)
    218 
    219 
    220   int x1=0,y1=0,x2=79,y2=25;
    221   bar(x1,y1+1,x2,y2,176,0x01);
    222   put_title(t);
    223 
    224   box(x1,(y1+y2)/2-1,x2,(y1+y2)/2+1,0x17);
    225   bar(x1+1,(y1+y2)/2,x2-1,(y1+y2)/2,' ',0x17);
    226 
    227   put_string(x1+1,(y1+y2)/2,p,0x17);
    228   bar       (x1+1+strlen(p)+1,(y1+y2)/2,x2-1,(y1+y2)/2,' ',0x0f);
    229   put_string(x1+1+strlen(p)+1,(y1+y2)/2,d,0x70);
    230   set_cursor(x1+1+strlen(p)+1,(y1+y2)/2);
    231   while (!_bios_keybrd(_KEYBRD_READY));
    232   if (_bios_keybrd(_KEYBRD_READY)==7181)
    233   {
    234     getch();
    235     cls();
    236     char ln[100];
    237     strcpy(ln,d);                  // d might get collect in next new
    238     return new_lisp_string(ln);
    239   }
    240   else
    241   {
    242     bar       (x1+1+strlen(p)+1,(y1+y2)/2,x2-1,(y1+y2)/2,' ',0x0f);
    243     int key;
    244     char ln[100];
    245     ln[0]=0;
    246     do
    247     {
    248       key=getch();
    249       if (key==8 && ln[0])
    250       {
    251         ln[strlen(ln)-1]=0;
    252         bar(x1+1+strlen(p)+1,(y1+y2)/2,x2-1,(y1+y2)/2,' ',0x0f);
    253         put_string(x1+1+strlen(p)+1,(y1+y2)/2,ln,0x0f);
    254       }
    255       else if (isprint(key))
    256       {
    257         ln[strlen(ln)+1]=0;
    258         ln[strlen(ln)]=key;
    259 
    260         put_string(x1+1+strlen(p)+1,(y1+y2)/2,ln,0x0f);
    261       }     
    262       set_cursor(x1+1+strlen(p)+1+strlen(ln),(y1+y2)/2);
    263     } while (key!=13 && key!=27);
    264 
    265     cls();
    266     if (key==27) return NULL;
    267     return new_lisp_string(ln);         
    268   }
    269 }
    270 
    271 void *nice_menu(void *main_title, void *menu_title, void *list)
    272 {
    273   int x1=0,y1=0,x2=79,y2=25;
    274 
    275   p_ref r1(main_title),r2(menu_title),r3(list);
    276   main_title=eval(main_title);
    277   menu_title=eval(menu_title);
    278   char *t=lstring_value(main_title);
    279   put_title(t);
    280 
    281   bar(x1,y1+1,x2,y2,176,0x01);
    282 
    283   void *l=eval(list);
    284   p_ref r4(l);
    285   int menu_height=list_length(l),menu_length=0;
    286   void *m;
    287   for (m=l;m;m=CDR(m))
    288   { long l=strlen(lstring_value(CAR(m)));
    289     if (l>menu_length) menu_length=l;
    290   }
    291 
    292   char *mt=lstring_value(menu_title);
    293   if (strlen(mt)>menu_length) menu_length=strlen(mt);
    294 
    295   int mx=(x2+x1)/2-menu_length/2-1,my=(y2+y1)/2-menu_height/2-2;
    296   box(mx,my,mx+menu_length+2,my+menu_height+3,0x17);
    297   bar(mx+1,my+1,mx+menu_length+1,my+menu_height+2,' ',0x17);
    298   put_string(mx+1+menu_length/2-strlen(mt)/2,my,mt,0x1f);       // draw menu title
    299   set_cursor(0,25);
    300 
    301   int cur_sel=0;
    302   int key;
    303   do
    304   {
    305     int y=0;
    306     for (m=l;m;m=CDR(m),y++)
    307     {
    308       char *s=lstring_value(CAR(m));
    309       if (y==cur_sel)
    310       {
    311         bar(mx+1,my+2+y,mx+1+menu_length,my+2+y,' ',0x0f);
    312         put_string(mx+1+menu_length/2-strlen(s)/2,my+2+y,s,0x0f);
    313       }
    314       else
    315       {
    316         bar(mx+1,my+2+y,mx+1+menu_length,my+2+y,' ',0x1f);
    317         put_string(mx+1+menu_length/2-strlen(s)/2,my+2+y,s,0x1f);
    318       }
    319     }
    320 
    321     key=_bios_keybrd(_KEYBRD_READ);
    322 
    323     if (key==18432)
    324     { cur_sel--; if (cur_sel==-1) cur_sel=menu_height-1; }
    325     if (key==20480)
    326     { cur_sel++; if (cur_sel==menu_height) cur_sel=0; }
    327 
    328   } while (key!=283 && key!=7181);
    329   cls();
    330   if (key==283)
    331     return new_lisp_number(-1);
    332 
    333   return new_lisp_number(cur_sel);
    334 }
    335 
    336 void center_tbox(void *list, int c)
    337 {
    338   int x1=0,y1=0,x2=79,y2=25;
    339   int h;
    340 
    341   if (item_type(list)==L_CONS_CELL)
    342     h=list_length(list);
    343   else h=1;
    344 
    345   int y=(y1+y2)/2-h/2+1;
    346   box(x1,(y1+y2)/2-h/2,x2,(y1+y2)/2-h/2+h+1,c);
    347   bar(x1+1,y,x2-1,(y1+y2)/2-h/2+h+1-1,' ',c);
    348 
    349   if (item_type(list)==L_CONS_CELL)
    350   {
    351     while (list)
    352     {
    353       char *s=lstring_value(CAR(list));
    354       put_string((x1+x2)/2-strlen(s)/2,y++,s,c);
    355       list=CDR(list);
    356     }
    357   } else
    358   {
    359     char *s=lstring_value(list);
    360     put_string((x1+x2)/2-strlen(s)/2,y++,s,c);
    361   }
    362 }
    363 
    364 void *show_yes_no(void *t, void *msg, void *y, void *n)
    365 {
    366   p_ref r1(t),r2(msg),r3(y),r4(n);
    367   y=eval(y);
    368   n=eval(n);
    369   put_title(lstring_value(eval(t)));
    370 
    371   int x1=0,y1=0,x2=79,y2=25;
    372   bar(x1,y1+1,x2,y2,176,0x01); 
    373   center_tbox(eval(msg),0x1f);
    374   int key;
    375   char *yes=lstring_value(y);
    376   char *no=lstring_value(n);
    377   set_cursor(0,25);
    378   do
    379   {
    380     key=getch();
    381     set_cursor(0,0);
    382   } while (toupper(key)!=toupper(yes[0]) && toupper(key)!=toupper(no[0]));
    383   cls();
    384   if (toupper(key)==toupper(yes[0]))
    385     return true_symbol;
    386   else return NULL;
    387 }
    388 
    389 #else
    39033
    39134int nice_copy(char *title, char *source, char *dest) { return 0; }
     
    496139}
    497140
    498 #endif
  • abuse/trunk/src/text_gui.hpp

    r57 r90  
    2323void center_tbox(void *list, int c);
    2424void *show_yes_no(void *t, void *msg, void *y, void *n);
    25 void modify_install_path(char *path);
    2625
    2726
  • abuse/trunk/src/username.cpp

    r56 r90  
    1515#include <unistd.h>
    1616
    17 #ifdef __WATCOMC__
    18 char const *get_username() { return "DOS user"; }
    19 #elif (defined(__APPLE__) && !defined(__MACH__))
    20 char const *get_username() { return "Mac user"; }
    21 #else
    22  
    2317char const *get_username()
    2418{
     
    3529}
    3630
    37 #endif
    38 
    39 
  • abuse/trunk/src/view.cpp

    r88 r90  
    181181char cur_user_name[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    182182
    183 #ifdef __WATCOMC__
    184183char const *get_login()
    185 {  if (cur_user_name[0]) return cur_user_name; else return "DOS user"; }
    186 
    187 #include <dos.h>
    188 #elif defined( __APPLE__ )
    189 
    190 char const *get_login()
    191 {  if (cur_user_name[0]) return cur_user_name; else return "Mac user"; }
    192 
    193 #else
    194 char const *get_login()
    195 {  if (cur_user_name[0]) return cur_user_name; else return (getlogin() ? getlogin() : "unknown"); }
    196 
    197 #endif
     184{
     185    if(cur_user_name[0])
     186        return cur_user_name;
     187    else
     188        return(getlogin() ? getlogin() : "unknown");
     189}
    198190
    199191void set_login(char const *name)
Note: See TracChangeset for help on using the changeset viewer.