summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xvchat-commands.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/vchat-commands.c b/vchat-commands.c
index 5499948..b3c955e 100755
--- a/vchat-commands.c
+++ b/vchat-commands.c
@@ -15,10 +15,13 @@
15 */ 15 */
16 16
17/* general includes */ 17/* general includes */
18#include <stdlib.h>
18#include <unistd.h> 19#include <unistd.h>
19#include <errno.h> 20#include <errno.h>
20#include <stdio.h> 21#include <stdio.h>
21#include <string.h> 22#include <string.h>
23#include <sys/stat.h>
24#include <readline/readline.h>
22 25
23/* local includes */ 26/* local includes */
24#include "vchat.h" 27#include "vchat.h"
@@ -40,6 +43,7 @@ COMMAND_LSFLT,
40COMMAND_RMFLT, 43COMMAND_RMFLT,
41COMMAND_CLFLT, 44COMMAND_CLFLT,
42COMMAND_HELP, 45COMMAND_HELP,
46COMMAND_FORMAT,
43COMMAND_KEYS, 47COMMAND_KEYS,
44COMMAND_QUIT, 48COMMAND_QUIT,
45COMMAND_USER, 49COMMAND_USER,
@@ -304,20 +308,20 @@ command_format(char *line) {
304 308
305 flushout(); 309 flushout();
306 while( *line==' ') line++; 310 while( *line==' ') line++;
307 if(file) { 311 if(line) {
308 tildex = tilde_expand( file ); 312 tildex = tilde_expand( line );
309 if(tildex && !stat(file, &testexist )) 313 if(tildex && !stat(tildex, &testexist ))
310 loadformats(file); 314 loadformats(tildex);
311 else { 315 else {
312#define BUFSIZE 4096 316#define BUFSIZE 4096
313 char buf[BUFSIZE]; 317 char buf[BUFSIZE];
314 snprintf( buf, BUFSIZE, "~/.vchat/sample-%s.fmt", file ); 318 snprintf( buf, BUFSIZE, "~/.vchat/sample-%s.fmt", line );
315 free(tildex); 319 free(tildex);
316 tildex = tilde_expand( file ); 320 tildex = tilde_expand( line );
317 if(tildex && !stat(file, &testexist )) 321 if(tildex && !stat(tildex, &testexist ))
318 loadformats(file); 322 loadformats(tildex);
319 } 323 }
320 324 writeout(" Sort of done. ");
321 } else { 325 } else {
322 writeout(" Forgot to specify format file. "); 326 writeout(" Forgot to specify format file. ");
323 } 327 }