Unified · Split
| @@ -5,7 +5,7 @@ AR=ar · 4 unmodified lines | ||
| 5 | 5 | AS=as |
| 6 | 6 | RANLIB=ranlib |
| 7 | 7 | CC=gcc |
| 8 | −CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -D_THREAD_SAFE $(PTHREAD) | |
| 8 | +CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -D_THREAD_SAFE $(PTHREAD) -O2 | |
| 9 | 9 | O=o |
| 10 | 10 | OS=posix |
| 11 | 11 | GUI=x11 |
| @@ -3,20 +3,20 @@ · 2 unmodified lines | ||
| 3 | 3 | # on another platform. Otherwise the binaries are just |
| 4 | 4 | # named gcc, etc. |
| 5 | 5 | |
| 6 | −MING=mingw32- | |
| 6 | +MING=i586-mingw32msvc- | |
| 7 | 7 | #MING= |
| 8 | 8 | AR=$(MING)ar |
| 9 | 9 | CC=$(MING)gcc |
| 10 | 10 | AS=$(MING)as |
| 11 | 11 | RANLIB=$(MING)ranlib |
| 12 | −CFLAGS=-Wall -Wno-missing-braces -I$(ROOT)/include -I$(ROOT) -I$(ROOT)/kern -c -D_X86_ -DIS_32 -DWINDOWS | |
| 12 | +CFLAGS=-Wall -Wno-missing-braces -I$(ROOT)/include -I$(ROOT) -I$(ROOT)/kern -c -D_X86_ -DIS_32 -DWINDOWS -O2 | |
| 13 | 13 | O=o |
| 14 | 14 | FS=fs-win32 |
| 15 | 15 | IP=win32 |
| 16 | 16 | OS=win32 |
| 17 | 17 | GUI=win32 |
| 18 | 18 | LDFLAGS=-mwindows |
| 19 | −LDADD=-lkernel32 -ladvapi32 -lgdi32 -lmpr -lwsock32 | |
| 19 | +LDADD=-lkernel32 -ladvapi32 -lgdi32 -lmpr -lwsock32 -lmsvcrt -lmingw32 | |
| 20 | 20 | TARG=drawterm.exe |
| 21 | 21 | |
| 22 | 22 | # Windows via MSVC |
| @@ -380,9 +380,8 @@ p9auth(int fd) · 379 unmodified lines | ||
| 380 | 380 | return fd; |
| 381 | 381 | |
| 382 | 382 | /* exchange random numbers */ |
| 383 | − srand(truerand()); | |
| 384 | 383 | for(i = 0; i < 4; i++) |
| 385 | − key[i] = rand(); | |
| 384 | + key[i] = fastrand(); | |
| 386 | 385 | if(write(fd, key, 4) != 4) |
| 387 | 386 | return -1; |
| 388 | 387 | if(readn(fd, key+12, 4) != 4) |
| @@ -7,8 +7,7 @@ OFILES=\ · 6 unmodified lines | ||
| 7 | 7 | cload.$O\ |
| 8 | 8 | draw.$O\ |
| 9 | 9 | load.$O\ |
| 10 | − screen.$O\ | |
| 11 | − wstrtoutf.$O | |
| 10 | + screen.$O | |
| 12 | 11 | |
| 13 | 12 | default: $(LIB) |
| 14 | 13 | $(LIB): $(OFILES) |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | # endif |
| 6 | 6 | #elif defined(WINDOWS) |
| 7 | 7 | # include "9windows.h" |
| 8 | +# define main mymain | |
| 8 | 9 | #else |
| 9 | 10 | # error "Define an OS" |
| 10 | 11 | #endif |
| @@ -15,11 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #define log2 liblog2 |
| 16 | 16 | #define log liblog |
| 17 | 17 | #define reboot libreboot |
| 18 | −#define srand dtsrand | |
| 19 | −#define rand dtrand | |
| 20 | −#define nrand dtnrand | |
| 21 | −#define lrand dtlrand | |
| 22 | −#define lnrand dtlnrand | |
| 23 | 18 | #undef timeradd |
| 24 | 19 | #define timeradd xtimeradd |
| 25 | 20 | |
| @@ -240,13 +235,6 @@ extern int fmtprint(Fmt*, char*, ...); · 214 unmodified lines | ||
| 240 | 235 | extern int fmtvprint(Fmt*, char*, va_list); |
| 241 | 236 | extern void* mallocz(ulong, int); |
| 242 | 237 | |
| 243 | −extern void srand(long); | |
| 244 | −extern int rand(void); | |
| 245 | −extern int nrand(int); | |
| 246 | −extern long lrand(void); | |
| 247 | −extern long lnrand(long); | |
| 248 | −extern double frand(void); | |
| 249 | − | |
| 250 | 238 | extern ulong getcallerpc(void*); |
| 251 | 239 | extern char* cleanname(char*); |
| 252 | 240 | extern void sysfatal(char*, ...); |
| @@ -60,7 +60,6 @@ static struct · 59 unmodified lines | ||
| 60 | 60 | char *sysname; |
| 61 | 61 | vlong fasthz; |
| 62 | 62 | |
| 63 | −static void seedrand(void); | |
| 64 | 63 | static int readtime(ulong, char*, int); |
| 65 | 64 | static int readbintime(char*, int); |
| 66 | 65 | static int writetime(char*, int); |
| @@ -986,30 +985,6 @@ Dev consdevtab = { · 919 unmodified lines | ||
| 986 | 985 | devwstat, |
| 987 | 986 | }; |
| 988 | 987 | |
| 989 | −static ulong randn; | |
| 990 | − | |
| 991 | −static void | |
| 992 | −seedrand(void) | |
| 993 | −{ | |
| 994 | − randomread((void*)&randn, sizeof(randn)); | |
| 995 | −} | |
| 996 | − | |
| 997 | −int | |
| 998 | −xnrand(int n) | |
| 999 | −{ | |
| 1000 | − if(randn == 0) | |
| 1001 | − seedrand(); | |
| 1002 | − randn = randn*1103515245 + 12345 + fastticks(0); | |
| 1003 | − return (randn>>16) % n; | |
| 1004 | −} | |
| 1005 | − | |
| 1006 | −int | |
| 1007 | −rand(void) | |
| 1008 | −{ | |
| 1009 | − xnrand(1); | |
| 1010 | − return randn; | |
| 1011 | −} | |
| 1012 | − | |
| 1013 | 988 | static uvlong uvorder = (uvlong) 0x0001020304050607ULL; |
| 1014 | 989 | |
| 1015 | 990 | static uchar* |
| @@ -46,12 +46,13 @@ so_socket(int type) · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | fd = socket(AF_INET, type, 0); |
| 48 | 48 | if(fd < 0) |
| 49 | − error(sys_errlist[errno]); | |
| 49 | + oserror(); | |
| 50 | 50 | |
| 51 | 51 | one = 1; |
| 52 | − if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&one, sizeof(one)) > 0) | |
| 53 | − print("setsockopt: %s", sys_errlist[errno]); | |
| 54 | − | |
| 52 | + if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&one, sizeof(one)) > 0){ | |
| 53 | + oserrstr(); | |
| 54 | + print("setsockopt: %s\n", up->errstr); | |
| 55 | + } | |
| 55 | 56 | |
| 56 | 57 | return fd; |
| 57 | 58 | } |
| @@ -68,7 +69,7 @@ so_connect(int fd, unsigned long raddr, unsigned short rport) · 10 unmodified lines | ||
| 68 | 69 | hnputl(&sin.sin_addr.s_addr, raddr); |
| 69 | 70 | |
| 70 | 71 | if(connect(fd, (struct sockaddr*)&sin, sizeof(sin)) < 0) |
| 71 | − error(sys_errlist[errno]); | |
| 72 | + oserror(); | |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | void |
| @@ -79,7 +80,7 @@ so_getsockname(int fd, unsigned long *laddr, unsigned short *lport) · 4 unmodified lines | ||
| 79 | 80 | |
| 80 | 81 | len = sizeof(sin); |
| 81 | 82 | if(getsockname(fd, (struct sockaddr*)&sin, &len) < 0) |
| 82 | − error(sys_errlist[errno]); | |
| 83 | + oserror(); | |
| 83 | 84 | |
| 84 | 85 | if(sin.sin_family != AF_INET || len != sizeof(sin)) |
| 85 | 86 | error("not AF_INET"); |
| @@ -92,7 +93,7 @@ void · 6 unmodified lines | ||
| 92 | 93 | so_listen(int fd) |
| 93 | 94 | { |
| 94 | 95 | if(listen(fd, 5) < 0) |
| 95 | − error(sys_errlist[errno]); | |
| 96 | + oserror(); | |
| 96 | 97 | } |
| 97 | 98 | |
| 98 | 99 | int |
| @@ -104,7 +105,7 @@ so_accept(int fd, unsigned long *raddr, unsigned short *rport) · 5 unmodified lines | ||
| 104 | 105 | len = sizeof(sin); |
| 105 | 106 | nfd = accept(fd, (struct sockaddr*)&sin, &len); |
| 106 | 107 | if(nfd < 0) |
| 107 | − error(sys_errlist[errno]); | |
| 108 | + oserror(); | |
| 108 | 109 | |
| 109 | 110 | if(sin.sin_family != AF_INET || len != sizeof(sin)) |
| 110 | 111 | error("not AF_INET"); |
| @@ -121,8 +122,10 @@ so_bind(int fd, int su, unsigned short port) · 10 unmodified lines | ||
| 121 | 122 | struct sockaddr_in sin; |
| 122 | 123 | |
| 123 | 124 | one = 1; |
| 124 | − if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&one, sizeof(one)) < 0) | |
| 125 | − print("setsockopt: %s", sys_errlist[errno]); | |
| 125 | + if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&one, sizeof(one)) < 0){ | |
| 126 | + oserrstr(); | |
| 127 | + print("setsockopt: %s", up->errstr); | |
| 128 | + } | |
| 126 | 129 | |
| 127 | 130 | if(su) { |
| 128 | 131 | for(i = 600; i < 1024; i++) { |
| @@ -133,7 +136,7 @@ so_bind(int fd, int su, unsigned short port) · 4 unmodified lines | ||
| 133 | 136 | if(bind(fd, (struct sockaddr*)&sin, sizeof(sin)) >= 0) |
| 134 | 137 | return; |
| 135 | 138 | } |
| 136 | − error(sys_errlist[errno]); | |
| 139 | + oserror(); | |
| 137 | 140 | } |
| 138 | 141 | |
| 139 | 142 | memset(&sin, 0, sizeof(sin)); |
| @@ -141,7 +144,7 @@ so_bind(int fd, int su, unsigned short port) · 1 unmodified line | ||
| 141 | 144 | hnputs(&sin.sin_port, port); |
| 142 | 145 | |
| 143 | 146 | if(bind(fd, (struct sockaddr*)&sin, sizeof(sin)) < 0) |
| 144 | − error(sys_errlist[errno]); | |
| 147 | + oserror(); | |
| 145 | 148 | } |
| 146 | 149 | |
| 147 | 150 | int |
| @@ -228,6 +228,7 @@ ipopen(Chan *c, int omode) · 227 unmodified lines | ||
| 228 | 228 | Conv *cv, *lcv; |
| 229 | 229 | |
| 230 | 230 | omode &= 3; |
| 231 | + perm = 0; | |
| 231 | 232 | switch(omode) { |
| 232 | 233 | case OREAD: |
| 233 | 234 | perm = 4; |
| @@ -181,6 +181,8 @@ rootgen(Chan *c, char *name, Dirtab *dirt, int ndirt, int s, Dir *dp) · 180 unmodified lines | ||
| 181 | 181 | t = c->qid.path - Qmnt - 1; |
| 182 | 182 | l = &mntlist; |
| 183 | 183 | break; |
| 184 | + default: | |
| 185 | + return -1; | |
| 184 | 186 | } |
| 185 | 187 | if(t >= l->ndir) |
| 186 | 188 | return -1; |
| @@ -717,7 +717,7 @@ static void · 716 unmodified lines | ||
| 717 | 717 | randfill(uchar *buf, int len) |
| 718 | 718 | { |
| 719 | 719 | while(len-- > 0) |
| 720 | − *buf++ = nrand(256); | |
| 720 | + *buf++ = fastrand(); | |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | static long |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #include "lib.h" |
| 4 | 4 | #include "dat.h" |
| 5 | 5 | #include "fns.h" |
| 6 | +#include <libsec.h> | |
| 6 | 7 | |
| 7 | 8 | typedef struct Oproc Oproc; |
| 8 | 9 | struct Oproc { |
| @@ -136,24 +137,49 @@ procwakeup(Proc *p) · 127 unmodified lines | ||
| 136 | 137 | ReleaseSemaphore(op->sema, 1, 0); |
| 137 | 138 | } |
| 138 | 139 | |
| 140 | +void | |
| 141 | +random20(uchar *p) | |
| 142 | +{ | |
| 143 | + LARGE_INTEGER ti; | |
| 144 | + int i, j; | |
| 145 | + FILETIME ft; | |
| 146 | + DigestState ds; | |
| 147 | + vlong tsc; | |
| 148 | + | |
| 149 | + GetSystemTimeAsFileTime(&ft); | |
| 150 | + memset(&ds, 0, sizeof ds); | |
| 151 | + sha1((uchar*)&ft, sizeof(ft), 0, &ds); | |
| 152 | + for(i=0; i<50; i++) { | |
| 153 | + for(j=0; j<10; j++) { | |
| 154 | + QueryPerformanceCounter(&ti); | |
| 155 | + sha1((uchar*)&ti, sizeof(ti), 0, &ds); | |
| 156 | + tsc = GetTickCount(); | |
| 157 | + sha1((uchar*)&tsc, sizeof(tsc), 0, &ds); | |
| 158 | + } | |
| 159 | + Sleep(10); | |
| 160 | + } | |
| 161 | + sha1(0, 0, p, &ds); | |
| 162 | +} | |
| 163 | + | |
| 139 | 164 | void |
| 140 | 165 | randominit(void) |
| 141 | 166 | { |
| 142 | − srand(seconds()); | |
| 143 | 167 | } |
| 144 | 168 | |
| 145 | 169 | ulong |
| 146 | 170 | randomread(void *v, ulong n) |
| 147 | 171 | { |
| 148 | − int m, i, *r; | |
| 149 | − | |
| 150 | − m = (n / sizeof(int)) * sizeof(int); | |
| 151 | − for (i = 0, r = (int*)v; i < m; i += sizeof(int)) { | |
| 152 | − *r = rand(); | |
| 153 | − r += sizeof(int); | |
| 172 | + int i; | |
| 173 | + uchar p[20]; | |
| 174 | + | |
| 175 | + for(i=0; i<n; i+=20){ | |
| 176 | + random20(p); | |
| 177 | + if(i+20 <= n) | |
| 178 | + memmove((char*)v+i, p, 20); | |
| 179 | + else | |
| 180 | + memmove((char*)v+i, p, n-i); | |
| 154 | 181 | } |
| 155 | − | |
| 156 | − return m; | |
| 182 | + return n; | |
| 157 | 183 | } |
| 158 | 184 | |
| 159 | 185 | long |
| @@ -183,14 +209,151 @@ fastticks(uvlong *v) · 23 unmodified lines | ||
| 183 | 209 | |
| 184 | 210 | extern int main(int, char*[]); |
| 185 | 211 | |
| 212 | + | |
| 213 | +int | |
| 214 | +wstrutflen(Rune *s) | |
| 215 | +{ | |
| 216 | + int n; | |
| 217 | + | |
| 218 | + for(n=0; *s; n+=runelen(*s),s++) | |
| 219 | + ; | |
| 220 | + return n; | |
| 221 | +} | |
| 222 | + | |
| 223 | +int | |
| 224 | +wstrtoutf(char *s, Rune *t, int n) | |
| 225 | +{ | |
| 226 | + int i; | |
| 227 | + char *s0; | |
| 228 | + | |
| 229 | + s0 = s; | |
| 230 | + if(n <= 0) | |
| 231 | + return wstrutflen(t)+1; | |
| 232 | + while(*t) { | |
| 233 | + if(n < UTFmax+1 && n < runelen(*t)+1) { | |
| 234 | + *s = 0; | |
| 235 | + return s-s0+wstrutflen(t)+1; | |
| 236 | + } | |
| 237 | + i = runetochar(s, t); | |
| 238 | + s += i; | |
| 239 | + n -= i; | |
| 240 | + t++; | |
| 241 | + } | |
| 242 | + *s = 0; | |
| 243 | + return s-s0; | |
| 244 | +} | |
| 245 | + | |
| 246 | +int | |
| 247 | +win_hasunicode(void) | |
| 248 | +{ | |
| 249 | + OSVERSIONINFOA osinfo; | |
| 250 | + int r; | |
| 251 | + | |
| 252 | + osinfo.dwOSVersionInfoSize = sizeof(osinfo); | |
| 253 | + if(!GetVersionExA(&osinfo)) | |
| 254 | + panic("GetVersionEx failed"); | |
| 255 | + switch(osinfo.dwPlatformId) { | |
| 256 | + default: | |
| 257 | + panic("unknown PlatformId"); | |
| 258 | + case VER_PLATFORM_WIN32s: | |
| 259 | + panic("Win32s not supported"); | |
| 260 | + case VER_PLATFORM_WIN32_WINDOWS: | |
| 261 | + r = 0; | |
| 262 | + break; | |
| 263 | + case VER_PLATFORM_WIN32_NT: | |
| 264 | + r = 1; | |
| 265 | + break; | |
| 266 | + } | |
| 267 | + | |
| 268 | + return r; | |
| 269 | +} | |
| 270 | + | |
| 271 | +int | |
| 272 | +wstrlen(Rune *s) | |
| 273 | +{ | |
| 274 | + int n; | |
| 275 | + | |
| 276 | + for(n=0; *s; s++,n++) | |
| 277 | + ; | |
| 278 | + return n; | |
| 279 | +} | |
| 280 | +static int args(char *argv[], int n, char *p); | |
| 281 | + | |
| 186 | 282 | int APIENTRY |
| 187 | −WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR arg, int nshow) | |
| 283 | +WinMain(HINSTANCE x, HINSTANCE y, LPSTR z, int w) | |
| 188 | 284 | { |
| 189 | − main(__argc, __argv); | |
| 285 | + int argc, n; | |
| 286 | + char *arg, *p, **argv; | |
| 287 | + Rune *warg; | |
| 288 | + | |
| 289 | + if(0 && win_hasunicode()){ | |
| 290 | + warg = GetCommandLineW(); | |
| 291 | + n = (wstrlen(warg)+1)*UTFmax; | |
| 292 | + arg = malloc(n); | |
| 293 | + wstrtoutf(arg, warg, n); | |
| 294 | + }else | |
| 295 | + arg = GetCommandLineA(); | |
| 296 | + | |
| 297 | + /* conservative guess at the number of args */ | |
| 298 | + for(argc=4,p=arg; *p; p++) | |
| 299 | + if(*p == ' ' || *p == '\t') | |
| 300 | + argc++; | |
| 301 | + argv = malloc(argc*sizeof(char*)); | |
| 302 | + argc = args(argv, argc, arg); | |
| 303 | + | |
| 304 | + mymain(argc, argv); | |
| 190 | 305 | ExitThread(0); |
| 191 | 306 | return 0; |
| 192 | 307 | } |
| 193 | 308 | |
| 309 | +/* | |
| 310 | + * Break the command line into arguments | |
| 311 | + * The rules for this are not documented but appear to be the following | |
| 312 | + * according to the source for the microsoft C library. | |
| 313 | + * Words are seperated by space or tab | |
| 314 | + * Words containing a space or tab can be quoted using " | |
| 315 | + * 2N backslashes + " ==> N backslashes and end quote | |
| 316 | + * 2N+1 backslashes + " ==> N backslashes + literal " | |
| 317 | + * N backslashes not followed by " ==> N backslashes | |
| 318 | + */ | |
| 319 | +static int | |
| 320 | +args(char *argv[], int n, char *p) | |
| 321 | +{ | |
| 322 | + char *p2; | |
| 323 | + int i, j, quote, nbs; | |
| 324 | + | |
| 325 | + for(i=0; *p && i<n-1; i++) { | |
| 326 | + while(*p == ' ' || *p == '\t') | |
| 327 | + p++; | |
| 328 | + quote = 0; | |
| 329 | + argv[i] = p2 = p; | |
| 330 | + for(;*p; p++) { | |
| 331 | + if(!quote && (*p == ' ' || *p == '\t')) | |
| 332 | + break; | |
| 333 | + for(nbs=0; *p == '\\'; p++,nbs++) | |
| 334 | + ; | |
| 335 | + if(*p == '"') { | |
| 336 | + for(j=0; j<(nbs>>1); j++) | |
| 337 | + *p2++ = '\\'; | |
| 338 | + if(nbs&1) | |
| 339 | + *p2++ = *p; | |
| 340 | + else | |
| 341 | + quote = !quote; | |
| 342 | + } else { | |
| 343 | + for(j=0; j<nbs; j++) | |
| 344 | + *p2++ = '\\'; | |
| 345 | + *p2++ = *p; | |
| 346 | + } | |
| 347 | + } | |
| 348 | + /* move p up one to avoid pointing to null at end of p2 */ | |
| 349 | + if(*p) | |
| 350 | + p++; | |
| 351 | + *p2 = 0; | |
| 352 | + } | |
| 353 | + argv[i] = 0; | |
| 354 | + | |
| 355 | + return i; | |
| 356 | +} | |
| 194 | 357 | /* |
| 195 | 358 | * Windows socket error messages |
| 196 | 359 | * There must be a way to get these strings out of the library. |
| @@ -29,16 +29,12 @@ OFILES=\ · 28 unmodified lines | ||
| 29 | 29 | fmtstr.$O\ |
| 30 | 30 | fmtvprint.$O\ |
| 31 | 31 | fprint.$O\ |
| 32 | − frand.$O\ | |
| 33 | 32 | getfields.$O\ |
| 34 | 33 | getpid.$O\ |
| 35 | − lnrand.$O\ | |
| 36 | 34 | lock.$O\ |
| 37 | − lrand.$O\ | |
| 38 | 35 | mallocz.$O\ |
| 39 | 36 | nan64.$O\ |
| 40 | 37 | netmkaddr.$O\ |
| 41 | − nrand.$O\ | |
| 42 | 38 | nsec.$O\ |
| 43 | 39 | pow10.$O\ |
| 44 | 40 | pushssl.$O\ |
| @@ -19,13 +19,13 @@ static uvlong uvneginf = 0xFFF0000000000000ULL; · 18 unmodified lines | ||
| 19 | 19 | double |
| 20 | 20 | __NaN(void) |
| 21 | 21 | { |
| 22 | − return *(double*)&uvnan; | |
| 22 | + return *(double*)(void*)&uvnan; | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | int |
| 26 | 26 | __isNaN(double d) |
| 27 | 27 | { |
| 28 | − uvlong x = *(uvlong*)&d; | |
| 28 | + uvlong x = *(uvlong*)(void*)&d; | |
| 29 | 29 | return (ulong)(x>>32)==0x7FF00000 && !__isInf(d, 0); |
| 30 | 30 | } |
| 31 | 31 | |
| @@ -33,9 +33,9 @@ double · 1 unmodified line | ||
| 33 | 33 | __Inf(int sign) |
| 34 | 34 | { |
| 35 | 35 | if(sign < 0) |
| 36 | − return *(double*)&uvinf; | |
| 36 | + return *(double*)(void*)&uvinf; | |
| 37 | 37 | else |
| 38 | − return *(double*)&uvneginf; | |
| 38 | + return *(double*)(void*)&uvneginf; | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | int |
| @@ -43,7 +43,7 @@ __isInf(double d, int sign) · 1 unmodified line | ||
| 43 | 43 | { |
| 44 | 44 | uvlong x; |
| 45 | 45 | |
| 46 | − x = *(uvlong*)&d; | |
| 46 | + x = *(uvlong*)(void*)&d; | |
| 47 | 47 | if(sign == 0) |
| 48 | 48 | return x==uvinf || x==uvneginf; |
| 49 | 49 | else if(sign > 0) |
| @@ -2368,7 +2368,7 @@ DBG print("bsh %d\n", bsh); · 2367 unmodified lines | ||
| 2368 | 2368 | |
| 2369 | 2369 | bx = -bsh-1; |
| 2370 | 2370 | ex = -bsh-1-dx; |
| 2371 | − SET(bits); | |
| 2371 | + bits = 0; | |
| 2372 | 2372 | v = par->sdval; |
| 2373 | 2373 | |
| 2374 | 2374 | /* make little endian */ |
| @@ -32,6 +32,8 @@ int · 31 unmodified lines | ||
| 32 | 32 | main(int argc, char **argv) |
| 33 | 33 | { |
| 34 | 34 | eve = getuser(); |
| 35 | + if(eve == nil) | |
| 36 | + eve = "drawterm"; | |
| 35 | 37 | |
| 36 | 38 | sizebug(); |
| 37 | 39 | fmtinstall('r', errfmt); |
| @@ -101,6 +103,7 @@ findkey(char **puser, char *dom) · 63 unmodified lines | ||
| 101 | 103 | continue; |
| 102 | 104 | pass = nil; |
| 103 | 105 | haveproto = havedom = 0; |
| 106 | + user = nil; | |
| 104 | 107 | for(i=1; i<nf; i++){ |
| 105 | 108 | if(strncmp(f[i], "user=", 5) == 0) |
| 106 | 109 | user = f[i]+5; |