Skip to content

Commit 1f4180c

Browse files
committed
fix warnings
1 parent fbcacb0 commit 1f4180c

9 files changed

+170
-100
lines changed

siod/editline.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,19 @@ extern int tgetnum();
234234
** TTY input/output functions.
235235
*/
236236

237+
STATIC int writeerr = 0;
238+
237239
void TTYflush()
238240
{
241+
int r;
239242
if (ScreenCount) {
240243
if (el_no_echo == 0)
241-
(void)write(1, Screen, ScreenCount);
244+
{
245+
r = write(1, Screen, ScreenCount);
246+
/* I don't care about failure to write here, really */
247+
/* but to keep the compiler gods happy I'll count the errors */
248+
writeerr += ScreenCount - r;
249+
}
242250
ScreenCount = 0;
243251
}
244252
}

siod/siod_est.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,15 @@ static void val_free(LISP val)
191191
USERVAL(val) = NULL;
192192
}
193193

194-
static void val_prin1(LISP v, FILE *fd)
194+
static int val_prin1(LISP v, FILE *fd)
195195
{
196196
char b[1024];
197197
fput_st(fd,"#<");
198198
fput_st(fd,val(v).type());
199199
sprintf(b," %p",val(v).internal_ptr());
200200
fput_st(fd,b);
201201
fput_st(fd,">");
202+
return 0;
202203
}
203204

204205
static void val_print_string(LISP v, char *tkbuffer)

siod/siodp.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern LISP open_files;
2828
extern LISP eof_val;
2929
extern LISP siod_docstrings;
3030
extern int siod_interactive;
31-
void sock_acknowledge_error();
31+
int sock_acknowledge_error();
3232
extern FILE *fwarn;
3333
extern LISP unbound_marker;
3434
extern long gc_kind_copying;
@@ -46,7 +46,7 @@ struct user_type_hooks
4646
LISP (*gc_mark)(LISP);
4747
void (*gc_free)(LISP);
4848
void (*gc_clear)(LISP);
49-
void (*prin1)(LISP, FILE *);
49+
int (*prin1)(LISP, FILE *);
5050
void (*print_string)(LISP, char *);
5151
LISP (*leval)(LISP, LISP *, LISP *);
5252
long (*c_sxhash)(LISP,long);

siod/slib.cc

+47-29
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ LISP unbound_marker = NIL;
139139
LISP *obarray;
140140
long obarray_dim = 100;
141141
struct catch_frame *catch_framep = (struct catch_frame *) NULL;
142-
void (*repl_puts)(char *) = NULL;
142+
int (*repl_puts)(char *) = NULL;
143143
LISP (*repl_read)(void) = NULL;
144144
LISP (*repl_eval)(LISP) = NULL;
145-
void (*repl_print)(LISP) = NULL;
145+
int (*repl_print)(LISP) = NULL;
146146
repl_getc_fn siod_fancy_getc = f_getc;
147147
repl_ungetc_fn siod_fancy_ungetc = f_ungetc;
148148
LISP *inums;
@@ -368,12 +368,18 @@ long repl_driver(long want_sigint,long want_init,struct repl_hooks *h)
368368
else
369369
return(repl(h));}
370370

371-
static void ignore_puts(char *st)
372-
{(void)st;}
371+
static int ignore_puts(char *st)
372+
{
373+
(void)st;
374+
return 0;
375+
}
373376

374-
static void noprompt_puts(char *st)
375-
{if (strcmp(st,"> ") != 0)
376-
put_st(st);}
377+
static int noprompt_puts(char *st)
378+
{
379+
if (strcmp(st,"> ") != 0)
380+
put_st(st);
381+
return 0;
382+
}
377383

378384
static char *repl_c_string_arg = NULL;
379385
static long repl_c_string_flag = 0;
@@ -386,13 +392,17 @@ static LISP repl_c_string_read(void)
386392
repl_c_string_arg = NULL;
387393
return(read_from_string(get_c_string(s)));}
388394

389-
static void ignore_print(LISP x)
390-
{(void)x;
391-
repl_c_string_flag = 1;}
395+
static int ignore_print(LISP x)
396+
{
397+
(void)x;
398+
repl_c_string_flag = 1;
399+
return 0;
400+
}
392401

393-
static void not_ignore_print(LISP x)
402+
static int not_ignore_print(LISP x)
394403
{repl_c_string_flag = 1;
395-
pprint(x);}
404+
pprint(x);
405+
return 0;}
396406

397407
long repl_c_string(char *str,
398408
long want_sigint,long want_init,long want_print)
@@ -443,34 +453,42 @@ double myruntime(void)
443453
#endif
444454
#endif
445455

446-
void set_repl_hooks(void (*puts_f)(char *),
456+
void set_repl_hooks(int (*puts_f)(char *),
447457
LISP (*read_f)(void),
448458
LISP (*eval_f)(LISP),
449-
void (*print_f)(LISP))
459+
int (*print_f)(LISP))
450460
{repl_puts = puts_f;
451461
repl_read = read_f;
452462
repl_eval = eval_f;
453463
repl_print = print_f;}
454464

455-
void fput_st(FILE *f,const char *st)
456-
{long flag;
457-
if (f != NULL) /* so we can block warning messages easily */
458-
{
459-
flag = no_interrupt(1);
460-
fprintf(f,"%s",st);
461-
no_interrupt(flag);
462-
}
465+
int fput_st(FILE *f,const char *st)
466+
{
467+
long flag;
468+
if (f != NULL) /* so we can block warning messages easily */
469+
{
470+
flag = no_interrupt(1);
471+
fprintf(f,"%s",st);
472+
no_interrupt(flag);
473+
}
474+
return 0;
463475
}
464476

465477
void put_st(const char *st)
466478
{fput_st(stdout,st);}
467479

468-
void grepl_puts(char *st,void (*repl_putss)(char *))
469-
{if (repl_putss == NULL)
470-
{fput_st(fwarn,st);
471-
if (fwarn != NULL) fflush(stdout);}
472-
else
473-
(*repl_putss)(st);}
480+
int grepl_puts(char *st,int (*repl_putss)(char *))
481+
{
482+
if (repl_putss == NULL)
483+
{
484+
fput_st(fwarn,st);
485+
if (fwarn != NULL)
486+
fflush(stdout);
487+
}
488+
else
489+
(*repl_putss)(st);
490+
return 0;
491+
}
474492

475493
static void display_backtrace(LISP args)
476494
{
@@ -1489,7 +1507,7 @@ LISP leval(LISP x,LISP qenv)
14891507
return(x);}}
14901508

14911509
void set_print_hooks(long type,
1492-
void (*prin1)(LISP, FILE *),
1510+
int (*prin1)(LISP, FILE *),
14931511
void (*print_string)(LISP, char *)
14941512
)
14951513
{struct user_type_hooks *p;

siod/slib_file.cc

+15-10
Original file line numberDiff line numberDiff line change
@@ -333,16 +333,21 @@ LISP fclose_l(LISP p)
333333
no_interrupt(flag);
334334
return(NIL);}
335335

336-
static void file_prin1(LISP ptr,FILE *f)
337-
{char *name;
338-
name = ptr->storage_as.c_file.name;
339-
fput_st(f,"#<FILE ");
340-
sprintf(tkbuffer," %p",(void *)ptr->storage_as.c_file.f);
341-
fput_st(f,tkbuffer);
342-
if (name)
343-
{fput_st(f," ");
344-
fput_st(f,name);}
345-
fput_st(f,">");}
336+
static int file_prin1(LISP ptr,FILE *f)
337+
{
338+
char *name;
339+
name = ptr->storage_as.c_file.name;
340+
fput_st(f,"#<FILE ");
341+
sprintf(tkbuffer," %p",(void *)ptr->storage_as.c_file.f);
342+
fput_st(f,tkbuffer);
343+
if (name)
344+
{
345+
fput_st(f," ");
346+
fput_st(f,name);
347+
}
348+
fput_st(f,">");
349+
return 0;
350+
}
346351

347352
FILE *get_c_file(LISP p,FILE *deflt)
348353
{if (NULLP(p) && deflt) return(deflt);

siod/slib_server.cc

+20-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ int siod_server_socket = -1;
1717

1818
LISP siod_send_lisp_to_client(LISP x)
1919
{
20+
int r;
21+
LISP rx = x;
22+
2023
// Send x to the client
2124
if (siod_server_socket == -1)
2225
{
@@ -40,43 +43,53 @@ LISP siod_send_lisp_to_client(LISP x)
4043
#ifdef WIN32
4144
send(siod_server_socket,"LP\n",3,0);
4245
#else
43-
write(siod_server_socket,"LP\n",3);
46+
r = write(siod_server_socket,"LP\n",3);
47+
if (r != 3)
48+
rx = NIL;
4449
#endif
4550
socket_send_file(siod_server_socket,tmpfile);
4651
unlink(tmpfile);
4752
}
4853

49-
return x;
54+
return rx;
5055
}
5156

52-
void sock_acknowledge_error()
57+
int sock_acknowledge_error()
5358
{
5459
// Called to let client know if server gets an error
5560
// Thanks to mcb for pointing out this omission
61+
int r = 0;
5662

5763
if (siod_server_socket != -1)
5864
#ifdef WIN32
5965
send(siod_server_socket,"ER\n",3,0);
6066
#else
61-
write(siod_server_socket,"ER\n",3);
67+
r = write(siod_server_socket,"ER\n",3);
6268
#endif
69+
return r;
6370

6471
}
6572

66-
static void acknowledge_sock_print(LISP x)
73+
static int acknowledge_sock_print(LISP x)
6774
{ // simple return "OK" -- used in server socket mode
75+
int r;
6876

6977
siod_send_lisp_to_client(x);
7078
#ifdef WIN32
7179
send(siod_server_socket,"OK\n",3,0);
7280
#else
73-
write(siod_server_socket,"OK\n",3);
81+
r = write(siod_server_socket,"OK\n",3);
7482
#endif
83+
if (r == 3)
84+
return 0;
85+
else
86+
return -1;
7587
}
7688

77-
static void ignore_puts(char *x)
89+
static int ignore_puts(char *x)
7890
{
7991
(void)x;
92+
return 0;
8093
}
8194

8295
long repl_from_socket(int fd)

siod/slib_sys.cc

+11-4
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,24 @@ static LISP lchdir(LISP args, LISP env)
5252
{
5353
(void)env;
5454
char *home;
55+
int r;
5556

5657
if (siod_llength(args) == 0)
5758
{
5859
home = getenv("HOME");
59-
chdir(home);
60-
return rintern(home);
60+
r=chdir(home);
61+
if (r==0)
62+
return rintern(home);
63+
else
64+
return NIL;
6165
}
6266
else
6367
{
64-
chdir(get_c_string(leval(car(args),env)));
65-
return (car(args));
68+
r=chdir(get_c_string(leval(car(args),env)));
69+
if (r == 0)
70+
return (car(args));
71+
else
72+
return NIL;
6673
}
6774
}
6875

0 commit comments

Comments
 (0)