]> Git repositories of Nishi - keine.git/commitdiff
better message
authorNishi <nishi@nishi.boats>
Wed, 11 Sep 2024 15:46:04 +0000 (15:46 +0000)
committerNishi <nishi@nishi.boats>
Wed, 11 Sep 2024 15:46:04 +0000 (15:46 +0000)
git-svn-id: file:///raid/svn-personal/keine/trunk@7 a3977ea8-0dc0-2842-9144-a1a46b47fd40

CGI/cgi.c
CGI/man.c

index 3c2aa34b029302b7d62722e68b15ef655902e226..caab342a35918cba4fbf138e296ddeca297db72d 100644 (file)
--- a/CGI/cgi.c
+++ b/CGI/cgi.c
@@ -50,7 +50,7 @@ void manpage_scan(const char* root) {
                                        manpage_scan(path);
                                } else {
                                        char* name = kn_strdup(nl[i]->d_name);
-                                       char* desc = kn_strdup("dadsandasndasdsadmadsadmsmdsmdmdksmdkamdkmdksmdsmdmskdmdmsakdsdmsakdmskdmsdmsadkmsakdmdsdmsdkamdkmdkamdksmdksamkdsmdkmadmsakdmsakdmmdakmdsm");
+                                       char* desc = kn_strdup("&lt;No description detected&gt;");
 
                                        int incr = 0;
                                        FILE* f = fopen(path, "r");
@@ -60,24 +60,24 @@ void manpage_scan(const char* root) {
                                        fclose(f);
 
                                        int j;
-                                       for(j = 0;; j++){
-                                               if(b[j] == '\n' || b[j] == 0){
+                                       for(j = 0;; j++) {
+                                               if(b[j] == '\n' || b[j] == 0) {
                                                        char* line = malloc(j - incr + 1);
                                                        line[j - incr] = 0;
                                                        memcpy(line, b + incr, j - incr);
 
                                                        int k;
-                                                       for(k = 0; line[k] != 0 && k < 4; k++){
-                                                               if(line[k] == ' '){
+                                                       for(k = 0; line[k] != 0 && k < 4; k++) {
+                                                               if(line[k] == ' ') {
                                                                        line[k] = 0;
-                                                                       if(strcasecmp(line, ".Nd") == 0){
+                                                                       if(strcasecmp(line, ".Nd") == 0) {
                                                                                free(desc);
                                                                                desc = kn_strdup(line + k + 1);
                                                                                int l;
-                                                                               for(l = 0; desc[l] != 0; l++){
-                                                                                       if(desc[l] == '\\'){
+                                                                               for(l = 0; desc[l] != 0; l++) {
+                                                                                       if(desc[l] == '\\') {
                                                                                                l++;
-                                                                                               if(desc[l] == '"'){
+                                                                                               if(desc[l] == '"') {
                                                                                                        l--;
                                                                                                        desc[l] = 0;
                                                                                                        break;
@@ -97,7 +97,7 @@ void manpage_scan(const char* root) {
 
                                        free(b);
 
-                                       if(strlen(desc) > 70){
+                                       if(strlen(desc) > 70) {
                                                desc[70] = 0;
                                                desc[69] = '.';
                                                desc[68] = '.';
@@ -124,7 +124,7 @@ void list_manpages(void) {
 #ifdef MANPAGE_DIRS
        int i;
        const char* dirs[] = MANPAGE_DIRS;
-       for(i = 0; i < sizeof(dirs) / sizeof(*dirs); i++){
+       for(i = 0; i < sizeof(dirs) / sizeof(*dirs); i++) {
                manpage_scan(dirs[i]);
        }
 #else
@@ -185,7 +185,7 @@ void kn_parse_query(void) {
 #ifdef MANPAGE_DIRS
                int i;
                const char* dirs[] = MANPAGE_DIRS;
-               for(i = 0; i < sizeof(dirs) / sizeof(*dirs); i++){
+               for(i = 0; i < sizeof(dirs) / sizeof(*dirs); i++) {
                        cond = (path = kn_find(dirs[i], kn_get_query("page"))) != NULL;
                        if(cond) break;
                }
index 3d637c52fdb218ae25464e32461f9a621b642184..7e3df563594c6f269ff53e111a1afd0d1e62f324 100644 (file)
--- a/CGI/man.c
+++ b/CGI/man.c
@@ -47,9 +47,9 @@ bool kn_has_manpage(const char* str) {
 #ifdef MANPAGE_DIRS
        int i;
        const char* dirs[] = MANPAGE_DIRS;
-       for(i = 0; i < sizeof(dirs) / sizeof(*dirs); i++){
+       for(i = 0; i < sizeof(dirs) / sizeof(*dirs); i++) {
                char* pth = kn_find(dirs[i], str);
-               if(pth != NULL){
+               if(pth != NULL) {
                        free(pth);
                        return true;
                }