]> code.citadel.org Git - citadel.git/blobdiff - citadel/citadel.c
centralized filename calculation
[citadel.git] / citadel / citadel.c
index 58846072b990060cad796cc2c3f219aea416b950..6779f8978c8b825a245f87a9eb02d22839be2f53 100644 (file)
@@ -50,6 +50,7 @@
 #include "snprintf.h"
 #endif
 #include "screen.h"
+#include "citadel_dirs.h"
 
 #include "md5.h"
 
@@ -211,7 +212,7 @@ void userlist(CtdlIPC *ipc, char *patn)
        int r;                          /* IPC response code */
        char *listing = NULL;
 
-       r = CtdlIPCUserListing(ipc, &listing, buf);
+       r = CtdlIPCUserListing(ipc, patn, &listing, buf);
        if (r / 100 != 1) {
                pprintf("%s\n", buf);
                return;
@@ -219,7 +220,7 @@ void userlist(CtdlIPC *ipc, char *patn)
 
        pprintf("       User Name           Num  L  LastCall  Calls Posts\n");
        pprintf("------------------------- ----- - ---------- ----- -----\n");
-       while (strlen(listing) > 0) {
+       if (listing != NULL) while (strlen(listing) > 0) {
                extract_token(buf, listing, 0, '\n', sizeof buf);
                remove_token(listing, 0, '\n');
 
@@ -1122,7 +1123,7 @@ int main(int argc, char **argv)
                         * guaranteed to have the uid/gid we want.
                         */
                        if (!getuid() || !getgid()) {
-                               if (stat(CTDLDIR "/citadel.config", &st) < 0) {
+                               if (stat(file_citadel_config, &st) < 0) {
                                        perror("couldn't stat citadel.config");
                                        logoff(NULL, 3);
                                }
@@ -1358,9 +1359,9 @@ NEWUSR:   if (strlen(rc_password) == 0) {
         * program.  Don't mess with these once they've been set, because we
         * will be unlinking them later on in the program and we don't
         * want to delete something that we didn't create. */
-       snprintf(temp, sizeof temp, tmpnam(NULL));
-       snprintf(temp2, sizeof temp2, tmpnam(NULL));
-       snprintf(tempdir, sizeof tempdir, tmpnam(NULL));
+       CtdlMakeTempFileName(temp, sizeof temp);
+       CtdlMakeTempFileName(temp2, sizeof temp2);
+       CtdlMakeTempFileName(tempdir, sizeof tempdir);
 
        /* Get screen dimensions.  First we go to a default of 80x24.  Then
         * we try to get the user's actual screen dimensions off the server.
@@ -1410,7 +1411,7 @@ NEWUSR:   if (strlen(rc_password) == 0) {
                                formout(ipc, "help");
                                break;
                        case 4:
-                               entmsg(ipc, 0, 0);
+                               entmsg(ipc, 0, ((userflags & US_EXTEDIT) ? 2 : 0));
                                break;
                        case 36:
                                entmsg(ipc, 0, 1);
@@ -1422,7 +1423,9 @@ NEWUSR:   if (strlen(rc_password) == 0) {
                                {
                                        /* Only m.author is used */
                                        struct ctdlipcmessage m;
-                                       newprompt("What do you want your username to be? ", m.author, USERNAME_SIZE - 1);
+                                       newprompt("What do you want your username to be? ",
+                                               m.author, USERNAME_SIZE - 1);
+                                       m.text = "";
                                        r = CtdlIPCPostMessage(ipc, 2, &m, aaa);
                                        if (r / 100 != 2)
                                                scr_printf("%s\n", aaa);