- if (laad.flags & LSATT_FLAG_SORT_BY_ID)
- pmd.loop_col_num = ATTCOL_NAME;
- if (laad.flags & LSATT_FLAG_REVERSE)
- pmd.pm_flags |= PM_REVERSE_LOOP;
- for_each_matching_row(&pmd);
- if (laad.pb.offset)
- pass_buffer_as_shm(laad.pb.buf, laad.pb.offset, &fd);
- free(laad.pb.buf);
-}
-
-int com_lsatt(struct stream_cipher_context *scc, int argc, char * const * const argv)
-{
- unsigned flags = 0;
- struct osl_object options = {.data = &flags, .size = sizeof(flags)};
- int ret, i;
-
- for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
- if (arg[0] != '-')
- break;
- if (!strcmp(arg, "--")) {
- i++;
- break;
- }
- if (!strcmp(arg, "-i")) {
- flags |= LSATT_FLAG_SORT_BY_ID;
- continue;
- }
- if (!strcmp(arg, "-l")) {
- flags |= LSATT_FLAG_LONG;
- continue;
- }
- if (!strcmp(arg, "-r")) {
- flags |= LSATT_FLAG_REVERSE;
- continue;
- }
- }
- ret = send_option_arg_callback_request(&options, argc - i, argv + i,
- com_lsatt_callback, sc_send_result, scc);
- if (!ret) {
- if (argc > 1)
- ret = sc_send_va_buffer(scc, "no matches\n");
- } else if (ret < 0)
- sc_send_va_buffer(scc, "%s\n", para_strerror(-ret));
- return ret;
-}