diff options
author | 2003-01-14 04:14:38 +0000 | |
---|---|---|
committer | 2003-01-14 04:14:38 +0000 | |
commit | 727fcd294d0f6c69a58a24fb7e3710dab61edf28 (patch) | |
tree | 249781f9fa81f22da8e2bf552335722d44cfa729 /net-im/pork/files | |
parent | version bump (diff) | |
download | historical-727fcd294d0f6c69a58a24fb7e3710dab61edf28.tar.gz historical-727fcd294d0f6c69a58a24fb7e3710dab61edf28.tar.bz2 historical-727fcd294d0f6c69a58a24fb7e3710dab61edf28.zip |
add /help command
Diffstat (limited to 'net-im/pork/files')
-rw-r--r-- | net-im/pork/files/README.gentoo-0.3.0 | 2 | ||||
-rw-r--r-- | net-im/pork/files/digest-pork-0.3.0-r1 | 1 | ||||
-rw-r--r-- | net-im/pork/files/pork-0.3.0-help.patch | 141 |
3 files changed, 143 insertions, 1 deletions
diff --git a/net-im/pork/files/README.gentoo-0.3.0 b/net-im/pork/files/README.gentoo-0.3.0 index fbee603cc0cc..d36f63532c4c 100644 --- a/net-im/pork/files/README.gentoo-0.3.0 +++ b/net-im/pork/files/README.gentoo-0.3.0 @@ -18,7 +18,7 @@ This is FAR from complete in how to use pork, to find a full listing of commands $ find /usr/share/pork/help -To get the usage info about a specific command simply cat it's file out of the listing generated above. +To get the usage info about a specific command simply cat it's file out of the listing generated above, or use the /help command from inside pork. Things that I discovered: pork has a hard time syncing LARGE buddy lists on first connect. If you find that not all of your buddy list is downloaded from the server, you can actually use gaim to sync your list, and then copy that list verbatim from ~/.gaim/[screenname].0.blist to ~/.pork/[screenname]/buddy_list and restart pork to get your whole buddy list. Note that gaim uses all caps for the [screenname] and pork uses all lowercase. diff --git a/net-im/pork/files/digest-pork-0.3.0-r1 b/net-im/pork/files/digest-pork-0.3.0-r1 new file mode 100644 index 000000000000..9925ebb99cc0 --- /dev/null +++ b/net-im/pork/files/digest-pork-0.3.0-r1 @@ -0,0 +1 @@ +MD5 ffafe7b2a0f99c5fd66f60786a415b05 pork-0.3.0.tar.gz 341832 diff --git a/net-im/pork/files/pork-0.3.0-help.patch b/net-im/pork/files/pork-0.3.0-help.patch new file mode 100644 index 000000000000..449f38c8b045 --- /dev/null +++ b/net-im/pork/files/pork-0.3.0-help.patch @@ -0,0 +1,141 @@ +diff -Nru pork-0.3.0-clean/src/Makefile.am pork-0.3.0/src/Makefile.am +--- pork-0.3.0-clean/src/Makefile.am 2003-01-08 21:24:34.000000000 -0600 ++++ pork-0.3.0/src/Makefile.am 2003-01-13 19:02:10.000000000 -0600 +@@ -2,7 +2,7 @@ + bin_PROGRAMS = pork + + AM_CFLAGS = -funsigned-char -Imissing -Wall +-AM_CFLAGS += -DSYSTEM_PORKRC=\"$(pkgdatadir)/porkrc\" ++AM_CFLAGS += -DHELP_PATH=\"$(pkgdatadir)/help\" -DSYSTEM_PORKRC=\"$(pkgdatadir)/porkrc\" + AM_CFLAGS += $(PERL_CFLAGS) $(DEBUG_CFLAGS) + + pork_LDFLAGS = -Lmissing -Llibfaim +diff -Nru pork-0.3.0-clean/src/Makefile.in pork-0.3.0/src/Makefile.in +--- pork-0.3.0-clean/src/Makefile.in 2003-01-08 21:41:16.000000000 -0600 ++++ pork-0.3.0/src/Makefile.in 2003-01-13 19:02:10.000000000 -0600 +@@ -122,7 +122,7 @@ + SUBDIRS = missing libfaim + bin_PROGRAMS = pork + +-AM_CFLAGS = -funsigned-char -Imissing -Wall -DSYSTEM_PORKRC=\"$(pkgdatadir)/porkrc\" $(PERL_CFLAGS) $(DEBUG_CFLAGS) ++AM_CFLAGS = -funsigned-char -Imissing -Wall -DHELP_PATH=\"$(pkgdatadir)/help\" -DSYSTEM_PORKRC=\"$(pkgdatadir)/porkrc\" $(PERL_CFLAGS) $(DEBUG_CFLAGS) + + pork_LDFLAGS = -Lmissing -Llibfaim + pork_LDADD = -lmissing -lfaim -lncurses $(PERL_LIBS) $(DEBUG_LIBS) +diff -Nru pork-0.3.0-clean/src/pork_command.c pork-0.3.0/src/pork_command.c +--- pork-0.3.0-clean/src/pork_command.c 2003-01-08 20:33:32.000000000 -0600 ++++ pork-0.3.0/src/pork_command.c 2003-01-13 22:11:43.000000000 -0600 +@@ -11,7 +11,9 @@ + #include <config.h> + + #include <unistd.h> ++#include <dirent.h> + #include <ncurses.h> ++#include <sys/stat.h> + #include <sys/types.h> + #include <string.h> + #include <stdlib.h> +@@ -1932,6 +1934,103 @@ + } + + USER_COMMAND(cmd_help) { ++ /* For printing help files */ ++ char buf[4096]; ++ ++ /* Next 3 for separating args */ ++ char *section; ++ char *command; ++ char *last; ++ ++ /* Directory and filenames of help area */ ++ char *dir_name; ++ char *file_name; ++ ++ struct stat st; ++ struct dirent *d_ent; ++ ++ DIR *dp; ++ FILE *fp; ++ ++ /* Start both pointers at the beginning */ ++ section = args; ++ command = section; ++ ++ /* Ensure that the help files are available */ ++ if (stat(HELP_PATH, &st) != 0 || !S_ISDIR(st.st_mode)) { ++ screen_err_msg("Cannot find help path: %s", HELP_PATH); ++ } else if (args != NULL) { ++ /* Parse the arguments into a section and a command */ ++ while ((last = strsep(&args, " ")) != NULL) { ++ if (args != NULL) { ++ command = args; ++ } ++ if ( section < last && last < command ) { ++ *(last - 1) = '/'; ++ } ++ } ++ ++ /* Create full path of section */ ++ dir_name = malloc(sizeof(HELP_PATH) + strlen(section) + 2); ++ snprintf(dir_name, sizeof(HELP_PATH) + strlen(section) + 2, ++ "%s/%s", HELP_PATH, section); ++ /* Create full path of command */ ++ if ( command == section ) { ++ file_name = dir_name; ++ } else { ++ file_name = malloc(strlen(dir_name) + strlen(command) + 2); ++ snprintf(file_name, strlen(dir_name) + strlen(command) + 2, ++ "%s/%s", dir_name, command); ++ } ++ ++ /* Make sure that we have a valid section */ ++ if (stat(dir_name, &st) != 0 || !S_ISDIR(st.st_mode)) { ++ screen_err_msg("Error: %s is not a valid help command", ++ section); ++ /* Make sure we have a valid command */ ++ } else if (stat(file_name, &st) != 0) { ++ screen_err_msg("Error: No help in section %s for %s", ++ section, command); ++ /* If command is a section itself, print the section */ ++ } else if (S_ISDIR(st.st_mode)) { ++ screen_win_msg(cur_window(), 0, 0, 1, ++ "Help topics from command %s:", section); ++ dp = opendir(dir_name); ++ while((d_ent = readdir(dp)) != NULL){ ++ if ( d_ent->d_name[0] != '.' ) ++ screen_win_msg(cur_window(), 0, 0, 1, ++ "%s", d_ent->d_name); ++ } ++ closedir(dp); ++ /* If command matches a helpfile, print it */ ++ } else if (S_ISREG(st.st_mode)) { ++ screen_win_msg(cur_window(), 0, 0, 1, ++ "Help from command %s for %s:", section, command); ++ fp = fopen(file_name,"r"); ++ while (fgets(buf, sizeof(buf), fp) != NULL) ++ screen_win_msg(cur_window(), 0, 0, 1, "%s", buf); ++ fclose(fp); ++ /* If command matches anything else, error */ ++ } else { ++ screen_err_msg("Error opening help file"); ++ } ++ /* Clean up */ ++ if (file_name != dir_name) ++ free(file_name); ++ free(dir_name); ++ /* Otherwise print the list of sections */ ++ } else { ++ ++ screen_win_msg(cur_window(), 0, 0, 1, "Available help commands:"); ++ ++ dp = opendir(HELP_PATH); ++ while((d_ent = readdir(dp)) != NULL){ ++ if ( d_ent->d_name[0] != '.' ) ++ screen_win_msg(cur_window(), 0, 0, 1, ++ "%s", d_ent->d_name); ++ } ++ closedir(dp); ++ } + } + + USER_COMMAND(cmd_idle) { |