File: getsl.c

package info (click to toggle)
fsp 2.81.b24-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,904 kB
  • ctags: 1,423
  • sloc: ansic: 9,215; sh: 3,639; makefile: 212; lex: 130; csh: 77; python: 22
file content (12 lines) | stat: -rw-r--r-- 277 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
#include "tweak.h"
#include <stdio.h>
#include "my-string.h"
#include "common_def.h"
#include "co_extern.h"

char *getsl(char *s, int l) {
    int i;
    char *rv = fgets(s, l, stdin);
    if(rv && (i = strlen(rv)) > 0) if(rv[i - 1] == '\n') rv[i - 1] = '\0';
    return rv;
}