History

add * to list the keys of a dict

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit 77b04081 parent a04da7c1 file · +6 −1Browse files

Unified · Split

main.c+6−1
@@ -22,7 +22,7 @@ threadmain(int argc, char **argv) · 21 unmodified lines
22 Biobuf *b;22 Biobuf *b;
23 Stream *s;23 Stream *s;
24 Pdf *pdf;24 Pdf *pdf;
25 int i, n;25 int i, n, k;
26 26
27 quotefmtinstall();27 quotefmtinstall();
28 inflateinit();28 inflateinit();
@@ -50,6 +50,11 @@ threadmain(int argc, char **argv) · 21 unmodified lines
50 Sclose(s);50 Sclose(s);
51 v = nil;51 v = nil;
52 break;52 break;
53 }else if(argv[i][0] == '*' && argv[i][1] == 0 && v->type == Odict){
54 for(k = 0; k < v->dict.nkv; k++)
55 print("%s\n", v->dict.kv[k].key);
56 v = nil;
57 break;
53 }else if(argv[i][0] == '@' && argv[i][1] == 0 && v->type == Ostream){58 }else if(argv[i][0] == '@' && argv[i][1] == 0 && v->type == Ostream){
54 fprint(2, "%d %d\n", v->stream.off, v->stream.len);59 fprint(2, "%d %d\n", v->stream.off, v->stream.len);
55 v = nil;60 v = nil;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t