ANSI C; sprintf now returns an int.
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 23 Oct 1987 11:48:38 +0000 (03:48 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 23 Oct 1987 11:48:38 +0000 (03:48 -0800)
SCCS-vsn: usr.bin/learn/learn/selsub.c 4.5

usr/src/usr.bin/learn/learn/selsub.c

index 13f162c..b5b642f 100644 (file)
@@ -1,9 +1,10 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)selsub.c   4.4     (Berkeley)      %G%";
+static char sccsid[] = "@(#)selsub.c   4.5     (Berkeley)      %G%";
 #endif not lint
 
 #include "stdio.h"
 #include "sys/types.h"
 #endif not lint
 
 #include "stdio.h"
 #include "sys/types.h"
+#include "sys/file.h"
 #include "sys/stat.h"
 #include "lrnref.h"
 
 #include "sys/stat.h"
 #include "lrnref.h"
 
@@ -122,11 +123,14 @@ char *argv[];
        }
        /* after this point, we have a working directory. */
        /* have to call wrapup to clean up */
        }
        /* after this point, we have a working directory. */
        /* have to call wrapup to clean up */
-       if (access(sprintf(ans1, "%s/%s/Init", direct, sname), 04)==0)
-               if (system(sprintf(ans1, "%s/%s/Init %s", direct, sname, level)) != 0) {
+       (void)sprintf(ans1, "%s/%s/Init", direct, sname);
+       if (access(ans1, R_OK)==0) {
+               (void)sprintf(ans1, "%s/%s/Init %s", direct, sname, level);
+               if (system(ans1) != 0) {
                        printf("Leaving learn.\n");
                        wrapup(1);
                }
                        printf("Leaving learn.\n");
                        wrapup(1);
                }
+       }
 }
 
 chknam(name)
 }
 
 chknam(name)