Showing content from https://gitlab.com/OldManProgrammer/unix-tree/-/merge_requests/8.diff below:
diff --git a/json.c b/json.c index c88bf37ca1ad87f04c63fb651e7f72a3f7b08d11..a589f96f43b201d7751480c7c31307799bdd99d9 100644 --- a/json.c +++ b/json.c @@ -120,8 +120,10 @@ int json_printinfo(char *dirname, struct _info *file, int level) if (!noindent) json_indent(level); - if (file->lnk) mt = file->mode & S_IFMT; - else mt = file->mode & S_IFMT; + if (file != NULL) { + if (file->lnk) mt = file->mode & S_IFMT; + else mt = file->mode & S_IFMT; + } else mt = 0; for(t=0;ifmt[t];t++) if (ifmt[t] == mt) break; diff --git a/xml.c b/xml.c index e8d1e6115c845d941585f78c621549cd79ea6426..3b0d9b2f452241f3c6560f659c1f256cc1110498 100644 --- a/xml.c +++ b/xml.c @@ -104,8 +104,10 @@ int xml_printinfo(char *dirname, struct _info *file, int level) if (!noindent) xml_indent(level); - if (file->lnk) mt = file->mode & S_IFMT; - else mt = file->mode & S_IFMT; + if (file != NULL) { + if (file->lnk) mt = file->mode & S_IFMT; + else mt = file->mode & S_IFMT; + } else mt = 0; for(t=0;ifmt[t];t++) if (ifmt[t] == mt) break; @@ -116,16 +118,6 @@ int xml_printinfo(char *dirname, struct _info *file, int level) int xml_printfile(char *dirname, char *filename, struct _info *file, int descend) { - int t, mt; - - if (file) { - if (file->lnk) mt = file->mode & S_IFMT; - else mt = file->mode & S_IFMT; - } else mt = 0; - for(t=0;ifmt[t];t++) - if (ifmt[t] == mt) break; - fprintf(outfile,"<%s", ftype[t]); - fprintf(outfile, " name=\""); html_encode(outfile, filename); fputc('"',outfile);
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4