@@ -102,44 +102,44 @@ static void delete_data(const char *line)
102
102
103
103
static void builtin_help (void )
104
104
{
105
- printf ("quit - quit from program\n" );
106
- printf ("help - prints this help message\n" );
107
- printf ("clear - clean buffer\n" );
108
- printf ("print - print buffer\n" );
109
- printf ("append - append data to buffer\n" );
110
- printf ("write [file] - safe buffer to file\n" );
111
- printf ("read [file] - read file to buffer\n" );
112
- printf ("delete [line] - delete the specified line\n" );
113
- printf ("inserta [line] - insert after specified line\n" );
114
- printf ("insertb [line] - insert before specified line\n" );
115
- printf ("swap [line] [line] - swaps two lines\n" );
105
+ printf ("q - quit from program\n" );
106
+ printf ("h - prints this help message\n" );
107
+ printf ("c - clean buffer\n" );
108
+ printf ("p - print buffer\n" );
109
+ printf ("a - append data to buffer\n" );
110
+ printf ("w [file] - safe buffer to file\n" );
111
+ printf ("r [file] - read file to buffer\n" );
112
+ printf ("d [line] - delete the specified line\n" );
113
+ printf ("ia [line] - insert after specified line\n" );
114
+ printf ("ib [line] - insert before specified line\n" );
115
+ printf ("s [line] [line] - swaps two lines\n" );
116
116
}
117
117
118
118
static int execute (struct command * cmd )
119
119
{
120
120
if (cmd == NULL )
121
121
return SUCCESS_EXECUTE ;
122
- else if (strcmp (cmd -> name , "quit " ) == 0 )
122
+ else if (strcmp (cmd -> name , "q " ) == 0 )
123
123
return QUIT_EXECUTE ;
124
- else if (strcmp (cmd -> name , "append " ) == 0 )
124
+ else if (strcmp (cmd -> name , "a " ) == 0 )
125
125
append_data ();
126
- else if (strcmp (cmd -> name , "delete " ) == 0 )
126
+ else if (strcmp (cmd -> name , "d " ) == 0 )
127
127
delete_data (cmd -> parameter1 );
128
- else if (strcmp (cmd -> name , "inserta " ) == 0 )
128
+ else if (strcmp (cmd -> name , "ia " ) == 0 )
129
129
inserta_data (cmd -> parameter1 );
130
- else if (strcmp (cmd -> name , "insertb " ) == 0 )
130
+ else if (strcmp (cmd -> name , "ib " ) == 0 )
131
131
insertb_data (cmd -> parameter1 );
132
- else if (strcmp (cmd -> name , "swap " ) == 0 )
132
+ else if (strcmp (cmd -> name , "s " ) == 0 )
133
133
swap (cmd -> parameter1 , cmd -> parameter2 );
134
- else if (strcmp (cmd -> name , "print " ) == 0 )
134
+ else if (strcmp (cmd -> name , "p " ) == 0 )
135
135
print_lines ();
136
- else if (strcmp (cmd -> name , "write " ) == 0 )
136
+ else if (strcmp (cmd -> name , "w " ) == 0 )
137
137
write_lines (cmd -> parameter1 );
138
- else if (strcmp (cmd -> name , "read " ) == 0 )
138
+ else if (strcmp (cmd -> name , "r " ) == 0 )
139
139
read_lines (cmd -> parameter1 );
140
- else if (strcmp (cmd -> name , "clear " ) == 0 )
140
+ else if (strcmp (cmd -> name , "c " ) == 0 )
141
141
delete_lines ();
142
- else if (strcmp (cmd -> name , "help " ) == 0 )
142
+ else if (strcmp (cmd -> name , "h " ) == 0 )
143
143
builtin_help ();
144
144
else
145
145
printf ("unknown command: %s\n" , cmd -> name );
0 commit comments