]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/turn.c
Indented with src/scripts/indent-emp.
[empserver] / src / lib / commands / turn.c
index 90fc698ed073cea6c9dc19ffa0c2caeaac6413c0..158f5c178f7fc77f682f4c85641059f4f3b4f166 100644 (file)
 int
 turn(void)
 {
-       extern  s_char *upfil;
-       extern  s_char *downfil;
-       int     fd;
-       struct  telstr tgm;
-       register s_char *p;
-       s_char  buf[MAXTELSIZE];
+    extern s_char *upfil;
+    extern s_char *downfil;
+    int fd;
+    struct telstr tgm;
+    register s_char *p;
+    s_char buf[MAXTELSIZE];
 
-       p = getstarg(player->argp[1], "on, off or message? ", buf);
-       if (!p)
-               return RET_SYN;
-       if (strcmp(p, "off") == 0) {
-               (void) unlink(upfil);
+    p = getstarg(player->argp[1], "on, off or message? ", buf);
+    if (!p)
+       return RET_SYN;
+    if (strcmp(p, "off") == 0) {
+       (void)unlink(upfil);
 #if !defined(_WIN32)
-               fd = open(downfil, O_RDWR|O_CREAT|O_TRUNC, 0660);
+       fd = open(downfil, O_RDWR | O_CREAT | O_TRUNC, 0660);
 #else
-               fd = open(downfil, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0660);
+       fd = open(downfil, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0660);
 #endif
-               pr("off ");
-       } else if (strcmp(p, "on") == 0) {
-               (void) unlink(downfil);
+       pr("off ");
+    } else if (strcmp(p, "on") == 0) {
+       (void)unlink(downfil);
 #if !defined(_WIN32)
-               fd = open(upfil, O_RDWR|O_CREAT|O_TRUNC, 0660);
+       fd = open(upfil, O_RDWR | O_CREAT | O_TRUNC, 0660);
 #else
-               fd = open(upfil, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0660);
+       fd = open(upfil, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0660);
 #endif
-               pr("on ");
-       } else {
+       pr("on ");
+    } else {
 #if !defined(_WIN32)
-               fd = open(upfil, O_RDWR|O_CREAT|O_TRUNC, 0660);
+       fd = open(upfil, O_RDWR | O_CREAT | O_TRUNC, 0660);
 #else
-               fd = open(upfil, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0660);
+       fd = open(upfil, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0660);
 #endif
-               pr("motd ");
-       }
-       (void) time(&tgm.tel_date);
-       if ((tgm.tel_length = getele("The World", buf)) <= 0) {
-               pr("Ignored\n");
-               close(fd);
-               return RET_SYN;
-       }
-       (void) write(fd, (s_char *)&tgm, sizeof (tgm));
-       (void) write(fd, buf, tgm.tel_length);
-       (void) close(fd);
-       pr("\n");
-       return RET_OK;
+       pr("motd ");
+    }
+    (void)time(&tgm.tel_date);
+    if ((tgm.tel_length = getele("The World", buf)) <= 0) {
+       pr("Ignored\n");
+       close(fd);
+       return RET_SYN;
+    }
+    (void)write(fd, (s_char *)&tgm, sizeof(tgm));
+    (void)write(fd, buf, tgm.tel_length);
+    (void)close(fd);
+    pr("\n");
+    return RET_OK;
 }