- { "help", cmd_help, "Help"},
- { "quit", cmd_quit, "Quit"},
- { "login", cmd_login, "Log into AIM"},
- { "logout", cmd_logout, "Log out of AIM"},
- { "connlist", cmd_connlist, "List open connections"},
- { "goodday", cmd_goodday, "Say goodday to arg"},
- { "warn", cmd_warn, "Warn arg"},
- { "anonwarn", cmd_anonwarn, "Anonymously warn arg"},
- { "sendmsg", cmd_sendmsg, "Send arg[0] bytes to arg[1]"},
- { (char *)NULL, (Function *)NULL, (char *)NULL }
+ { "help", cmd_help, "Help"},
+ { "quit", cmd_quit, "Quit"},
+ { "login", cmd_login, "Log into AIM"},
+ { "logout", cmd_logout, "Log out of AIM"},
+ { "connlist", cmd_connlist, "List open connections"},
+ { "goodday", cmd_goodday, "Say goodday to arg"},
+ { "warn", cmd_warn, "Warn arg"},
+ { "anonwarn", cmd_anonwarn, "Anonymously warn arg"},
+ { "sendmsg", cmd_sendmsg, "Send arg[0] bytes to arg[1]"},
+ { (char *)NULL, (Function *)NULL, (char *)NULL }
- static int list_index, len;
- char *name;
-
- if (!state) {
- list_index = 0;
- len = strlen (text);
- }
-
- while ((name = cmdlist[list_index].name)) {
- list_index++;
- if (strncmp (name, text, len) == 0)
- return (strdup(name));
- }
-
- /* If no names matched, then return NULL. */
- return (char *)NULL;
+ static int list_index, len;
+ char *name;
+
+ if (!state) {
+ list_index = 0;
+ len = strlen (text);
+ }
+
+ while ((name = cmdlist[list_index].name)) {
+ list_index++;
+ if (strncmp (name, text, len) == 0)
+ return (strdup(name));
+ }
+
+ /* If no names matched, then return NULL. */
+ return (char *)NULL;
- /*
- * If this word is at the start of the line, then it is a command
- * to complete. Otherwise it is the name of a file in the current
- * directory.
- */
- if (start == 0)
- matches = completion_matches(text, cmdgenerator);
+ /*
+ * If this word is at the start of the line, then it is a command
+ * to complete. Otherwise it is the name of a file in the current
+ * directory.
+ */
+ if (start == 0)
+ matches = completion_matches(text, cmdgenerator);
- for (i = 0; cmdlist[i].name; i++)
- if (strcmp (name, cmdlist[i].name) == 0)
- return cmdlist[i].func;
+ for (i = 0; cmdlist[i].name; i++) {
+ if (strcmp (name, cmdlist[i].name) == 0)
+ return cmdlist[i].func;
+ }
- int i;
- Function *cmd;
- char *word;
-
- /* Isolate the command word. */
- i = 0;
- while (line[i] && whitespace (line[i]))
- i++;
- word = line + i;
-
- while (line[i] && !whitespace (line[i]))
- i++;
-
- if (line[i])
- line[i++] = '\0';
-
- if (!(cmd = cmdfind(word))) {
- fprintf(stderr, "%s: invalid command\n", word);
- return -1;
- }
- /* Get argument to command, if any. */
- while (whitespace (line[i]))
- i++;
-
- word = line + i;
-
- /* Call the function. */
- return cmd(word);
+ int i;
+ Function *cmd;
+ char *word;
+
+ /* Isolate the command word. */
+ i = 0;
+ while (line[i] && whitespace (line[i]))
+ i++;
+ word = line + i;
+
+ while (line[i] && !whitespace (line[i]))
+ i++;
+
+ if (line[i])
+ line[i++] = '\0';
+
+ if (!(cmd = cmdfind(word))) {
+ fprintf(stderr, "%s: invalid command\n", word);
+ return -1;
+ }
+ /* Get argument to command, if any. */
+ while (whitespace (line[i]))
+ i++;
+
+ word = line + i;
+
+ /* Call the function. */
+ return cmd(word);
- for (i = 0; cmdlist[i].name; i++)
- printf("%16s\t\t%s\n", cmdlist[i].name, cmdlist[i].doc);
+ for (i = 0; cmdlist[i].name; i++)
+ printf("%16s\t\t%s\n", cmdlist[i].name, cmdlist[i].doc);
- printf("Open connections:\n");
- for (cur = aimsess.connlist; cur; cur = cur->next) {
- printf(" fd=%d type=0x%02x\n", cur->fd, cur->type);
- }
+ printf("Open connections:\n");
+ for (cur = aimsess.connlist; cur; cur = cur->next)
+ printf(" fd=%d type=0x%02x\n", cur->fd, cur->type);
- if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
- aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, AIM_IMFLAGS_ACK, "Good day to you too.");
- else
- printf("no one to say hello to!\n");
+ if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
+ aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, AIM_IMFLAGS_ACK, "Good day to you too.");
+ else
+ printf("no one to say hello to!\n");
- if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
- aim_send_warning(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, 0);
- else
- printf("no one to warn!\n");
+ if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
+ aim_send_warning(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, 0);
+ else
+ printf("no one to warn!\n");
- if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
- aim_send_warning(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, AIM_WARN_ANON);
- else
- printf("no one to anonwarn!\n");
+ if (arg && strlen(arg) && (strlen(arg) < MAXSNLEN))
+ aim_send_warning(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), arg, AIM_WARN_ANON);
+ else
+ printf("no one to anonwarn!\n");
- if ((sscanf(arg, "%d %32s", &len, sn) != 2) ||
- (len >= 10000) || (strlen(sn) > MAXSNLEN)) {
- printf("invalid args\n");
- return 0;
- }
+ if ((sscanf(arg, "%d %32s", &len, sn) != 2) ||
+ (len >= 10000) || (strlen(sn) > MAXSNLEN)) {
+ printf("invalid args\n");
+ return 0;
+ }
- aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), sn, AIM_IMFLAGS_ACK, newbuf);
+ aim_send_im(&aimsess, aim_getconn_type(&aimsess, AIM_CONN_TYPE_BOS), sn, AIM_IMFLAGS_ACK, newbuf);